[PATCH] D113291: [AggressiveInstCombine] Lower Table Based CTTZ and enable it for AARCH64 in -O3

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 26 11:04:43 PDT 2022


craig.topper added a comment.

In D113291#3539965 <https://reviews.llvm.org/D113291#3539965>, @efriedma wrote:

>> as for the second I'm not sure when it would be profitable to transform back and emit the table
>
> You really just have to weigh it against the current default expansion on targets where ctlz/cttz aren't legal, which is `popcount(v & -v)`.  It should be a straightforward comparison, generally.  If you have popcount, use it.  If multiply is legal, use a table lookup.  Otherwise... maybe stick with the popcount expansion?  Probably any approach is expensive at that point.

Note, the popcount expansion already uses a multiply without checking if it is legal.


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

https://reviews.llvm.org/D113291



More information about the llvm-commits mailing list