xref: /aosp_15_r20/external/llvm/test/CodeGen/ARM/ldstrex-m.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=thumbv7m-none-eabi -mcpu=cortex-m4 | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=thumbv8m.main-none-eabi | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=thumbv8m.base-none-eabi | FileCheck %s
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f0:
6*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: ldrexd
7*9880d681SAndroid Build Coastguard Workerdefine i64 @f0(i64* %p) nounwind readonly {
8*9880d681SAndroid Build Coastguard Workerentry:
9*9880d681SAndroid Build Coastguard Worker  %0 = load atomic i64, i64* %p seq_cst, align 8
10*9880d681SAndroid Build Coastguard Worker  ret i64 %0
11*9880d681SAndroid Build Coastguard Worker}
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f1:
14*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: strexd
15*9880d681SAndroid Build Coastguard Workerdefine void @f1(i64* %p) nounwind readonly {
16*9880d681SAndroid Build Coastguard Workerentry:
17*9880d681SAndroid Build Coastguard Worker  store atomic i64 0, i64* %p seq_cst, align 8
18*9880d681SAndroid Build Coastguard Worker  ret void
19*9880d681SAndroid Build Coastguard Worker}
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f2:
22*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: ldrexd
23*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: strexd
24*9880d681SAndroid Build Coastguard Workerdefine i64 @f2(i64* %p) nounwind readonly {
25*9880d681SAndroid Build Coastguard Workerentry:
26*9880d681SAndroid Build Coastguard Worker  %0 = atomicrmw add i64* %p, i64 1 seq_cst
27*9880d681SAndroid Build Coastguard Worker  ret i64 %0
28*9880d681SAndroid Build Coastguard Worker}
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f3:
31*9880d681SAndroid Build Coastguard Worker; CHECK: ldr
32*9880d681SAndroid Build Coastguard Workerdefine i32 @f3(i32* %p) nounwind readonly {
33*9880d681SAndroid Build Coastguard Workerentry:
34*9880d681SAndroid Build Coastguard Worker  %0 = load atomic i32, i32* %p seq_cst, align 4
35*9880d681SAndroid Build Coastguard Worker  ret i32 %0
36*9880d681SAndroid Build Coastguard Worker}
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f4:
39*9880d681SAndroid Build Coastguard Worker; CHECK: ldrb
40*9880d681SAndroid Build Coastguard Workerdefine i8 @f4(i8* %p) nounwind readonly {
41*9880d681SAndroid Build Coastguard Workerentry:
42*9880d681SAndroid Build Coastguard Worker  %0 = load atomic i8, i8* %p seq_cst, align 4
43*9880d681SAndroid Build Coastguard Worker  ret i8 %0
44*9880d681SAndroid Build Coastguard Worker}
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f5:
47*9880d681SAndroid Build Coastguard Worker; CHECK: str
48*9880d681SAndroid Build Coastguard Workerdefine void @f5(i32* %p) nounwind readonly {
49*9880d681SAndroid Build Coastguard Workerentry:
50*9880d681SAndroid Build Coastguard Worker  store atomic i32 0, i32* %p seq_cst, align 4
51*9880d681SAndroid Build Coastguard Worker  ret void
52*9880d681SAndroid Build Coastguard Worker}
53*9880d681SAndroid Build Coastguard Worker
54*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f6:
55*9880d681SAndroid Build Coastguard Worker; CHECK: ldrex
56*9880d681SAndroid Build Coastguard Worker; CHECK: strex
57*9880d681SAndroid Build Coastguard Workerdefine i32 @f6(i32* %p) nounwind readonly {
58*9880d681SAndroid Build Coastguard Workerentry:
59*9880d681SAndroid Build Coastguard Worker  %0 = atomicrmw add i32* %p, i32 1 seq_cst
60*9880d681SAndroid Build Coastguard Worker  ret i32 %0
61*9880d681SAndroid Build Coastguard Worker}
62