1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=arm64-apple-ios -mcpu=apple-m1 -run-pass=early-ifcvt -o - %s | FileCheck %s
3 # RUN: llc -mtriple=arm64-apple-ios -mcpu=apple-m1 -passes=early-ifcvt -o - %s | FileCheck %s
6 define void @test_cond_is_load_with_invariant_ops() {
11 define void @test_cond_is_load_with_invariant_ops2() {
16 define void @test_cond_is_load_with_varying_ops() {
22 name: test_cond_is_load_with_invariant_ops
24 tracksRegLiveness: true
26 ; CHECK-LABEL: name: test_cond_is_load_with_invariant_ops
28 ; CHECK-NEXT: successors: %bb.1(0x80000000)
29 ; CHECK-NEXT: liveins: $x0, $x1, $w2, $x3
31 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64common = COPY $x3
32 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32common = COPY $w2
33 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr64common = COPY $x1
34 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr64common = COPY $x0
37 ; CHECK-NEXT: successors: %bb.3(0x30000000), %bb.2(0x50000000)
39 ; CHECK-NEXT: [[LDRBBui:%[0-9]+]]:gpr32 = LDRBBui [[COPY3]], 0 :: (load (s8))
40 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:gpr32all = COPY $wzr
41 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:gpr32all = COPY [[COPY4]]
42 ; CHECK-NEXT: CBZW killed [[LDRBBui]], %bb.3
46 ; CHECK-NEXT: successors: %bb.3(0x80000000)
48 ; CHECK-NEXT: [[SUBSWri:%[0-9]+]]:gpr32 = SUBSWri [[COPY1]], 4080, 12, implicit-def $nzcv
49 ; CHECK-NEXT: [[MOVi32imm:%[0-9]+]]:gpr32 = MOVi32imm 16711680
50 ; CHECK-NEXT: [[CSELWr:%[0-9]+]]:gpr32common = CSELWr [[COPY1]], killed [[MOVi32imm]], 11, implicit $nzcv
51 ; CHECK-NEXT: [[SUBSWri1:%[0-9]+]]:gpr32 = SUBSWri [[CSELWr]], 0, 0, implicit-def $nzcv
52 ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gpr32 = COPY $wzr
53 ; CHECK-NEXT: [[CSELWr1:%[0-9]+]]:gpr32 = CSELWr [[CSELWr]], [[COPY6]], 12, implicit $nzcv
54 ; CHECK-NEXT: [[COPY7:%[0-9]+]]:gpr32all = COPY [[CSELWr1]]
55 ; CHECK-NEXT: [[SUBSWri2:%[0-9]+]]:gpr32 = SUBSWri [[COPY1]], 0, 0, implicit-def $nzcv
56 ; CHECK-NEXT: [[CSELWr2:%[0-9]+]]:gpr32 = CSELWr [[COPY1]], [[COPY6]], 12, implicit $nzcv
57 ; CHECK-NEXT: [[COPY8:%[0-9]+]]:gpr32all = COPY [[CSELWr2]]
60 ; CHECK-NEXT: successors: %bb.1(0x80000000)
62 ; CHECK-NEXT: [[PHI:%[0-9]+]]:gpr32 = PHI [[COPY5]], %bb.1, [[COPY7]], %bb.2
63 ; CHECK-NEXT: [[PHI1:%[0-9]+]]:gpr32 = PHI [[COPY5]], %bb.1, [[COPY8]], %bb.2
64 ; CHECK-NEXT: STRBBui [[PHI1]], [[COPY2]], 0 :: (store (s8))
65 ; CHECK-NEXT: STRBBui [[PHI]], [[COPY]], 0 :: (store (s8))
68 liveins: $x0, $x1, $w2, $x3
70 %20:gpr64common = COPY $x3
71 %6:gpr32common = COPY $w2
72 %5:gpr64common = COPY $x1
73 %4:gpr64common = COPY $x0
76 successors: %bb.3(0x30000000), %bb.2(0x50000000)
78 %9:gpr32 = LDRBBui %4, 0 :: (load (s8))
79 %10:gpr32all = COPY $wzr
80 %8:gpr32all = COPY %10
85 %11:gpr32 = SUBSWri %6, 4080, 12, implicit-def $nzcv
86 %12:gpr32 = MOVi32imm 16711680
87 %13:gpr32common = CSELWr %6, killed %12, 11, implicit $nzcv
88 %14:gpr32 = SUBSWri %13, 0, 0, implicit-def $nzcv
90 %16:gpr32 = CSELWr %13, %15, 12, implicit $nzcv
91 %0:gpr32all = COPY %16
92 %17:gpr32 = SUBSWri %6, 0, 0, implicit-def $nzcv
93 %18:gpr32 = CSELWr %6, %15, 12, implicit $nzcv
94 %1:gpr32all = COPY %18
97 %2:gpr32 = PHI %8, %bb.1, %0, %bb.2
98 %3:gpr32 = PHI %8, %bb.1, %1, %bb.2
99 STRBBui %3, %5, 0 :: (store (s8))
100 STRBBui %2, %20, 0 :: (store (s8))
105 name: test_cond_is_load_with_invariant_ops2
107 tracksRegLiveness: true
109 ; CHECK-LABEL: name: test_cond_is_load_with_invariant_ops2
111 ; CHECK-NEXT: successors: %bb.1(0x80000000)
112 ; CHECK-NEXT: liveins: $x0, $x1, $w2, $x3
114 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64common = COPY $x3
115 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32common = COPY $w2
116 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr64common = COPY $x1
117 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr64common = COPY $x0
120 ; CHECK-NEXT: successors: %bb.3(0x30000000), %bb.2(0x50000000)
122 ; CHECK-NEXT: [[LDRBBui:%[0-9]+]]:gpr32 = LDRBBui [[COPY3]], 0 :: (load (s8))
123 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:gpr32all = COPY $wzr
124 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:gpr32all = COPY [[COPY4]]
125 ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gpr32all = COPY [[LDRBBui]]
126 ; CHECK-NEXT: CBZW killed [[LDRBBui]], %bb.3
127 ; CHECK-NEXT: B %bb.2
130 ; CHECK-NEXT: successors: %bb.3(0x80000000)
132 ; CHECK-NEXT: [[SUBSWri:%[0-9]+]]:gpr32 = SUBSWri [[COPY1]], 4080, 12, implicit-def $nzcv
133 ; CHECK-NEXT: [[COPY7:%[0-9]+]]:gpr32all = COPY [[SUBSWri]]
136 ; CHECK-NEXT: successors: %bb.1(0x80000000)
138 ; CHECK-NEXT: [[PHI:%[0-9]+]]:gpr32 = PHI [[COPY6]], %bb.1, [[COPY7]], %bb.2
139 ; CHECK-NEXT: STRBBui [[PHI]], [[COPY]], 0 :: (store (s8))
140 ; CHECK-NEXT: B %bb.1
142 liveins: $x0, $x1, $w2, $x3
144 %20:gpr64common = COPY $x3
145 %6:gpr32common = COPY $w2
146 %5:gpr64common = COPY $x1
147 %4:gpr64common = COPY $x0
150 successors: %bb.3(0x30000000), %bb.2(0x50000000)
152 %9:gpr32 = LDRBBui %4, 0 :: (load (s8))
153 %10:gpr32all = COPY $wzr
154 %8:gpr32all = COPY %10
155 %21:gpr32all = COPY %9
156 CBZW killed %9, %bb.3
160 %11:gpr32 = SUBSWri %6, 4080, 12, implicit-def $nzcv
161 %0:gpr32all = COPY %11
164 %2:gpr32 = PHI %21, %bb.1, %0, %bb.2
165 STRBBui %2, %20, 0 :: (store (s8))
170 name: test_cond_is_load_with_varying_ops
172 tracksRegLiveness: true
174 ; CHECK-LABEL: name: test_cond_is_load_with_varying_ops
176 ; CHECK-NEXT: successors: %bb.1(0x80000000)
177 ; CHECK-NEXT: liveins: $x0, $x1, $w2
179 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32common = COPY $w2
180 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64common = COPY $x1
181 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr64 = COPY $x0
184 ; CHECK-NEXT: successors: %bb.1(0x80000000)
186 ; CHECK-NEXT: [[PHI:%[0-9]+]]:gpr64sp = PHI [[COPY2]], %bb.0, %4, %bb.1
187 ; CHECK-NEXT: [[LDRBBui:%[0-9]+]]:gpr32common = LDRBBui [[PHI]], 0 :: (load (s8))
188 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr32all = COPY $wzr
189 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:gpr32 = COPY [[COPY3]]
190 ; CHECK-NEXT: [[SUBSWri:%[0-9]+]]:gpr32 = SUBSWri [[COPY]], 4080, 12, implicit-def $nzcv
191 ; CHECK-NEXT: [[MOVi32imm:%[0-9]+]]:gpr32 = MOVi32imm 16711680
192 ; CHECK-NEXT: [[CSELWr:%[0-9]+]]:gpr32common = CSELWr [[COPY]], killed [[MOVi32imm]], 11, implicit $nzcv
193 ; CHECK-NEXT: [[SUBSWri1:%[0-9]+]]:gpr32 = SUBSWri [[CSELWr]], 0, 0, implicit-def $nzcv
194 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:gpr32 = COPY $wzr
195 ; CHECK-NEXT: [[CSELWr1:%[0-9]+]]:gpr32 = CSELWr [[CSELWr]], [[COPY5]], 12, implicit $nzcv
196 ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gpr32 = COPY [[CSELWr1]]
197 ; CHECK-NEXT: [[SUBSWri2:%[0-9]+]]:gpr32 = SUBSWri [[COPY]], 0, 0, implicit-def $nzcv
198 ; CHECK-NEXT: [[CSELWr2:%[0-9]+]]:gpr32 = CSELWr [[COPY]], [[COPY5]], 12, implicit $nzcv
199 ; CHECK-NEXT: [[COPY7:%[0-9]+]]:gpr32 = COPY [[CSELWr2]]
200 ; CHECK-NEXT: $wzr = SUBSWri [[LDRBBui]], 0, 0, implicit-def $nzcv
201 ; CHECK-NEXT: [[CSELWr3:%[0-9]+]]:gpr32 = CSELWr [[COPY4]], [[COPY6]], 0, implicit $nzcv
202 ; CHECK-NEXT: $wzr = SUBSWri [[LDRBBui]], 0, 0, implicit-def $nzcv
203 ; CHECK-NEXT: [[CSELWr4:%[0-9]+]]:gpr32 = CSELWr [[COPY4]], [[COPY7]], 0, implicit $nzcv
204 ; CHECK-NEXT: STRBBui [[CSELWr4]], [[COPY1]], 0 :: (store (s8))
205 ; CHECK-NEXT: early-clobber %20:gpr64sp = STRBBpost [[CSELWr3]], [[PHI]], 1 :: (store (s8))
206 ; CHECK-NEXT: [[COPY8:%[0-9]+]]:gpr64all = COPY %20
207 ; CHECK-NEXT: B %bb.1
209 liveins: $x0, $x1, $w2
211 %8:gpr32common = COPY $w2
212 %7:gpr64common = COPY $x1
216 successors: %bb.3(0x30000000), %bb.2(0x50000000)
218 %0:gpr64sp = PHI %6, %bb.0, %5, %bb.3
219 %11:gpr32 = LDRBBui %0, 0 :: (load (s8))
220 %12:gpr32all = COPY $wzr
221 %10:gpr32all = COPY %12
222 CBZW killed %11, %bb.3
226 %13:gpr32 = SUBSWri %8, 4080, 12, implicit-def $nzcv
227 %14:gpr32 = MOVi32imm 16711680
228 %15:gpr32common = CSELWr %8, killed %14, 11, implicit $nzcv
229 %16:gpr32 = SUBSWri %15, 0, 0, implicit-def $nzcv
230 %17:gpr32 = COPY $wzr
231 %18:gpr32 = CSELWr %15, %17, 12, implicit $nzcv
232 %1:gpr32all = COPY %18
233 %19:gpr32 = SUBSWri %8, 0, 0, implicit-def $nzcv
234 %20:gpr32 = CSELWr %8, %17, 12, implicit $nzcv
235 %2:gpr32all = COPY %20
238 %3:gpr32 = PHI %10, %bb.1, %1, %bb.2
239 %4:gpr32 = PHI %10, %bb.1, %2, %bb.2
240 STRBBui %4, %7, 0 :: (store (s8))
241 early-clobber %21:gpr64sp = STRBBpost %3, %0, 1 :: (store (s8))
242 %5:gpr64all = COPY %21