summaryrefslogtreecommitdiffstats
path: root/test/CodeGen/atomic_ops.c
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2012-08-15 20:02:54 +0000
committerdim <dim@FreeBSD.org>2012-08-15 20:02:54 +0000
commit554bcb69c2d785a011a30e7db87a36a87fe7db10 (patch)
tree9abb1a658a297776086f4e0dfa6ca533de02104e /test/CodeGen/atomic_ops.c
parentbb67ca86b31f67faee50bd10c3b036d65751745a (diff)
downloadFreeBSD-src-554bcb69c2d785a011a30e7db87a36a87fe7db10.zip
FreeBSD-src-554bcb69c2d785a011a30e7db87a36a87fe7db10.tar.gz
Vendor import of clang trunk r161861:
http://llvm.org/svn/llvm-project/cfe/trunk@161861
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