[llvm] [WIP][DAG] Add legalization handling for AVGCEIL/AVGFLOOR nodes (PR #92096)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 08:02:46 PDT 2024


================
@@ -5234,6 +5234,20 @@ SDValue DAGCombiner::visitAVG(SDNode *N) {
   if (N0 == N1 && Level >= AfterLegalizeTypes)
     return N0;
 
+  // Fold avgflooru(x,c) -> avgceilu(x,c-1)
+  // iff c > 0 and avgflooru isn't legal/custom but avgceilu is.
----------------
RKSimon wrote:

Its purely to get around x86 regressions (which only has avgceilu) - we can add other equivalences if there are other targets don't have all the avg variants.

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


More information about the llvm-commits mailing list