Skip to content

Commit 1d2ede8

Browse files
committed
[X86][AVX] Move lowerShuffleWithVPMOV inside explicit shuffle lowering cases
Perform lowerShuffleWithVPMOV as part of the v16i8/v8i16 shuffle lowering stages, which are the only types that are currently supported. We need to expand support for lowering shuffles as truncations to fix the remaining regressions in D66004
1 parent cd2139a commit 1d2ede8

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11329,8 +11329,7 @@ static SDValue lowerShuffleWithVPMOV(const SDLoc &DL, ArrayRef<int> Mask,
1132911329
MVT VT, SDValue V1, SDValue V2,
1133011330
SelectionDAG &DAG,
1133111331
const X86Subtarget &Subtarget) {
11332-
if (VT != MVT::v16i8 && VT != MVT::v8i16)
11333-
return SDValue();
11332+
assert((VT == MVT::v16i8 || VT == MVT::v8i16) && "Unexpected VTRUNC type");
1133411333

1133511334
if (Mask.size() != VT.getVectorNumElements())
1133611335
return SDValue();
@@ -14732,6 +14731,11 @@ static SDValue lowerV8I16Shuffle(const SDLoc &DL, ArrayRef<int> Mask,
1473214731
Zeroable, Subtarget, DAG))
1473314732
return ZExt;
1473414733

14734+
// Try to use lower using a truncation.
14735+
if (SDValue V =
14736+
lowerShuffleWithVPMOV(DL, Mask, MVT::v8i16, V1, V2, DAG, Subtarget))
14737+
return V;
14738+
1473514739
int NumV2Inputs = count_if(Mask, [](int M) { return M >= 8; });
1473614740

1473714741
if (NumV2Inputs == 0) {
@@ -14916,6 +14920,11 @@ static SDValue lowerV16I8Shuffle(const SDLoc &DL, ArrayRef<int> Mask,
1491614920
Zeroable, Subtarget, DAG))
1491714921
return ZExt;
1491814922

14923+
// Try to use lower using a truncation.
14924+
if (SDValue V =
14925+
lowerShuffleWithVPMOV(DL, Mask, MVT::v16i8, V1, V2, DAG, Subtarget))
14926+
return V;
14927+
1491914928
// See if we can use SSE4A Extraction / Insertion.
1492014929
if (Subtarget.hasSSE4A())
1492114930
if (SDValue V = lowerShuffleWithSSE4A(DL, MVT::v16i8, V1, V2, Mask,
@@ -18003,9 +18012,6 @@ static SDValue lowerVECTOR_SHUFFLE(SDValue Op, const X86Subtarget &Subtarget,
1800318012
std::swap(V1, V2);
1800418013
}
1800518014

18006-
if (SDValue V = lowerShuffleWithVPMOV(DL, Mask, VT, V1, V2, DAG, Subtarget))
18007-
return V;
18008-
1800918015
// For each vector width, delegate to a specialized lowering routine.
1801018016
if (VT.is128BitVector())
1801118017
return lower128BitShuffle(DL, Mask, VT, V1, V2, Zeroable, Subtarget, DAG);

0 commit comments

Comments
 (0)