1 # RUN: llc -run-pass arm-prera-ldst-opt %s -o - | FileCheck %s
2 # RUN: llc -run-pass arm-prera-ldst-opt -arm-prera-ldst-opt-reorder-limit=3 %s -o - | FileCheck %s
3 # RUN: llc -run-pass arm-prera-ldst-opt -arm-prera-ldst-opt-reorder-limit=2 %s -o - | FileCheck %s --check-prefix=CHECK-LIMIT
5 target triple = "thumbv7---eabi"
7 define void @a(ptr nocapture %x, i32 %y, i32 %z) {
12 define void @b(ptr nocapture %x, i32 %y, i32 %z) {
18 # CHECK-LABEL: name: a
21 tracksRegLiveness: true
23 - { reg: '$r0', virtual-reg: '%0' }
24 - { reg: '$r1', virtual-reg: '%1' }
25 - { reg: '$r2', virtual-reg: '%2' }
28 liveins: $r0, $r1, $r2
33 %3 : rgpr = t2MUL %2, %2, 14, $noreg
34 %4 : rgpr = t2MUL %1, %1, 14, $noreg
35 %5 : rgpr = t2MOVi32imm -858993459
36 %6 : rgpr, %7 : rgpr = t2UMULL killed %3, %5, 14, $noreg
37 %8 : rgpr, %9 : rgpr = t2UMULL killed %4, %5, 14, $noreg
38 t2STRi12 %1, %0, 0, 14, $noreg :: (store (s32))
39 %10 : rgpr = t2LSLri %2, 1, 14, $noreg, $noreg
40 t2STRi12 killed %10, %0, 4, 14, $noreg :: (store (s32))
42 ; Make sure we move the paired stores next to each other, and
43 ; insert them in an appropriate location.
44 ; CHECK: t2STRDi8 %1, %10,
48 %11 : rgpr = t2MOVi 55, 14, $noreg, $noreg
49 %12 : gprnopc = t2ADDrs %11, killed %7, 19, 14, $noreg, $noreg
50 t2STRi12 killed %12, %0, 16, 14, $noreg :: (store (s32))
51 %13 : gprnopc = t2ADDrs %11, killed %9, 19, 14, $noreg, $noreg
52 t2STRi12 killed %13, %0, 20, 14, $noreg :: (store (s32))
54 ; Make sure we move the paired stores next to each other.
55 ; CHECK: t2STRDi8 %12, %13,
59 # CHECK-LABEL: name: b
62 tracksRegLiveness: true
64 - { reg: '$r0', virtual-reg: '%0' }
65 - { reg: '$r1', virtual-reg: '%1' }
66 - { reg: '$r2', virtual-reg: '%2' }
69 liveins: $r0, $r1, $r2
74 t2STRi12 %1, %0, 0, 14, $noreg :: (store (s32))
75 %10 : rgpr = t2LSLri %2, 1, 14, $noreg, $noreg
76 t2STRi12 killed %10, %0, 4, 14, $noreg :: (store (s32))
77 %3 : rgpr = t2MUL %2, %2, 14, $noreg
78 t2STRi12 %3, %0, 8, 14, $noreg :: (store (s32))
80 ; Make sure we move the paired stores next to each other, and
81 ; insert them in an appropriate location.
82 ; CHECK: t2STRi12 {{.*}}, 0
83 ; CHECK-NEXT: t2STRi12 {{.*}}, 4
84 ; CHECK-NEXT: t2STRi12 {{.*}}, 8
86 ; CHECK-NEXT: t2MOVi32imm
88 ; CHECK-LIMIT-LABEL: name: b
89 ; CHECK-LIMIT: t2STRDi8 {{.*}}, {{.*}}, {{.*}}, 0
90 ; CHECK-LIMIT-NEXT: t2MUL
91 ; CHECK-LIMIT-NEXT: t2STRi12 {{.*}}, 8
93 %4 : rgpr = t2MUL %1, %1, 14, $noreg
94 %5 : rgpr = t2MOVi32imm -858993459
95 %6 : rgpr, %7 : rgpr = t2UMULL killed %3, %5, 14, $noreg
96 %8 : rgpr, %9 : rgpr = t2UMULL killed %4, %5, 14, $noreg
97 %10 : rgpr = t2LSLri %2, 1, 14, $noreg, $noreg
98 %11 : rgpr = t2MOVi 55, 14, $noreg, $noreg
99 %12 : gprnopc = t2ADDrs %11, killed %7, 19, 14, $noreg, $noreg
100 t2STRi12 killed %12, %0, 16, 14, $noreg :: (store (s32))
101 %13 : gprnopc = t2ADDrs %11, killed %9, 19, 14, $noreg, $noreg
102 t2STRi12 killed %13, %0, 20, 14, $noreg :: (store (s32))
104 ; Make sure we move the paired stores next to each other.
105 ; CHECK: t2STRDi8 %12, %13, %0, 16