1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple thumbv8m.base-none-eabi -run-pass=peephole-opt -verify-machineinstrs -o - %s | FileCheck %s
4 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
5 target triple = "thumbv8m.base-none-none-eabi"
7 define i32 @test_adc(i32 %a, i32 %b) { ret i32 %a }
8 define i32 @test_adc_mov(i32 %a, i32 %b) { ret i32 %a }
9 define i32 @test_sbc(i32 %a, i32 %b) { ret i32 %a }
10 define i32 @test_rsb(i32 %a) { ret i32 %a }
11 define i32 @test_and(i32 %a, i32 %b) { ret i32 %a }
12 define i32 @test_orr(i32 %a, i32 %b) { ret i32 %a }
13 define i32 @test_eor(i32 %a, i32 %b) { ret i32 %a }
14 define i32 @test_bic(i32 %a, i32 %b) { ret i32 %a }
15 define i32 @test_mvn(i32 %a) { ret i32 %a }
16 define i32 @test_asrrr(i32 %a, i32 %b) { ret i32 %a }
17 define i32 @test_asrri(i32 %a) { ret i32 %a }
18 define i32 @test_ror(i32 %a, i32 %b) { ret i32 %a }
24 - { reg: '$r0', virtual-reg: '%0' }
25 - { reg: '$r1', virtual-reg: '%1' }
27 ; CHECK-LABEL: name: test_adc
29 ; CHECK: successors: %bb.2(0x40000000), %bb.1(0x40000000)
30 ; CHECK: [[COPY:%[0-9]+]]:tgpr = COPY $r1
31 ; CHECK: [[COPY1:%[0-9]+]]:tgpr = COPY $r0
32 ; CHECK: %2:tgpr, $cpsr = tADDrr [[COPY1]], [[COPY]], 14 /* CC::al */, $noreg
33 ; CHECK: %3:tgpr, $cpsr = tADC [[COPY1]], [[COPY]], 14 /* CC::al */, $noreg, implicit $cpsr
34 ; CHECK: tBcc %bb.2, 1 /* CC::ne */, $cpsr
35 ; CHECK: tB %bb.1, 14 /* CC::al */, $noreg
37 ; CHECK: $r0 = COPY [[COPY1]]
38 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
40 ; CHECK: %4:tgpr, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
41 ; CHECK: $r0 = COPY %3
42 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
44 successors: %bb.2(0x40000000), %bb.1(0x40000000)
49 %3:tgpr, $cpsr = tADDrr %0, %1, 14, $noreg
50 %2:tgpr, dead $cpsr = tADC %0, %1, 14, $noreg, implicit $cpsr
51 tCMPi8 %2, 0, 14, $noreg, implicit-def $cpsr
57 tBX_RET 14, $noreg, implicit $r0
60 %4:tgpr, dead $cpsr = tMOVi8 0, 14, $noreg
62 tBX_RET 14, $noreg, implicit $r0
67 - { reg: '$r0', virtual-reg: '%0' }
68 - { reg: '$r1', virtual-reg: '%1' }
70 ; CHECK-LABEL: name: test_adc_mov
72 ; CHECK: successors: %bb.2(0x40000000), %bb.1(0x40000000)
73 ; CHECK: [[COPY:%[0-9]+]]:tgpr = COPY $r1
74 ; CHECK: [[COPY1:%[0-9]+]]:tgpr = COPY $r0
75 ; CHECK: %2:tgpr, $cpsr = tADDrr [[COPY1]], [[COPY]], 14 /* CC::al */, $noreg
76 ; CHECK: %3:tgpr, dead $cpsr = tADC [[COPY1]], [[COPY]], 14 /* CC::al */, $noreg, implicit $cpsr
77 ; CHECK: %4:tgpr, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
78 ; CHECK: tCMPi8 %3, 0, 14 /* CC::al */, $noreg, implicit-def $cpsr
79 ; CHECK: tBcc %bb.2, 1 /* CC::ne */, $cpsr
80 ; CHECK: tB %bb.1, 14 /* CC::al */, $noreg
82 ; CHECK: $r0 = COPY [[COPY1]]
83 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
85 ; CHECK: %5:tgpr, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
86 ; CHECK: $r0 = COPY %3
87 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
89 successors: %bb.2(0x40000000), %bb.1(0x40000000)
94 %3:tgpr, $cpsr = tADDrr %0, %1, 14, $noreg
95 %2:tgpr, dead $cpsr = tADC %0, %1, 14, $noreg, implicit $cpsr
96 %5:tgpr, dead $cpsr = tMOVi8 0, 14, $noreg
97 tCMPi8 %2, 0, 14, $noreg, implicit-def $cpsr
103 tBX_RET 14, $noreg, implicit $r0
106 %4:tgpr, dead $cpsr = tMOVi8 0, 14, $noreg
108 tBX_RET 14, $noreg, implicit $r0
113 - { reg: '$r0', virtual-reg: '%0' }
114 - { reg: '$r1', virtual-reg: '%1' }
116 ; CHECK-LABEL: name: test_sbc
118 ; CHECK: successors: %bb.2(0x40000000), %bb.1(0x40000000)
119 ; CHECK: [[COPY:%[0-9]+]]:tgpr = COPY $r1
120 ; CHECK: [[COPY1:%[0-9]+]]:tgpr = COPY $r0
121 ; CHECK: %2:tgpr, $cpsr = tADDrr [[COPY1]], [[COPY]], 14 /* CC::al */, $noreg
122 ; CHECK: %3:tgpr, $cpsr = tSBC [[COPY1]], [[COPY]], 14 /* CC::al */, $noreg, implicit $cpsr
123 ; CHECK: tBcc %bb.2, 1 /* CC::ne */, $cpsr
124 ; CHECK: tB %bb.1, 14 /* CC::al */, $noreg
126 ; CHECK: $r0 = COPY [[COPY1]]
127 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
129 ; CHECK: %4:tgpr, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
130 ; CHECK: $r0 = COPY %3
131 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
133 successors: %bb.2(0x40000000), %bb.1(0x40000000)
138 %3:tgpr, $cpsr = tADDrr %0, %1, 14, $noreg
139 %2:tgpr, dead $cpsr = tSBC %0, %1, 14, $noreg, implicit $cpsr
140 tCMPi8 %2, 0, 14, $noreg, implicit-def $cpsr
146 tBX_RET 14, $noreg, implicit $r0
149 %4:tgpr, dead $cpsr = tMOVi8 0, 14, $noreg
151 tBX_RET 14, $noreg, implicit $r0
156 - { reg: '$r0', virtual-reg: '%0' }
158 ; CHECK-LABEL: name: test_rsb
160 ; CHECK: successors: %bb.2(0x40000000), %bb.1(0x40000000)
161 ; CHECK: [[COPY:%[0-9]+]]:tgpr = COPY $r0
162 ; CHECK: %1:tgpr, $cpsr = tRSB [[COPY]], 14 /* CC::al */, $noreg
163 ; CHECK: tBcc %bb.2, 1 /* CC::ne */, $cpsr
164 ; CHECK: tB %bb.1, 14 /* CC::al */, $noreg
166 ; CHECK: $r0 = COPY [[COPY]]
167 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
169 ; CHECK: %2:tgpr, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
170 ; CHECK: $r0 = COPY %1
171 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
173 successors: %bb.2(0x40000000), %bb.1(0x40000000)
177 %1:tgpr, dead $cpsr = tRSB %0, 14, $noreg
178 tCMPi8 %1, 0, 14, $noreg, implicit-def $cpsr
184 tBX_RET 14, $noreg, implicit $r0
187 %4:tgpr, dead $cpsr = tMOVi8 0, 14, $noreg
189 tBX_RET 14, $noreg, implicit $r0
194 - { reg: '$r0', virtual-reg: '%0' }
195 - { reg: '$r1', virtual-reg: '%1' }
197 ; CHECK-LABEL: name: test_and
199 ; CHECK: successors: %bb.2(0x40000000), %bb.1(0x40000000)
200 ; CHECK: [[COPY:%[0-9]+]]:tgpr = COPY $r1
201 ; CHECK: [[COPY1:%[0-9]+]]:tgpr = COPY $r0
202 ; CHECK: %2:tgpr, $cpsr = tAND [[COPY1]], [[COPY]], 14 /* CC::al */, $noreg
203 ; CHECK: tBcc %bb.2, 1 /* CC::ne */, $cpsr
204 ; CHECK: tB %bb.1, 14 /* CC::al */, $noreg
206 ; CHECK: $r0 = COPY [[COPY1]]
207 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
209 ; CHECK: %3:tgpr, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
210 ; CHECK: $r0 = COPY %2
211 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
213 successors: %bb.2(0x40000000), %bb.1(0x40000000)
218 %2:tgpr, dead $cpsr = tAND %0, %1, 14, $noreg
219 tCMPi8 %2, 0, 14, $noreg, implicit-def $cpsr
225 tBX_RET 14, $noreg, implicit $r0
228 %4:tgpr, dead $cpsr = tMOVi8 0, 14, $noreg
230 tBX_RET 14, $noreg, implicit $r0
235 - { reg: '$r0', virtual-reg: '%0' }
236 - { reg: '$r1', virtual-reg: '%1' }
238 ; CHECK-LABEL: name: test_orr
240 ; CHECK: successors: %bb.2(0x40000000), %bb.1(0x40000000)
241 ; CHECK: [[COPY:%[0-9]+]]:tgpr = COPY $r1
242 ; CHECK: [[COPY1:%[0-9]+]]:tgpr = COPY $r0
243 ; CHECK: %2:tgpr, $cpsr = tORR [[COPY1]], [[COPY]], 14 /* CC::al */, $noreg
244 ; CHECK: tBcc %bb.2, 1 /* CC::ne */, $cpsr
245 ; CHECK: tB %bb.1, 14 /* CC::al */, $noreg
247 ; CHECK: $r0 = COPY [[COPY1]]
248 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
250 ; CHECK: %3:tgpr, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
251 ; CHECK: $r0 = COPY %2
252 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
254 successors: %bb.2(0x40000000), %bb.1(0x40000000)
259 %2:tgpr, dead $cpsr = tORR %0, %1, 14, $noreg
260 tCMPi8 %2, 0, 14, $noreg, implicit-def $cpsr
266 tBX_RET 14, $noreg, implicit $r0
269 %4:tgpr, dead $cpsr = tMOVi8 0, 14, $noreg
271 tBX_RET 14, $noreg, implicit $r0
276 - { reg: '$r0', virtual-reg: '%0' }
277 - { reg: '$r1', virtual-reg: '%1' }
279 ; CHECK-LABEL: name: test_eor
281 ; CHECK: successors: %bb.2(0x40000000), %bb.1(0x40000000)
282 ; CHECK: [[COPY:%[0-9]+]]:tgpr = COPY $r1
283 ; CHECK: [[COPY1:%[0-9]+]]:tgpr = COPY $r0
284 ; CHECK: %2:tgpr, $cpsr = tEOR [[COPY1]], [[COPY]], 14 /* CC::al */, $noreg
285 ; CHECK: tBcc %bb.2, 1 /* CC::ne */, $cpsr
286 ; CHECK: tB %bb.1, 14 /* CC::al */, $noreg
288 ; CHECK: $r0 = COPY [[COPY1]]
289 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
291 ; CHECK: %3:tgpr, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
292 ; CHECK: $r0 = COPY %2
293 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
295 successors: %bb.2(0x40000000), %bb.1(0x40000000)
300 %2:tgpr, dead $cpsr = tEOR %0, %1, 14, $noreg
301 tCMPi8 %2, 0, 14, $noreg, implicit-def $cpsr
307 tBX_RET 14, $noreg, implicit $r0
310 %4:tgpr, dead $cpsr = tMOVi8 0, 14, $noreg
312 tBX_RET 14, $noreg, implicit $r0
317 - { reg: '$r0', virtual-reg: '%0' }
318 - { reg: '$r1', virtual-reg: '%1' }
320 ; CHECK-LABEL: name: test_bic
322 ; CHECK: successors: %bb.2(0x40000000), %bb.1(0x40000000)
323 ; CHECK: [[COPY:%[0-9]+]]:tgpr = COPY $r1
324 ; CHECK: [[COPY1:%[0-9]+]]:tgpr = COPY $r0
325 ; CHECK: %2:tgpr, $cpsr = tBIC [[COPY1]], [[COPY]], 14 /* CC::al */, $noreg
326 ; CHECK: tBcc %bb.2, 1 /* CC::ne */, $cpsr
327 ; CHECK: tB %bb.1, 14 /* CC::al */, $noreg
329 ; CHECK: $r0 = COPY [[COPY1]]
330 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
332 ; CHECK: %3:tgpr, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
333 ; CHECK: $r0 = COPY %2
334 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
336 successors: %bb.2(0x40000000), %bb.1(0x40000000)
341 %2:tgpr, dead $cpsr = tBIC %0, %1, 14, $noreg
342 tCMPi8 %2, 0, 14, $noreg, implicit-def $cpsr
348 tBX_RET 14, $noreg, implicit $r0
351 %4:tgpr, dead $cpsr = tMOVi8 0, 14, $noreg
353 tBX_RET 14, $noreg, implicit $r0
358 - { reg: '$r0', virtual-reg: '%0' }
360 ; CHECK-LABEL: name: test_mvn
362 ; CHECK: successors: %bb.2(0x40000000), %bb.1(0x40000000)
363 ; CHECK: [[COPY:%[0-9]+]]:tgpr = COPY $r0
364 ; CHECK: %1:tgpr, $cpsr = tMVN [[COPY]], 14 /* CC::al */, $noreg
365 ; CHECK: tBcc %bb.2, 1 /* CC::ne */, $cpsr
366 ; CHECK: tB %bb.1, 14 /* CC::al */, $noreg
368 ; CHECK: $r0 = COPY [[COPY]]
369 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
371 ; CHECK: %2:tgpr, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
372 ; CHECK: $r0 = COPY %1
373 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
375 successors: %bb.2(0x40000000), %bb.1(0x40000000)
379 %1:tgpr, dead $cpsr = tMVN %0, 14, $noreg
380 tCMPi8 %1, 0, 14, $noreg, implicit-def $cpsr
386 tBX_RET 14, $noreg, implicit $r0
389 %4:tgpr, dead $cpsr = tMOVi8 0, 14, $noreg
391 tBX_RET 14, $noreg, implicit $r0
396 - { reg: '$r0', virtual-reg: '%0' }
397 - { reg: '$r1', virtual-reg: '%1' }
399 ; CHECK-LABEL: name: test_asrrr
401 ; CHECK: successors: %bb.2(0x40000000), %bb.1(0x40000000)
402 ; CHECK: [[COPY:%[0-9]+]]:tgpr = COPY $r1
403 ; CHECK: [[COPY1:%[0-9]+]]:tgpr = COPY $r0
404 ; CHECK: %2:tgpr, $cpsr = tASRrr [[COPY1]], [[COPY]], 14 /* CC::al */, $noreg
405 ; CHECK: tBcc %bb.2, 1 /* CC::ne */, $cpsr
406 ; CHECK: tB %bb.1, 14 /* CC::al */, $noreg
408 ; CHECK: $r0 = COPY [[COPY1]]
409 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
411 ; CHECK: %3:tgpr, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
412 ; CHECK: $r0 = COPY %2
413 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
415 successors: %bb.2(0x40000000), %bb.1(0x40000000)
420 %2:tgpr, dead $cpsr = tASRrr %0, %1, 14, $noreg
421 tCMPi8 %2, 0, 14, $noreg, implicit-def $cpsr
427 tBX_RET 14, $noreg, implicit $r0
430 %4:tgpr, dead $cpsr = tMOVi8 0, 14, $noreg
432 tBX_RET 14, $noreg, implicit $r0
437 - { reg: '$r0', virtual-reg: '%0' }
439 ; CHECK-LABEL: name: test_asrri
441 ; CHECK: successors: %bb.2(0x40000000), %bb.1(0x40000000)
442 ; CHECK: [[COPY:%[0-9]+]]:tgpr = COPY $r0
443 ; CHECK: %1:tgpr, $cpsr = tASRri [[COPY]], 1, 14 /* CC::al */, $noreg
444 ; CHECK: tBcc %bb.2, 1 /* CC::ne */, $cpsr
445 ; CHECK: tB %bb.1, 14 /* CC::al */, $noreg
447 ; CHECK: $r0 = COPY [[COPY]]
448 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
450 ; CHECK: %2:tgpr, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
451 ; CHECK: $r0 = COPY %1
452 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
454 successors: %bb.2(0x40000000), %bb.1(0x40000000)
458 %2:tgpr, dead $cpsr = tASRri %0, 1, 14, $noreg
459 tCMPi8 %2, 0, 14, $noreg, implicit-def $cpsr
465 tBX_RET 14, $noreg, implicit $r0
468 %4:tgpr, dead $cpsr = tMOVi8 0, 14, $noreg
470 tBX_RET 14, $noreg, implicit $r0
475 - { reg: '$r0', virtual-reg: '%0' }
476 - { reg: '$r1', virtual-reg: '%1' }
478 ; CHECK-LABEL: name: test_ror
480 ; CHECK: successors: %bb.2(0x40000000), %bb.1(0x40000000)
481 ; CHECK: [[COPY:%[0-9]+]]:tgpr = COPY $r1
482 ; CHECK: [[COPY1:%[0-9]+]]:tgpr = COPY $r0
483 ; CHECK: %2:tgpr, $cpsr = tROR [[COPY1]], [[COPY]], 14 /* CC::al */, $noreg
484 ; CHECK: tBcc %bb.2, 1 /* CC::ne */, $cpsr
485 ; CHECK: tB %bb.1, 14 /* CC::al */, $noreg
487 ; CHECK: $r0 = COPY [[COPY1]]
488 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
490 ; CHECK: %3:tgpr, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
491 ; CHECK: $r0 = COPY %2
492 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $r0
494 successors: %bb.2(0x40000000), %bb.1(0x40000000)
499 %2:tgpr, dead $cpsr = tROR %0, %1, 14, $noreg
500 tCMPi8 %2, 0, 14, $noreg, implicit-def $cpsr
506 tBX_RET 14, $noreg, implicit $r0
509 %4:tgpr, dead $cpsr = tMOVi8 0, 14, $noreg
511 tBX_RET 14, $noreg, implicit $r0