[PATCH] D32605: Recognize CTLZ builtin

Evgeny Stupachenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 27 14:08:06 PDT 2017


evstupac added a comment.

In https://reviews.llvm.org/D32605#739907, @hfinkel wrote:

> We could add a TTI callback like we have for popcnt. You could also argue that this is the better canonical form because it can enable other analysis/optimizations (and we should fix the expansion if it is suboptimal).


I also feel like "not a perfect expand" for particular CPU is the issue that should be resolved by CPU owner.
Besides converting to countable loop we also get:

1. Clear range for lzct result (from 0 to bitwidth).
2. Some Combine optimizations that can apply.
3. An ability to expand intrinsic to the most profitable way for each CPU.

Guarding is easier. Let's do this only if someone complains about performance.


Repository:
  rL LLVM

https://reviews.llvm.org/D32605





More information about the llvm-commits mailing list