summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/atomic.c
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-04-07 00:55:51 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-04-07 00:55:51 +0000
commit4fab57ddeafc95d65610422b9d3e42bb76c15e96 (patch)
treec502364308c6ea29c571a8f4b66051a9f5da9fbe /clang/test/CodeGen/atomic.c
parentf247b30abbab02823988fda319c7a8eac73059c2 (diff)
downloadbcm5719-llvm-4fab57ddeafc95d65610422b9d3e42bb76c15e96.tar.gz
bcm5719-llvm-4fab57ddeafc95d65610422b9d3e42bb76c15e96.zip
Implement __sync_{add,sub,and,or,xor}_and_fetch and
__sync_bool_compare_and_swap. - <rdar://problem/6762223> [sema/irgen] support __sync_bool_compare_and_swap and __sync_add_and_fetch llvm-svn: 68482
Diffstat (limited to 'clang/test/CodeGen/atomic.c')
-rw-r--r--clang/test/CodeGen/atomic.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/clang/test/CodeGen/atomic.c b/clang/test/CodeGen/atomic.c
index 0e2d850dbb1..d1b3cbb0d4b 100644
--- a/clang/test/CodeGen/atomic.c
+++ b/clang/test/CodeGen/atomic.c
@@ -1,15 +1,15 @@
// RUN: clang-cc %s -emit-llvm -o - > %t1 &&
-// RUN: grep @llvm.atomic.load.add.i32 %t1 &&
-// RUN: grep @llvm.atomic.load.sub.i32 %t1 &&
+// RUN: grep @llvm.atomic.load.add.i32 %t1 | count 3 &&
+// RUN: grep @llvm.atomic.load.sub.i32 %t1 | count 3 &&
// RUN: grep @llvm.atomic.load.min.i32 %t1 &&
// RUN: grep @llvm.atomic.load.max.i32 %t1 &&
// RUN: grep @llvm.atomic.load.umin.i32 %t1 &&
// RUN: grep @llvm.atomic.load.umax.i32 %t1 &&
// RUN: grep @llvm.atomic.swap.i32 %t1 &&
-// RUN: grep @llvm.atomic.cmp.swap.i32 %t1 &&
-// RUN: grep @llvm.atomic.load.and.i32 %t1 &&
-// RUN: grep @llvm.atomic.load.or.i32 %t1 &&
-// RUN: grep @llvm.atomic.load.xor.i32 %t1
+// RUN: grep @llvm.atomic.cmp.swap.i32 %t1 | count 3 &&
+// RUN: grep @llvm.atomic.load.and.i32 %t1 | count 3 &&
+// RUN: grep @llvm.atomic.load.or.i32 %t1 | count 3 &&
+// RUN: grep @llvm.atomic.load.xor.i32 %t1 | count 3
int atomic(void)
@@ -28,8 +28,16 @@ int atomic(void)
old = __sync_fetch_and_umax(&uval, 6u);
old = __sync_lock_test_and_set(&val, 7);
old = __sync_val_compare_and_swap(&val, 4, 1976);
+ old = __sync_bool_compare_and_swap(&val, 4, 1976);
old = __sync_fetch_and_and(&val, 0x9);
old = __sync_fetch_and_or(&val, 0xa);
old = __sync_fetch_and_xor(&val, 0xb);
+
+ old = __sync_add_and_fetch(&val, 1);
+ old = __sync_sub_and_fetch(&val, 2);
+ old = __sync_and_and_fetch(&val, 3);
+ old = __sync_or_and_fetch(&val, 4);
+ old = __sync_xor_and_fetch(&val, 5);
+
return old;
}
OpenPOWER on IntegriCloud