[ARM] GlobalISel: Select s64 G_FCMP

Very similar to how we select s32 G_FCMP, the only thing that is
different is the exact opcodes that we use.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307763 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Diana Picus 2017-07-12 09:01:54 +00:00
parent fbec1c990e
commit 8577619105
2 changed files with 643 additions and 3 deletions

View File

@ -348,6 +348,9 @@ template <typename T> struct ARMInstructionSelector::CmpHelper {
// The assumed register bank ID for the operands.
static const unsigned OperandRegBankID;
// The assumed size in bits for the operands.
static const unsigned OperandSize;
// The assumed register bank ID for the result.
static const unsigned ResultRegBankID = ARM::GPRRegBankID;
@ -420,7 +423,7 @@ private:
bool validateOpReg(unsigned OpReg, MachineRegisterInfo &MRI,
const TargetRegisterInfo &TRI,
const RegisterBankInfo &RBI) {
if (MRI.getType(OpReg).getSizeInBits() != 32) {
if (MRI.getType(OpReg).getSizeInBits() != OperandSize) {
DEBUG(dbgs() << "Unsupported size for comparison operand");
return false;
}
@ -452,6 +455,9 @@ const unsigned ARMInstructionSelector::CmpHelper<int>::ComparisonOpcode =
template <>
const unsigned ARMInstructionSelector::CmpHelper<float>::ComparisonOpcode =
ARM::VCMPS;
template <>
const unsigned ARMInstructionSelector::CmpHelper<double>::ComparisonOpcode =
ARM::VCMPD;
// Specialize the opcode to be used for reading the comparison flags for
// different types of operands.
@ -461,6 +467,9 @@ const unsigned ARMInstructionSelector::CmpHelper<int>::ReadFlagsOpcode =
template <>
const unsigned ARMInstructionSelector::CmpHelper<float>::ReadFlagsOpcode =
ARM::FMSTAT;
template <>
const unsigned ARMInstructionSelector::CmpHelper<double>::ReadFlagsOpcode =
ARM::FMSTAT;
// Specialize the register bank where the operands of the comparison are assumed
// to live.
@ -470,6 +479,17 @@ const unsigned ARMInstructionSelector::CmpHelper<int>::OperandRegBankID =
template <>
const unsigned ARMInstructionSelector::CmpHelper<float>::OperandRegBankID =
ARM::FPRRegBankID;
template <>
const unsigned ARMInstructionSelector::CmpHelper<double>::OperandRegBankID =
ARM::FPRRegBankID;
// Specialize the size that the operands of the comparison are assumed to have.
template <>
const unsigned ARMInstructionSelector::CmpHelper<int>::OperandSize = 32;
template <>
const unsigned ARMInstructionSelector::CmpHelper<float>::OperandSize = 32;
template <>
const unsigned ARMInstructionSelector::CmpHelper<double>::OperandSize = 64;
template <typename T>
bool ARMInstructionSelector::selectCmp(MachineInstrBuilder &MIB,
@ -667,9 +687,24 @@ bool ARMInstructionSelector::select(MachineInstr &I) const {
return selectSelect(MIB, TII, MRI, TRI, RBI);
case G_ICMP:
return selectCmp<int>(MIB, TII, MRI, TRI, RBI);
case G_FCMP:
case G_FCMP: {
assert(TII.getSubtarget().hasVFP2() && "Can't select fcmp without VFP");
return selectCmp<float>(MIB, TII, MRI, TRI, RBI);
unsigned OpReg = I.getOperand(2).getReg();
unsigned Size = MRI.getType(OpReg).getSizeInBits();
if (Size == 32)
return selectCmp<float>(MIB, TII, MRI, TRI, RBI);
if (Size == 64) {
if (TII.getSubtarget().isFPOnlySP()) {
DEBUG(dbgs() << "Subtarget only supports single precision");
return false;
}
return selectCmp<double>(MIB, TII, MRI, TRI, RBI);
}
DEBUG(dbgs() << "Unsupported size for G_FCMP operand");
return false;
}
case G_GEP:
I.setDesc(TII.get(ARM::ADDrr));
MIB.add(predOps(ARMCC::AL)).add(condCodeOp());

View File

@ -30,6 +30,25 @@
define void @test_fcmp_one_s32() #0 { ret void }
define void @test_fcmp_ueq_s32() #0 { ret void }
define void @test_fcmp_true_s64() #0 { ret void }
define void @test_fcmp_false_s64() #0 { ret void }
define void @test_fcmp_oeq_s64() #0 { ret void }
define void @test_fcmp_ogt_s64() #0 { ret void }
define void @test_fcmp_oge_s64() #0 { ret void }
define void @test_fcmp_olt_s64() #0 { ret void }
define void @test_fcmp_ole_s64() #0 { ret void }
define void @test_fcmp_ord_s64() #0 { ret void }
define void @test_fcmp_ugt_s64() #0 { ret void }
define void @test_fcmp_uge_s64() #0 { ret void }
define void @test_fcmp_ult_s64() #0 { ret void }
define void @test_fcmp_ule_s64() #0 { ret void }
define void @test_fcmp_une_s64() #0 { ret void }
define void @test_fcmp_uno_s64() #0 { ret void }
define void @test_fcmp_one_s64() #0 { ret void }
define void @test_fcmp_ueq_s64() #0 { ret void }
attributes #0 = { "target-features"="+vfp2" }
...
---
@ -978,3 +997,589 @@ body: |
BX_RET 14, _, implicit %r0
; CHECK: BX_RET 14, _, implicit %r0
...
---
name: test_fcmp_true_s64
# CHECK-LABEL: name: test_fcmp_true_s64
legalized: true
regBankSelected: true
selected: false
# CHECK: selected: true
registers:
- { id: 0, class: fprb }
- { id: 1, class: fprb }
- { id: 2, class: gprb }
- { id: 3, class: gprb }
body: |
bb.0:
liveins: %d0, %d1
%0(s64) = COPY %d0
%1(s64) = COPY %d1
%2(s1) = G_FCMP floatpred(true), %0(s64), %1
; CHECK: [[RES:%[0-9]+]] = MOVi 1, 14, _, _
%3(s32) = G_ZEXT %2(s1)
; CHECK: [[RET:%[0-9]+]] = ANDri [[RES]], 1, 14, _, _
%r0 = COPY %3(s32)
; CHECK: %r0 = COPY [[RET]]
BX_RET 14, _, implicit %r0
; CHECK: BX_RET 14, _, implicit %r0
...
---
name: test_fcmp_false_s64
# CHECK-LABEL: name: test_fcmp_false_s64
legalized: true
regBankSelected: true
selected: false
# CHECK: selected: true
registers:
- { id: 0, class: fprb }
- { id: 1, class: fprb }
- { id: 2, class: gprb }
- { id: 3, class: gprb }
body: |
bb.0:
liveins: %d0, %d1
%0(s64) = COPY %d0
%1(s64) = COPY %d1
%2(s1) = G_FCMP floatpred(false), %0(s64), %1
; CHECK: [[RES:%[0-9]+]] = MOVi 0, 14, _, _
%3(s32) = G_ZEXT %2(s1)
; CHECK: [[RET:%[0-9]+]] = ANDri [[RES]], 1, 14, _, _
%r0 = COPY %3(s32)
; CHECK: %r0 = COPY [[RET]]
BX_RET 14, _, implicit %r0
; CHECK: BX_RET 14, _, implicit %r0
...
---
name: test_fcmp_oeq_s64
# CHECK-LABEL: name: test_fcmp_oeq_s64
legalized: true
regBankSelected: true
selected: false
# CHECK: selected: true
registers:
- { id: 0, class: fprb }
- { id: 1, class: fprb }
- { id: 2, class: gprb }
- { id: 3, class: gprb }
body: |
bb.0:
liveins: %d0, %d1
%0(s64) = COPY %d0
; CHECK: [[VREGX:%[0-9]+]] = COPY %d0
%1(s64) = COPY %d1
; CHECK: [[VREGY:%[0-9]+]] = COPY %d1
%2(s1) = G_FCMP floatpred(oeq), %0(s64), %1
; CHECK: [[ZERO:%[0-9]+]] = MOVi 0, 14, _, _
; CHECK-NEXT: VCMPD [[VREGX]], [[VREGY]], 14, _, implicit-def %fpscr_nzcv
; CHECK-NEXT: FMSTAT 14, _, implicit-def %cpsr, implicit %fpscr_nzcv
; CHECK-NEXT: [[RES:%[0-9]+]] = MOVCCi [[ZERO]], 1, 0, %cpsr
%3(s32) = G_ZEXT %2(s1)
; CHECK: [[RET:%[0-9]+]] = ANDri [[RES]], 1, 14, _, _
%r0 = COPY %3(s32)
; CHECK: %r0 = COPY [[RET]]
BX_RET 14, _, implicit %r0
; CHECK: BX_RET 14, _, implicit %r0
...
---
name: test_fcmp_ogt_s64
# CHECK-LABEL: name: test_fcmp_ogt_s64
legalized: true
regBankSelected: true
selected: false
# CHECK: selected: true
registers:
- { id: 0, class: fprb }
- { id: 1, class: fprb }
- { id: 2, class: gprb }
- { id: 3, class: gprb }
body: |
bb.0:
liveins: %d0, %d1
%0(s64) = COPY %d0
; CHECK: [[VREGX:%[0-9]+]] = COPY %d0
%1(s64) = COPY %d1
; CHECK: [[VREGY:%[0-9]+]] = COPY %d1
%2(s1) = G_FCMP floatpred(ogt), %0(s64), %1
; CHECK: [[ZERO:%[0-9]+]] = MOVi 0, 14, _, _
; CHECK-NEXT: VCMPD [[VREGX]], [[VREGY]], 14, _, implicit-def %fpscr_nzcv
; CHECK-NEXT: FMSTAT 14, _, implicit-def %cpsr, implicit %fpscr_nzcv
; CHECK-NEXT: [[RES:%[0-9]+]] = MOVCCi [[ZERO]], 1, 12, %cpsr
%3(s32) = G_ZEXT %2(s1)
; CHECK: [[RET:%[0-9]+]] = ANDri [[RES]], 1, 14, _, _
%r0 = COPY %3(s32)
; CHECK: %r0 = COPY [[RET]]
BX_RET 14, _, implicit %r0
; CHECK: BX_RET 14, _, implicit %r0
...
---
name: test_fcmp_oge_s64
# CHECK-LABEL: name: test_fcmp_oge_s64
legalized: true
regBankSelected: true
selected: false
# CHECK: selected: true
registers:
- { id: 0, class: fprb }
- { id: 1, class: fprb }
- { id: 2, class: gprb }
- { id: 3, class: gprb }
body: |
bb.0:
liveins: %d0, %d1
%0(s64) = COPY %d0
; CHECK: [[VREGX:%[0-9]+]] = COPY %d0
%1(s64) = COPY %d1
; CHECK: [[VREGY:%[0-9]+]] = COPY %d1
%2(s1) = G_FCMP floatpred(oge), %0(s64), %1
; CHECK: [[ZERO:%[0-9]+]] = MOVi 0, 14, _, _
; CHECK-NEXT: VCMPD [[VREGX]], [[VREGY]], 14, _, implicit-def %fpscr_nzcv
; CHECK-NEXT: FMSTAT 14, _, implicit-def %cpsr, implicit %fpscr_nzcv
; CHECK-NEXT: [[RES:%[0-9]+]] = MOVCCi [[ZERO]], 1, 10, %cpsr
%3(s32) = G_ZEXT %2(s1)
; CHECK: [[RET:%[0-9]+]] = ANDri [[RES]], 1, 14, _, _
%r0 = COPY %3(s32)
; CHECK: %r0 = COPY [[RET]]
BX_RET 14, _, implicit %r0
; CHECK: BX_RET 14, _, implicit %r0
...
---
name: test_fcmp_olt_s64
# CHECK-LABEL: name: test_fcmp_olt_s64
legalized: true
regBankSelected: true
selected: false
# CHECK: selected: true
registers:
- { id: 0, class: fprb }
- { id: 1, class: fprb }
- { id: 2, class: gprb }
- { id: 3, class: gprb }
body: |
bb.0:
liveins: %d0, %d1
%0(s64) = COPY %d0
; CHECK: [[VREGX:%[0-9]+]] = COPY %d0
%1(s64) = COPY %d1
; CHECK: [[VREGY:%[0-9]+]] = COPY %d1
%2(s1) = G_FCMP floatpred(olt), %0(s64), %1
; CHECK: [[ZERO:%[0-9]+]] = MOVi 0, 14, _, _
; CHECK-NEXT: VCMPD [[VREGX]], [[VREGY]], 14, _, implicit-def %fpscr_nzcv
; CHECK-NEXT: FMSTAT 14, _, implicit-def %cpsr, implicit %fpscr_nzcv
; CHECK-NEXT: [[RES:%[0-9]+]] = MOVCCi [[ZERO]], 1, 4, %cpsr
%3(s32) = G_ZEXT %2(s1)
; CHECK: [[RET:%[0-9]+]] = ANDri [[RES]], 1, 14, _, _
%r0 = COPY %3(s32)
; CHECK: %r0 = COPY [[RET]]
BX_RET 14, _, implicit %r0
; CHECK: BX_RET 14, _, implicit %r0
...
---
name: test_fcmp_ole_s64
# CHECK-LABEL: name: test_fcmp_ole_s64
legalized: true
regBankSelected: true
selected: false
# CHECK: selected: true
registers:
- { id: 0, class: fprb }
- { id: 1, class: fprb }
- { id: 2, class: gprb }
- { id: 3, class: gprb }
body: |
bb.0:
liveins: %d0, %d1
%0(s64) = COPY %d0
; CHECK: [[VREGX:%[0-9]+]] = COPY %d0
%1(s64) = COPY %d1
; CHECK: [[VREGY:%[0-9]+]] = COPY %d1
%2(s1) = G_FCMP floatpred(ole), %0(s64), %1
; CHECK: [[ZERO:%[0-9]+]] = MOVi 0, 14, _, _
; CHECK-NEXT: VCMPD [[VREGX]], [[VREGY]], 14, _, implicit-def %fpscr_nzcv
; CHECK-NEXT: FMSTAT 14, _, implicit-def %cpsr, implicit %fpscr_nzcv
; CHECK-NEXT: [[RES:%[0-9]+]] = MOVCCi [[ZERO]], 1, 9, %cpsr
%3(s32) = G_ZEXT %2(s1)
; CHECK: [[RET:%[0-9]+]] = ANDri [[RES]], 1, 14, _, _
%r0 = COPY %3(s32)
; CHECK: %r0 = COPY [[RET]]
BX_RET 14, _, implicit %r0
; CHECK: BX_RET 14, _, implicit %r0
...
---
name: test_fcmp_ord_s64
# CHECK-LABEL: name: test_fcmp_ord_s64
legalized: true
regBankSelected: true
selected: false
# CHECK: selected: true
registers:
- { id: 0, class: fprb }
- { id: 1, class: fprb }
- { id: 2, class: gprb }
- { id: 3, class: gprb }
body: |
bb.0:
liveins: %d0, %d1
%0(s64) = COPY %d0
; CHECK: [[VREGX:%[0-9]+]] = COPY %d0
%1(s64) = COPY %d1
; CHECK: [[VREGY:%[0-9]+]] = COPY %d1
%2(s1) = G_FCMP floatpred(ord), %0(s64), %1
; CHECK: [[ZERO:%[0-9]+]] = MOVi 0, 14, _, _
; CHECK-NEXT: VCMPD [[VREGX]], [[VREGY]], 14, _, implicit-def %fpscr_nzcv
; CHECK-NEXT: FMSTAT 14, _, implicit-def %cpsr, implicit %fpscr_nzcv
; CHECK-NEXT: [[RES:%[0-9]+]] = MOVCCi [[ZERO]], 1, 7, %cpsr
%3(s32) = G_ZEXT %2(s1)
; CHECK: [[RET:%[0-9]+]] = ANDri [[RES]], 1, 14, _, _
%r0 = COPY %3(s32)
; CHECK: %r0 = COPY [[RET]]
BX_RET 14, _, implicit %r0
; CHECK: BX_RET 14, _, implicit %r0
...
---
name: test_fcmp_ugt_s64
# CHECK-LABEL: name: test_fcmp_ugt_s64
legalized: true
regBankSelected: true
selected: false
# CHECK: selected: true
registers:
- { id: 0, class: fprb }
- { id: 1, class: fprb }
- { id: 2, class: gprb }
- { id: 3, class: gprb }
body: |
bb.0:
liveins: %d0, %d1
%0(s64) = COPY %d0
; CHECK: [[VREGX:%[0-9]+]] = COPY %d0
%1(s64) = COPY %d1
; CHECK: [[VREGY:%[0-9]+]] = COPY %d1
%2(s1) = G_FCMP floatpred(ugt), %0(s64), %1
; CHECK: [[ZERO:%[0-9]+]] = MOVi 0, 14, _, _
; CHECK-NEXT: VCMPD [[VREGX]], [[VREGY]], 14, _, implicit-def %fpscr_nzcv
; CHECK-NEXT: FMSTAT 14, _, implicit-def %cpsr, implicit %fpscr_nzcv
; CHECK-NEXT: [[RES:%[0-9]+]] = MOVCCi [[ZERO]], 1, 8, %cpsr
%3(s32) = G_ZEXT %2(s1)
; CHECK: [[RET:%[0-9]+]] = ANDri [[RES]], 1, 14, _, _
%r0 = COPY %3(s32)
; CHECK: %r0 = COPY [[RET]]
BX_RET 14, _, implicit %r0
; CHECK: BX_RET 14, _, implicit %r0
...
---
name: test_fcmp_uge_s64
# CHECK-LABEL: name: test_fcmp_uge_s64
legalized: true
regBankSelected: true
selected: false
# CHECK: selected: true
registers:
- { id: 0, class: fprb }
- { id: 1, class: fprb }
- { id: 2, class: gprb }
- { id: 3, class: gprb }
body: |
bb.0:
liveins: %d0, %d1
%0(s64) = COPY %d0
; CHECK: [[VREGX:%[0-9]+]] = COPY %d0
%1(s64) = COPY %d1
; CHECK: [[VREGY:%[0-9]+]] = COPY %d1
%2(s1) = G_FCMP floatpred(uge), %0(s64), %1
; CHECK: [[ZERO:%[0-9]+]] = MOVi 0, 14, _, _
; CHECK-NEXT: VCMPD [[VREGX]], [[VREGY]], 14, _, implicit-def %fpscr_nzcv
; CHECK-NEXT: FMSTAT 14, _, implicit-def %cpsr, implicit %fpscr_nzcv
; CHECK-NEXT: [[RES:%[0-9]+]] = MOVCCi [[ZERO]], 1, 5, %cpsr
%3(s32) = G_ZEXT %2(s1)
; CHECK: [[RET:%[0-9]+]] = ANDri [[RES]], 1, 14, _, _
%r0 = COPY %3(s32)
; CHECK: %r0 = COPY [[RET]]
BX_RET 14, _, implicit %r0
; CHECK: BX_RET 14, _, implicit %r0
...
---
name: test_fcmp_ult_s64
# CHECK-LABEL: name: test_fcmp_ult_s64
legalized: true
regBankSelected: true
selected: false
# CHECK: selected: true
registers:
- { id: 0, class: fprb }
- { id: 1, class: fprb }
- { id: 2, class: gprb }
- { id: 3, class: gprb }
body: |
bb.0:
liveins: %d0, %d1
%0(s64) = COPY %d0
; CHECK: [[VREGX:%[0-9]+]] = COPY %d0
%1(s64) = COPY %d1
; CHECK: [[VREGY:%[0-9]+]] = COPY %d1
%2(s1) = G_FCMP floatpred(ult), %0(s64), %1
; CHECK: [[ZERO:%[0-9]+]] = MOVi 0, 14, _, _
; CHECK-NEXT: VCMPD [[VREGX]], [[VREGY]], 14, _, implicit-def %fpscr_nzcv
; CHECK-NEXT: FMSTAT 14, _, implicit-def %cpsr, implicit %fpscr_nzcv
; CHECK-NEXT: [[RES:%[0-9]+]] = MOVCCi [[ZERO]], 1, 11, %cpsr
%3(s32) = G_ZEXT %2(s1)
; CHECK: [[RET:%[0-9]+]] = ANDri [[RES]], 1, 14, _, _
%r0 = COPY %3(s32)
; CHECK: %r0 = COPY [[RET]]
BX_RET 14, _, implicit %r0
; CHECK: BX_RET 14, _, implicit %r0
...
---
name: test_fcmp_ule_s64
# CHECK-LABEL: name: test_fcmp_ule_s64
legalized: true
regBankSelected: true
selected: false
# CHECK: selected: true
registers:
- { id: 0, class: fprb }
- { id: 1, class: fprb }
- { id: 2, class: gprb }
- { id: 3, class: gprb }
body: |
bb.0:
liveins: %d0, %d1
%0(s64) = COPY %d0
; CHECK: [[VREGX:%[0-9]+]] = COPY %d0
%1(s64) = COPY %d1
; CHECK: [[VREGY:%[0-9]+]] = COPY %d1
%2(s1) = G_FCMP floatpred(ule), %0(s64), %1
; CHECK: [[ZERO:%[0-9]+]] = MOVi 0, 14, _, _
; CHECK-NEXT: VCMPD [[VREGX]], [[VREGY]], 14, _, implicit-def %fpscr_nzcv
; CHECK-NEXT: FMSTAT 14, _, implicit-def %cpsr, implicit %fpscr_nzcv
; CHECK-NEXT: [[RES:%[0-9]+]] = MOVCCi [[ZERO]], 1, 13, %cpsr
%3(s32) = G_ZEXT %2(s1)
; CHECK: [[RET:%[0-9]+]] = ANDri [[RES]], 1, 14, _, _
%r0 = COPY %3(s32)
; CHECK: %r0 = COPY [[RET]]
BX_RET 14, _, implicit %r0
; CHECK: BX_RET 14, _, implicit %r0
...
---
name: test_fcmp_une_s64
# CHECK-LABEL: name: test_fcmp_une_s64
legalized: true
regBankSelected: true
selected: false
# CHECK: selected: true
registers:
- { id: 0, class: fprb }
- { id: 1, class: fprb }
- { id: 2, class: gprb }
- { id: 3, class: gprb }
body: |
bb.0:
liveins: %d0, %d1
%0(s64) = COPY %d0
; CHECK: [[VREGX:%[0-9]+]] = COPY %d0
%1(s64) = COPY %d1
; CHECK: [[VREGY:%[0-9]+]] = COPY %d1
%2(s1) = G_FCMP floatpred(une), %0(s64), %1
; CHECK: [[ZERO:%[0-9]+]] = MOVi 0, 14, _, _
; CHECK-NEXT: VCMPD [[VREGX]], [[VREGY]], 14, _, implicit-def %fpscr_nzcv
; CHECK-NEXT: FMSTAT 14, _, implicit-def %cpsr, implicit %fpscr_nzcv
; CHECK-NEXT: [[RES:%[0-9]+]] = MOVCCi [[ZERO]], 1, 1, %cpsr
%3(s32) = G_ZEXT %2(s1)
; CHECK: [[RET:%[0-9]+]] = ANDri [[RES]], 1, 14, _, _
%r0 = COPY %3(s32)
; CHECK: %r0 = COPY [[RET]]
BX_RET 14, _, implicit %r0
; CHECK: BX_RET 14, _, implicit %r0
...
---
name: test_fcmp_uno_s64
# CHECK-LABEL: name: test_fcmp_uno_s64
legalized: true
regBankSelected: true
selected: false
# CHECK: selected: true
registers:
- { id: 0, class: fprb }
- { id: 1, class: fprb }
- { id: 2, class: gprb }
- { id: 3, class: gprb }
body: |
bb.0:
liveins: %d0, %d1
%0(s64) = COPY %d0
; CHECK: [[VREGX:%[0-9]+]] = COPY %d0
%1(s64) = COPY %d1
; CHECK: [[VREGY:%[0-9]+]] = COPY %d1
%2(s1) = G_FCMP floatpred(uno), %0(s64), %1
; CHECK: [[ZERO:%[0-9]+]] = MOVi 0, 14, _, _
; CHECK-NEXT: VCMPD [[VREGX]], [[VREGY]], 14, _, implicit-def %fpscr_nzcv
; CHECK-NEXT: FMSTAT 14, _, implicit-def %cpsr, implicit %fpscr_nzcv
; CHECK-NEXT: [[RES:%[0-9]+]] = MOVCCi [[ZERO]], 1, 6, %cpsr
%3(s32) = G_ZEXT %2(s1)
; CHECK: [[RET:%[0-9]+]] = ANDri [[RES]], 1, 14, _, _
%r0 = COPY %3(s32)
; CHECK: %r0 = COPY [[RET]]
BX_RET 14, _, implicit %r0
; CHECK: BX_RET 14, _, implicit %r0
...
---
name: test_fcmp_one_s64
# CHECK-LABEL: name: test_fcmp_one_s64
legalized: true
regBankSelected: true
selected: false
# CHECK: selected: true
registers:
- { id: 0, class: fprb }
- { id: 1, class: fprb }
- { id: 2, class: gprb }
- { id: 3, class: gprb }
body: |
bb.0:
liveins: %d0, %d1
%0(s64) = COPY %d0
; CHECK: [[VREGX:%[0-9]+]] = COPY %d0
%1(s64) = COPY %d1
; CHECK: [[VREGY:%[0-9]+]] = COPY %d1
%2(s1) = G_FCMP floatpred(one), %0(s64), %1
; CHECK: [[ZERO:%[0-9]+]] = MOVi 0, 14, _, _
; CHECK-NEXT: VCMPD [[VREGX]], [[VREGY]], 14, _, implicit-def %fpscr_nzcv
; CHECK-NEXT: FMSTAT 14, _, implicit-def %cpsr, implicit %fpscr_nzcv
; CHECK-NEXT: [[RES1:%[0-9]+]] = MOVCCi [[ZERO]], 1, 12, %cpsr
; CHECK-NEXT: VCMPD [[VREGX]], [[VREGY]], 14, _, implicit-def %fpscr_nzcv
; CHECK-NEXT: FMSTAT 14, _, implicit-def %cpsr, implicit %fpscr_nzcv
; CHECK-NEXT: [[RES:%[0-9]+]] = MOVCCi [[RES1]], 1, 4, %cpsr
%3(s32) = G_ZEXT %2(s1)
; CHECK: [[RET:%[0-9]+]] = ANDri [[RES]], 1, 14, _, _
%r0 = COPY %3(s32)
; CHECK: %r0 = COPY [[RET]]
BX_RET 14, _, implicit %r0
; CHECK: BX_RET 14, _, implicit %r0
...
---
name: test_fcmp_ueq_s64
# CHECK-LABEL: name: test_fcmp_ueq_s64
legalized: true
regBankSelected: true
selected: false
# CHECK: selected: true
registers:
- { id: 0, class: fprb }
- { id: 1, class: fprb }
- { id: 2, class: gprb }
- { id: 3, class: gprb }
body: |
bb.0:
liveins: %d0, %d1
%0(s64) = COPY %d0
; CHECK: [[VREGX:%[0-9]+]] = COPY %d0
%1(s64) = COPY %d1
; CHECK: [[VREGY:%[0-9]+]] = COPY %d1
%2(s1) = G_FCMP floatpred(ueq), %0(s64), %1
; CHECK: [[ZERO:%[0-9]+]] = MOVi 0, 14, _, _
; CHECK-NEXT: VCMPD [[VREGX]], [[VREGY]], 14, _, implicit-def %fpscr_nzcv
; CHECK-NEXT: FMSTAT 14, _, implicit-def %cpsr, implicit %fpscr_nzcv
; CHECK-NEXT: [[RES1:%[0-9]+]] = MOVCCi [[ZERO]], 1, 0, %cpsr
; CHECK-NEXT: VCMPD [[VREGX]], [[VREGY]], 14, _, implicit-def %fpscr_nzcv
; CHECK-NEXT: FMSTAT 14, _, implicit-def %cpsr, implicit %fpscr_nzcv
; CHECK-NEXT: [[RES:%[0-9]+]] = MOVCCi [[RES1]], 1, 6, %cpsr
%3(s32) = G_ZEXT %2(s1)
; CHECK: [[RET:%[0-9]+]] = ANDri [[RES]], 1, 14, _, _
%r0 = COPY %3(s32)
; CHECK: %r0 = COPY [[RET]]
BX_RET 14, _, implicit %r0
; CHECK: BX_RET 14, _, implicit %r0
...