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
5 define void @test_cond_is_load_with_invariant_ops() {
10 define void @test_cond_is_load_with_invariant_ops2() {
15 define void @test_cond_is_load_with_varying_ops() {
21 name: test_cond_is_load_with_invariant_ops
23 tracksRegLiveness: true
25 ; CHECK-LABEL: name: test_cond_is_load_with_invariant_ops
27 ; CHECK-NEXT: successors: %bb.1(0x80000000)
28 ; CHECK-NEXT: liveins: $x0, $x1, $w2, $x3
30 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64common = COPY $x3
31 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32common = COPY $w2
32 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr64common = COPY $x1
33 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr64common = COPY $x0
36 ; CHECK-NEXT: successors: %bb.3(0x30000000), %bb.2(0x50000000)
38 ; CHECK-NEXT: [[LDRBBui:%[0-9]+]]:gpr32 = LDRBBui [[COPY3]], 0 :: (load (s8))
39 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:gpr32all = COPY $wzr
40 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:gpr32all = COPY [[COPY4]]
41 ; CHECK-NEXT: CBZW killed [[LDRBBui]], %bb.3
45 ; CHECK-NEXT: successors: %bb.3(0x80000000)
47 ; CHECK-NEXT: [[SUBSWri:%[0-9]+]]:gpr32 = SUBSWri [[COPY1]], 4080, 12, implicit-def $nzcv
48 ; CHECK-NEXT: [[MOVi32imm:%[0-9]+]]:gpr32 = MOVi32imm 16711680
49 ; CHECK-NEXT: [[CSELWr:%[0-9]+]]:gpr32common = CSELWr [[COPY1]], killed [[MOVi32imm]], 11, implicit $nzcv
50 ; CHECK-NEXT: [[SUBSWri1:%[0-9]+]]:gpr32 = SUBSWri [[CSELWr]], 0, 0, implicit-def $nzcv
51 ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gpr32 = COPY $wzr
52 ; CHECK-NEXT: [[CSELWr1:%[0-9]+]]:gpr32 = CSELWr [[CSELWr]], [[COPY6]], 12, implicit $nzcv
53 ; CHECK-NEXT: [[COPY7:%[0-9]+]]:gpr32all = COPY [[CSELWr1]]
54 ; CHECK-NEXT: [[SUBSWri2:%[0-9]+]]:gpr32 = SUBSWri [[COPY1]], 0, 0, implicit-def $nzcv
55 ; CHECK-NEXT: [[CSELWr2:%[0-9]+]]:gpr32 = CSELWr [[COPY1]], [[COPY6]], 12, implicit $nzcv
56 ; CHECK-NEXT: [[COPY8:%[0-9]+]]:gpr32all = COPY [[CSELWr2]]
59 ; CHECK-NEXT: successors: %bb.1(0x80000000)
61 ; CHECK-NEXT: [[PHI:%[0-9]+]]:gpr32 = PHI [[COPY5]], %bb.1, [[COPY7]], %bb.2
62 ; CHECK-NEXT: [[PHI1:%[0-9]+]]:gpr32 = PHI [[COPY5]], %bb.1, [[COPY8]], %bb.2
63 ; CHECK-NEXT: STRBBui [[PHI1]], [[COPY2]], 0 :: (store (s8))
64 ; CHECK-NEXT: STRBBui [[PHI]], [[COPY]], 0 :: (store (s8))
67 liveins: $x0, $x1, $w2, $x3
69 %20:gpr64common = COPY $x3
70 %6:gpr32common = COPY $w2
71 %5:gpr64common = COPY $x1
72 %4:gpr64common = COPY $x0
75 successors: %bb.3(0x30000000), %bb.2(0x50000000)
77 %9:gpr32 = LDRBBui %4, 0 :: (load (s8))
78 %10:gpr32all = COPY $wzr
79 %8:gpr32all = COPY %10
84 %11:gpr32 = SUBSWri %6, 4080, 12, implicit-def $nzcv
85 %12:gpr32 = MOVi32imm 16711680
86 %13:gpr32common = CSELWr %6, killed %12, 11, implicit $nzcv
87 %14:gpr32 = SUBSWri %13, 0, 0, implicit-def $nzcv
89 %16:gpr32 = CSELWr %13, %15, 12, implicit $nzcv
90 %0:gpr32all = COPY %16
91 %17:gpr32 = SUBSWri %6, 0, 0, implicit-def $nzcv
92 %18:gpr32 = CSELWr %6, %15, 12, implicit $nzcv
93 %1:gpr32all = COPY %18
96 %2:gpr32 = PHI %8, %bb.1, %0, %bb.2
97 %3:gpr32 = PHI %8, %bb.1, %1, %bb.2
98 STRBBui %3, %5, 0 :: (store (s8))
99 STRBBui %2, %20, 0 :: (store (s8))
104 name: test_cond_is_load_with_invariant_ops2
106 tracksRegLiveness: true
108 ; CHECK-LABEL: name: test_cond_is_load_with_invariant_ops2
110 ; CHECK-NEXT: successors: %bb.1(0x80000000)
111 ; CHECK-NEXT: liveins: $x0, $x1, $w2, $x3
113 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64common = COPY $x3
114 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32common = COPY $w2
115 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr64common = COPY $x1
116 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr64common = COPY $x0
119 ; CHECK-NEXT: successors: %bb.3(0x30000000), %bb.2(0x50000000)
121 ; CHECK-NEXT: [[LDRBBui:%[0-9]+]]:gpr32 = LDRBBui [[COPY3]], 0 :: (load (s8))
122 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:gpr32all = COPY $wzr
123 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:gpr32all = COPY [[COPY4]]
124 ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gpr32all = COPY [[LDRBBui]]
125 ; CHECK-NEXT: CBZW killed [[LDRBBui]], %bb.3
126 ; CHECK-NEXT: B %bb.2
129 ; CHECK-NEXT: successors: %bb.3(0x80000000)
131 ; CHECK-NEXT: [[SUBSWri:%[0-9]+]]:gpr32 = SUBSWri [[COPY1]], 4080, 12, implicit-def $nzcv
132 ; CHECK-NEXT: [[COPY7:%[0-9]+]]:gpr32all = COPY [[SUBSWri]]
135 ; CHECK-NEXT: successors: %bb.1(0x80000000)
137 ; CHECK-NEXT: [[PHI:%[0-9]+]]:gpr32 = PHI [[COPY6]], %bb.1, [[COPY7]], %bb.2
138 ; CHECK-NEXT: STRBBui [[PHI]], [[COPY]], 0 :: (store (s8))
139 ; CHECK-NEXT: B %bb.1
141 liveins: $x0, $x1, $w2, $x3
143 %20:gpr64common = COPY $x3
144 %6:gpr32common = COPY $w2
145 %5:gpr64common = COPY $x1
146 %4:gpr64common = COPY $x0
149 successors: %bb.3(0x30000000), %bb.2(0x50000000)
151 %9:gpr32 = LDRBBui %4, 0 :: (load (s8))
152 %10:gpr32all = COPY $wzr
153 %8:gpr32all = COPY %10
154 %21:gpr32all = COPY %9
155 CBZW killed %9, %bb.3
159 %11:gpr32 = SUBSWri %6, 4080, 12, implicit-def $nzcv
160 %0:gpr32all = COPY %11
163 %2:gpr32 = PHI %21, %bb.1, %0, %bb.2
164 STRBBui %2, %20, 0 :: (store (s8))
169 name: test_cond_is_load_with_varying_ops
171 tracksRegLiveness: true
173 ; CHECK-LABEL: name: test_cond_is_load_with_varying_ops
175 ; CHECK-NEXT: successors: %bb.1(0x80000000)
176 ; CHECK-NEXT: liveins: $x0, $x1, $w2
178 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32common = COPY $w2
179 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64common = COPY $x1
180 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr64 = COPY $x0
183 ; CHECK-NEXT: successors: %bb.1(0x80000000)
185 ; CHECK-NEXT: [[PHI:%[0-9]+]]:gpr64sp = PHI [[COPY2]], %bb.0, %4, %bb.1
186 ; CHECK-NEXT: [[LDRBBui:%[0-9]+]]:gpr32common = LDRBBui [[PHI]], 0 :: (load (s8))
187 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr32all = COPY $wzr
188 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:gpr32 = COPY [[COPY3]]
189 ; CHECK-NEXT: [[SUBSWri:%[0-9]+]]:gpr32 = SUBSWri [[COPY]], 4080, 12, implicit-def $nzcv
190 ; CHECK-NEXT: [[MOVi32imm:%[0-9]+]]:gpr32 = MOVi32imm 16711680
191 ; CHECK-NEXT: [[CSELWr:%[0-9]+]]:gpr32common = CSELWr [[COPY]], killed [[MOVi32imm]], 11, implicit $nzcv
192 ; CHECK-NEXT: [[SUBSWri1:%[0-9]+]]:gpr32 = SUBSWri [[CSELWr]], 0, 0, implicit-def $nzcv
193 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:gpr32 = COPY $wzr
194 ; CHECK-NEXT: [[CSELWr1:%[0-9]+]]:gpr32 = CSELWr [[CSELWr]], [[COPY5]], 12, implicit $nzcv
195 ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gpr32 = COPY [[CSELWr1]]
196 ; CHECK-NEXT: [[SUBSWri2:%[0-9]+]]:gpr32 = SUBSWri [[COPY]], 0, 0, implicit-def $nzcv
197 ; CHECK-NEXT: [[CSELWr2:%[0-9]+]]:gpr32 = CSELWr [[COPY]], [[COPY5]], 12, implicit $nzcv
198 ; CHECK-NEXT: [[COPY7:%[0-9]+]]:gpr32 = COPY [[CSELWr2]]
199 ; CHECK-NEXT: $wzr = SUBSWri [[LDRBBui]], 0, 0, implicit-def $nzcv
200 ; CHECK-NEXT: [[CSELWr3:%[0-9]+]]:gpr32 = CSELWr [[COPY4]], [[COPY6]], 0, implicit $nzcv
201 ; CHECK-NEXT: $wzr = SUBSWri [[LDRBBui]], 0, 0, implicit-def $nzcv
202 ; CHECK-NEXT: [[CSELWr4:%[0-9]+]]:gpr32 = CSELWr [[COPY4]], [[COPY7]], 0, implicit $nzcv
203 ; CHECK-NEXT: STRBBui [[CSELWr4]], [[COPY1]], 0 :: (store (s8))
204 ; CHECK-NEXT: early-clobber %20:gpr64sp = STRBBpost [[CSELWr3]], [[PHI]], 1 :: (store (s8))
205 ; CHECK-NEXT: [[COPY8:%[0-9]+]]:gpr64all = COPY %20
206 ; CHECK-NEXT: B %bb.1
208 liveins: $x0, $x1, $w2
210 %8:gpr32common = COPY $w2
211 %7:gpr64common = COPY $x1
215 successors: %bb.3(0x30000000), %bb.2(0x50000000)
217 %0:gpr64sp = PHI %6, %bb.0, %5, %bb.3
218 %11:gpr32 = LDRBBui %0, 0 :: (load (s8))
219 %12:gpr32all = COPY $wzr
220 %10:gpr32all = COPY %12
221 CBZW killed %11, %bb.3
225 %13:gpr32 = SUBSWri %8, 4080, 12, implicit-def $nzcv
226 %14:gpr32 = MOVi32imm 16711680
227 %15:gpr32common = CSELWr %8, killed %14, 11, implicit $nzcv
228 %16:gpr32 = SUBSWri %15, 0, 0, implicit-def $nzcv
229 %17:gpr32 = COPY $wzr
230 %18:gpr32 = CSELWr %15, %17, 12, implicit $nzcv
231 %1:gpr32all = COPY %18
232 %19:gpr32 = SUBSWri %8, 0, 0, implicit-def $nzcv
233 %20:gpr32 = CSELWr %8, %17, 12, implicit $nzcv
234 %2:gpr32all = COPY %20
237 %3:gpr32 = PHI %10, %bb.1, %1, %bb.2
238 %4:gpr32 = PHI %10, %bb.1, %2, %bb.2
239 STRBBui %4, %7, 0 :: (store (s8))
240 early-clobber %21:gpr64sp = STRBBpost %3, %0, 1 :: (store (s8))
241 %5:gpr64all = COPY %21