diff options
author | dim <dim@FreeBSD.org> | 2010-09-17 15:54:40 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2010-09-17 15:54:40 +0000 |
commit | 36c49e3f258dced101949edabd72e9bc3f1dedc4 (patch) | |
tree | 0bbe07708f7571f8b5291f6d7b96c102b7c99dee /test/CodeGen/atomic.c | |
parent | fc84956ac8b7cd244ef30e7a4d4d38a58dec5904 (diff) | |
download | FreeBSD-src-36c49e3f258dced101949edabd72e9bc3f1dedc4.zip FreeBSD-src-36c49e3f258dced101949edabd72e9bc3f1dedc4.tar.gz |
Vendor import of clang r114020 (from the release_28 branch):
http://llvm.org/svn/llvm-project/cfe/branches/release_28@114020
Approved by: rpaulo (mentor)
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); +} |