From 2cefaa2747403eccd691ba74986f32c242db9640 Mon Sep 17 00:00:00 2001 From: Petar Avramovic Date: Fri, 9 Nov 2018 14:21:16 +0000 Subject: [MIPS GlobalISel] narrowScalar G_CONSTANT Legalize s64 G_CONSTANT using narrowScalar on MIPS 32. Differential Revision: https://reviews.llvm.org/D54255 llvm-svn: 346495 --- llvm/lib/Target/Mips/MipsLegalizerInfo.cpp | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'llvm/lib/Target/Mips/MipsLegalizerInfo.cpp') diff --git a/llvm/lib/Target/Mips/MipsLegalizerInfo.cpp b/llvm/lib/Target/Mips/MipsLegalizerInfo.cpp index 02701f31e32..6a8688f1cb9 100644 --- a/llvm/lib/Target/Mips/MipsLegalizerInfo.cpp +++ b/llvm/lib/Target/Mips/MipsLegalizerInfo.cpp @@ -41,8 +41,7 @@ MipsLegalizerInfo::MipsLegalizerInfo(const MipsSubtarget &ST) { getActionDefinitionsBuilder(G_CONSTANT) .legalFor({s32}) - .minScalar(0, s32) - .customFor({s64}); + .clampScalar(0, s32, s32); getActionDefinitionsBuilder(G_GEP) .legalFor({{p0, s32}}); @@ -93,27 +92,6 @@ bool MipsLegalizerInfo::legalizeCustom(MachineInstr &MI, MI.eraseFromParent(); break; } - case G_CONSTANT: { - - unsigned Size = MRI.getType(MI.getOperand(0).getReg()).getSizeInBits(); - const LLT sHalf = LLT::scalar(Size / 2); - - const APInt &CImmValue = MI.getOperand(1).getCImm()->getValue(); - - unsigned ResLow = MRI.createGenericVirtualRegister(sHalf); - unsigned ResHigh = MRI.createGenericVirtualRegister(sHalf); - MIRBuilder.buildConstant( - ResLow, *ConstantInt::get(MI.getMF()->getFunction().getContext(), - CImmValue.trunc(Size / 2))); - MIRBuilder.buildConstant( - ResHigh, *ConstantInt::get(MI.getMF()->getFunction().getContext(), - CImmValue.lshr(Size / 2).trunc(Size / 2))); - - MIRBuilder.buildMerge(MI.getOperand(0).getReg(), {ResLow, ResHigh}); - - MI.eraseFromParent(); - break; - } default: return false; } -- cgit v1.2.3