[X86] Don't compute known bits twice for the same SDValue in LowerMUL.

We called MaskedValueIsZero with two different masks, but underneath that calls computeKnownBits before applying the mask. This means we compute the same known bits twice due to the two calls. Instead just call computeKnownBits directly and apply the two masks ourselves.

llvm-svn: 327251
This commit is contained in:
Craig Topper 2018-03-12 05:35:02 +00:00
parent a20e05bb94
commit 7cc1b1fc84
1 changed files with 8 additions and 4 deletions

View File

@ -22532,13 +22532,17 @@ static SDValue LowerMUL(SDValue Op, const X86Subtarget &Subtarget,
// //
// Hi = psllqi(AloBhi + AhiBlo, 32); // Hi = psllqi(AloBhi + AhiBlo, 32);
// return AloBlo + Hi; // return AloBlo + Hi;
KnownBits AKnown, BKnown;
DAG.computeKnownBits(A, AKnown);
DAG.computeKnownBits(B, BKnown);
APInt LowerBitsMask = APInt::getLowBitsSet(64, 32); APInt LowerBitsMask = APInt::getLowBitsSet(64, 32);
bool ALoIsZero = DAG.MaskedValueIsZero(A, LowerBitsMask); bool ALoIsZero = LowerBitsMask.isSubsetOf(AKnown.Zero);
bool BLoIsZero = DAG.MaskedValueIsZero(B, LowerBitsMask); bool BLoIsZero = LowerBitsMask.isSubsetOf(BKnown.Zero);
APInt UpperBitsMask = APInt::getHighBitsSet(64, 32); APInt UpperBitsMask = APInt::getHighBitsSet(64, 32);
bool AHiIsZero = DAG.MaskedValueIsZero(A, UpperBitsMask); bool AHiIsZero = UpperBitsMask.isSubsetOf(AKnown.Zero);
bool BHiIsZero = DAG.MaskedValueIsZero(B, UpperBitsMask); bool BHiIsZero = UpperBitsMask.isSubsetOf(BKnown.Zero);
// If DQI is supported we can use MULLQ, but MULUDQ is still better if the // If DQI is supported we can use MULLQ, but MULUDQ is still better if the
// the high bits are known to be zero. // the high bits are known to be zero.