1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[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 2db36ac7d6
commit 3445620d9a

View File

@ -20301,7 +20301,8 @@ X86TargetLowering::BuildSDIVPow2(SDNode *N, const APInt &Divisor,
SDLoc DL(N); SDLoc DL(N);
SDValue N0 = N->getOperand(0); SDValue N0 = N->getOperand(0);
SDValue Zero = DAG.getConstant(0, DL, VT); 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. // 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); SDValue Cmp = DAG.getSetCC(DL, MVT::i8, N0, Zero, ISD::SETLT);