1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64-- -mattr=+lse -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
5 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
7 define void @atomicrmw_xchg_i64(i64* %addr) { ret void }
8 define void @atomicrmw_add_i64(i64* %addr) { ret void }
9 define void @atomicrmw_add_i32(i64* %addr) { ret void }
10 define void @atomicrmw_sub_i32(i64* %addr) { ret void }
11 define void @atomicrmw_and_i32(i64* %addr) { ret void }
13 define void @atomicrmw_or_i32(i64* %addr) { ret void }
14 define void @atomicrmw_xor_i32(i64* %addr) { ret void }
15 define void @atomicrmw_min_i32(i64* %addr) { ret void }
16 define void @atomicrmw_max_i32(i64* %addr) { ret void }
17 define void @atomicrmw_umin_i32(i64* %addr) { ret void }
18 define void @atomicrmw_umax_i32(i64* %addr) { ret void }
22 name: atomicrmw_xchg_i64
30 ; CHECK-LABEL: name: atomicrmw_xchg_i64
31 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
32 ; CHECK: [[CST:%[0-9]+]]:gpr64 = MOVi64imm 1
33 ; CHECK: [[RES:%[0-9]+]]:gpr64 = SWPX [[CST]], [[COPY]] :: (load store monotonic 8 on %ir.addr)
34 ; CHECK: $x0 = COPY [[RES]]
36 %1:gpr(s64) = G_CONSTANT i64 1
37 %2:gpr(s64) = G_ATOMICRMW_XCHG %0, %1 :: (load store monotonic 8 on %ir.addr)
41 name: atomicrmw_add_i64
49 ; CHECK-LABEL: name: atomicrmw_add_i64
50 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
51 ; CHECK: [[CST:%[0-9]+]]:gpr64 = MOVi64imm 1
52 ; CHECK: [[RES:%[0-9]+]]:gpr64 = LDADDX [[CST]], [[COPY]] :: (load store monotonic 8 on %ir.addr)
53 ; CHECK: $x0 = COPY [[RES]]
55 %1:gpr(s64) = G_CONSTANT i64 1
56 %2:gpr(s64) = G_ATOMICRMW_ADD %0, %1 :: (load store monotonic 8 on %ir.addr)
60 name: atomicrmw_add_i32
68 ; CHECK-LABEL: name: atomicrmw_add_i32
69 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
70 ; CHECK: [[CST:%[0-9]+]]:gpr32 = MOVi32imm 1
71 ; CHECK: [[RES:%[0-9]+]]:gpr32 = LDADDALW [[CST]], [[COPY]] :: (load store seq_cst 4 on %ir.addr)
72 ; CHECK: $w0 = COPY [[RES]]
74 %1:gpr(s32) = G_CONSTANT i32 1
75 %2:gpr(s32) = G_ATOMICRMW_ADD %0, %1 :: (load store seq_cst 4 on %ir.addr)
80 name: atomicrmw_sub_i32
88 ; CHECK-LABEL: name: atomicrmw_sub_i32
89 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
90 ; CHECK: [[CST:%[0-9]+]]:gpr32 = MOVi32imm 1
91 ; CHECK: [[RES:%[0-9]+]]:gpr32 = LDADDALW [[CST]], [[COPY]] :: (load store seq_cst 4 on %ir.addr)
92 ; CHECK: $w0 = COPY [[RES]]
94 %1:gpr(s32) = G_CONSTANT i32 1
95 %2:gpr(s32) = G_ATOMICRMW_ADD %0, %1 :: (load store seq_cst 4 on %ir.addr)
100 name: atomicrmw_and_i32
102 regBankSelected: true
108 ; CHECK-LABEL: name: atomicrmw_and_i32
109 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
110 ; CHECK: [[CST:%[0-9]+]]:gpr32 = MOVi32imm 1
111 ; CHECK: [[CST2:%[0-9]+]]:gpr32 = ORNWrr $wzr, [[CST]]
112 ; CHECK: [[RES:%[0-9]+]]:gpr32 = LDCLRAW [[CST2]], [[COPY]] :: (load store acquire 4 on %ir.addr)
113 ; CHECK: $w0 = COPY [[RES]]
114 %0:gpr(p0) = COPY $x0
115 %1:gpr(s32) = G_CONSTANT i32 1
116 %2:gpr(s32) = G_ATOMICRMW_AND %0, %1 :: (load store acquire 4 on %ir.addr)
121 name: atomicrmw_or_i32
123 regBankSelected: true
129 ; CHECK-LABEL: name: atomicrmw_or_i32
130 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
131 ; CHECK: [[CST:%[0-9]+]]:gpr32 = MOVi32imm 1
132 ; CHECK: [[RES:%[0-9]+]]:gpr32 = LDSETLW [[CST]], [[COPY]] :: (load store release 4 on %ir.addr)
133 ; CHECK: $w0 = COPY [[RES]]
134 %0:gpr(p0) = COPY $x0
135 %1:gpr(s32) = G_CONSTANT i32 1
136 %2:gpr(s32) = G_ATOMICRMW_OR %0, %1 :: (load store release 4 on %ir.addr)
141 name: atomicrmw_xor_i32
143 regBankSelected: true
149 ; CHECK-LABEL: name: atomicrmw_xor_i32
150 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
151 ; CHECK: [[CST:%[0-9]+]]:gpr32 = MOVi32imm 1
152 ; CHECK: [[RES:%[0-9]+]]:gpr32 = LDEORALW [[CST]], [[COPY]] :: (load store acq_rel 4 on %ir.addr)
153 ; CHECK: $w0 = COPY [[RES]]
154 %0:gpr(p0) = COPY $x0
155 %1:gpr(s32) = G_CONSTANT i32 1
156 %2:gpr(s32) = G_ATOMICRMW_XOR %0, %1 :: (load store acq_rel 4 on %ir.addr)
161 name: atomicrmw_min_i32
163 regBankSelected: true
169 ; CHECK-LABEL: name: atomicrmw_min_i32
170 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
171 ; CHECK: [[CST:%[0-9]+]]:gpr32 = MOVi32imm 1
172 ; CHECK: [[RES:%[0-9]+]]:gpr32 = LDSMINALW [[CST]], [[COPY]] :: (load store acq_rel 4 on %ir.addr)
173 ; CHECK: $w0 = COPY [[RES]]
174 %0:gpr(p0) = COPY $x0
175 %1:gpr(s32) = G_CONSTANT i32 1
176 %2:gpr(s32) = G_ATOMICRMW_MIN %0, %1 :: (load store acq_rel 4 on %ir.addr)
181 name: atomicrmw_max_i32
183 regBankSelected: true
189 ; CHECK-LABEL: name: atomicrmw_max_i32
190 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
191 ; CHECK: [[CST:%[0-9]+]]:gpr32 = MOVi32imm 1
192 ; CHECK: [[RES:%[0-9]+]]:gpr32 = LDSMAXALW [[CST]], [[COPY]] :: (load store acq_rel 4 on %ir.addr)
193 ; CHECK: $w0 = COPY [[RES]]
194 %0:gpr(p0) = COPY $x0
195 %1:gpr(s32) = G_CONSTANT i32 1
196 %2:gpr(s32) = G_ATOMICRMW_MAX %0, %1 :: (load store acq_rel 4 on %ir.addr)
201 name: atomicrmw_umin_i32
203 regBankSelected: true
209 ; CHECK-LABEL: name: atomicrmw_umin_i32
210 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
211 ; CHECK: [[CST:%[0-9]+]]:gpr32 = MOVi32imm 1
212 ; CHECK: [[RES:%[0-9]+]]:gpr32 = LDUMINALW [[CST]], [[COPY]] :: (load store acq_rel 4 on %ir.addr)
213 ; CHECK: $w0 = COPY [[RES]]
214 %0:gpr(p0) = COPY $x0
215 %1:gpr(s32) = G_CONSTANT i32 1
216 %2:gpr(s32) = G_ATOMICRMW_UMIN %0, %1 :: (load store acq_rel 4 on %ir.addr)
221 name: atomicrmw_umax_i32
223 regBankSelected: true
229 ; CHECK-LABEL: name: atomicrmw_umax_i32
230 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
231 ; CHECK: [[CST:%[0-9]+]]:gpr32 = MOVi32imm 1
232 ; CHECK: [[RES:%[0-9]+]]:gpr32 = LDUMAXALW [[CST]], [[COPY]] :: (load store acq_rel 4 on %ir.addr)
233 ; CHECK: $w0 = COPY [[RES]]
234 %0:gpr(p0) = COPY $x0
235 %1:gpr(s32) = G_CONSTANT i32 1
236 %2:gpr(s32) = G_ATOMICRMW_UMAX %0, %1 :: (load store acq_rel 4 on %ir.addr)