From 93ee5ca805f9d51c13dc613a07048ea83728fd97 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Sat, 16 Jun 2012 02:19:17 +0000 Subject: 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 --- clang/test/CodeGen/atomic_ops.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'clang/test/CodeGen/atomic_ops.c') 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 -- cgit v1.2.3