[llvm] [LV] Add support for absolute difference partial reductions (PR #188043)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 02:59:06 PDT 2026


================
@@ -6030,6 +6030,34 @@ optimizeExtendsForPartialReduction(VPSingleDefRecipe *BinOp,
     return BinOp;
   }
 
+  // reduce.add(abs(sub(ext(A), ext(B))))
+  // -> reduce.add(ext(absolute-difference(A, B)))
+  VPValue *X, *Y;
+  if (match(BinOp,
+            m_Intrinsic<Intrinsic::abs>(m_Sub(m_ZExtOrSExt(m_VPValue(X)),
----------------
MacDue wrote:

It can do (it should not make a functional difference though as the operand needs to be matched by `matchExtendedReductionOperand` first). 

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


More information about the llvm-commits mailing list