[PATCH] D63004: [TargetLowering] Simplify (ctpop x) == 1

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 10:06:28 PDT 2019


lebedev.ri added a comment.

In D63004#1534270 <https://reviews.llvm.org/D63004#1534270>, @xbolva00 wrote:

> Or should we prefer  (x-1) < (x & -x) ? This seems like a much faster choice.


I'm guessing lack of CTPOP also likely implies lack of BMI1? (`(x & x-1)` is a single `blsr` instruction)
While that second variant looks like it has simpler ir, the ask looks more complex in general, more arithmetic:
https://godbolt.org/z/iwIIKK


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

https://reviews.llvm.org/D63004





More information about the llvm-commits mailing list