1 # RUN: llc -o - %s -mtriple=aarch64-none-eabi -mcpu=cortex-a55 -lsr-preferred-addressing-mode=preindexed -stop-after=aarch64-ldst-opt | FileCheck %s
4 name: 1-ldrwpre-ldrwui-merge
5 tracksRegLiveness: true
14 liveins: $w0, $w1, $x1
15 ; CHECK-LABEL: name: 1-ldrwpre-ldrwui-merge
16 ; CHECK: liveins: $w0, $w1, $x1
17 ; CHECK: early-clobber $x1, renamable $w0, renamable $w2 = LDPWpre renamable $x1, 5 :: (load (s32))
18 ; CHECK: STPWi renamable $w0, renamable $w2, renamable $x1, 0 :: (store (s32))
19 ; CHECK: RET undef $lr
20 early-clobber renamable $x1, renamable $w0 = LDRWpre killed renamable $x1, 20 :: (load (s32))
21 renamable $w2 = LDRWui renamable $x1, 1 :: (load (s32))
22 STRWui killed renamable $w0, renamable $x1, 0 :: (store (s32))
23 STRWui killed renamable $w2, renamable $x1, 1 :: (store (s32))
29 name: 2-ldrxpre-ldrxui-merge
30 tracksRegLiveness: true
39 liveins: $x2, $x3, $x1
40 ; CHECK-LABEL: name: 2-ldrxpre-ldrxui-merge
41 ; CHECK: liveins: $x1, $x2, $x3
42 ; CHECK: early-clobber $x1, renamable $x2, renamable $x3 = LDPXpre renamable $x1, 3 :: (load (s64))
43 ; CHECK: STPXi renamable $x2, renamable $x3, renamable $x1, 0 :: (store (s64))
44 ; CHECK: RET undef $lr
45 early-clobber renamable $x1, renamable $x2 = LDRXpre killed renamable $x1, 24 :: (load (s64))
46 renamable $x3 = LDRXui renamable $x1, 1 :: (load (s64))
47 STRXui killed renamable $x2, renamable $x1, 0 :: (store (s64))
48 STRXui killed renamable $x3, renamable $x1, 1 :: (store (s64))
54 name: 3-ldrspre-ldrsui-merge
55 tracksRegLiveness: true
64 liveins: $s0, $s1, $x1
65 ; CHECK-LABEL: name: 3-ldrspre-ldrsui-merge
66 ; CHECK: liveins: $s0, $s1, $x1
67 ; CHECK: early-clobber $x1, renamable $s0, renamable $s1 = LDPSpre renamable $x1, 3 :: (load (s32))
68 ; CHECK: STRSui renamable $s0, renamable $x1, 0 :: (store (s32))
69 ; CHECK: STRSui renamable $s1, renamable $x1, 1 :: ("aarch64-suppress-pair" store (s32))
70 ; CHECK: RET undef $lr
71 early-clobber renamable $x1, renamable $s0 = LDRSpre killed renamable $x1, 12 :: (load (s32))
72 renamable $s1 = LDRSui renamable $x1, 1 :: (load (s32))
73 STRSui killed renamable $s0, renamable $x1, 0 :: (store (s32))
74 STRSui killed renamable $s1, renamable $x1, 1 :: (store (s32))
80 name: 4-ldrqdre-ldrdui-merge
81 tracksRegLiveness: true
90 liveins: $d0, $d1, $x1
91 ; CHECK-LABEL: name: 4-ldrqdre-ldrdui-merge
92 ; CHECK: liveins: $d0, $d1, $x1
93 ; CHECK: early-clobber $x1, renamable $d0, renamable $d1 = LDPDpre renamable $x1, 16 :: (load (s64))
94 ; CHECK: STRDui renamable $d0, renamable $x1, 0 :: (store (s64))
95 ; CHECK: STRDui renamable $d1, renamable $x1, 1 :: ("aarch64-suppress-pair" store (s64))
96 ; CHECK: RET undef $lr
97 early-clobber renamable $x1, renamable $d0 = LDRDpre killed renamable $x1, 128 :: (load (s64))
98 renamable $d1 = LDRDui renamable $x1, 1 :: (load (s64))
99 STRDui killed renamable $d0, renamable $x1, 0 :: (store (s64))
100 STRDui killed renamable $d1, renamable $x1, 1 :: (store (s64))
106 name: 5-ldrqpre-ldrqui-merge
108 tracksRegLiveness: true
120 liveins: $q0, $q1, $x1
121 ; CHECK-LABEL: name: 5-ldrqpre-ldrqui-merge
122 ; CHECK: liveins: $q0, $q1, $x1
123 ; CHECK: early-clobber $x1, renamable $q0, renamable $q1 = LDPQpre renamable $x1, 3 :: (load (s128))
124 ; CHECK: STPQi renamable $q0, renamable $q1, renamable $x1, 0 :: (store (s128))
125 ; CHECK: RET undef $lr
126 early-clobber renamable $x1, renamable $q0 = LDRQpre killed renamable $x1, 48 :: (load (s128))
127 renamable $q1 = LDRQui renamable $x1, 1 :: (load (s128))
128 STRQui killed renamable $q0, renamable $x1, 0 :: (store (s128))
129 STRQui killed renamable $q1, renamable $x1, 1 :: (store (s128))
135 name: 6-ldrqui-ldrqpre-no-merge
137 tracksRegLiveness: true
149 liveins: $q0, $q1, $x1
150 ; CHECK-LABEL: name: 6-ldrqui-ldrqpre-no-merge
151 ; CHECK: liveins: $q0, $q1, $x1
152 ; CHECK: renamable $q1 = LDRQui renamable $x1, 1 :: (load (s128))
153 ; CHECK: early-clobber renamable $x1, renamable $q0 = LDRQpre renamable $x1, 48, implicit $w1 :: (load (s128))
154 ; CHECK: STPQi renamable $q0, renamable $q1, renamable $x1, 0 :: (store (s128))
155 ; CHECK: RET undef $lr
156 renamable $q1 = LDRQui renamable $x1, 1 :: (load (s128))
157 early-clobber renamable $x1, renamable $q0 = LDRQpre killed renamable $x1, 48 :: (load (s128))
158 STRQui killed renamable $q0, renamable $x1, 0 :: (store (s128))
159 STRQui killed renamable $q1, renamable $x1, 1 :: (store (s128))
165 name: 7-ldrqpre-ldrqui-max-offset-merge
167 tracksRegLiveness: true
179 liveins: $q0, $q1, $x1
180 ; CHECK-LABEL: name: 7-ldrqpre-ldrqui-max-offset-merge
181 ; CHECK: liveins: $q0, $q1, $x1
182 ; CHECK: early-clobber $x1, renamable $q0, renamable $q1 = LDPQpre renamable $x1, 15 :: (load (s128))
183 ; CHECK: STPQi renamable $q0, renamable $q1, renamable $x1, 0 :: (store (s128))
184 ; CHECK: RET undef $lr
185 early-clobber renamable $x1, renamable $q0 = LDRQpre killed renamable $x1, 240 :: (load (s128))
186 renamable $q1 = LDRQui renamable $x1, 1 :: (load (s128))
187 STRQui killed renamable $q0, renamable $x1, 0 :: (store (s128))
188 STRQui killed renamable $q1, renamable $x1, 1 :: (store (s128))
194 name: 8-ldrqpre-ldrqui-min-offset-merge
196 tracksRegLiveness: true
208 liveins: $q0, $q1, $x1
209 ; CHECK-LABEL: name: 8-ldrqpre-ldrqui-min-offset-merge
210 ; CHECK: liveins: $q0, $q1, $x1
211 ; CHECK: early-clobber $x1, renamable $q0, renamable $q1 = LDPQpre renamable $x1, -16 :: (load (s128))
212 ; CHECK: STPQi renamable $q0, renamable $q1, renamable $x1, 0 :: (store (s128))
213 ; CHECK: RET undef $lr
214 early-clobber renamable $x1, renamable $q0 = LDRQpre killed renamable $x1, -256 :: (load (s128))
215 renamable $q1 = LDRQui renamable $x1, 1 :: (load (s128))
216 STRQui killed renamable $q0, renamable $x1, 0 :: (store (s128))
217 STRQui killed renamable $q1, renamable $x1, 1 :: (store (s128))
223 name: 9-ldrspre-ldrsui-mod-base-reg-no-merge
225 tracksRegLiveness: true
238 liveins: $s0, $s1, $x0, $x1
239 ; CHECK-LABEL: name: 9-ldrspre-ldrsui-mod-base-reg-no-merge
240 ; CHECK: liveins: $s0, $s1, $x0, $x1
241 ; CHECK: dead early-clobber renamable $x1, renamable $s0 = LDRSpre renamable $x1, 12, implicit $w1 :: (load (s32))
242 ; CHECK: renamable $x1 = LDRXui renamable $x0, 1 :: (load (s64))
243 ; CHECK: renamable $s1 = LDRSui renamable $x1, 1 :: (load (s32))
244 ; CHECK: STPSi renamable $s0, renamable $s1, renamable $x1, 0 :: (store (s32))
245 ; CHECK: RET undef $lr
246 early-clobber renamable $x1, renamable $s0 = LDRSpre killed renamable $x1, 12 :: (load (s32))
247 renamable $x1 = LDRXui renamable $x0, 1 :: (load (s64))
248 renamable $s1 = LDRSui renamable $x1, 1 :: (load (s32))
249 STRSui killed renamable $s0, renamable $x1, 0 :: (store (s32))
250 STRSui killed renamable $s1, renamable $x1, 1 :: (store (s32))
256 name: 10-ldrspre-ldrsui-used-base-reg-no-merge
258 tracksRegLiveness: true
271 liveins: $s0, $s1, $x0, $x1
272 ; CHECK-LABEL: name: 10-ldrspre-ldrsui-used-base-reg-no-merge
273 ; CHECK: liveins: $s0, $s1, $x0, $x1
274 ; CHECK: early-clobber renamable $x1, renamable $s0 = LDRSpre renamable $x1, 12, implicit $w1 :: (load (s32))
275 ; CHECK: renamable $x0 = LDRXui renamable $x1, 1 :: (load (s64))
276 ; CHECK: STRXui renamable $x0, renamable $x0, 1 :: (store (s64))
277 ; CHECK: renamable $s1 = LDRSui renamable $x1, 1 :: (load (s32))
278 ; CHECK: STRSui renamable $s0, renamable $x1, 0 :: (store (s32))
279 ; CHECK: STRSui renamable $s1, renamable $x1, 1 :: ("aarch64-suppress-pair" store (s32))
280 ; CHECK: RET undef $lr
281 early-clobber renamable $x1, renamable $s0 = LDRSpre killed renamable $x1, 12 :: (load (s32))
282 renamable $x0 = LDRXui renamable $x1, 1 :: (load (s64))
283 STRXui killed renamable $x0, renamable $x0, 1 :: (store (s64))
284 renamable $s1 = LDRSui renamable $x1, 1 :: (load (s32))
285 STRSui killed renamable $s0, renamable $x1, 0 :: (store (s32))
286 STRSui killed renamable $s1, renamable $x1, 1 :: (store (s32))
292 name: 11-ldrqpre-ldrqpre-no-merge
294 tracksRegLiveness: true
306 liveins: $q0, $q1, $x1
307 ; CHECK-LABEL: name: 11-ldrqpre-ldrqpre-no-merge
308 ; CHECK: liveins: $q0, $q1, $x1
309 ; CHECK: early-clobber renamable $x1, dead renamable $q0 = LDRQpre renamable $x1, 48, implicit $w1 :: (load (s128))
310 ; CHECK: early-clobber renamable $x1, dead renamable $q1 = LDRQpre renamable $x1, 1, implicit $w1 :: (load (s128))
311 ; CHECK: early-clobber renamable $x1, dead renamable $q0 = LDRQpre renamable $x1, 16, implicit $w1 :: (load (s128))
312 ; CHECK: early-clobber renamable $x1, dead renamable $q1 = LDRQpre renamable $x1, 12, implicit $w1 :: (load (s128))
313 ; CHECK: early-clobber renamable $x1, renamable $q0 = LDRQpre renamable $x1, 16, implicit $w1 :: (load (s128))
314 ; CHECK: early-clobber renamable $x1, renamable $q1 = LDRQpre renamable $x1, 16, implicit $w1 :: (load (s128))
315 ; CHECK: STPQi renamable $q0, renamable $q1, renamable $x1, 0 :: (store (s128))
316 ; CHECK: RET undef $lr
317 early-clobber renamable $x1, renamable $q0 = LDRQpre killed renamable $x1, 48 :: (load (s128))
318 early-clobber renamable $x1, renamable $q1 = LDRQpre killed renamable $x1, 1 :: (load (s128))
319 early-clobber renamable $x1, renamable $q0 = LDRQpre killed renamable $x1, 16 :: (load (s128))
320 early-clobber renamable $x1, renamable $q1 = LDRQpre killed renamable $x1, 12 :: (load (s128))
321 early-clobber renamable $x1, renamable $q0 = LDRQpre killed renamable $x1, 16 :: (load (s128))
322 early-clobber renamable $x1, renamable $q1 = LDRQpre killed renamable $x1, 16 :: (load (s128))
323 STRQui killed renamable $q0, renamable $x1, 0 :: (store (s128))
324 STRQui killed renamable $q1, renamable $x1, 1 :: (store (s128))
330 name: 12-ldrspre-ldrsui-no-merge
331 tracksRegLiveness: true
340 liveins: $s0, $s1, $x1
342 ; The offset of the second load is not equal to the
343 ; size of the destination register, and hence can’t be merged.
345 ; CHECK-LABEL: name: 12-ldrspre-ldrsui-no-merge
346 ; CHECK: liveins: $s0, $s1, $x1
347 ; CHECK: early-clobber renamable $x1, renamable $s0 = LDRSpre renamable $x1, 12, implicit $w1 :: (load (s32))
348 ; CHECK: renamable $s1 = LDRSui renamable $x1, 2 :: (load (s32))
349 ; CHECK: STRSui renamable $s0, renamable $x1, 0 :: (store (s32))
350 ; CHECK: STRSui renamable $s1, renamable $x1, 1 :: ("aarch64-suppress-pair" store (s32))
351 ; CHECK: RET undef $lr
352 early-clobber renamable $x1, renamable $s0 = LDRSpre killed renamable $x1, 12 :: (load (s32))
353 renamable $s1 = LDRSui renamable $x1, 2 :: (load (s32))
354 STRSui killed renamable $s0, renamable $x1, 0 :: (store (s32))
355 STRSui killed renamable $s1, renamable $x1, 1 :: (store (s32))
361 name: 13-ldrqpre-ldrdui-no-merge
363 tracksRegLiveness: true
375 liveins: $q0, $d1, $x1
376 ; CHECK-LABEL: name: 13-ldrqpre-ldrdui-no-merge
377 ; CHECK: liveins: $d1, $q0, $x1
378 ; CHECK: early-clobber renamable $x1, renamable $q0 = LDRQpre renamable $x1, 32, implicit $w1 :: (load (s128))
379 ; CHECK: renamable $d1 = LDRDui renamable $x1, 1 :: (load (s64))
380 ; CHECK: STRQui renamable $q0, renamable $x1, 0 :: (store (s128))
381 ; CHECK: STRDui renamable $d1, renamable $x1, 1 :: (store (s64))
382 ; CHECK: RET undef $lr
383 early-clobber renamable $x1, renamable $q0 = LDRQpre killed renamable $x1, 32 :: (load (s128))
384 renamable $d1 = LDRDui renamable $x1, 1 :: (load (s64))
385 STRQui killed renamable $q0, renamable $x1, 0 :: (store (s128))
386 STRDui killed renamable $d1, renamable $x1, 1 :: (store (s64))
392 name: 14-ldrqpre-strqui-no-merge
394 tracksRegLiveness: true
406 liveins: $q0, $q1, $x1
407 ; CHECK-LABEL: name: 14-ldrqpre-strqui-no-merge
408 ; CHECK: liveins: $q0, $q1, $x1
409 ; CHECK: early-clobber renamable $x1, renamable $q0 = LDRQpre renamable $x1, 32, implicit $w1 :: (load (s128))
410 ; CHECK: STRQui renamable $q0, renamable $x1, 0 :: (store (s128))
411 ; CHECK: RET undef $lr
412 early-clobber renamable $x1, renamable $q0 = LDRQpre killed renamable $x1, 32 :: (load (s128))
413 STRQui killed renamable $q0, renamable $x1, 0 :: (store (s128))
419 name: 15-ldrqpre-ldrqui-same-dst-reg-no-merge
421 tracksRegLiveness: true
434 ; CHECK-LABEL: name: 15-ldrqpre-ldrqui-same-dst-reg-no-merge
435 ; CHECK: liveins: $q0, $q1, $x1
436 ; CHECK: early-clobber renamable $x1, dead renamable $q0 = LDRQpre renamable $x1, 32, implicit $w1 :: (load (s128))
437 ; CHECK: renamable $q0 = LDRQui renamable $x1, 1 :: (load (s128))
438 ; CHECK: STRQui renamable $q0, renamable $x1, 0 :: (store (s128))
439 ; CHECK: RET undef $lr
440 early-clobber renamable $x1, renamable $q0 = LDRQpre killed renamable $x1, 32 :: (load (s128))
441 renamable $q0 = LDRQui renamable $x1, 1 :: (load (s128))
442 STRQui killed renamable $q0, renamable $x1, 0 :: (store (s128))
448 name: 16-ldrqpre-ldrqui-diff-base-reg-no-merge
450 tracksRegLiveness: true
463 liveins: $q0, $q1, $x1, $x2
464 ; CHECK-LABEL: name: 16-ldrqpre-ldrqui-diff-base-reg-no-merge
465 ; CHECK: liveins: $q0, $q1, $x1, $x2
466 ; CHECK: early-clobber renamable $x1, renamable $q0 = LDRQpre renamable $x1, 32, implicit $w1 :: (load (s128))
467 ; CHECK: renamable $q1 = LDRQui renamable $x2, 1 :: (load (s128))
468 ; CHECK: STPQi renamable $q0, renamable $q1, renamable $x1, 0 :: (store (s128))
469 ; CHECK: RET undef $lr
470 early-clobber renamable $x1, renamable $q0 = LDRQpre killed renamable $x1, 32 :: (load (s128))
471 renamable $q1 = LDRQui renamable $x2, 1 :: (load (s128))
472 STRQui killed renamable $q0, renamable $x1, 0 :: (store (s128))
473 STRQui killed renamable $q1, renamable $x1, 1 :: (store (s128))
479 name: 17-ldrqpre-ldurqi-merge
481 tracksRegLiveness: true
493 liveins: $q0, $q1, $x1
494 ; CHECK-LABEL: name: 17-ldrqpre-ldurqi-merge
495 ; CHECK: liveins: $q0, $q1, $x1
496 ; CHECK: early-clobber $x1, renamable $q0, renamable $q1 = LDPQpre renamable $x1, 2 :: (load (s128))
497 ; CHECK: STPQi renamable $q0, renamable $q1, renamable $x1, 0 :: (store (s128))
498 ; CHECK: RET undef $lr
499 early-clobber renamable $x1, renamable $q0 = LDRQpre killed renamable $x1, 32 :: (load (s128))
500 renamable $q1 = LDURQi renamable $x1, 16 :: (load (s128))
501 STRQui killed renamable $q0, renamable $x1, 0 :: (store (s128))
502 STRQui killed renamable $q1, renamable $x1, 1 :: (store (s128))
508 name: 18-ldrqpre-ldurqi-no-merge
510 tracksRegLiveness: true
522 liveins: $q0, $q1, $x1
523 ; CHECK-LABEL: name: 18-ldrqpre-ldurqi-no-merge
524 ; CHECK: liveins: $q0, $q1, $x1
525 ; CHECK: early-clobber renamable $x1, renamable $q0 = LDRQpre renamable $x1, 32, implicit $w1 :: (load (s128))
526 ; CHECK: renamable $q1 = LDURQi renamable $x1, 1 :: (load (s128))
527 ; CHECK: STPQi renamable $q0, renamable $q1, renamable $x1, 0 :: (store (s128))
528 ; CHECK: RET undef $lr
529 early-clobber renamable $x1, renamable $q0 = LDRQpre killed renamable $x1, 32 :: (load (s128))
530 renamable $q1 = LDURQi renamable $x1, 1 :: (load (s128))
531 STRQui killed renamable $q0, renamable $x1, 0 :: (store (s128))
532 STRQui killed renamable $q1, renamable $x1, 1 :: (store (s128))
538 name: 19-ldrspre-ldrsui-max-merge
539 tracksRegLiveness: true
548 liveins: $s0, $s1, $x1
549 ; CHECK-LABEL: name: 19-ldrspre-ldrsui-max-merge
550 ; CHECK: liveins: $s0, $s1, $x1
551 ; CHECK: early-clobber $x1, renamable $s0, renamable $s1 = LDPSpre renamable $x1, 63 :: (load (s32))
552 ; CHECK: STRSui renamable $s0, renamable $x1, 0 :: (store (s32))
553 ; CHECK: STRSui renamable $s1, renamable $x1, 1 :: ("aarch64-suppress-pair" store (s32))
554 ; CHECK: RET undef $lr
555 early-clobber renamable $x1, renamable $s0 = LDRSpre killed renamable $x1, 252 :: (load (s32))
556 renamable $s1 = LDRSui renamable $x1, 1 :: (load (s32))
557 STRSui killed renamable $s0, renamable $x1, 0 :: (store (s32))
558 STRSui killed renamable $s1, renamable $x1, 1 :: (store (s32))
564 name: 20-ldrspre-ldrsui-unaligned-no-merge
565 tracksRegLiveness: true
574 liveins: $s0, $s1, $x1
575 ; CHECK-LABEL: name: 20-ldrspre-ldrsui-unaligned-no-merge
576 ; CHECK: liveins: $s0, $s1, $x1
577 ; CHECK: early-clobber renamable $x1, renamable $s0 = LDRSpre renamable $x1, 251, implicit $w1 :: (load (s32))
578 ; CHECK: renamable $s1 = LDRSui renamable $x1, 1 :: (load (s32))
579 ; CHECK: STRSui renamable $s0, renamable $x1, 0 :: (store (s32))
580 ; CHECK: STRSui renamable $s1, renamable $x1, 1 :: ("aarch64-suppress-pair" store (s32))
581 ; CHECK: RET undef $lr
582 early-clobber renamable $x1, renamable $s0 = LDRSpre killed renamable $x1, 251 :: (load (s32))
583 renamable $s1 = LDRSui renamable $x1, 1 :: (load (s32))
584 STRSui killed renamable $s0, renamable $x1, 0 :: (store (s32))
585 STRSui killed renamable $s1, renamable $x1, 1 :: (store (s32))