1 // XFAIL: hexagon 2 // RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s 3 // RUN: %clang_cc1 -triple mips-linux-gnu -emit-llvm %s -o - | FileCheck %s 4 5 void foo(int x) 6 { 7 _Atomic(int) i = 0; 8 _Atomic(short) j = 0; 9 // Check that multiply / divides on atomics produce a cmpxchg loop 10 i *= 2; 11 // CHECK: mul nsw i32 12 // CHECK: {{(cmpxchg i32*|i1 @__atomic_compare_exchange\(i32 4,)}} 13 i /= 2; 14 // CHECK: sdiv i32 15 // CHECK: {{(cmpxchg i32*|i1 @__atomic_compare_exchange\(i32 4, )}} 16 j /= x; 17 // CHECK: sdiv i32 18 // CHECK: {{(cmpxchg i16*|i1 @__atomic_compare_exchange\(i32 2, )}} 19 20 } 21 22 extern _Atomic _Bool b; 23 24 _Bool bar() { 25 // CHECK-LABEL: @bar 26 // CHECK: %[[load:.*]] = load atomic i8, i8* @b seq_cst 27 // CHECK: %[[tobool:.*]] = trunc i8 %[[load]] to i1 28 // CHECK: ret i1 %[[tobool]] 29 return b; 30 } 31 32 extern _Atomic(_Complex int) x; 33 34 void baz(int y) { 35 // CHECK-LABEL: @baz 36 // CHECK: {{store atomic|call void @__atomic_store}} 37 x += y; 38 } 39