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