diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2012-06-16 02:19:17 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2012-06-16 02:19:17 +0000 |
| commit | 93ee5ca805f9d51c13dc613a07048ea83728fd97 (patch) | |
| tree | 3c8a7ceb6a3b9eb657fac604025c92293386f499 /clang/test/CodeGen/atomic_ops.c | |
| parent | 818e9f4a26a6c7aa0bdecb28b66ff30f44f9e4a6 (diff) | |
| download | bcm5719-llvm-93ee5ca805f9d51c13dc613a07048ea83728fd97.tar.gz bcm5719-llvm-93ee5ca805f9d51c13dc613a07048ea83728fd97.zip | |
Fix Sema and IRGen for atomic compound assignment so it has the right semantics when promotions are involved.
(As far as I can tell, this only affects some edge cases.)
llvm-svn: 158591
Diffstat (limited to 'clang/test/CodeGen/atomic_ops.c')
| -rw-r--r-- | clang/test/CodeGen/atomic_ops.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/clang/test/CodeGen/atomic_ops.c b/clang/test/CodeGen/atomic_ops.c index 9a18c9e9449..481d1e06fbd 100644 --- a/clang/test/CodeGen/atomic_ops.c +++ b/clang/test/CodeGen/atomic_ops.c @@ -1,11 +1,20 @@ // RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s -void foo(void) +void foo(int x) { _Atomic(int) i = 0; + _Atomic(short) j = 0; // Check that multiply / divides on atomics produce a cmpxchg loop - i *= 2; // CHECK: cmpxchg - i /= 2; // CHECK: cmpxchg + i *= 2; + // CHECK: mul nsw i32 + // CHECK: cmpxchg i32* + i /= 2; + // CHECK: sdiv i32 + // CHECK: cmpxchg i32* + j /= x; + // CHECK: sdiv i32 + // CHECK: cmpxchg i16* + // These should be emitting atomicrmw instructions, but they aren't yet i += 2; // CHECK: cmpxchg i -= 2; // CHECK: cmpxchg |

