• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 -run-pass mir-strip-debug,aarch64-ldst-opt -mir-strip-debugify-only=0 -verify-machineinstrs  -o - %s | FileCheck %s
3#
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 -run-pass aarch64-ldst-opt,mir-strip-debug -mir-strip-debugify-only=0 -verify-machineinstrs  -o - %s | FileCheck %s
6---
7
8### STG and its offset limits
9
10# CHECK-LABEL: name: test_STG_post
11# CHECK: STGPostIndex $x0, $x0, 7
12name: test_STG_post
13body: |
14  bb.0.entry:
15    liveins: $x0
16
17    STGOffset $x0, $x0, 0
18    DBG_VALUE $x0, 0
19    DBG_VALUE $x0, 0
20    $x0 = ADDXri $x0, 112, 0
21    DBG_VALUE $x0, 0
22    DBG_VALUE $x0, 0
23    RET_ReallyLR implicit $x0
24...
25
26# CHECK-LABEL: name: test_STG_post_same_reg
27# CHECK: STGPostIndex $x1, $x0, 7
28name: test_STG_post_same_reg
29body: |
30  bb.0.entry:
31    liveins: $x0, $x1
32
33    STGOffset $x1, $x0, 0
34    DBG_VALUE $x0, 0
35    DBG_VALUE $x0, 0
36    $x0 = ADDXri $x0, 112, 0
37    DBG_VALUE $x0, 0
38    DBG_VALUE $x0, 0
39    RET_ReallyLR implicit $x0
40...
41
42# CHECK-LABEL: name: test_STG_post_unaligned
43# CHECK:      STGOffset $x0, $x0, 0
44# CHECK-NEXT: ADDXri $x0, 8, 0
45name: test_STG_post_unaligned
46body: |
47  bb.0.entry:
48    liveins: $x0
49
50    STGOffset $x0, $x0, 0
51    DBG_VALUE $x0, 0
52    DBG_VALUE $x0, 0
53    $x0 = ADDXri $x0, 8, 0
54    DBG_VALUE $x0, 0
55    DBG_VALUE $x0, 0
56    RET_ReallyLR implicit $x0
57...
58
59# CHECK-LABEL: name: test_STG_post2
60# CHECK: STGPostIndex $x0, $x0, -256
61name: test_STG_post2
62body: |
63  bb.0.entry:
64    liveins: $x0
65
66    STGOffset $x0, $x0, 0
67    DBG_VALUE $x0, 0
68    DBG_VALUE $x0, 0
69    $x0 = SUBXri $x0, 4096, 0
70    DBG_VALUE $x0, 0
71    DBG_VALUE $x0, 0
72    RET_ReallyLR implicit $x0
73...
74
75# CHECK-LABEL: name: test_STG_post3
76# CHECK:      STGOffset $x0, $x0, 0
77# CHECK-NEXT: SUBXri $x0, 4112, 0
78name: test_STG_post3
79body: |
80  bb.0.entry:
81    liveins: $x0
82
83    STGOffset $x0, $x0, 0
84    DBG_VALUE $x0, 0
85    DBG_VALUE $x0, 0
86    $x0 = SUBXri $x0, 4112, 0
87    DBG_VALUE $x0, 0
88    DBG_VALUE $x0, 0
89    RET_ReallyLR implicit $x0
90...
91
92# CHECK-LABEL: name: test_STG_post4
93# CHECK: STGPostIndex $x0, $x0, 255
94name: test_STG_post4
95body: |
96  bb.0.entry:
97    liveins: $x0
98
99    STGOffset $x0, $x0, 0
100    DBG_VALUE $x0, 0
101    DBG_VALUE $x0, 0
102    $x0 = ADDXri $x0, 4080, 0
103    DBG_VALUE $x0, 0
104    DBG_VALUE $x0, 0
105    RET_ReallyLR implicit $x0
106...
107
108# CHECK-LABEL: name: test_STG_post5
109# CHECK:      STGOffset $x0, $x0, 0
110# CHECK-NEXT: ADDXri $x0, 4096, 0
111name: test_STG_post5
112body: |
113  bb.0.entry:
114    liveins: $x0
115
116    STGOffset $x0, $x0, 0
117    DBG_VALUE $x0, 0
118    DBG_VALUE $x0, 0
119    $x0 = ADDXri $x0, 4096, 0
120    DBG_VALUE $x0, 0
121    DBG_VALUE $x0, 0
122    RET_ReallyLR implicit $x0
123...
124
125### The rest of ST*G variants.
126
127# CHECK-LABEL: name: test_STZG_post
128# CHECK: STZGPostIndex $x0, $x0, 7
129name: test_STZG_post
130body: |
131  bb.0.entry:
132    liveins: $x0
133
134    STZGOffset $x0, $x0, 0
135    DBG_VALUE $x0, 0
136    DBG_VALUE $x0, 0
137    $x0 = ADDXri $x0, 112, 0
138    DBG_VALUE $x0, 0
139    DBG_VALUE $x0, 0
140    RET_ReallyLR implicit $x0
141...
142
143# CHECK-LABEL: name: test_ST2G_post
144# CHECK: ST2GPostIndex $x0, $x0, 7
145name: test_ST2G_post
146body: |
147  bb.0.entry:
148    liveins: $x0
149
150    ST2GOffset $x0, $x0, 0
151    DBG_VALUE $x0, 0
152    DBG_VALUE $x0, 0
153    $x0 = ADDXri $x0, 112, 0
154    DBG_VALUE $x0, 0
155    DBG_VALUE $x0, 0
156    RET_ReallyLR implicit $x0
157...
158
159# CHECK-LABEL: name: test_STZ2G_post
160# CHECK: STZ2GPostIndex $x0, $x0, 7
161name: test_STZ2G_post
162body: |
163  bb.0.entry:
164    liveins: $x0
165
166    STZ2GOffset $x0, $x0, 0
167    DBG_VALUE $x0, 0
168    DBG_VALUE $x0, 0
169    $x0 = ADDXri $x0, 112, 0
170    DBG_VALUE $x0, 0
171    DBG_VALUE $x0, 0
172    RET_ReallyLR implicit $x0
173...
174
175### STGP and its offset limits
176
177# CHECK-LABEL: name: test_STGP_post
178# CHECK: STGPpost $x1, $x2, $x0, 7
179name: test_STGP_post
180body: |
181  bb.0.entry:
182    liveins: $x0, $x1, $x2
183
184    STGPi $x1, $x2, $x0, 0
185    DBG_VALUE $x0, 0
186    DBG_VALUE $x0, 0
187    $x0 = ADDXri $x0, 112, 0
188    DBG_VALUE $x0, 0
189    DBG_VALUE $x0, 0
190    RET_ReallyLR implicit $x0
191...
192
193# CHECK-LABEL: name: test_STGP_post2
194# CHECK: STGPpost $x1, $x2, $x0, -64
195name: test_STGP_post2
196body: |
197  bb.0.entry:
198    liveins: $x0, $x1, $x2
199
200    STGPi $x1, $x2, $x0, 0
201    DBG_VALUE $x0, 0
202    DBG_VALUE $x0, 0
203    $x0 = SUBXri $x0, 1024, 0
204    DBG_VALUE $x0, 0
205    DBG_VALUE $x0, 0
206    RET_ReallyLR implicit $x0
207...
208
209# CHECK-LABEL: name: test_STGP_post3
210# CHECK:      STGPi $x1, $x2, $x0, 0
211# CHECK-NEXT: SUBXri $x0, 1040, 0
212name: test_STGP_post3
213body: |
214  bb.0.entry:
215    liveins: $x0, $x1, $x2
216
217    STGPi $x1, $x2, $x0, 0
218    DBG_VALUE $x0, 0
219    DBG_VALUE $x0, 0
220    $x0 = SUBXri $x0, 1040, 0
221    DBG_VALUE $x0, 0
222    DBG_VALUE $x0, 0
223    RET_ReallyLR implicit $x0
224...
225
226# CHECK-LABEL: name: test_STGP_post4
227# CHECK: STGPpost $x1, $x2, $x0, 63
228name: test_STGP_post4
229body: |
230  bb.0.entry:
231    liveins: $x0, $x1, $x2
232
233    STGPi $x1, $x2, $x0, 0
234    DBG_VALUE $x0, 0
235    DBG_VALUE $x0, 0
236    $x0 = ADDXri $x0, 1008, 0
237    DBG_VALUE $x0, 0
238    DBG_VALUE $x0, 0
239    RET_ReallyLR implicit $x0
240...
241
242# CHECK-LABEL: name: test_STGP_post5
243# CHECK:      STGPi $x1, $x2, $x0, 0
244# CHECK-NEXT: ADDXri $x0, 1024, 0
245name: test_STGP_post5
246body: |
247  bb.0.entry:
248    liveins: $x0, $x1, $x2
249
250    STGPi $x1, $x2, $x0, 0
251    DBG_VALUE $x0, 0
252    DBG_VALUE $x0, 0
253    $x0 = ADDXri $x0, 1024, 0
254    DBG_VALUE $x0, 0
255    DBG_VALUE $x0, 0
256    RET_ReallyLR implicit $x0
257...
258
259### Pre-indexed forms
260
261# CHECK-LABEL: name: test_STG_pre
262# CHECK: STGPreIndex $x0, $x0, 10
263name: test_STG_pre
264body: |
265  bb.0.entry:
266    liveins: $x0
267
268    STGOffset $x0, $x0, 10
269    DBG_VALUE $x0, 0
270    DBG_VALUE $x0, 0
271    $x0 = ADDXri $x0, 160, 0
272    DBG_VALUE $x0, 0
273    DBG_VALUE $x0, 0
274    RET_ReallyLR implicit $x0
275...
276
277# CHECK-LABEL: name: test_STGP_pre
278# CHECK: STGPpre $x1, $x2, $x0, 10
279name: test_STGP_pre
280body: |
281  bb.0.entry:
282    liveins: $x0, $x1, $x2
283
284    STGPi $x1, $x2, $x0, 10
285    DBG_VALUE $x0, 0
286    DBG_VALUE $x0, 0
287    $x0 = ADDXri $x0, 160, 0
288    DBG_VALUE $x0, 0
289    DBG_VALUE $x0, 0
290    RET_ReallyLR implicit $x0
291...
292
293### Pre-indexed forms with add/sub coming before the store.
294
295# CHECK-LABEL: name: test_STG_pre_back
296# CHECK: STGPreIndex $x0, $x0, 2
297name: test_STG_pre_back
298body: |
299  bb.0.entry:
300    liveins: $x0
301
302    $x0 = ADDXri $x0, 32, 0
303    DBG_VALUE $x0, 0
304    DBG_VALUE $x0, 0
305    STGOffset $x0, $x0, 0
306    DBG_VALUE $x0, 0
307    DBG_VALUE $x0, 0
308    RET_ReallyLR implicit $x0
309...
310
311# CHECK-LABEL: name: test_STGP_pre_back
312# CHECK: STGPpre $x1, $x2, $x0, -3
313name: test_STGP_pre_back
314body: |
315  bb.0.entry:
316    liveins: $x0, $x1, $x2
317
318    $x0 = SUBXri $x0, 48, 0
319    DBG_VALUE $x0, 0
320    DBG_VALUE $x0, 0
321    STGPi $x1, $x2, $x0, 0
322    DBG_VALUE $x0, 0
323    DBG_VALUE $x0, 0
324    RET_ReallyLR implicit $x0
325...
326
327### STGP with source register == address register
328
329# CHECK-LABEL: name: test_STGP_post_same_reg
330# CHECK: STGPpost $x0, $x0, $x0, 7
331name: test_STGP_post_same_reg
332body: |
333  bb.0.entry:
334    liveins: $x0
335
336    STGPi $x0, $x0, $x0, 0
337    DBG_VALUE $x0, 0
338    DBG_VALUE $x0, 0
339    $x0 = ADDXri $x0, 112, 0
340    DBG_VALUE $x0, 0
341    DBG_VALUE $x0, 0
342    RET_ReallyLR implicit $x0
343...
344
345# CHECK-LABEL: name: test_STGP_pre_same_reg
346# CHECK: STGPpre $x0, $x0, $x0, 7
347name: test_STGP_pre_same_reg
348body: |
349  bb.0.entry:
350    liveins: $x0
351
352    STGPi $x0, $x0, $x0, 7
353    DBG_VALUE $x0, 0
354    DBG_VALUE $x0, 0
355    $x0 = ADDXri $x0, 112, 0
356    DBG_VALUE $x0, 0
357    DBG_VALUE $x0, 0
358    RET_ReallyLR implicit $x0
359...
360
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
365name: test_STGP_pre_back_same_reg
366body: |
367  bb.0.entry:
368    liveins: $x0
369
370    $x0 = SUBXri $x0, 48, 0
371    DBG_VALUE $x0, 0
372    DBG_VALUE $x0, 0
373    STGPi $x0, $x0, $x0, 0
374    DBG_VALUE $x0, 0
375    DBG_VALUE $x0, 0
376    RET_ReallyLR implicit $x0
377...
378