[PATCH] D68189: [InstCombine] recognize popcount implemented in hacker's delight.

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 29 18:33:43 PDT 2019


shchenz added a comment.

In D68189#1687190 <https://reviews.llvm.org/D68189#1687190>, @xbolva00 wrote:

> >> Maybe we need to add TargetTransformInfo in InstCombiner to make sure this combination only happens when getPopcntSupport is true.
>
> Atleast on X86 it is not needed, since popcount expander expands intrinsic to exactly this pattern.
>
> https://godbolt.org/z/i-rswr


Thanks, yes it should be ok on powerpc and X86. But I am afraid there are some platforms which do not have hardware popcount, and we folding many arithmetical operations into one intrinsic, thus we may miss some combination/canonicalization opportunities for these arithmetical operations on such platform. I am not sure ^-^


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

https://reviews.llvm.org/D68189





More information about the llvm-commits mailing list