[llvm] 916cdc3 - [NFC][X86] combineX86ShuffleChain(): rename inner Mask to avoid future shadowing
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 4 07:15:39 PDT 2021
Author: Roman Lebedev
Date: 2021-08-04T17:15:12+03:00
New Revision: 916cdc3d4b66cf9658280cccb69a56eb6b403cdf
URL: https://github.com/llvm/llvm-project/commit/916cdc3d4b66cf9658280cccb69a56eb6b403cdf
DIFF: https://github.com/llvm/llvm-project/commit/916cdc3d4b66cf9658280cccb69a56eb6b403cdf.diff
LOG: [NFC][X86] combineX86ShuffleChain(): rename inner Mask to avoid future shadowing
I want to hoist `Mask` variable higher up,
but then it would clash with this one.
So let's rename this one first.
There are no other intentional changes here other than said rename.
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index b435f13632c7..a8355c986909 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -35889,22 +35889,23 @@ static SDValue combineX86ShuffleChain(ArrayRef<SDValue> Inputs, SDValue Root,
}
// Narrow shuffle mask to v4x128.
- SmallVector<int, 4> Mask;
+ SmallVector<int, 4> ScaledMask;
assert((BaseMaskEltSizeInBits % 128) == 0 && "Illegal mask size");
- narrowShuffleMaskElts(BaseMaskEltSizeInBits / 128, BaseMask, Mask);
+ narrowShuffleMaskElts(BaseMaskEltSizeInBits / 128, BaseMask, ScaledMask);
// Try to lower to vshuf64x2/vshuf32x4.
- auto MatchSHUF128 = [&](MVT ShuffleVT, const SDLoc &DL, ArrayRef<int> Mask,
- SDValue V1, SDValue V2, SelectionDAG &DAG) {
+ auto MatchSHUF128 = [&](MVT ShuffleVT, const SDLoc &DL,
+ ArrayRef<int> ScaledMask, SDValue V1, SDValue V2,
+ SelectionDAG &DAG) {
unsigned PermMask = 0;
// Insure elements came from the same Op.
SDValue Ops[2] = {DAG.getUNDEF(ShuffleVT), DAG.getUNDEF(ShuffleVT)};
for (int i = 0; i < 4; ++i) {
- assert(Mask[i] >= -1 && "Illegal shuffle sentinel value");
- if (Mask[i] < 0)
+ assert(ScaledMask[i] >= -1 && "Illegal shuffle sentinel value");
+ if (ScaledMask[i] < 0)
continue;
- SDValue Op = Mask[i] >= 4 ? V2 : V1;
+ SDValue Op = ScaledMask[i] >= 4 ? V2 : V1;
unsigned OpIndex = i / 2;
if (Ops[OpIndex].isUndef())
Ops[OpIndex] = Op;
@@ -35914,7 +35915,7 @@ static SDValue combineX86ShuffleChain(ArrayRef<SDValue> Inputs, SDValue Root,
// Convert the 128-bit shuffle mask selection values into 128-bit
// selection bits defined by a vshuf64x2 instruction's immediate control
// byte.
- PermMask |= (Mask[i] % 4) << (i * 2);
+ PermMask |= (ScaledMask[i] % 4) << (i * 2);
}
return DAG.getNode(X86ISD::SHUF128, DL, ShuffleVT,
@@ -35926,18 +35927,20 @@ static SDValue combineX86ShuffleChain(ArrayRef<SDValue> Inputs, SDValue Root,
// FIXME: Is there a better way to do this? is256BitLaneRepeatedShuffleMask
// doesn't work because our mask is for 128 bits and we don't have an MVT
// to match that.
- bool PreferPERMQ =
- UnaryShuffle && isUndefOrInRange(Mask[0], 0, 2) &&
- isUndefOrInRange(Mask[1], 0, 2) && isUndefOrInRange(Mask[2], 2, 4) &&
- isUndefOrInRange(Mask[3], 2, 4) &&
- (Mask[0] < 0 || Mask[2] < 0 || Mask[0] == (Mask[2] % 2)) &&
- (Mask[1] < 0 || Mask[3] < 0 || Mask[1] == (Mask[3] % 2));
-
- if (!isAnyZero(Mask) && !PreferPERMQ) {
+ bool PreferPERMQ = UnaryShuffle && isUndefOrInRange(ScaledMask[0], 0, 2) &&
+ isUndefOrInRange(ScaledMask[1], 0, 2) &&
+ isUndefOrInRange(ScaledMask[2], 2, 4) &&
+ isUndefOrInRange(ScaledMask[3], 2, 4) &&
+ (ScaledMask[0] < 0 || ScaledMask[2] < 0 ||
+ ScaledMask[0] == (ScaledMask[2] % 2)) &&
+ (ScaledMask[1] < 0 || ScaledMask[3] < 0 ||
+ ScaledMask[1] == (ScaledMask[3] % 2));
+
+ if (!isAnyZero(ScaledMask) && !PreferPERMQ) {
if (Depth == 0 && Root.getOpcode() == X86ISD::SHUF128)
return SDValue(); // Nothing to do!
MVT ShuffleVT = (FloatDomain ? MVT::v8f64 : MVT::v8i64);
- if (SDValue V = MatchSHUF128(ShuffleVT, DL, Mask, V1, V2, DAG))
+ if (SDValue V = MatchSHUF128(ShuffleVT, DL, ScaledMask, V1, V2, DAG))
return DAG.getBitcast(RootVT, V);
}
}
More information about the llvm-commits
mailing list