diff options
Diffstat (limited to 'test/CodeGen/atomic.c')
-rw-r--r-- | test/CodeGen/atomic.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/test/CodeGen/atomic.c b/test/CodeGen/atomic.c index aa5aa15..d0a7e04 100644 --- a/test/CodeGen/atomic.c +++ b/test/CodeGen/atomic.c @@ -1,5 +1,5 @@ // RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-apple-darwin9 > %t1 -// RUN: grep @llvm.memory.barrier %t1 | count 38 +// RUN: grep @llvm.memory.barrier %t1 | count 42 // RUN: grep @llvm.atomic.load.add.i32 %t1 | count 3 // RUN: grep @llvm.atomic.load.sub.i8 %t1 | count 2 // RUN: grep @llvm.atomic.load.min.i32 %t1 @@ -7,7 +7,7 @@ // 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 | count 4 +// RUN: grep @llvm.atomic.cmp.swap.i32 %t1 | count 5 // RUN: grep @llvm.atomic.load.and.i32 %t1 // RUN: grep @llvm.atomic.load.or.i8 %t1 // RUN: grep @llvm.atomic.load.xor.i8 %t1 @@ -19,6 +19,7 @@ int atomic(void) int old; int val = 1; char valc = 1; + _Bool valb = 0; unsigned int uval = 1; int cmp = 0; @@ -43,10 +44,18 @@ int atomic(void) __sync_val_compare_and_swap((void **)0, (void *)0, (void *)0); - + if ( __sync_val_compare_and_swap(&valb, 0, 1)) { + old = 42; + } + __sync_bool_compare_and_swap((void **)0, (void *)0, (void *)0); __sync_lock_release(&val); __sync_synchronize (); return old; } + +void release_return(int *lock) { + // Ensure this is actually returning void all the way through. + return __sync_lock_release(lock); +} |