[llvm] [RISCV][WIP] Optimize sum of absolute differences pattern. (PR #82722)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 23 12:29:22 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
----------------
topperc wrote:
For the workload in question we can pull that vext.vf2 through through the chain of adds that sums the absolute difference pieces. We could use an i16 accumulator for the beginning of the chain and switch to an i32 accumulator later in the chain.
Naive use of the computeKnownBits could get us some of that to prove the overflows don't happen. Need to check the l length of the chain in the workload to see if that would exceed computeKnownBits depth limit.
https://github.com/llvm/llvm-project/pull/82722
More information about the llvm-commits
mailing list