[X86] matchBinaryShuffle - limit SHUFFLE(X,Y) -> OR(X,Y) cases to where X + Y are the same width as the result

Minor bit of prep work toward not unnecessarily widening shuffle operands in combineX86ShufflesRecursively, instead only widening in combineX86ShuffleChain if we actual find a match - see Issue #45319
This commit is contained in:
Simon Pilgrim 2022-07-23 16:56:39 +01:00
parent b35e0d0cf3
commit 676a03d8a5
1 changed files with 5 additions and 1 deletions

View File

@ -37421,6 +37421,7 @@ static bool matchBinaryShuffle(MVT MaskVT, ArrayRef<int> Mask,
bool IsUnary) { bool IsUnary) {
unsigned NumMaskElts = Mask.size(); unsigned NumMaskElts = Mask.size();
unsigned EltSizeInBits = MaskVT.getScalarSizeInBits(); unsigned EltSizeInBits = MaskVT.getScalarSizeInBits();
unsigned SizeInBits = MaskVT.getSizeInBits();
if (MaskVT.is128BitVector()) { if (MaskVT.is128BitVector()) {
if (isTargetShuffleEquivalent(MaskVT, Mask, {0, 0}, DAG) && if (isTargetShuffleEquivalent(MaskVT, Mask, {0, 0}, DAG) &&
@ -37488,7 +37489,10 @@ static bool matchBinaryShuffle(MVT MaskVT, ArrayRef<int> Mask,
// Attempt to match against a OR if we're performing a blend shuffle and the // Attempt to match against a OR if we're performing a blend shuffle and the
// non-blended source element is zero in each case. // non-blended source element is zero in each case.
if ((EltSizeInBits % V1.getScalarValueSizeInBits()) == 0 && // TODO: Handle cases where V1/V2 sizes doesn't match SizeInBits.
if (SizeInBits == V1.getValueSizeInBits() &&
SizeInBits == V2.getValueSizeInBits() &&
(EltSizeInBits % V1.getScalarValueSizeInBits()) == 0 &&
(EltSizeInBits % V2.getScalarValueSizeInBits()) == 0) { (EltSizeInBits % V2.getScalarValueSizeInBits()) == 0) {
bool IsBlend = true; bool IsBlend = true;
unsigned NumV1Elts = V1.getValueType().getVectorNumElements(); unsigned NumV1Elts = V1.getValueType().getVectorNumElements();