[llvm] [WIP][DAG] Add legalization handling for AVGCEIL/AVGFLOOR nodes (PR #92096)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Wed May 15 07:57:48 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.
----------------
jayfoad wrote:
Is this a quirk of some specific target? Otherwise, why not do this for the signed cases too, and do the opposite fold from ceil -> floor?
https://github.com/llvm/llvm-project/pull/92096
More information about the llvm-commits
mailing list