[PATCH] D113291: [AggressiveInstCombine] Lower Table Based CTTZ

Djordje Todorovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 15 00:05:01 PDT 2022


djtodoro added a comment.

In D113291#3569456 <https://reviews.llvm.org/D113291#3569456>, @gsocshubham wrote:

> In D113291#3569225 <https://reviews.llvm.org/D113291#3569225>, @djtodoro wrote:
>
>> In D113291#3569114 <https://reviews.llvm.org/D113291#3569114>, @gsocshubham wrote:
>>
>>> In D113291#3566581 <https://reviews.llvm.org/D113291#3566581>, @djtodoro wrote:
>>>
>>>> In D113291#3542941 <https://reviews.llvm.org/D113291#3542941>, @efriedma wrote:
>>>>
>>>>> Concretely, my preferred solution looks something like:
>>>>>
>>>>> 1. Perform the transform unconditionally in AggressiveInstCombine (so this patch without the preferCTTZLowering() bits).
>>>>
>>>> The latest update implements this.
>>>>
>>>>> 2. Teach TargetLowering::expandCTTZ to emit a table lookup.
>>>
>>> @djtodoro - Will you be sending patch for (2) "Teach TargetLowering::expandCTTZ to emit a table lookup."?
>>
>> Unfortunately, I don’t have time to do it right now. If you are interested, please go ahead with the implementation.
>
> @djtodoro - Sure. I am interested to do it. Can you elaborate (2) a bit in detail?

Basically this patch implements lowering of the table-based `cttz` implementation into `@llvm.cttz` unconditionally. For some targets it won't be that beneficial, so during the `TargetLowering::expandCTTZ` we should emit table lookup again. @efriedma May have something to add.


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

https://reviews.llvm.org/D113291



More information about the llvm-commits mailing list