1 # Strip out debug info, then run ldst-opt with limit=1.
2 # RUN: llc -aarch64-load-store-scan-limit=1 -mtriple=aarch64-none-linux-gnu -mattr=+mte -run-pass mir-strip-debug,aarch64-ldst-opt -mir-strip-debugify-only=0 -verify-machineinstrs -o - %s | FileCheck %s
4 # Run ldst-opt with limit=1, then strip out debug info.
5 # RUN: llc -aarch64-load-store-scan-limit=1 -mtriple=aarch64-none-linux-gnu -mattr=+mte -run-pass aarch64-ldst-opt,mir-strip-debug -mir-strip-debugify-only=0 -verify-machineinstrs -o - %s | FileCheck %s
8 ### STG and its offset limits
10 # CHECK-LABEL: name: test_STG_post
11 # CHECK: STGPostIndex $x0, $x0, 7
20 $x0 = ADDXri $x0, 112, 0
23 RET_ReallyLR implicit $x0
26 # CHECK-LABEL: name: test_STG_post_same_reg
27 # CHECK: STGPostIndex $x1, $x0, 7
28 name: test_STG_post_same_reg
36 $x0 = ADDXri $x0, 112, 0
39 RET_ReallyLR implicit $x0
42 # CHECK-LABEL: name: test_STG_post_unaligned
43 # CHECK: STGi $x0, $x0, 0
44 # CHECK-NEXT: ADDXri $x0, 8, 0
45 name: test_STG_post_unaligned
53 $x0 = ADDXri $x0, 8, 0
56 RET_ReallyLR implicit $x0
59 # CHECK-LABEL: name: test_STG_post2
60 # CHECK: STGPostIndex $x0, $x0, -256
69 $x0 = SUBXri $x0, 4096, 0
72 RET_ReallyLR implicit $x0
75 # CHECK-LABEL: name: test_STG_post3
76 # CHECK: STGi $x0, $x0, 0
77 # CHECK-NEXT: SUBXri $x0, 4112, 0
86 $x0 = SUBXri $x0, 4112, 0
89 RET_ReallyLR implicit $x0
92 # CHECK-LABEL: name: test_STG_post4
93 # CHECK: STGPostIndex $x0, $x0, 255
102 $x0 = ADDXri $x0, 4080, 0
105 RET_ReallyLR implicit $x0
108 # CHECK-LABEL: name: test_STG_post5
109 # CHECK: STGi $x0, $x0, 0
110 # CHECK-NEXT: ADDXri $x0, 4096, 0
119 $x0 = ADDXri $x0, 4096, 0
122 RET_ReallyLR implicit $x0
125 ### The rest of ST*G variants.
127 # CHECK-LABEL: name: test_STZG_post
128 # CHECK: STZGPostIndex $x0, $x0, 7
137 $x0 = ADDXri $x0, 112, 0
140 RET_ReallyLR implicit $x0
143 # CHECK-LABEL: name: test_ST2G_post
144 # CHECK: ST2GPostIndex $x0, $x0, 7
153 $x0 = ADDXri $x0, 112, 0
156 RET_ReallyLR implicit $x0
159 # CHECK-LABEL: name: test_STZ2G_post
160 # CHECK: STZ2GPostIndex $x0, $x0, 7
161 name: test_STZ2G_post
169 $x0 = ADDXri $x0, 112, 0
172 RET_ReallyLR implicit $x0
175 ### STGP and its offset limits
177 # CHECK-LABEL: name: test_STGP_post
178 # CHECK: STGPpost $x1, $x2, $x0, 7
182 liveins: $x0, $x1, $x2
184 STGPi $x1, $x2, $x0, 0
187 $x0 = ADDXri $x0, 112, 0
190 RET_ReallyLR implicit $x0
193 # CHECK-LABEL: name: test_STGP_post2
194 # CHECK: STGPpost $x1, $x2, $x0, -64
195 name: test_STGP_post2
198 liveins: $x0, $x1, $x2
200 STGPi $x1, $x2, $x0, 0
203 $x0 = SUBXri $x0, 1024, 0
206 RET_ReallyLR implicit $x0
209 # CHECK-LABEL: name: test_STGP_post3
210 # CHECK: STGPi $x1, $x2, $x0, 0
211 # CHECK-NEXT: SUBXri $x0, 1040, 0
212 name: test_STGP_post3
215 liveins: $x0, $x1, $x2
217 STGPi $x1, $x2, $x0, 0
220 $x0 = SUBXri $x0, 1040, 0
223 RET_ReallyLR implicit $x0
226 # CHECK-LABEL: name: test_STGP_post4
227 # CHECK: STGPpost $x1, $x2, $x0, 63
228 name: test_STGP_post4
231 liveins: $x0, $x1, $x2
233 STGPi $x1, $x2, $x0, 0
236 $x0 = ADDXri $x0, 1008, 0
239 RET_ReallyLR implicit $x0
242 # CHECK-LABEL: name: test_STGP_post5
243 # CHECK: STGPi $x1, $x2, $x0, 0
244 # CHECK-NEXT: ADDXri $x0, 1024, 0
245 name: test_STGP_post5
248 liveins: $x0, $x1, $x2
250 STGPi $x1, $x2, $x0, 0
253 $x0 = ADDXri $x0, 1024, 0
256 RET_ReallyLR implicit $x0
259 ### Pre-indexed forms
261 # CHECK-LABEL: name: test_STG_pre
262 # CHECK: STGPreIndex $x0, $x0, 10
271 $x0 = ADDXri $x0, 160, 0
274 RET_ReallyLR implicit $x0
277 # CHECK-LABEL: name: test_STGP_pre
278 # CHECK: STGPpre $x1, $x2, $x0, 10
282 liveins: $x0, $x1, $x2
284 STGPi $x1, $x2, $x0, 10
287 $x0 = ADDXri $x0, 160, 0
290 RET_ReallyLR implicit $x0
293 ### Pre-indexed forms with add/sub coming before the store.
295 # CHECK-LABEL: name: test_STG_pre_back
296 # CHECK: STGPreIndex $x0, $x0, 2
297 name: test_STG_pre_back
302 $x0 = ADDXri $x0, 32, 0
308 RET_ReallyLR implicit $x0
311 # CHECK-LABEL: name: test_STGP_pre_back
312 # CHECK: STGPpre $x1, $x2, $x0, -3
313 name: test_STGP_pre_back
316 liveins: $x0, $x1, $x2
318 $x0 = SUBXri $x0, 48, 0
321 STGPi $x1, $x2, $x0, 0
324 RET_ReallyLR implicit $x0
327 ### STGP with source register == address register
329 # CHECK-LABEL: name: test_STGP_post_same_reg
330 # CHECK: STGPpost $x0, $x0, $x0, 7
331 name: test_STGP_post_same_reg
336 STGPi $x0, $x0, $x0, 0
339 $x0 = ADDXri $x0, 112, 0
342 RET_ReallyLR implicit $x0
345 # CHECK-LABEL: name: test_STGP_pre_same_reg
346 # CHECK: STGPpre $x0, $x0, $x0, 7
347 name: test_STGP_pre_same_reg
352 STGPi $x0, $x0, $x0, 7
355 $x0 = ADDXri $x0, 112, 0
358 RET_ReallyLR implicit $x0
361 # This case can not be merged because the source register is always read before writeback.
362 # CHECK-LABEL: name: test_STGP_pre_back_same_reg
363 # CHECK: SUBXri $x0, 48, 0
364 # CHECK-NEXT: STGPi $x0, $x0, $x0, 0
365 name: test_STGP_pre_back_same_reg
370 $x0 = SUBXri $x0, 48, 0
373 STGPi $x0, $x0, $x0, 0
376 RET_ReallyLR implicit $x0