diff options
author | Petar Avramovic <Petar.Avramovic@rt-rk.com> | 2018-11-09 14:21:16 +0000 |
---|---|---|
committer | Petar Avramovic <Petar.Avramovic@rt-rk.com> | 2018-11-09 14:21:16 +0000 |
commit | 2cefaa2747403eccd691ba74986f32c242db9640 (patch) | |
tree | c06220bcd19eb9df000b2027b5bb3f28bfbce3d0 /llvm/lib | |
parent | f740fd647a0f570d6d60c1dd4608b6a3ff20e437 (diff) | |
download | bcm5719-llvm-2cefaa2747403eccd691ba74986f32c242db9640.tar.gz bcm5719-llvm-2cefaa2747403eccd691ba74986f32c242db9640.zip |
[MIPS GlobalISel] narrowScalar G_CONSTANT
Legalize s64 G_CONSTANT using narrowScalar on MIPS 32.
Differential Revision: https://reviews.llvm.org/D54255
llvm-svn: 346495
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/Mips/MipsLegalizerInfo.cpp | 24 |
1 files changed, 1 insertions, 23 deletions
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; } |