Skip to content

Commit 94f7600

Browse files
[AArch64] Add tests for merging LDRSWpre-LDR pairs
This patch adds MIR test cases that test merging an LDRSWpre-LDR instruction pair into an LDPSWpre instruction. This optimization is currently missing and will be added a subsequent patch (D152407), so all test cases are no merge for now. Differential Revision: https://reviews.llvm.org/D152564
1 parent 17508cb commit 94f7600

File tree

1 file changed

+190
-0
lines changed

1 file changed

+190
-0
lines changed

llvm/test/CodeGen/AArch64/ldrpre-ldr-merge.mir

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,3 +585,193 @@ body: |
585585
STRSui killed renamable $s1, renamable $x1, 1 :: (store (s32))
586586
RET undef $lr
587587
...
588+
589+
590+
---
591+
name: 21-ldrswpre-ldrswui-no-merge
592+
tracksRegLiveness: true
593+
liveins:
594+
- { reg: '$x0' }
595+
- { reg: '$x1' }
596+
- { reg: '$x2' }
597+
machineFunctionInfo:
598+
hasRedZone: false
599+
body: |
600+
bb.0:
601+
liveins: $x0, $x1, $x2
602+
; CHECK-LABEL: name: 21-ldrswpre-ldrswui-no-merge
603+
; CHECK: liveins: $x0, $x1, $x2
604+
; CHECK: early-clobber renamable $x1, renamable $x0 = LDRSWpre renamable $x1, 40, implicit $w1 :: (load (s32))
605+
; CHECK: renamable $x2 = LDRSWui renamable $x1, 1 :: (load (s32))
606+
; CHECK: STPXi renamable $x0, renamable $x2, renamable $x1, 0 :: (store (s64))
607+
; CHECK: RET undef $lr
608+
early-clobber renamable $x1, renamable $x0 = LDRSWpre killed renamable $x1, 40 :: (load (s32))
609+
renamable $x2 = LDRSWui renamable $x1, 1 :: (load (s32))
610+
STRXui killed renamable $x0, renamable $x1, 0 :: (store (s64))
611+
STRXui killed renamable $x2, renamable $x1, 1 :: (store (s64))
612+
RET undef $lr
613+
...
614+
615+
616+
---
617+
name: 22-ldrswpre-ldurswi-no-merge
618+
tracksRegLiveness: true
619+
liveins:
620+
- { reg: '$x0' }
621+
- { reg: '$x1' }
622+
- { reg: '$x2' }
623+
machineFunctionInfo:
624+
hasRedZone: false
625+
body: |
626+
bb.0:
627+
liveins: $x0, $x1, $x2
628+
; CHECK-LABEL: name: 22-ldrswpre-ldurswi-no-merge
629+
; CHECK: liveins: $x0, $x1, $x2
630+
; CHECK: early-clobber renamable $x1, renamable $x0 = LDRSWpre renamable $x1, 40, implicit $w1 :: (load (s32))
631+
; CHECK: renamable $x2 = LDURSWi renamable $x1, 4 :: (load (s32))
632+
; CHECK: STPXi renamable $x0, renamable $x2, renamable $x1, 0 :: (store (s64))
633+
; CHECK: RET undef $lr
634+
early-clobber renamable $x1, renamable $x0 = LDRSWpre killed renamable $x1, 40 :: (load (s32))
635+
renamable $x2 = LDURSWi renamable $x1, 4 :: (load (s32))
636+
STRXui killed renamable $x0, renamable $x1, 0 :: (store (s64))
637+
STRXui killed renamable $x2, renamable $x1, 1 :: (store (s64))
638+
RET undef $lr
639+
...
640+
641+
642+
---
643+
name: 23-ldrswui-ldrswpre-no-merge
644+
tracksRegLiveness: true
645+
liveins:
646+
- { reg: '$x0' }
647+
- { reg: '$x1' }
648+
- { reg: '$x2' }
649+
machineFunctionInfo:
650+
hasRedZone: false
651+
body: |
652+
bb.0:
653+
liveins: $x0, $x1, $x2
654+
; CHECK-LABEL: name: 23-ldrswui-ldrswpre-no-merge
655+
; CHECK: liveins: $x0, $x1, $x2
656+
; CHECK: renamable $x2 = LDRSWui renamable $x1, 1 :: (load (s32))
657+
; CHECK: early-clobber renamable $x1, renamable $x0 = LDRSWpre renamable $x1, 40, implicit $w1 :: (load (s32))
658+
; CHECK: STPXi renamable $x0, renamable $x2, renamable $x1, 0 :: (store (s64))
659+
; CHECK: RET undef $lr
660+
renamable $x2 = LDRSWui renamable $x1, 1 :: (load (s32))
661+
early-clobber renamable $x1, renamable $x0 = LDRSWpre killed renamable $x1, 40 :: (load (s32))
662+
STRXui killed renamable $x0, renamable $x1, 0 :: (store (s64))
663+
STRXui killed renamable $x2, renamable $x1, 1 :: (store (s64))
664+
RET undef $lr
665+
...
666+
667+
668+
---
669+
name: 24-ldurswi-ldrswpre-no-merge
670+
tracksRegLiveness: true
671+
liveins:
672+
- { reg: '$x0' }
673+
- { reg: '$x1' }
674+
- { reg: '$x2' }
675+
machineFunctionInfo:
676+
hasRedZone: false
677+
body: |
678+
bb.0:
679+
liveins: $x0, $x1, $x2
680+
; CHECK-LABEL: name: 24-ldurswi-ldrswpre-no-merge
681+
; CHECK: liveins: $x0, $x1, $x2
682+
; CHECK: renamable $x2 = LDURSWi renamable $x1, 4 :: (load (s32))
683+
; CHECK: early-clobber renamable $x1, renamable $x0 = LDRSWpre renamable $x1, 40, implicit $w1 :: (load (s32))
684+
; CHECK: STPXi renamable $x0, renamable $x2, renamable $x1, 0 :: (store (s64))
685+
; CHECK: RET undef $lr
686+
renamable $x2 = LDURSWi renamable $x1, 4 :: (load (s32))
687+
early-clobber renamable $x1, renamable $x0 = LDRSWpre killed renamable $x1, 40 :: (load (s32))
688+
STRXui killed renamable $x0, renamable $x1, 0 :: (store (s64))
689+
STRXui killed renamable $x2, renamable $x1, 1 :: (store (s64))
690+
RET undef $lr
691+
...
692+
693+
694+
---
695+
name: 25-ldrswpre-ldrswpre-no-merge
696+
tracksRegLiveness: true
697+
liveins:
698+
- { reg: '$x0' }
699+
- { reg: '$x1' }
700+
- { reg: '$x2' }
701+
machineFunctionInfo:
702+
hasRedZone: false
703+
body: |
704+
bb.0:
705+
liveins: $x0, $x1, $x2
706+
; CHECK-LABEL: name: 25-ldrswpre-ldrswpre-no-merge
707+
; CHECK: liveins: $x0, $x1, $x2
708+
; CHECK: early-clobber renamable $x1, dead renamable $x0 = LDRSWpre renamable $x1, 48, implicit $w1 :: (load (s32))
709+
; CHECK: early-clobber renamable $x1, dead renamable $x2 = LDRSWpre renamable $x1, 1, implicit $w1 :: (load (s32))
710+
; CHECK: early-clobber renamable $x1, dead renamable $x0 = LDRSWpre renamable $x1, 16, implicit $w1 :: (load (s32))
711+
; CHECK: early-clobber renamable $x1, dead renamable $x2 = LDRSWpre renamable $x1, 12, implicit $w1 :: (load (s32))
712+
; CHECK: early-clobber renamable $x1, renamable $x0 = LDRSWpre renamable $x1, 16, implicit $w1 :: (load (s32))
713+
; CHECK: early-clobber renamable $x1, renamable $x2 = LDRSWpre renamable $x1, 16, implicit $w1 :: (load (s32))
714+
; CHECK: STPXi renamable $x0, renamable $x2, renamable $x1, 0 :: (store (s64))
715+
; CHECK: RET undef $lr
716+
early-clobber renamable $x1, renamable $x0 = LDRSWpre killed renamable $x1, 48 :: (load (s32))
717+
early-clobber renamable $x1, renamable $x2 = LDRSWpre killed renamable $x1, 1 :: (load (s32))
718+
early-clobber renamable $x1, renamable $x0 = LDRSWpre killed renamable $x1, 16 :: (load (s32))
719+
early-clobber renamable $x1, renamable $x2 = LDRSWpre killed renamable $x1, 12 :: (load (s32))
720+
early-clobber renamable $x1, renamable $x0 = LDRSWpre killed renamable $x1, 16 :: (load (s32))
721+
early-clobber renamable $x1, renamable $x2 = LDRSWpre killed renamable $x1, 16 :: (load (s32))
722+
STRXui killed renamable $x0, renamable $x1, 0 :: (store (s64))
723+
STRXui killed renamable $x2, renamable $x1, 1 :: (store (s64))
724+
RET undef $lr
725+
...
726+
727+
728+
---
729+
name: 26-ldrswpre-ldrwui-no-merge
730+
tracksRegLiveness: true
731+
liveins:
732+
- { reg: '$x0' }
733+
- { reg: '$x1' }
734+
- { reg: '$x2' }
735+
machineFunctionInfo:
736+
hasRedZone: false
737+
body: |
738+
bb.0:
739+
liveins: $x0, $x1, $x2
740+
; CHECK-LABEL: name: 26-ldrswpre-ldrwui-no-merge
741+
; CHECK: liveins: $x0, $x1, $x2
742+
; CHECK: early-clobber renamable $x1, renamable $x0 = LDRSWpre renamable $x1, 40, implicit $w1 :: (load (s32))
743+
; CHECK: renamable $w2 = LDRWui renamable $x1, 1, implicit-def $x2 :: (load (s32))
744+
; CHECK: STPXi renamable $x0, renamable $x2, renamable $x1, 0 :: (store (s64))
745+
; CHECK: RET undef $lr
746+
early-clobber renamable $x1, renamable $x0 = LDRSWpre killed renamable $x1, 40 :: (load (s32))
747+
renamable $w2 = LDRWui renamable $x1, 1 :: (load (s32))
748+
STRXui killed renamable $x0, renamable $x1, 0 :: (store (s64))
749+
STRXui killed renamable $x2, renamable $x1, 1 :: (store (s64))
750+
RET undef $lr
751+
...
752+
753+
754+
---
755+
name: 27-ldrwpre-ldrswui-no-merge
756+
tracksRegLiveness: true
757+
liveins:
758+
- { reg: '$x0' }
759+
- { reg: '$x1' }
760+
- { reg: '$x2' }
761+
machineFunctionInfo:
762+
hasRedZone: false
763+
body: |
764+
bb.0:
765+
liveins: $x0, $x1, $x2
766+
; CHECK-LABEL: name: 27-ldrwpre-ldrswui-no-merge
767+
; CHECK: liveins: $x0, $x1, $x2
768+
; CHECK: early-clobber renamable $x1, renamable $w0 = LDRWpre renamable $x1, 40, implicit $w1 :: (load (s32))
769+
; CHECK: renamable $x2 = LDRSWui renamable $x1, 1 :: (load (s32))
770+
; CHECK: STPXi renamable $x0, renamable $x2, renamable $x1, 0 :: (store (s64))
771+
; CHECK: RET undef $lr
772+
early-clobber renamable $x1, renamable $w0 = LDRWpre killed renamable $x1, 40 :: (load (s32))
773+
renamable $x2 = LDRSWui renamable $x1, 1 :: (load (s32))
774+
STRXui killed renamable $x0, renamable $x1, 0 :: (store (s64))
775+
STRXui killed renamable $x2, renamable $x1, 1 :: (store (s64))
776+
RET undef $lr
777+
...

0 commit comments

Comments
 (0)