[X86] Use APInt::getLowBitsSet helper. NFCI.

Also avoids a static analyzer warning about out of range shifts.

llvm-svn: 372103
This commit is contained in:
Simon Pilgrim 2019-09-17 10:51:30 +00:00
parent 79d19bdf81
commit 0b10da7cc7
1 changed files with 2 additions and 1 deletions

View File

@ -20301,7 +20301,8 @@ X86TargetLowering::BuildSDIVPow2(SDNode *N, const APInt &Divisor,
SDLoc DL(N);
SDValue N0 = N->getOperand(0);
SDValue Zero = DAG.getConstant(0, DL, VT);
SDValue Pow2MinusOne = DAG.getConstant((1ULL << Lg2) - 1, DL, VT);
APInt Lg2Mask = APInt::getLowBitsSet(VT.getSizeInBits(), Lg2);
SDValue Pow2MinusOne = DAG.getConstant(Lg2Mask, DL, VT);
// If N0 is negative, we need to add (Pow2 - 1) to it before shifting right.
SDValue Cmp = DAG.getSetCC(DL, MVT::i8, N0, Zero, ISD::SETLT);