|
| 1 | +# RUN: llc -run-pass=peephole-opt %s -o - -verify-machineinstrs | FileCheck %s |
| 2 | + |
| 3 | +# The and -> ands transform is sensitive to scheduling; make sure we don't |
| 4 | +# transform cases which aren't legal. |
| 5 | + |
| 6 | +# CHECK-LABEL: name: foo_transform |
| 7 | +# CHECK: %2:gpr = ANDri %0, 1, 14, $noreg, def $cpsr |
| 8 | +# CHECK-NEXT: %3:gpr = MOVCCi16 %1, 5, 0, $cpsr |
| 9 | + |
| 10 | +# CHECK-LABEL: name: foo_notransform |
| 11 | +# CHECK: TSTri %0, 1, 14, $noreg, implicit-def $cpsr |
| 12 | +# CHECK-NEXT: %2:gpr = MOVCCi16 %1, 5, 0, $cpsr |
| 13 | + |
| 14 | +--- | |
| 15 | + target triple = "armv7-unknown-unknown" |
| 16 | + define i32 @foo_transform(i32 %in) { |
| 17 | + ret i32 undef |
| 18 | + } |
| 19 | + define i32 @foo_notransform(i32 %in) { |
| 20 | + ret i32 undef |
| 21 | + } |
| 22 | + |
| 23 | +... |
| 24 | +--- |
| 25 | +name: foo_transform |
| 26 | +tracksRegLiveness: true |
| 27 | +body: | |
| 28 | + bb.0 (%ir-block.0): |
| 29 | + liveins: $r0 |
| 30 | +
|
| 31 | + %1:gpr = COPY $r0 |
| 32 | + %2:gpr = MOVi 4, 14, $noreg, $noreg |
| 33 | + %4:gpr = ANDri %1:gpr, 1, 14, $noreg, $noreg |
| 34 | + TSTri %1:gpr, 1, 14, $noreg, implicit-def $cpsr |
| 35 | + %3:gpr = MOVCCi16 %2, 5, 0, $cpsr |
| 36 | + $r0 = COPY killed %3 |
| 37 | + $r1 = COPY killed %4 |
| 38 | + BX_RET 14, $noreg, implicit $r0, implicit $r1 |
| 39 | +... |
| 40 | +name: foo_notransform |
| 41 | +tracksRegLiveness: true |
| 42 | +body: | |
| 43 | + bb.0 (%ir-block.0): |
| 44 | + liveins: $r0 |
| 45 | +
|
| 46 | + %1:gpr = COPY $r0 |
| 47 | + %2:gpr = MOVi 4, 14, $noreg, $noreg |
| 48 | + TSTri %1:gpr, 1, 14, $noreg, implicit-def $cpsr |
| 49 | + %3:gpr = MOVCCi16 %2, 5, 0, $cpsr |
| 50 | + %4:gpr = ANDri %1:gpr, 1, 14, $noreg, $noreg |
| 51 | + $r0 = COPY killed %3 |
| 52 | + $r1 = COPY killed %4 |
| 53 | + BX_RET 14, $noreg, implicit $r0, implicit $r1 |
| 54 | +
|
0 commit comments