@@ -39827,7 +39827,6 @@ static SDValue combineX86ShuffleChain(
39827
39827
39828
39828
// If we're inserting the low subvector, an insert-subvector 'concat'
39829
39829
// pattern is quicker than VPERM2X128.
39830
- // TODO: Add AVX2 support instead of VPERMQ/VPERMPD.
39831
39830
if (BaseMask[0] == 0 && (BaseMask[1] == 0 || BaseMask[1] == 2) &&
39832
39831
!Subtarget.hasAVX2()) {
39833
39832
if (Depth == 0 && RootOpc == ISD::INSERT_SUBVECTOR)
@@ -39838,15 +39837,15 @@ static SDValue combineX86ShuffleChain(
39838
39837
return insertSubVector(Lo, Hi, NumRootElts / 2, DAG, DL, 128);
39839
39838
}
39840
39839
39841
- if (Depth == 0 && RootOpc == X86ISD::VPERM2X128)
39842
- return SDValue(); // Nothing to do!
39843
-
39844
- // If we have AVX2, prefer to use VPERMQ/VPERMPD for unary shuffles unless
39845
- // we need to use the zeroing feature.
39840
+ // Don't lower to VPERM2X128 here if we have AVX2+, prefer to use
39841
+ // VPERMQ/VPERMPD for unary shuffles unless we need to use the zeroing
39842
+ // feature.
39846
39843
// Prefer blends for sequential shuffles unless we are optimizing for size.
39847
39844
if (UnaryShuffle &&
39848
39845
!(Subtarget.hasAVX2() && isUndefOrInRange(Mask, 0, 2)) &&
39849
39846
(OptForSize || !isSequentialOrUndefOrZeroInRange(Mask, 0, 2, 0))) {
39847
+ if (Depth == 0 && RootOpc == X86ISD::VPERM2X128)
39848
+ return SDValue(); // Nothing to do!
39850
39849
unsigned PermMask = 0;
39851
39850
PermMask |= ((Mask[0] < 0 ? 0x8 : (Mask[0] & 1)) << 0);
39852
39851
PermMask |= ((Mask[1] < 0 ? 0x8 : (Mask[1] & 1)) << 4);
@@ -39864,6 +39863,8 @@ static SDValue combineX86ShuffleChain(
39864
39863
"Unexpected shuffle sentinel value");
39865
39864
// Prefer blends to X86ISD::VPERM2X128.
39866
39865
if (!((Mask[0] == 0 && Mask[1] == 3) || (Mask[0] == 2 && Mask[1] == 1))) {
39866
+ if (Depth == 0 && RootOpc == X86ISD::VPERM2X128)
39867
+ return SDValue(); // Nothing to do!
39867
39868
unsigned PermMask = 0;
39868
39869
PermMask |= ((Mask[0] & 3) << 0);
39869
39870
PermMask |= ((Mask[1] & 3) << 4);
0 commit comments