diff options
author | Diana Picus <diana.picus@linaro.org> | 2018-01-30 07:54:52 +0000 |
---|---|---|
committer | Diana Picus <diana.picus@linaro.org> | 2018-01-30 07:54:52 +0000 |
commit | 4ed0ee7b5f6e209cd39506980869620eabff7aad (patch) | |
tree | ce7818f575e4f697e618b0720fbd54ce9e42a5d8 /llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp | |
parent | cf47b046f90b12e1656d03f5afcb4e93d2d6b886 (diff) | |
download | bcm5719-llvm-4ed0ee7b5f6e209cd39506980869620eabff7aad.tar.gz bcm5719-llvm-4ed0ee7b5f6e209cd39506980869620eabff7aad.zip |
[ARM GlobalISel] Legalize G_FPTOSI and G_FPTOUI
Legal if we have hardware support for floating point, libcalls
otherwise.
Also add the necessary support for libcalls in the legalizer helper.
llvm-svn: 323726
Diffstat (limited to 'llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp')
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp index 2121b722958..4fcb6a639d8 100644 --- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp +++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp @@ -150,6 +150,10 @@ static RTLIB::Libcall getConvRTLibDesc(unsigned Opcode, Type *ToType, return RTLIB::getFPEXT(FromMVT, ToMVT); case TargetOpcode::G_FPTRUNC: return RTLIB::getFPROUND(FromMVT, ToMVT); + case TargetOpcode::G_FPTOSI: + return RTLIB::getFPTOSINT(FromMVT, ToMVT); + case TargetOpcode::G_FPTOUI: + return RTLIB::getFPTOUINT(FromMVT, ToMVT); } llvm_unreachable("Unsupported libcall function"); } @@ -220,6 +224,20 @@ LegalizerHelper::libcall(MachineInstr &MI) { return Status; break; } + case TargetOpcode::G_FPTOSI: + case TargetOpcode::G_FPTOUI: { + // FIXME: Support other types + unsigned FromSize = MRI.getType(MI.getOperand(1).getReg()).getSizeInBits(); + unsigned ToSize = MRI.getType(MI.getOperand(0).getReg()).getSizeInBits(); + if (ToSize != 32 || (FromSize != 32 && FromSize != 64)) + return UnableToLegalize; + LegalizeResult Status = conversionLibcall( + MI, MIRBuilder, Type::getInt32Ty(Ctx), + FromSize == 64 ? Type::getDoubleTy(Ctx) : Type::getFloatTy(Ctx)); + if (Status != Legalized) + return Status; + break; + } } MI.eraseFromParent(); |