diff options
author | Alexander Ivchenko <alexander.ivchenko@intel.com> | 2018-08-31 11:16:58 +0000 |
---|---|---|
committer | Alexander Ivchenko <alexander.ivchenko@intel.com> | 2018-08-31 11:16:58 +0000 |
commit | 9b0b492653ab5556af709179af11074bd39005f3 (patch) | |
tree | b4096ccb9d6153e3c2464586039610db1b5528f4 /llvm/lib | |
parent | 58a5d6fde73f3652bb3f39aa939f6416acc0e93c (diff) | |
download | bcm5719-llvm-9b0b492653ab5556af709179af11074bd39005f3.tar.gz bcm5719-llvm-9b0b492653ab5556af709179af11074bd39005f3.zip |
[GlobalISel][X86_64] Support for G_FPTOSI
Differential Revision: https://reviews.llvm.org/D49183
llvm-svn: 341200
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/X86/X86LegalizerInfo.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86RegisterBankInfo.cpp | 10 |
2 files changed, 14 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/X86LegalizerInfo.cpp b/llvm/lib/Target/X86/X86LegalizerInfo.cpp index 2ba00708836..2b747f79e1b 100644 --- a/llvm/lib/Target/X86/X86LegalizerInfo.cpp +++ b/llvm/lib/Target/X86/X86LegalizerInfo.cpp @@ -219,6 +219,13 @@ void X86LegalizerInfo::setLegalizerInfo64bit() { .clampScalar(0, s32, s64) .widenScalarToNextPow2(0); + getActionDefinitionsBuilder(G_FPTOSI) + .legalForCartesianProduct({s32, s64}) + .clampScalar(1, s32, s64) + .widenScalarToNextPow2(0) + .clampScalar(0, s32, s64) + .widenScalarToNextPow2(1); + // Comparison setAction({G_ICMP, 1, s64}, Legal); diff --git a/llvm/lib/Target/X86/X86RegisterBankInfo.cpp b/llvm/lib/Target/X86/X86RegisterBankInfo.cpp index 9c725f154bd..47dff3113fc 100644 --- a/llvm/lib/Target/X86/X86RegisterBankInfo.cpp +++ b/llvm/lib/Target/X86/X86RegisterBankInfo.cpp @@ -198,15 +198,19 @@ X86RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const { // Instruction having only floating-point operands (all scalars in VECRReg) getInstrPartialMappingIdxs(MI, MRI, /* isFP */ true, OpRegBankIdx); break; - case TargetOpcode::G_SITOFP: { + case TargetOpcode::G_SITOFP: + case TargetOpcode::G_FPTOSI: { // Some of the floating-point instructions have mixed GPR and FP operands: // fine-tune the computed mapping. auto &Op0 = MI.getOperand(0); auto &Op1 = MI.getOperand(1); const LLT Ty0 = MRI.getType(Op0.getReg()); const LLT Ty1 = MRI.getType(Op1.getReg()); - OpRegBankIdx[0] = getPartialMappingIdx(Ty0, /* isFP */ true); - OpRegBankIdx[1] = getPartialMappingIdx(Ty1, /* isFP */ false); + + bool FirstArgIsFP = Opc == TargetOpcode::G_SITOFP; + bool SecondArgIsFP = Opc == TargetOpcode::G_FPTOSI; + OpRegBankIdx[0] = getPartialMappingIdx(Ty0, /* isFP */ FirstArgIsFP); + OpRegBankIdx[1] = getPartialMappingIdx(Ty1, /* isFP */ SecondArgIsFP); break; } case TargetOpcode::G_FCMP: { |