[llvm] [RISCV][WIP] Optimize sum of absolute differences pattern. (PR #82722)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 26 22:20:23 PST 2024


================
@@ -13176,6 +13176,61 @@ static SDValue performXORCombine(SDNode *N, SelectionDAG &DAG,
   return combineSelectAndUseCommutative(N, DAG, /*AllOnes*/ false, Subtarget);
 }
 
+// Look for (abs (sub (zext X), (zext Y))).
+// Rewrite as (zext (sub (zext (max X, Y), (min X, Y)))) if the user is an add
----------------
lukel97 wrote:

Is lowering (abs (sub X, Y)) to (sub (umax x, y), (umin x, y)) worthwhile doing on its own, ignoring pulling through the zexts for now?

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


More information about the llvm-commits mailing list