OSDN Git Service

[X86] LowerFunnelShift - use modulo constant shift amount.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 3 Jul 2019 10:04:16 +0000 (10:04 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 3 Jul 2019 10:04:16 +0000 (10:04 +0000)
This avoids the use of getZExtValue and uses the modulo shift amount which is whats expected for funnel shifts anyhow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365016 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp

index 3807ad6..65a72fe 100644 (file)
@@ -17831,7 +17831,7 @@ static SDValue LowerFunnelShift(SDValue Op, const X86Subtarget &Subtarget,
 
     APInt APIntShiftAmt;
     if (isConstantSplat(Amt, APIntShiftAmt)) {
-      uint64_t ShiftAmt = APIntShiftAmt.getZExtValue();
+      uint64_t ShiftAmt = APIntShiftAmt.urem(VT.getScalarSizeInBits());
       return DAG.getNode(IsFSHR ? X86ISD::VSHRD : X86ISD::VSHLD, DL, VT,
                          Op0, Op1, DAG.getConstant(ShiftAmt, DL, MVT::i8));
     }