David Chisnall | 28397be | 2012-04-11 15:29:15 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-apple-darwin9 | FileCheck %s |
| 2 | struct A { |
| 3 | _Atomic(int) i; |
| 4 | A(int j); |
| 5 | void v(int j); |
| 6 | }; |
| 7 | // Storing to atomic values should be atomic |
| 8 | // CHECK: store atomic i32 |
| 9 | void A::v(int j) { i = j; } |
| 10 | // Initialising atomic values should not be atomic |
| 11 | // CHECK-NOT: store atomic |
| 12 | A::A(int j) : i(j) {} |
David Chisnall | eb9496e | 2012-04-11 17:24:05 +0000 | [diff] [blame] | 13 | |
| 14 | struct B { |
| 15 | int i; |
| 16 | B(int x) : i(x) {} |
| 17 | }; |
| 18 | |
| 19 | _Atomic(B) b; |
| 20 | |
| 21 | // CHECK: define void @_Z11atomic_initR1Ai |
| 22 | void atomic_init(A& a, int i) { |
| 23 | // CHECK-NOT: atomic |
Richard Smith | be646db | 2012-04-11 18:00:46 +0000 | [diff] [blame^] | 24 | __c11_atomic_init(&b, B(i)); |
David Chisnall | eb9496e | 2012-04-11 17:24:05 +0000 | [diff] [blame] | 25 | } |