Skip to content

Commit ced1f50

Browse files
authored
[X86] IsElementEquivalent - pull out exact matching for same index/op. (#143367)
The types must still be vectors matching MaskSize
1 parent b3b8a09 commit ced1f50

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9790,6 +9790,10 @@ static bool IsElementEquivalent(int MaskSize, SDValue Op, SDValue ExpectedOp,
97909790
(int)ExpectedVT.getVectorNumElements() != MaskSize)
97919791
return false;
97929792

9793+
// Exact match.
9794+
if (Idx == ExpectedIdx && Op == ExpectedOp)
9795+
return true;
9796+
97939797
switch (Op.getOpcode()) {
97949798
case ISD::BUILD_VECTOR:
97959799
// If the values are build vectors, we can look through them to find
@@ -9837,8 +9841,7 @@ static bool IsElementEquivalent(int MaskSize, SDValue Op, SDValue ExpectedOp,
98379841
SmallVector<int, 8> Mask;
98389842
DecodeVPERMMask(MaskSize, Op.getConstantOperandVal(1), Mask);
98399843
SDValue Src = Op.getOperand(0);
9840-
return (Mask[Idx] == Mask[ExpectedIdx]) ||
9841-
IsElementEquivalent(MaskSize, Src, Src, Mask[Idx],
9844+
return IsElementEquivalent(MaskSize, Src, Src, Mask[Idx],
98429845
Mask[ExpectedIdx]);
98439846
}
98449847
break;

0 commit comments

Comments
 (0)