1 # RUN: llc -run-pass=peephole-opt %s -o - -verify-machineinstrs | FileCheck %s
3 # The and -> ands transform is sensitive to scheduling; make sure we don't
4 # transform cases which aren't legal.
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
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
15 target triple = "armv7-unknown-unknown"
16 define i32 @foo_transform(i32 %in) {
19 define i32 @foo_notransform(i32 %in) {
26 tracksRegLiveness: true
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
38 BX_RET 14, $noreg, implicit $r0, implicit $r1
41 tracksRegLiveness: true
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
53 BX_RET 14, $noreg, implicit $r0, implicit $r1