summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/atomic.c
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2010-07-18 07:23:17 +0000
committerChandler Carruth <chandlerc@gmail.com>2010-07-18 07:23:17 +0000
commitbc8cab16c5d1cff4839c742846c104e155e6f7a0 (patch)
treec6b01eaafd52d4928e2dd1b27fd24bc448aa8b7b /clang/test/CodeGen/atomic.c
parent1392b8eb7948530dbfb8153ec822675e8bb5c860 (diff)
downloadbcm5719-llvm-bc8cab16c5d1cff4839c742846c104e155e6f7a0.tar.gz
bcm5719-llvm-bc8cab16c5d1cff4839c742846c104e155e6f7a0.zip
Improve the representation of the atomic builtins in a few ways. First, we make
their call expressions synthetically have the "deduced" types based on their first argument. We only insert conversions in the AST for arguments whose values require conversion to match the value type expected. This keeps PR7600 closed by maintaining the return type, but avoids assertions due to unexpected implicit casts making the type unsigned (test case added from Daniel). The magic is moved into the codegen for the atomic builtin which inserts the casts as needed at the IR level to raise the type to an integer suitable for the LLVM intrinsic. This shouldn't cause any real change in functionality, but now we can make the builtin be more truly polymorphic. llvm-svn: 108638
Diffstat (limited to 'clang/test/CodeGen/atomic.c')
-rw-r--r--clang/test/CodeGen/atomic.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/test/CodeGen/atomic.c b/clang/test/CodeGen/atomic.c
index aa5aa1507b0..8b66bfd6600 100644
--- a/clang/test/CodeGen/atomic.c
+++ b/clang/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 40
// 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
@@ -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,6 +44,9 @@ 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_lock_release(&val);
OpenPOWER on IntegriCloud