Skip to content

Commit 10f23d1

Browse files
committed
[X86] matchPMADDWD/matchPMADDWD_2 - update to use m_ExtractElt matchers. NFC.
1 parent 0ae75eb commit 10f23d1

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -56568,14 +56568,11 @@ static SDValue matchPMADDWD(SelectionDAG &DAG, SDNode *N,
5656856568
Op0H = Op0->getOperand(i + 1), Op1H = Op1->getOperand(i + 1);
5656956569
// TODO: Be more tolerant to undefs.
5657056570
APInt Idx0L, Idx0H, Idx1L, Idx1H;
56571-
if (!sd_match(Op0L, m_BinOp(ISD::EXTRACT_VECTOR_ELT, m_Value(),
56572-
m_ConstInt(Idx0L))) ||
56573-
!sd_match(Op0H, m_BinOp(ISD::EXTRACT_VECTOR_ELT, m_Value(),
56574-
m_ConstInt(Idx0H))) ||
56575-
!sd_match(Op1L, m_BinOp(ISD::EXTRACT_VECTOR_ELT, m_Value(),
56576-
m_ConstInt(Idx1L))) ||
56577-
!sd_match(Op1H, m_BinOp(ISD::EXTRACT_VECTOR_ELT, m_Value(),
56578-
m_ConstInt(Idx1H))))
56571+
SDValue Vec0L, Vec0H, Vec1L, Vec1H;
56572+
if (!sd_match(Op0L, m_ExtractElt(m_Value(Vec0L), m_ConstInt(Idx0L))) ||
56573+
!sd_match(Op0H, m_ExtractElt(m_Value(Vec0H), m_ConstInt(Idx0H))) ||
56574+
!sd_match(Op1L, m_ExtractElt(m_Value(Vec1L), m_ConstInt(Idx1L))) ||
56575+
!sd_match(Op1H, m_ExtractElt(m_Value(Vec1H), m_ConstInt(Idx1H))))
5657956576
return SDValue();
5658056577
// Commutativity of mul allows factors of a product to reorder.
5658156578
if (Idx0L.getZExtValue() > Idx1L.getZExtValue())
@@ -56594,14 +56591,13 @@ static SDValue matchPMADDWD(SelectionDAG &DAG, SDNode *N,
5659456591
// First time an extract_elt's source vector is visited. Must be a MUL
5659556592
// with 2X number of vector elements than the BUILD_VECTOR.
5659656593
// Both extracts must be from same MUL.
56597-
Mul = Op0L->getOperand(0);
56598-
if (Mul->getOpcode() != ISD::MUL ||
56594+
Mul = Vec0L;
56595+
if (Mul.getOpcode() != ISD::MUL ||
5659956596
Mul.getValueType().getVectorNumElements() != 2 * e)
5660056597
return SDValue();
5660156598
}
5660256599
// Check that the extract is from the same MUL previously seen.
56603-
if (Mul != Op0L->getOperand(0) || Mul != Op1L->getOperand(0) ||
56604-
Mul != Op0H->getOperand(0) || Mul != Op1H->getOperand(0))
56600+
if (Mul != Vec0L || Mul != Vec1L || Mul != Vec0H || Mul != Vec1H)
5660556601
return SDValue();
5660656602
}
5660756603

@@ -56681,14 +56677,10 @@ static SDValue matchPMADDWD_2(SelectionDAG &DAG, SDNode *N,
5668156677
// TODO: Be more tolerant to undefs.
5668256678
SDValue N00In, N01In, N10In, N11In;
5668356679
APInt IdxN00, IdxN01, IdxN10, IdxN11;
56684-
if (!sd_match(N00Elt, m_BinOp(ISD::EXTRACT_VECTOR_ELT, m_Value(N00In),
56685-
m_ConstInt(IdxN00))) ||
56686-
!sd_match(N01Elt, m_BinOp(ISD::EXTRACT_VECTOR_ELT, m_Value(N01In),
56687-
m_ConstInt(IdxN01))) ||
56688-
!sd_match(N10Elt, m_BinOp(ISD::EXTRACT_VECTOR_ELT, m_Value(N10In),
56689-
m_ConstInt(IdxN10))) ||
56690-
!sd_match(N11Elt, m_BinOp(ISD::EXTRACT_VECTOR_ELT, m_Value(N11In),
56691-
m_ConstInt(IdxN11))))
56680+
if (!sd_match(N00Elt, m_ExtractElt(m_Value(N00In), m_ConstInt(IdxN00))) ||
56681+
!sd_match(N01Elt, m_ExtractElt(m_Value(N01In), m_ConstInt(IdxN01))) ||
56682+
!sd_match(N10Elt, m_ExtractElt(m_Value(N10In), m_ConstInt(IdxN10))) ||
56683+
!sd_match(N11Elt, m_ExtractElt(m_Value(N11In), m_ConstInt(IdxN11))))
5669256684
return SDValue();
5669356685
// Add is commutative so indices can be reordered.
5669456686
if (IdxN00.getZExtValue() > IdxN10.getZExtValue()) {

0 commit comments

Comments
 (0)