xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/atomic_ops.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1 // RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
2 
foo(int x)3 void foo(int x)
4 {
5   _Atomic(int) i = 0;
6   _Atomic(short) j = 0;
7   // Check that multiply / divides on atomics produce a cmpxchg loop
8   i *= 2;
9   // CHECK: mul nsw i32
10   // CHECK: {{(cmpxchg i32*|i1 @__atomic_compare_exchange\(i32 4,)}}
11   i /= 2;
12   // CHECK: sdiv i32
13   // CHECK: {{(cmpxchg i32*|i1 @__atomic_compare_exchange\(i32 4, )}}
14   j /= x;
15   // CHECK: sdiv i32
16   // CHECK: {{(cmpxchg i16*|i1 @__atomic_compare_exchange\(i32 2, )}}
17 
18 }
19