[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / arm-atomics-m.c
blobb9cc72bc6b98aba0a105aef9efc887e4e6b074d1
1 // RUN: %clang_cc1 %s -emit-llvm -o - -triple=thumbv7m-none--eabi -target-cpu cortex-m3 | FileCheck %s
3 int i;
4 long long l;
6 typedef enum memory_order {
7 memory_order_relaxed, memory_order_consume, memory_order_acquire,
8 memory_order_release, memory_order_acq_rel, memory_order_seq_cst
9 } memory_order;
11 void test_presence(void)
13 // CHECK-LABEL: @test_presence
14 // CHECK: atomicrmw add ptr {{.*}} seq_cst, align 4
15 __atomic_fetch_add(&i, 1, memory_order_seq_cst);
16 // CHECK: atomicrmw sub ptr {{.*}} seq_cst, align 4
17 __atomic_fetch_sub(&i, 1, memory_order_seq_cst);
18 // CHECK: load atomic i32, ptr {{.*}} seq_cst, align 4
19 int r;
20 __atomic_load(&i, &r, memory_order_seq_cst);
21 // CHECK: store atomic i32 {{.*}} seq_cst, align 4
22 r = 0;
23 __atomic_store(&i, &r, memory_order_seq_cst);
25 // CHECK: __atomic_fetch_add_8
26 __atomic_fetch_add(&l, 1, memory_order_seq_cst);
27 // CHECK: __atomic_fetch_sub_8
28 __atomic_fetch_sub(&l, 1, memory_order_seq_cst);
29 // CHECK: __atomic_load_8
30 long long rl;
31 __atomic_load(&l, &rl, memory_order_seq_cst);
32 // CHECK: __atomic_store_8
33 rl = 0;
34 __atomic_store(&l, &rl, memory_order_seq_cst);