[PATCH] D89952: [SelectionDAG] Enable CTPOP optimization fine tuning

David Zarzycki via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 27 06:35:49 PDT 2020


davezarzycki added a comment.

In D89952#2356168 <https://reviews.llvm.org/D89952#2356168>, @spatel wrote:

> In D89952#2355869 <https://reviews.llvm.org/D89952#2355869>, @davezarzycki wrote:
>
>> Hi @spatel – We can certainly remove the code gen tests that should have been handled by earlier optimization passes. Thanks for working on those. :-)
>>
>> As to the use case, I have AVX512 machines without BITALG/VPOPCNTDQ and a program that is doing hamming distance checks in critical sections. I.e. lots of low numbered "popcnt(x) < smallNumber" kind of checks that would be more efficiently implemented as a chain of legal "x & (x - 1)" instructions instead of the current/custom POPCNT emulation logic. This is especially true on my Knights Landing test box, which lacks AVX512BW and falling back to AVX2 to emulate VPOPCNTDQ is quite expensive.
>
> Ok - I have no doubts that there are cases we can optimize better. It would be great to see 1 or more reduced examples of these code patterns in source code. That way, we can confirm that we're not still missing any pre-codegen optimizations . Can you file a bug to show that?

I added another example to the original bug: https://bugs.llvm.org/show_bug.cgi?id=47825

I think pre codegen just needs to worry about the boundary conditions: comparisons effectively against zero and comparisons effectively >= element/scalar bit size.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89952



More information about the llvm-commits mailing list