@@ -46003,20 +46003,6 @@ static bool detectExtMul(SelectionDAG &DAG, const SDValue &Mul, SDValue &Op0,
46003
46003
return false;
46004
46004
}
46005
46005
46006
- // Given a ABS node, detect the following pattern:
46007
- // (ABS (SUB (ZERO_EXTEND a), (ZERO_EXTEND b))).
46008
- // This is useful as it is the input into a SAD pattern.
46009
- static bool detectZextAbsDiff(SDValue Abs, SDValue &Op0, SDValue &Op1) {
46010
- using namespace SDPatternMatch;
46011
-
46012
- // Check if the operands of the sub are zero-extended from vectors of i8.
46013
- return sd_match(
46014
- Abs,
46015
- m_Abs(m_Sub(
46016
- m_AllOf(m_Value(Op0), m_ZExt(m_SpecificVectorElementVT(MVT::i8))),
46017
- m_AllOf(m_Value(Op1), m_ZExt(m_SpecificVectorElementVT(MVT::i8))))));
46018
- }
46019
-
46020
46006
static SDValue createVPDPBUSD(SelectionDAG &DAG, SDValue LHS, SDValue RHS,
46021
46007
unsigned &LogBias, const SDLoc &DL,
46022
46008
const X86Subtarget &Subtarget) {
@@ -46379,6 +46365,8 @@ static SDValue combineVPDPBUSDPattern(SDNode *Extract, SelectionDAG &DAG,
46379
46365
46380
46366
static SDValue combineBasicSADPattern(SDNode *Extract, SelectionDAG &DAG,
46381
46367
const X86Subtarget &Subtarget) {
46368
+ using namespace SDPatternMatch;
46369
+
46382
46370
// PSADBW is only supported on SSE2 and up.
46383
46371
if (!Subtarget.hasSSE2())
46384
46372
return SDValue();
@@ -46399,8 +46387,7 @@ static SDValue combineBasicSADPattern(SDNode *Extract, SelectionDAG &DAG,
46399
46387
if (!Root)
46400
46388
return SDValue();
46401
46389
46402
- // The operand is expected to be zero extended from i8
46403
- // (verified in detectZextAbsDiff).
46390
+ // The operand is expected to be zero extended from i8.
46404
46391
// In order to convert to i64 and above, additional any/zero/sign
46405
46392
// extend is expected.
46406
46393
// The zero extend from 32 bit has no mathematical effect on the result.
@@ -46412,9 +46399,15 @@ static SDValue combineBasicSADPattern(SDNode *Extract, SelectionDAG &DAG,
46412
46399
Root.getOpcode() == ISD::ANY_EXTEND)
46413
46400
Root = Root.getOperand(0);
46414
46401
46415
- // Check whether we have an abs-diff pattern feeding into the select.
46402
+ // Check whether we have an abdu pattern.
46403
+ // TODO: Add handling for ISD::ABDU.
46416
46404
SDValue Zext0, Zext1;
46417
- if (!detectZextAbsDiff(Root, Zext0, Zext1))
46405
+ if (!sd_match(
46406
+ Root,
46407
+ m_Abs(m_Sub(m_AllOf(m_Value(Zext0),
46408
+ m_ZExt(m_SpecificVectorElementVT(MVT::i8))),
46409
+ m_AllOf(m_Value(Zext1),
46410
+ m_ZExt(m_SpecificVectorElementVT(MVT::i8)))))))
46418
46411
return SDValue();
46419
46412
46420
46413
// Create the SAD instruction.
0 commit comments