Skip to content

Commit 0b10da7

Browse files
committed
[X86] Use APInt::getLowBitsSet helper. NFCI.
Also avoids a static analyzer warning about out of range shifts. llvm-svn: 372103
1 parent 79d19bd commit 0b10da7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20301,7 +20301,8 @@ X86TargetLowering::BuildSDIVPow2(SDNode *N, const APInt &Divisor,
2030120301
SDLoc DL(N);
2030220302
SDValue N0 = N->getOperand(0);
2030320303
SDValue Zero = DAG.getConstant(0, DL, VT);
20304-
SDValue Pow2MinusOne = DAG.getConstant((1ULL << Lg2) - 1, DL, VT);
20304+
APInt Lg2Mask = APInt::getLowBitsSet(VT.getSizeInBits(), Lg2);
20305+
SDValue Pow2MinusOne = DAG.getConstant(Lg2Mask, DL, VT);
2030520306

2030620307
// If N0 is negative, we need to add (Pow2 - 1) to it before shifting right.
2030720308
SDValue Cmp = DAG.getSetCC(DL, MVT::i8, N0, Zero, ISD::SETLT);

0 commit comments

Comments
 (0)