Add a DAGCombine to turn (ctpop x) u< 2 into (x & x-1) == 0.
authorBenjamin Kramer <benny.kra@googlemail.com>
Mon, 17 Jan 2011 12:04:57 +0000 (12:04 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Mon, 17 Jan 2011 12:04:57 +0000 (12:04 +0000)
commitd8228924556d3c465da5b858c620b29fd1cf298e
tree76f23c5534b12780db45975b1f85f6f077fc77b6
parent8702e8be8df5f2ba12ecc89580d5e7453a1a39cd
Add a DAGCombine to turn (ctpop x) u< 2 into (x & x-1) == 0.

This shaves off 4 popcounts from the hacked 186.crafty source.

This is enabled even when a native popcount instruction is available. The
combined code is one operation longer but it should be faster nevertheless.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123621 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/TargetLowering.cpp
test/CodeGen/X86/ctpop-combine.ll [new file with mode: 0644]