1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[DAGCombine] Use APInt::extractBits in "sub-splat" constant mask detection. NFCI.

llvm-svn: 362820
This commit is contained in:
Simon Pilgrim 2019-06-07 18:07:06 +00:00
parent 1fe1482c3b
commit 3facdef56a

View File

@ -5005,10 +5005,10 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
// Make sure that variable 'Constant' is only set if 'SplatBitSize' is a // Make sure that variable 'Constant' is only set if 'SplatBitSize' is a
// multiple of 'BitWidth'. Otherwise, we could propagate a wrong value. // multiple of 'BitWidth'. Otherwise, we could propagate a wrong value.
if (SplatBitSize % BitWidth == 0) { if ((SplatBitSize % BitWidth) == 0) {
Constant = APInt::getAllOnesValue(BitWidth); Constant = APInt::getAllOnesValue(BitWidth);
for (unsigned i = 0, n = SplatBitSize/BitWidth; i < n; ++i) for (unsigned i = 0, n = (SplatBitSize / BitWidth); i < n; ++i)
Constant &= SplatValue.lshr(i*BitWidth).zextOrTrunc(BitWidth); Constant &= SplatValue.extractBits(BitWidth, i * BitWidth);
} }
} }
} }