[PATCH] D32605: Recognize CTLZ builtin

Evgeny Stupachenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 9 12:42:29 PDT 2017


evstupac added a comment.

I thought everybody agreed on the following.

In https://reviews.llvm.org/D32605#740041, @evstupac wrote:

> 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