1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple aarch64 -run-pass=aarch64-post-select-optimize -verify-machineinstrs %s -o - | FileCheck %s
4 name: test_fcmp_dead_cc
9 tracksRegLiveness: true
15 liveins: $w1, $x0, $s0, $s1
17 ; CHECK-LABEL: name: test_fcmp_dead_cc
18 ; CHECK: liveins: $w1, $x0, $s0, $s1
20 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
21 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
22 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:fpr32 = COPY $s0
23 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:fpr32 = COPY $s1
24 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:gpr32 = COPY $wzr
25 ; CHECK-NEXT: FCMPSrr [[COPY2]], [[COPY3]], implicit-def dead $nzcv, implicit $fpcr
26 ; CHECK-NEXT: [[SUBWrr:%[0-9]+]]:gpr32 = SUBWrr [[COPY1]], [[COPY4]]
27 ; CHECK-NEXT: FCMPSrr [[COPY2]], [[COPY3]], implicit-def $nzcv, implicit $fpcr
28 ; CHECK-NEXT: [[UBFMWri:%[0-9]+]]:gpr32common = UBFMWri [[SUBWrr]], 1, 31
29 ; CHECK-NEXT: [[MOVi32imm:%[0-9]+]]:gpr32 = MOVi32imm 1
30 ; CHECK-NEXT: [[CSELWr:%[0-9]+]]:gpr32 = CSELWr [[UBFMWri]], [[MOVi32imm]], 8, implicit $nzcv
31 ; CHECK-NEXT: $w0 = COPY [[CSELWr]]
32 ; CHECK-NEXT: RET_ReallyLR implicit $w0
38 FCMPSrr %3, %4, implicit-def $nzcv, implicit $fpcr
39 %12:gpr32 = SUBSWrr %2, %26, implicit-def $nzcv
40 FCMPSrr %3, %4, implicit-def $nzcv, implicit $fpcr
41 %14:gpr32common = UBFMWri %12, 1, 31
42 %60:gpr32 = MOVi32imm 1
43 %16:gpr32 = CSELWr %14, %60, 8, implicit $nzcv
45 RET_ReallyLR implicit $w0
49 name: test_fcmp_64_dead_cc
54 tracksRegLiveness: true
60 liveins: $w1, $x0, $d0, $d1
62 ; CHECK-LABEL: name: test_fcmp_64_dead_cc
63 ; CHECK: liveins: $w1, $x0, $d0, $d1
65 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
66 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
67 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:fpr64 = COPY $d0
68 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:fpr64 = COPY $d1
69 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:gpr32 = COPY $wzr
70 ; CHECK-NEXT: FCMPDrr [[COPY2]], [[COPY3]], implicit-def dead $nzcv, implicit $fpcr
71 ; CHECK-NEXT: [[SUBWrr:%[0-9]+]]:gpr32 = SUBWrr [[COPY1]], [[COPY4]]
72 ; CHECK-NEXT: FCMPDrr [[COPY2]], [[COPY3]], implicit-def $nzcv, implicit $fpcr
73 ; CHECK-NEXT: [[UBFMWri:%[0-9]+]]:gpr32common = UBFMWri [[SUBWrr]], 1, 31
74 ; CHECK-NEXT: [[MOVi32imm:%[0-9]+]]:gpr32 = MOVi32imm 1
75 ; CHECK-NEXT: [[CSELWr:%[0-9]+]]:gpr32 = CSELWr [[UBFMWri]], [[MOVi32imm]], 8, implicit $nzcv
76 ; CHECK-NEXT: $w0 = COPY [[CSELWr]]
77 ; CHECK-NEXT: RET_ReallyLR implicit $w0
83 FCMPDrr %3, %4, implicit-def $nzcv, implicit $fpcr
84 %12:gpr32 = SUBSWrr %2, %26, implicit-def $nzcv
85 FCMPDrr %3, %4, implicit-def $nzcv, implicit $fpcr
86 %14:gpr32common = UBFMWri %12, 1, 31
87 %60:gpr32 = MOVi32imm 1
88 %16:gpr32 = CSELWr %14, %60, 8, implicit $nzcv
90 RET_ReallyLR implicit $w0
94 name: test_fcmp_dead_cc_3_fcmps
99 tracksRegLiveness: true
105 liveins: $w1, $x0, $s0, $s1
107 ; CHECK-LABEL: name: test_fcmp_dead_cc_3_fcmps
108 ; CHECK: liveins: $w1, $x0, $s0, $s1
110 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
111 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
112 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:fpr32 = COPY $s0
113 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:fpr32 = COPY $s1
114 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:gpr32 = COPY $wzr
115 ; CHECK-NEXT: FCMPSrr [[COPY2]], [[COPY3]], implicit-def dead $nzcv, implicit $fpcr
116 ; CHECK-NEXT: [[SUBWrr:%[0-9]+]]:gpr32 = SUBWrr [[COPY1]], [[COPY4]]
117 ; CHECK-NEXT: FCMPSrr [[COPY2]], [[COPY3]], implicit-def dead $nzcv, implicit $fpcr
118 ; CHECK-NEXT: [[SUBWrr1:%[0-9]+]]:gpr32 = SUBWrr [[COPY1]], [[COPY4]]
119 ; CHECK-NEXT: FCMPSrr [[COPY2]], [[COPY3]], implicit-def $nzcv, implicit $fpcr
120 ; CHECK-NEXT: [[UBFMWri:%[0-9]+]]:gpr32common = UBFMWri [[SUBWrr1]], 1, 31
121 ; CHECK-NEXT: [[MOVi32imm:%[0-9]+]]:gpr32 = MOVi32imm 1
122 ; CHECK-NEXT: [[CSELWr:%[0-9]+]]:gpr32 = CSELWr [[UBFMWri]], [[MOVi32imm]], 8, implicit $nzcv
123 ; CHECK-NEXT: $w0 = COPY [[CSELWr]]
124 ; CHECK-NEXT: RET_ReallyLR implicit $w0
129 %26:gpr32 = COPY $wzr
130 FCMPSrr %3, %4, implicit-def $nzcv, implicit $fpcr
131 %12:gpr32 = SUBSWrr %2, %26, implicit-def $nzcv
132 FCMPSrr %3, %4, implicit-def $nzcv, implicit $fpcr
133 %12:gpr32 = SUBSWrr %2, %26, implicit-def $nzcv
134 FCMPSrr %3, %4, implicit-def $nzcv, implicit $fpcr
135 %14:gpr32common = UBFMWri %12, 1, 31
136 %60:gpr32 = MOVi32imm 1
137 %16:gpr32 = CSELWr %14, %60, 8, implicit $nzcv
139 RET_ReallyLR implicit $w0
143 name: test_impdef_subsx
146 regBankSelected: true
148 tracksRegLiveness: true
152 ; CHECK-LABEL: name: test_impdef_subsx
153 ; CHECK: liveins: $x0, $x1
155 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
156 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x1
157 ; CHECK-NEXT: [[SUBXrr:%[0-9]+]]:gpr64 = SUBXrr [[COPY]], [[COPY1]]
158 ; CHECK-NEXT: $x0 = COPY [[SUBXrr]]
159 ; CHECK-NEXT: RET_ReallyLR implicit $x0
162 %4:gpr64 = SUBSXrr %1, %2, implicit-def $nzcv
164 RET_ReallyLR implicit $x0
167 name: test_impdef_subsw
170 regBankSelected: true
172 tracksRegLiveness: true
176 ; CHECK-LABEL: name: test_impdef_subsw
177 ; CHECK: liveins: $w0, $w1
179 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $x0
180 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $x1
181 ; CHECK-NEXT: [[SUBWrr:%[0-9]+]]:gpr32 = SUBWrr [[COPY]], [[COPY1]]
182 ; CHECK-NEXT: $w0 = COPY [[SUBWrr]]
183 ; CHECK-NEXT: RET_ReallyLR implicit $w0
186 %4:gpr32 = SUBSWrr %1, %2, implicit-def $nzcv
188 RET_ReallyLR implicit $w0
191 name: test_impdef_addsx
194 regBankSelected: true
196 tracksRegLiveness: true
200 ; CHECK-LABEL: name: test_impdef_addsx
201 ; CHECK: liveins: $x0, $x1
203 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
204 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x1
205 ; CHECK-NEXT: [[ADDXrr:%[0-9]+]]:gpr64 = ADDXrr [[COPY]], [[COPY1]]
206 ; CHECK-NEXT: $x0 = COPY [[ADDXrr]]
207 ; CHECK-NEXT: RET_ReallyLR implicit $x0
210 %4:gpr64 = ADDSXrr %1, %2, implicit-def $nzcv
212 RET_ReallyLR implicit $x0
215 name: test_impdef_addsw
218 regBankSelected: true
220 tracksRegLiveness: true
224 ; CHECK-LABEL: name: test_impdef_addsw
225 ; CHECK: liveins: $w0, $w1
227 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $x0
228 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $x1
229 ; CHECK-NEXT: [[ADDWrr:%[0-9]+]]:gpr32 = ADDWrr [[COPY]], [[COPY1]]
230 ; CHECK-NEXT: $w0 = COPY [[ADDWrr]]
231 ; CHECK-NEXT: RET_ReallyLR implicit $w0
234 %4:gpr32 = ADDSWrr %1, %2, implicit-def $nzcv
236 RET_ReallyLR implicit $w0
239 name: test_impdef_adcsx
242 regBankSelected: true
244 tracksRegLiveness: true
247 liveins: $x0, $x1, $x2, $x3
248 ; CHECK-LABEL: name: test_impdef_adcsx
249 ; CHECK: liveins: $x0, $x1, $x2, $x3
251 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
252 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x1
253 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr64 = COPY $x2
254 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr64 = COPY $x3
255 ; CHECK-NEXT: [[ADDSXrr:%[0-9]+]]:gpr64 = ADDSXrr [[COPY]], [[COPY2]], implicit-def $nzcv
256 ; CHECK-NEXT: [[ADCXr:%[0-9]+]]:gpr64 = ADCXr [[COPY1]], [[COPY3]], implicit $nzcv
257 ; CHECK-NEXT: $x0 = COPY [[ADDSXrr]]
258 ; CHECK-NEXT: $x1 = COPY [[ADCXr]]
259 ; CHECK-NEXT: RET_ReallyLR implicit $x0, implicit $x1
264 %5:gpr64 = ADDSXrr %1, %3, implicit-def $nzcv
265 %6:gpr64 = ADCSXr %2, %4, implicit-def $nzcv, implicit $nzcv
268 RET_ReallyLR implicit $x0, implicit $x1
271 name: test_impdef_adcsw
274 regBankSelected: true
276 tracksRegLiveness: true
279 liveins: $w0, $w1, $w2, $w3
280 ; CHECK-LABEL: name: test_impdef_adcsw
281 ; CHECK: liveins: $w0, $w1, $w2, $w3
283 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $w0
284 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
285 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $w2
286 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr32 = COPY $w3
287 ; CHECK-NEXT: [[ADDSWrr:%[0-9]+]]:gpr32 = ADDSWrr [[COPY]], [[COPY2]], implicit-def $nzcv
288 ; CHECK-NEXT: [[ADCWr:%[0-9]+]]:gpr32 = ADCWr [[COPY1]], [[COPY3]], implicit $nzcv
289 ; CHECK-NEXT: $w0 = COPY [[ADDSWrr]]
290 ; CHECK-NEXT: $w1 = COPY [[ADCWr]]
291 ; CHECK-NEXT: RET_ReallyLR implicit $w0, implicit $w1
296 %5:gpr32 = ADDSWrr %1, %3, implicit-def $nzcv
297 %6:gpr32 = ADCSWr %2, %4, implicit-def $nzcv, implicit $nzcv
300 RET_ReallyLR implicit $w0, implicit $w1
303 name: test_impdef_sbcsx
306 regBankSelected: true
308 tracksRegLiveness: true
311 liveins: $x0, $x1, $x2, $x3
312 ; CHECK-LABEL: name: test_impdef_sbcsx
313 ; CHECK: liveins: $x0, $x1, $x2, $x3
315 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
316 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x1
317 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr64 = COPY $x2
318 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr64 = COPY $x3
319 ; CHECK-NEXT: [[SUBSXrr:%[0-9]+]]:gpr64 = SUBSXrr [[COPY]], [[COPY2]], implicit-def $nzcv
320 ; CHECK-NEXT: [[SBCXr:%[0-9]+]]:gpr64 = SBCXr [[COPY1]], [[COPY3]], implicit $nzcv
321 ; CHECK-NEXT: $x0 = COPY [[SUBSXrr]]
322 ; CHECK-NEXT: $x1 = COPY [[SBCXr]]
323 ; CHECK-NEXT: RET_ReallyLR implicit $x0, implicit $x1
328 %5:gpr64 = SUBSXrr %1, %3, implicit-def $nzcv
329 %6:gpr64 = SBCSXr %2, %4, implicit-def $nzcv, implicit $nzcv
332 RET_ReallyLR implicit $x0, implicit $x1
335 name: test_impdef_sbcsw
338 regBankSelected: true
340 tracksRegLiveness: true
343 liveins: $w0, $w1, $w2, $w3
344 ; CHECK-LABEL: name: test_impdef_sbcsw
345 ; CHECK: liveins: $w0, $w1, $w2, $w3
347 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $w0
348 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
349 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $w2
350 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr32 = COPY $w3
351 ; CHECK-NEXT: [[SUBSWrr:%[0-9]+]]:gpr32 = SUBSWrr [[COPY]], [[COPY2]], implicit-def $nzcv
352 ; CHECK-NEXT: [[SBCWr:%[0-9]+]]:gpr32 = SBCWr [[COPY1]], [[COPY3]], implicit $nzcv
353 ; CHECK-NEXT: $w0 = COPY [[SUBSWrr]]
354 ; CHECK-NEXT: $w1 = COPY [[SBCWr]]
355 ; CHECK-NEXT: RET_ReallyLR implicit $w0, implicit $w1
360 %5:gpr32 = SUBSWrr %1, %3, implicit-def $nzcv
361 %6:gpr32 = SBCSWr %2, %4, implicit-def $nzcv, implicit $nzcv
364 RET_ReallyLR implicit $w0, implicit $w1