[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / arm-atomics.c
blob701f2faa13df17e48646e5487aa8942b00af3b56
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
5 int i;
6 long long l;
8 typedef 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;
13 void test_presence(void)
15 // CHECK-LABEL: @test_presence
16 // CHECK: atomicrmw add ptr {{.*}} seq_cst, align 4
17 __atomic_fetch_add(&i, 1, memory_order_seq_cst);
18 // CHECK: atomicrmw sub ptr {{.*}} seq_cst, align 4
19 __atomic_fetch_sub(&i, 1, memory_order_seq_cst);
20 // CHECK: load atomic i32, ptr {{.*}} seq_cst, align 4
21 int r;
22 __atomic_load(&i, &r, memory_order_seq_cst);
23 // CHECK: store atomic i32 {{.*}} seq_cst, align 4
24 r = 0;
25 __atomic_store(&i, &r, memory_order_seq_cst);
27 // CHECK: atomicrmw add ptr {{.*}} seq_cst, align 8
28 __atomic_fetch_add(&l, 1, memory_order_seq_cst);
29 // CHECK: atomicrmw sub ptr {{.*}} seq_cst, align 8
30 __atomic_fetch_sub(&l, 1, memory_order_seq_cst);
31 // CHECK: load atomic i64, ptr {{.*}} seq_cst, align 8
32 long long rl;
33 __atomic_load(&l, &rl, memory_order_seq_cst);
34 // CHECK: store atomic i64 {{.*}} seq_cst, align 8
35 rl = 0;
36 __atomic_store(&l, &rl, memory_order_seq_cst);