[llvm] [SDAG] Shrink (abds (sext x) (sext y)) (PR #171865)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 11 09:48:22 PST 2025


================
@@ -5787,6 +5776,20 @@ SDValue DAGCombiner::visitABD(SDNode *N) {
       DAG.SignBitIsZero(N0) && DAG.SignBitIsZero(N1))
     return DAG.getNode(ISD::ABDU, DL, VT, N1, N0);
 
+  // fold (abds (sext x), (sext y)) -> (zext (abds x, y))
+  if (sd_match(N,
+               m_c_BinOp(ISD::ABDS, m_SExt(m_Value(X)), m_SExt(m_Value(Y)))) &&
+      X.getValueType() == Y.getValueType()) {
----------------
natanelh-mobileye wrote:

done

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


More information about the llvm-commits mailing list