diff options
author | Akira Hatanaka <ahatanaka@mips.com> | 2013-04-22 19:58:23 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@mips.com> | 2013-04-22 19:58:23 +0000 |
commit | 0d6964cf4af190a8dc11307e0e720b12abdf85c6 (patch) | |
tree | b2864749a08855f53190a233ff87150857c7a939 /llvm/lib | |
parent | 09a3912b5c0d30128f626a88096ddb3ce9404023 (diff) | |
download | bcm5719-llvm-0d6964cf4af190a8dc11307e0e720b12abdf85c6.tar.gz bcm5719-llvm-0d6964cf4af190a8dc11307e0e720b12abdf85c6.zip |
[mips] In performDSPShiftCombine, check that all elements in the vector are
shifted by the same amount and the shift amount is smaller than the element
size.
llvm-svn: 180039
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/Mips/MipsDSPInstrInfo.td | 14 | ||||
-rw-r--r-- | llvm/lib/Target/Mips/MipsSEISelLowering.cpp | 8 |
2 files changed, 12 insertions, 10 deletions
diff --git a/llvm/lib/Target/Mips/MipsDSPInstrInfo.td b/llvm/lib/Target/Mips/MipsDSPInstrInfo.td index 6790a279839..23c6a0592d8 100644 --- a/llvm/lib/Target/Mips/MipsDSPInstrInfo.td +++ b/llvm/lib/Target/Mips/MipsDSPInstrInfo.td @@ -1288,18 +1288,18 @@ def : DSPBinPat<ADDWC, i32, adde>; // Shift immediate patterns. class DSPShiftPat<Instruction Inst, ValueType ValTy, SDPatternOperator Node, - ImmLeaf Imm, Predicate Pred = HasDSP> : + SDPatternOperator Imm, Predicate Pred = HasDSP> : DSPPat<(Node ValTy:$a, Imm:$shamt), (Inst ValTy:$a, Imm:$shamt), Pred>; -def : DSPShiftPat<SHLL_PH, v2i16, MipsSHLL_DSP, immZExt4>; -def : DSPShiftPat<SHRA_PH, v2i16, MipsSHRA_DSP, immZExt4>; -def : DSPShiftPat<SHRL_PH, v2i16, MipsSHRL_DSP, immZExt4, HasDSPR2>; +def : DSPShiftPat<SHLL_PH, v2i16, MipsSHLL_DSP, imm>; +def : DSPShiftPat<SHRA_PH, v2i16, MipsSHRA_DSP, imm>; +def : DSPShiftPat<SHRL_PH, v2i16, MipsSHRL_DSP, imm, HasDSPR2>; def : DSPShiftPat<SHLL_PH, v2i16, int_mips_shll_ph, immZExt4>; def : DSPShiftPat<SHRA_PH, v2i16, int_mips_shra_ph, immZExt4>; def : DSPShiftPat<SHRL_PH, v2i16, int_mips_shrl_ph, immZExt4, HasDSPR2>; -def : DSPShiftPat<SHLL_QB, v4i8, MipsSHLL_DSP, immZExt3>; -def : DSPShiftPat<SHRA_QB, v4i8, MipsSHRA_DSP, immZExt3, HasDSPR2>; -def : DSPShiftPat<SHRL_QB, v4i8, MipsSHRL_DSP, immZExt3>; +def : DSPShiftPat<SHLL_QB, v4i8, MipsSHLL_DSP, imm>; +def : DSPShiftPat<SHRA_QB, v4i8, MipsSHRA_DSP, imm, HasDSPR2>; +def : DSPShiftPat<SHRL_QB, v4i8, MipsSHRL_DSP, imm>; def : DSPShiftPat<SHLL_QB, v4i8, int_mips_shll_qb, immZExt3>; def : DSPShiftPat<SHRA_QB, v4i8, int_mips_shra_qb, immZExt3, HasDSPR2>; def : DSPShiftPat<SHRL_QB, v4i8, int_mips_shrl_qb, immZExt3>; diff --git a/llvm/lib/Target/Mips/MipsSEISelLowering.cpp b/llvm/lib/Target/Mips/MipsSEISelLowering.cpp index ca911f03dd1..23d2578b074 100644 --- a/llvm/lib/Target/Mips/MipsSEISelLowering.cpp +++ b/llvm/lib/Target/Mips/MipsSEISelLowering.cpp @@ -327,9 +327,11 @@ static SDValue performDSPShiftCombine(unsigned Opc, SDNode *N, EVT Ty, unsigned EltSize = Ty.getVectorElementType().getSizeInBits(); BuildVectorSDNode *BV = dyn_cast<BuildVectorSDNode>(N->getOperand(1)); - if (!BV || !BV->isConstantSplat(SplatValue, SplatUndef, SplatBitSize, - HasAnyUndefs, EltSize, - !Subtarget->isLittle())) + if (!BV || + !BV->isConstantSplat(SplatValue, SplatUndef, SplatBitSize, HasAnyUndefs, EltSize, + !Subtarget->isLittle()) || + (SplatBitSize != EltSize) || + !isUIntN(Log2_32(EltSize), SplatValue.getZExtValue())) return SDValue(); return DAG.getNode(Opc, N->getDebugLoc(), Ty, N->getOperand(0), |