1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s 2f4a2713aSLionel Sambuc foo(int x)3f4a2713aSLionel Sambucvoid foo(int x) 4f4a2713aSLionel Sambuc { 5f4a2713aSLionel Sambuc _Atomic(int) i = 0; 6f4a2713aSLionel Sambuc _Atomic(short) j = 0; 7f4a2713aSLionel Sambuc // Check that multiply / divides on atomics produce a cmpxchg loop 8f4a2713aSLionel Sambuc i *= 2; 9f4a2713aSLionel Sambuc // CHECK: mul nsw i32 10*0a6a1f1dSLionel Sambuc // CHECK: {{(cmpxchg i32*|i1 @__atomic_compare_exchange\(i32 4,)}} 11f4a2713aSLionel Sambuc i /= 2; 12f4a2713aSLionel Sambuc // CHECK: sdiv i32 13*0a6a1f1dSLionel Sambuc // CHECK: {{(cmpxchg i32*|i1 @__atomic_compare_exchange\(i32 4, )}} 14f4a2713aSLionel Sambuc j /= x; 15f4a2713aSLionel Sambuc // CHECK: sdiv i32 16*0a6a1f1dSLionel Sambuc // CHECK: {{(cmpxchg i16*|i1 @__atomic_compare_exchange\(i32 2, )}} 17f4a2713aSLionel Sambuc 18f4a2713aSLionel Sambuc } 19