aboutsummaryrefslogtreecommitdiff
path: root/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
commitdb4325b098eff5e9e660db19f0148423fb21f27f (patch)
tree8fa64475dc2ac61a9f03b0367bbc68d14533ac46 /test/CodeGen/atomic.c
parent9638eef7e3b2ca30406c5d369a44aa49ff26b201 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108638 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/atomic.c')
-rw-r--r--test/CodeGen/atomic.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/CodeGen/atomic.c b/test/CodeGen/atomic.c
index aa5aa1507b..8b66bfd660 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 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);