1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64 -run-pass=peephole-opt -verify-machineinstrs %s -o - | FileCheck %s
4 name: remove_subswr_after_csincwr
5 tracksRegLiveness: true
7 ; CHECK-LABEL: name: remove_subswr_after_csincwr
9 ; CHECK: successors: %bb.1(0x40000000), %bb.2(0x40000000)
11 ; CHECK: [[COPY:%[0-9]+]]:gpr64common = COPY $x1
12 ; CHECK: [[DEF:%[0-9]+]]:gpr64 = IMPLICIT_DEF
13 ; CHECK: [[SUBSXrr:%[0-9]+]]:gpr64 = SUBSXrr killed [[DEF]], [[COPY]], implicit-def $nzcv
14 ; CHECK: [[CSINCWr:%[0-9]+]]:gpr32common = CSINCWr $wzr, $wzr, 1, implicit $nzcv
15 ; CHECK: Bcc 1, %bb.2, implicit $nzcv
18 ; CHECK: successors: %bb.2(0x80000000)
24 successors: %bb.1(0x40000000), %bb.2(0x40000000)
25 %1:gpr64common = COPY $x1
26 %2:gpr64 = IMPLICIT_DEF
27 %3:gpr64 = SUBSXrr killed %2:gpr64, %1:gpr64common, implicit-def $nzcv
28 %4:gpr32common = CSINCWr $wzr, $wzr, 1, implicit $nzcv
29 %5:gpr32 = SUBSWri killed %4:gpr32common, 1, 0, implicit-def $nzcv
30 Bcc 1, %bb.2, implicit $nzcv
34 successors: %bb.2(0x80000000)
42 name: remove_subsxr_after_csincxr_invertcc
43 tracksRegLiveness: true
45 ; CHECK-LABEL: name: remove_subsxr_after_csincxr_invertcc
47 ; CHECK: successors: %bb.1(0x40000000), %bb.2(0x40000000)
49 ; CHECK: [[COPY:%[0-9]+]]:gpr64common = COPY $x1
50 ; CHECK: [[DEF:%[0-9]+]]:gpr64 = IMPLICIT_DEF
51 ; CHECK: [[SUBSXrr:%[0-9]+]]:gpr64 = SUBSXrr killed [[DEF]], [[COPY]], implicit-def $nzcv
52 ; CHECK: [[CSINCXr:%[0-9]+]]:gpr64common = CSINCXr $xzr, $xzr, 1, implicit $nzcv
53 ; CHECK: Bcc 1, %bb.2, implicit $nzcv
56 ; CHECK: successors: %bb.2(0x80000000)
62 successors: %bb.1(0x40000000), %bb.2(0x40000000)
63 %1:gpr64common = COPY $x1
64 %2:gpr64 = IMPLICIT_DEF
65 %3:gpr64 = SUBSXrr killed %2:gpr64, %1:gpr64common, implicit-def $nzcv
66 %4:gpr64common = CSINCXr $xzr, $xzr, 1, implicit $nzcv
67 %5:gpr64 = SUBSXri killed %4:gpr64common, 0, 0, implicit-def $nzcv
68 Bcc 0, %bb.2, implicit $nzcv
72 successors: %bb.2(0x80000000)
80 name: cflags_alive_in_succs
81 tracksRegLiveness: true
83 ; CHECK-LABEL: name: cflags_alive_in_succs
85 ; CHECK: successors: %bb.1(0x40000000), %bb.2(0x40000000)
86 ; CHECK: liveins: $nzcv
87 ; CHECK: [[CSINCXr:%[0-9]+]]:gpr64common = CSINCXr $xzr, $xzr, 1, implicit $nzcv
88 ; CHECK: [[ADDSXri:%[0-9]+]]:gpr64 = ADDSXri killed [[CSINCXr]], 0, 0, implicit-def $nzcv
89 ; CHECK: Bcc 0, %bb.2, implicit $nzcv
92 ; CHECK: successors: %bb.2(0x80000000)
93 ; CHECK: liveins: $nzcv
99 successors: %bb.1(0x40000000), %bb.2(0x40000000)
100 %1:gpr64common = CSINCXr $xzr, $xzr, 1, implicit $nzcv
101 %2:gpr64 = ADDSXri killed %1:gpr64common, 0, 0, implicit-def $nzcv
102 Bcc 0, %bb.2, implicit $nzcv
107 successors: %bb.2(0x80000000)
115 name: nz_used_after_cmp
116 tracksRegLiveness: true
118 ; CHECK-LABEL: name: nz_used_after_cmp
120 ; CHECK: successors: %bb.1(0x40000000), %bb.2(0x40000000)
121 ; CHECK: liveins: $nzcv
122 ; CHECK: [[CSINCXr:%[0-9]+]]:gpr64common = CSINCXr $xzr, $xzr, 1, implicit $nzcv
123 ; CHECK: [[ADDSXri:%[0-9]+]]:gpr64 = ADDSXri killed [[CSINCXr]], 0, 0, implicit-def $nzcv
124 ; CHECK: Bcc 4, %bb.2, implicit $nzcv
127 ; CHECK: successors: %bb.2(0x80000000)
130 ; CHECK: RET_ReallyLR
133 successors: %bb.1(0x40000000), %bb.2(0x40000000)
134 %1:gpr64common = CSINCXr $xzr, $xzr, 1, implicit $nzcv
135 %2:gpr64 = ADDSXri killed %1:gpr64common, 0, 0, implicit-def $nzcv
136 Bcc 4, %bb.2, implicit $nzcv
140 successors: %bb.2(0x80000000)
148 name: remove_addswr_after_csincwr_invertcc
149 tracksRegLiveness: true
151 ; CHECK-LABEL: name: remove_addswr_after_csincwr_invertcc
153 ; CHECK: successors: %bb.1(0x40000000), %bb.2(0x40000000)
154 ; CHECK: liveins: $nzcv
155 ; CHECK: [[CSINCWr:%[0-9]+]]:gpr32common = CSINCWr $wzr, $wzr, 1, implicit $nzcv
156 ; CHECK: Bcc 0, %bb.2, implicit $nzcv
159 ; CHECK: successors: %bb.2(0x80000000)
162 ; CHECK: RET_ReallyLR
165 successors: %bb.1(0x40000000), %bb.2(0x40000000)
166 %1:gpr32common = CSINCWr $wzr, $wzr, 1, implicit $nzcv
167 %2:gpr32 = ADDSWri killed %1:gpr32common, 0, 0, implicit-def $nzcv
168 Bcc 1, %bb.2, implicit $nzcv
172 successors: %bb.2(0x80000000)
180 name: cv_used_after_cmp
181 tracksRegLiveness: true
183 ; CHECK-LABEL: name: cv_used_after_cmp
185 ; CHECK: successors: %bb.1(0x40000000), %bb.2(0x40000000)
186 ; CHECK: liveins: $nzcv
187 ; CHECK: [[CSINCWr:%[0-9]+]]:gpr32common = CSINCWr $wzr, $wzr, 1, implicit $nzcv
188 ; CHECK: [[SUBSWri:%[0-9]+]]:gpr32 = SUBSWri killed [[CSINCWr]], 0, 0, implicit-def $nzcv
189 ; CHECK: Bcc 2, %bb.2, implicit $nzcv
192 ; CHECK: successors: %bb.2(0x80000000)
195 ; CHECK: RET_ReallyLR
198 successors: %bb.1(0x40000000), %bb.2(0x40000000)
199 %1:gpr32common = CSINCWr $wzr, $wzr, 1, implicit $nzcv
200 %2:gpr32 = SUBSWri killed %1:gpr32common, 0, 0, implicit-def $nzcv
201 Bcc 2, %bb.2, implicit $nzcv
205 successors: %bb.2(0x80000000)
214 tracksRegLiveness: true
216 ; CHECK-LABEL: name: csinc_add0
218 ; CHECK: successors: %bb.1(0x40000000), %bb.2(0x40000000)
219 ; CHECK: liveins: $nzcv
220 ; CHECK: [[CSINCWr:%[0-9]+]]:gpr32common = CSINCWr $wzr, $wzr, 4, implicit $nzcv
221 ; CHECK: [[ADDSWri:%[0-9]+]]:gpr32 = ADDSWri killed [[CSINCWr]], 0, 0, implicit-def $nzcv
222 ; CHECK: Bcc 1, %bb.2, implicit $nzcv
225 ; CHECK: successors: %bb.2(0x80000000)
228 ; CHECK: RET_ReallyLR
231 successors: %bb.1(0x40000000), %bb.2(0x40000000)
232 %1:gpr32common = CSINCWr $wzr, $wzr, 4, implicit $nzcv
233 %2:gpr32 = ADDSWri killed %1:gpr32common, 0, 0, implicit-def $nzcv
234 Bcc 1, %bb.2, implicit $nzcv
238 successors: %bb.2(0x80000000)
246 name: remove_subs1_after_csincN_invertcc
247 tracksRegLiveness: true
249 ; CHECK-LABEL: name: remove_subs1_after_csincN_invertcc
251 ; CHECK: successors: %bb.1(0x40000000), %bb.2(0x40000000)
252 ; CHECK: liveins: $nzcv
253 ; CHECK: [[CSINCWr:%[0-9]+]]:gpr32common = CSINCWr $wzr, $wzr, 5, implicit $nzcv
254 ; CHECK: Bcc 5, %bb.2, implicit $nzcv
257 ; CHECK: successors: %bb.2(0x80000000)
260 ; CHECK: RET_ReallyLR
263 successors: %bb.1(0x40000000), %bb.2(0x40000000)
264 %1:gpr32common = CSINCWr $wzr, $wzr, 5, implicit $nzcv
265 %2:gpr32 = SUBSWri killed %1:gpr32common, 1, 0, implicit-def $nzcv
266 Bcc 4, %bb.2, implicit $nzcv
270 successors: %bb.2(0x80000000)
279 tracksRegLiveness: true
281 ; CHECK-LABEL: name: csinc_wrong_cc
283 ; CHECK: successors: %bb.1(0x40000000), %bb.2(0x40000000)
284 ; CHECK: liveins: $nzcv
285 ; CHECK: [[CSINCXr:%[0-9]+]]:gpr64common = CSINCXr $xzr, $xzr, 2, implicit $nzcv
286 ; CHECK: [[SUBSXri:%[0-9]+]]:gpr64 = SUBSXri killed [[CSINCXr]], 1, 0, implicit-def $nzcv
287 ; CHECK: Bcc 0, %bb.2, implicit $nzcv
290 ; CHECK: successors: %bb.2(0x80000000)
293 ; CHECK: RET_ReallyLR
296 successors: %bb.1(0x40000000), %bb.2(0x40000000)
297 %1:gpr64common = CSINCXr $xzr, $xzr, 2, implicit $nzcv
298 %2:gpr64 = SUBSXri killed %1:gpr64common, 1, 0, implicit-def $nzcv
299 Bcc 0, %bb.2, implicit $nzcv
303 successors: %bb.2(0x80000000)
311 name: subswr_wrong_cmp_value
312 tracksRegLiveness: true
314 ; CHECK-LABEL: name: subswr_wrong_cmp_value
316 ; CHECK: successors: %bb.1(0x40000000), %bb.2(0x40000000)
317 ; CHECK: liveins: $x1
318 ; CHECK: [[COPY:%[0-9]+]]:gpr64common = COPY $x1
319 ; CHECK: [[DEF:%[0-9]+]]:gpr64 = IMPLICIT_DEF
320 ; CHECK: [[SUBSXrr:%[0-9]+]]:gpr64 = SUBSXrr killed [[DEF]], [[COPY]], implicit-def $nzcv
321 ; CHECK: [[CSINCWr:%[0-9]+]]:gpr32common = CSINCWr $wzr, $wzr, 1, implicit $nzcv
322 ; CHECK: [[SUBSWri:%[0-9]+]]:gpr32 = SUBSWri killed [[CSINCWr]], 3, 0, implicit-def $nzcv
323 ; CHECK: Bcc 1, %bb.2, implicit $nzcv
326 ; CHECK: successors: %bb.2(0x80000000)
329 ; CHECK: RET_ReallyLR
332 successors: %bb.1(0x40000000), %bb.2(0x40000000)
333 %1:gpr64common = COPY $x1
334 %2:gpr64 = IMPLICIT_DEF
335 %3:gpr64 = SUBSXrr killed %2:gpr64, %1:gpr64common, implicit-def $nzcv
336 %4:gpr32common = CSINCWr $wzr, $wzr, 1, implicit $nzcv
337 %5:gpr32 = SUBSWri killed %4:gpr32common, 3, 0, implicit-def $nzcv
338 Bcc 1, %bb.2, implicit $nzcv
342 successors: %bb.2(0x80000000)