From: Ahmed Bougacha Date: Fri, 16 Sep 2016 15:12:43 +0000 (+0000) Subject: [AArch64][GlobalISel] Add default regbank mapping for G_FCMP. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d705c9fe792287994d12001414ae6b816422e954;p=llvm [AArch64][GlobalISel] Add default regbank mapping for G_FCMP. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281738 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/AArch64/AArch64RegisterBankInfo.cpp b/lib/Target/AArch64/AArch64RegisterBankInfo.cpp index ab70820e086..dab6225e4cf 100644 --- a/lib/Target/AArch64/AArch64RegisterBankInfo.cpp +++ b/lib/Target/AArch64/AArch64RegisterBankInfo.cpp @@ -221,6 +221,16 @@ AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const { OpBanks[Idx] = AArch64::GPRRegBankID; } + // Some of the floating-point instructions have mixed GPR and FPR operands: + // fine-tune the computed mapping. + switch (Opc) { + case TargetOpcode::G_FCMP: { + OpBanks = {AArch64::GPRRegBankID, /* Predicate */ 0, AArch64::FPRRegBankID, + AArch64::FPRRegBankID}; + break; + } + } + // Finally construct the computed mapping. for (unsigned Idx = 0; Idx < MI.getNumOperands(); ++Idx) if (MI.getOperand(Idx).isReg()) diff --git a/test/CodeGen/AArch64/GlobalISel/regbankselect-default.mir b/test/CodeGen/AArch64/GlobalISel/regbankselect-default.mir index c8cf12343c6..740223d5468 100644 --- a/test/CodeGen/AArch64/GlobalISel/regbankselect-default.mir +++ b/test/CodeGen/AArch64/GlobalISel/regbankselect-default.mir @@ -59,6 +59,8 @@ define void @test_fconstant_s32() { ret void } + define void @test_fcmp_s32() { ret void } + ... --- @@ -766,3 +768,22 @@ body: | ; CHECK: %0(s32) = G_FCONSTANT float 1.0 %0(s32) = G_FCONSTANT float 1.0 ... + +--- +# CHECK-LABEL: name: test_fcmp_s32 +name: test_fcmp_s32 +legalized: true +# CHECK: registers: +# CHECK: - { id: 0, class: fpr } +# CHECK: - { id: 1, class: gpr } +registers: + - { id: 0, class: _ } + - { id: 1, class: _ } +body: | + bb.0: + liveins: %s0 + ; CHECK: %0(s32) = COPY %s0 + ; CHECK: %1(s1) = G_FCMP floatpred(olt), %0(s32), %0 + %0(s32) = COPY %s0 + %1(s1) = G_FCMP floatpred(olt), %0, %0 +...