Skip to content

Commit 916cdc3

Browse files
committed
[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.
1 parent 40650f2 commit 916cdc3

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35889,22 +35889,23 @@ static SDValue combineX86ShuffleChain(ArrayRef<SDValue> Inputs, SDValue Root,
3588935889
}
3589035890

3589135891
// Narrow shuffle mask to v4x128.
35892-
SmallVector<int, 4> Mask;
35892+
SmallVector<int, 4> ScaledMask;
3589335893
assert((BaseMaskEltSizeInBits % 128) == 0 && "Illegal mask size");
35894-
narrowShuffleMaskElts(BaseMaskEltSizeInBits / 128, BaseMask, Mask);
35894+
narrowShuffleMaskElts(BaseMaskEltSizeInBits / 128, BaseMask, ScaledMask);
3589535895

3589635896
// Try to lower to vshuf64x2/vshuf32x4.
35897-
auto MatchSHUF128 = [&](MVT ShuffleVT, const SDLoc &DL, ArrayRef<int> Mask,
35898-
SDValue V1, SDValue V2, SelectionDAG &DAG) {
35897+
auto MatchSHUF128 = [&](MVT ShuffleVT, const SDLoc &DL,
35898+
ArrayRef<int> ScaledMask, SDValue V1, SDValue V2,
35899+
SelectionDAG &DAG) {
3589935900
unsigned PermMask = 0;
3590035901
// Insure elements came from the same Op.
3590135902
SDValue Ops[2] = {DAG.getUNDEF(ShuffleVT), DAG.getUNDEF(ShuffleVT)};
3590235903
for (int i = 0; i < 4; ++i) {
35903-
assert(Mask[i] >= -1 && "Illegal shuffle sentinel value");
35904-
if (Mask[i] < 0)
35904+
assert(ScaledMask[i] >= -1 && "Illegal shuffle sentinel value");
35905+
if (ScaledMask[i] < 0)
3590535906
continue;
3590635907

35907-
SDValue Op = Mask[i] >= 4 ? V2 : V1;
35908+
SDValue Op = ScaledMask[i] >= 4 ? V2 : V1;
3590835909
unsigned OpIndex = i / 2;
3590935910
if (Ops[OpIndex].isUndef())
3591035911
Ops[OpIndex] = Op;
@@ -35914,7 +35915,7 @@ static SDValue combineX86ShuffleChain(ArrayRef<SDValue> Inputs, SDValue Root,
3591435915
// Convert the 128-bit shuffle mask selection values into 128-bit
3591535916
// selection bits defined by a vshuf64x2 instruction's immediate control
3591635917
// byte.
35917-
PermMask |= (Mask[i] % 4) << (i * 2);
35918+
PermMask |= (ScaledMask[i] % 4) << (i * 2);
3591835919
}
3591935920

3592035921
return DAG.getNode(X86ISD::SHUF128, DL, ShuffleVT,
@@ -35926,18 +35927,20 @@ static SDValue combineX86ShuffleChain(ArrayRef<SDValue> Inputs, SDValue Root,
3592635927
// FIXME: Is there a better way to do this? is256BitLaneRepeatedShuffleMask
3592735928
// doesn't work because our mask is for 128 bits and we don't have an MVT
3592835929
// to match that.
35929-
bool PreferPERMQ =
35930-
UnaryShuffle && isUndefOrInRange(Mask[0], 0, 2) &&
35931-
isUndefOrInRange(Mask[1], 0, 2) && isUndefOrInRange(Mask[2], 2, 4) &&
35932-
isUndefOrInRange(Mask[3], 2, 4) &&
35933-
(Mask[0] < 0 || Mask[2] < 0 || Mask[0] == (Mask[2] % 2)) &&
35934-
(Mask[1] < 0 || Mask[3] < 0 || Mask[1] == (Mask[3] % 2));
35935-
35936-
if (!isAnyZero(Mask) && !PreferPERMQ) {
35930+
bool PreferPERMQ = UnaryShuffle && isUndefOrInRange(ScaledMask[0], 0, 2) &&
35931+
isUndefOrInRange(ScaledMask[1], 0, 2) &&
35932+
isUndefOrInRange(ScaledMask[2], 2, 4) &&
35933+
isUndefOrInRange(ScaledMask[3], 2, 4) &&
35934+
(ScaledMask[0] < 0 || ScaledMask[2] < 0 ||
35935+
ScaledMask[0] == (ScaledMask[2] % 2)) &&
35936+
(ScaledMask[1] < 0 || ScaledMask[3] < 0 ||
35937+
ScaledMask[1] == (ScaledMask[3] % 2));
35938+
35939+
if (!isAnyZero(ScaledMask) && !PreferPERMQ) {
3593735940
if (Depth == 0 && Root.getOpcode() == X86ISD::SHUF128)
3593835941
return SDValue(); // Nothing to do!
3593935942
MVT ShuffleVT = (FloatDomain ? MVT::v8f64 : MVT::v8i64);
35940-
if (SDValue V = MatchSHUF128(ShuffleVT, DL, Mask, V1, V2, DAG))
35943+
if (SDValue V = MatchSHUF128(ShuffleVT, DL, ScaledMask, V1, V2, DAG))
3594135944
return DAG.getBitcast(RootVT, V);
3594235945
}
3594335946
}

0 commit comments

Comments
 (0)