diff options
| author | Petar Avramovic <Petar.Avramovic@rt-rk.com> | 2019-06-20 09:05:02 +0000 |
|---|---|---|
| committer | Petar Avramovic <Petar.Avramovic@rt-rk.com> | 2019-06-20 09:05:02 +0000 |
| commit | 153bd24eda1f4f471d9e2eebad195ed49668c6a8 (patch) | |
| tree | ec0f73025847978ec5cb65144bc9e3fea80d52e9 /llvm/lib/Target/Mips | |
| parent | 4b4dae1c768d017604149fc0fa0aa854e796c0e1 (diff) | |
| download | bcm5719-llvm-153bd24eda1f4f471d9e2eebad195ed49668c6a8.tar.gz bcm5719-llvm-153bd24eda1f4f471d9e2eebad195ed49668c6a8.zip | |
[MIPS GlobalISel] Select integer to floating point conversions
Select G_SITOFP and G_UITOFP for MIPS32.
Differential Revision: https://reviews.llvm.org/D63542
llvm-svn: 363912
Diffstat (limited to 'llvm/lib/Target/Mips')
| -rw-r--r-- | llvm/lib/Target/Mips/MipsLegalizerInfo.cpp | 10 | ||||
| -rw-r--r-- | llvm/lib/Target/Mips/MipsRegisterBankInfo.cpp | 11 |
2 files changed, 21 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/MipsLegalizerInfo.cpp b/llvm/lib/Target/Mips/MipsLegalizerInfo.cpp index 0f7c4dfb148..465355d66b6 100644 --- a/llvm/lib/Target/Mips/MipsLegalizerInfo.cpp +++ b/llvm/lib/Target/Mips/MipsLegalizerInfo.cpp @@ -120,6 +120,16 @@ MipsLegalizerInfo::MipsLegalizerInfo(const MipsSubtarget &ST) { .libcallForCartesianProduct({s64}, {s64, s32}) .minScalar(0, s32); + // Int to FP conversion instructions + getActionDefinitionsBuilder(G_SITOFP) + .legalForCartesianProduct({s64, s32}, {s32}) + .libcallForCartesianProduct({s64, s32}, {s64}) + .minScalar(1, s32); + + getActionDefinitionsBuilder(G_UITOFP) + .libcallForCartesianProduct({s64, s32}, {s64}) + .minScalar(1, s32); + computeTables(); verify(*ST.getInstrInfo()); } diff --git a/llvm/lib/Target/Mips/MipsRegisterBankInfo.cpp b/llvm/lib/Target/Mips/MipsRegisterBankInfo.cpp index 736756ba3bf..b9d7f0468fa 100644 --- a/llvm/lib/Target/Mips/MipsRegisterBankInfo.cpp +++ b/llvm/lib/Target/Mips/MipsRegisterBankInfo.cpp @@ -182,6 +182,17 @@ MipsRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const { }); break; } + case G_SITOFP: { + unsigned SizeInt = MRI.getType(MI.getOperand(1).getReg()).getSizeInBits(); + unsigned SizeFP = MRI.getType(MI.getOperand(0).getReg()).getSizeInBits(); + assert((SizeInt == 32) && "Unsupported integer size"); + assert((SizeFP == 32 || SizeFP == 64) && "Unsupported floating point size"); + OperandsMapping = + getOperandsMapping({SizeFP == 32 ? &Mips::ValueMappings[Mips::SPRIdx] + : &Mips::ValueMappings[Mips::DPRIdx], + &Mips::ValueMappings[Mips::GPRIdx]}); + break; + } case G_CONSTANT: case G_FRAME_INDEX: case G_GLOBAL_VALUE: |

