[llvm] [AArch64] Transform add(x, abs(y)) -> saba(x, y, 0) (PR #156615)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 3 05:48:27 PDT 2025


================
@@ -21913,6 +21914,56 @@ static SDValue performExtBinopLoadFold(SDNode *N, SelectionDAG &DAG) {
   return DAG.getNode(N->getOpcode(), DL, VT, Ext0, NShift);
 }
 
+// Transform the following:
+// - add(x, abs(y)) -> saba(x, y, 0)
+// - add(x, zext(abs(y))) -> sabal(x, y, 0)
+static SDValue performAddSABACombine(SDNode *N,
----------------
david-arm wrote:

Should we limit this to post-legalisation only or do we specifically want to catch cases pre-legalisation?

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


More information about the llvm-commits mailing list