[PATCH] D125755: [AggressiveInstcombine] Conditionally fold saturated fptosi to llvm.fptosi.sat

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 25 11:58:40 PDT 2022


efriedma added a comment.

In summary, the cost of a saturating fptosi vs. plain fptosi+min+max varies so much across targets that that we need two canonical forms: one for targets where saturating fptosi with the given types is cheap, and one for targets where it isn't.  I guess that conclusion is fine, but we should state it in a comment in the code, so it's clear why we're cost-modeling this.

I'm not sure how D113291 <https://reviews.llvm.org/D113291> is related to that conclusion, though. The cost of llvm.cttz should be the the same as, or cheaper than, a table lookup.  Worst case, SelectionDAG emits a table lookup itself.  (SelectionDAG currently doesn't have code to emit a table lookup, I think, but that's straightforward to change.)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125755/new/

https://reviews.llvm.org/D125755



More information about the llvm-commits mailing list