2012-01-17 01:27:18 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
|
|
|
|
|
2012-06-16 10:19:17 +08:00
|
|
|
void foo(int x)
|
2012-01-17 01:27:18 +08:00
|
|
|
{
|
|
|
|
_Atomic(int) i = 0;
|
2012-06-16 10:19:17 +08:00
|
|
|
_Atomic(short) j = 0;
|
2012-01-17 01:27:18 +08:00
|
|
|
// Check that multiply / divides on atomics produce a cmpxchg loop
|
2012-06-16 10:19:17 +08:00
|
|
|
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*
|
|
|
|
|
2012-01-17 01:27:18 +08:00
|
|
|
}
|