1// RUN: %clang_cc1 %s -emit-llvm -o - -triple=thumbv7-none--eabi | FileCheck %s
2// RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv6-none--eabi | FileCheck %s
3// RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv7-unknown-openbsd | FileCheck %s
4
5int i;
6long long l;
7
8typedef enum memory_order {
9  memory_order_relaxed, memory_order_consume, memory_order_acquire,
10  memory_order_release, memory_order_acq_rel, memory_order_seq_cst
11} memory_order;
12
13void test_presence(void)
14{
15  // CHECK-LABEL: @test_presence
16  // CHECK: atomicrmw add i32* {{.*}} seq_cst
17  __atomic_fetch_add(&i, 1, memory_order_seq_cst);
18  // CHECK: atomicrmw sub i32* {{.*}} seq_cst
19  __atomic_fetch_sub(&i, 1, memory_order_seq_cst);
20  // CHECK: load atomic i32, i32* {{.*}} seq_cst
21  int r;
22  __atomic_load(&i, &r, memory_order_seq_cst);
23  // CHECK: store atomic i32 {{.*}} seq_cst
24  r = 0;
25  __atomic_store(&i, &r, memory_order_seq_cst);
26
27  // CHECK: atomicrmw add i64* {{.*}} seq_cst
28  __atomic_fetch_add(&l, 1, memory_order_seq_cst);
29  // CHECK: atomicrmw sub i64* {{.*}} seq_cst
30  __atomic_fetch_sub(&l, 1, memory_order_seq_cst);
31  // CHECK: load atomic i64, i64* {{.*}} seq_cst
32  long long rl;
33  __atomic_load(&l, &rl, memory_order_seq_cst);
34  // CHECK: store atomic i64 {{.*}} seq_cst
35  rl = 0;
36  __atomic_store(&l, &rl, memory_order_seq_cst);
37}
38