[llvm] [X86] combineBasicSADPattern - pattern match various vXi8 ABDU patterns (PR #147570)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 8 23:25:16 PDT 2025


================
@@ -46399,20 +46397,27 @@ static SDValue combineBasicSADPattern(SDNode *Extract, SelectionDAG &DAG,
       Root.getOpcode() == ISD::ANY_EXTEND)
     Root = Root.getOperand(0);
 
-  // Check whether we have an abdu pattern.
-  // TODO: Add handling for ISD::ABDU.
-  SDValue Zext0, Zext1;
+  // Check whether we have an vXi8 abdu pattern.
+  // TODO: Just match ISD::ABDU once the DAG is topological sorted.
+  SDValue Src0, Src1;
   if (!sd_match(
           Root,
-          m_Abs(m_Sub(m_AllOf(m_Value(Zext0),
-                              m_ZExt(m_SpecificVectorElementVT(MVT::i8))),
-                      m_AllOf(m_Value(Zext1),
-                              m_ZExt(m_SpecificVectorElementVT(MVT::i8)))))))
+          m_AnyOf(
+              m_SpecificVectorElementVT(
+                  MVT::i8, m_c_BinOp(ISD::ABDU, m_Value(Src0), m_Value(Src1))),
----------------
RKSimon wrote:

All 3 can be used with current trunk / test coverage, but when i finally get topological dag done the ISD::ABDU  case alone will be enough. I'm making quite a bit of progress with topological sorting now that the multiple freeze limit has gone, but there's still a lot to do.

https://github.com/llvm/llvm-project/pull/147570


More information about the llvm-commits mailing list