summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/atomic-ops.c
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-11-25 23:44:32 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-11-25 23:44:32 +0000
commit659be55daa7644777e5379a127543942d3dc954d (patch)
tree9addac048efeca58316a4204689272a15b892589 /clang/test/CodeGen/atomic-ops.c
parent443d61d62a36d2bca03ea98db5a0e811638d46b5 (diff)
downloadbcm5719-llvm-659be55daa7644777e5379a127543942d3dc954d.tar.gz
bcm5719-llvm-659be55daa7644777e5379a127543942d3dc954d.zip
CodeGen: Fix emission of __atomic_compare_exchange
We (wrongly) discarded the return value of the call. llvm-svn: 222798
Diffstat (limited to 'clang/test/CodeGen/atomic-ops.c')
-rw-r--r--clang/test/CodeGen/atomic-ops.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/test/CodeGen/atomic-ops.c b/clang/test/CodeGen/atomic-ops.c
index 08731aaaded..576e401a916 100644
--- a/clang/test/CodeGen/atomic-ops.c
+++ b/clang/test/CodeGen/atomic-ops.c
@@ -383,14 +383,23 @@ struct foo structAtomicExchange() {
}
int structAtomicCmpExchange() {
// CHECK-LABEL: @structAtomicCmpExchange
+ // CHECK: %[[x_mem:.*]] = alloca i8
_Bool x = __atomic_compare_exchange(&smallThing, &thing1, &thing2, 1, 5, 5);
- // CHECK: call zeroext i1 @__atomic_compare_exchange(i32 3, {{.*}} @smallThing{{.*}} @thing1{{.*}} @thing2
+ // CHECK: %[[call1:.*]] = call zeroext i1 @__atomic_compare_exchange(i32 3, {{.*}} @smallThing{{.*}} @thing1{{.*}} @thing2
+ // CHECK: %[[zext1:.*]] = zext i1 %[[call1]] to i8
+ // CHECK: store i8 %[[zext1]], i8* %[[x_mem]], align 1
+ // CHECK: %[[x:.*]] = load i8* %[[x_mem]]
+ // CHECK: %[[x_bool:.*]] = trunc i8 %[[x]] to i1
+ // CHECK: %[[conv1:.*]] = zext i1 %[[x_bool]] to i32
struct foo f = {0};
struct foo g = {0};
g.big[12] = 12;
return x & __c11_atomic_compare_exchange_strong(&bigAtomic, &f, g, 5, 5);
- // CHECK: call zeroext i1 @__atomic_compare_exchange(i32 512, i8* bitcast ({{.*}} @bigAtomic to i8*),
+ // CHECK: %[[call2:.*]] = call zeroext i1 @__atomic_compare_exchange(i32 512, i8* bitcast ({{.*}} @bigAtomic to i8*),
+ // CHECK: %[[conv2:.*]] = zext i1 %[[call2]] to i32
+ // CHECK: %[[and:.*]] = and i32 %[[conv1]], %[[conv2]]
+ // CHECK: ret i32 %[[and]]
}
// Check that no atomic operations are used in any initialisation of _Atomic
OpenPOWER on IntegriCloud