summaryrefslogtreecommitdiffstats
path: root/test/CodeGen/atomic_ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/atomic_ops.c')
-rw-r--r--test/CodeGen/atomic_ops.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/test/CodeGen/atomic_ops.c b/test/CodeGen/atomic_ops.c
index 9a18c9e..481d1e0 100644
--- a/test/CodeGen/atomic_ops.c
+++ b/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
OpenPOWER on IntegriCloud