Skip to content

Commit 50dc09d

Browse files
committed
[X86] combineX86ShufflesRecursively - split the getTargetShuffleInputs call from the resolveTargetShuffleAndZeroables call.
Exposes an issue in getFauxShuffleMask where the OR(SHUFFLE,SHUFFLE) decode should always resolve zero/undef elements. Part of the fix for PR43024 where ideally we shouldn't call resolveTargetShuffleAndZeroables for Depth == 0 llvm-svn: 374928
1 parent c7ec51a commit 50dc09d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6932,9 +6932,9 @@ static bool getFauxShuffleMask(SDValue N, const APInt &DemandedElts,
69326932
SmallVector<int, 64> SrcMask0, SrcMask1;
69336933
SmallVector<SDValue, 2> SrcInputs0, SrcInputs1;
69346934
if (!getTargetShuffleInputs(N0, SrcInputs0, SrcMask0, DAG, Depth + 1,
6935-
ResolveKnownElts) ||
6935+
true) ||
69366936
!getTargetShuffleInputs(N1, SrcInputs1, SrcMask1, DAG, Depth + 1,
6937-
ResolveKnownElts))
6937+
true))
69386938
return false;
69396939
size_t MaskSize = std::max(SrcMask0.size(), SrcMask1.size());
69406940
SmallVector<int, 64> Mask0, Mask1;
@@ -33012,11 +33012,17 @@ static SDValue combineX86ShufflesRecursively(
3301233012
"Can only combine shuffles of the same vector register size.");
3301333013

3301433014
// Extract target shuffle mask and resolve sentinels and inputs.
33015+
// TODO - determine Op's demanded elts from RootMask.
3301533016
SmallVector<int, 64> OpMask;
3301633017
SmallVector<SDValue, 2> OpInputs;
33017-
if (!getTargetShuffleInputs(Op, OpInputs, OpMask, DAG, Depth))
33018+
APInt OpUndef, OpZero;
33019+
APInt OpDemandedElts = APInt::getAllOnesValue(VT.getVectorNumElements());
33020+
if (!getTargetShuffleInputs(Op, OpDemandedElts, OpInputs, OpMask, OpUndef,
33021+
OpZero, DAG, Depth, false))
3301833022
return SDValue();
3301933023

33024+
resolveTargetShuffleAndZeroables(OpMask, OpUndef, OpZero);
33025+
3302033026
// Add the inputs to the Ops list, avoiding duplicates.
3302133027
SmallVector<SDValue, 16> Ops(SrcOps.begin(), SrcOps.end());
3302233028

0 commit comments

Comments
 (0)