]> git.ipfire.org Git - thirdparty/gcc.git/commit
get_known_nonzero_bits_1 should use wi::bit_and_not [PR118659]
authorAndrew Pinski <quic_apinski@quicinc.com>
Thu, 1 May 2025 07:14:27 +0000 (00:14 -0700)
committerAndrew Pinski <quic_apinski@quicinc.com>
Fri, 2 May 2025 06:49:16 +0000 (23:49 -0700)
commitadefadda3e87f693f20f0b2b34bced00aa525207
tree530610709b233c223e4f822caf46f773b51a3424
parent5d5bed0caef4570c255f35343be00e314dd8a08d
get_known_nonzero_bits_1 should use wi::bit_and_not [PR118659]

While looking into bitwise optimizations, I noticed that
get_known_nonzero_bits_1 does `bm.value () & ~bm.mask ()` which
is ok except it creates a temporary wide_int. Instead if we
use wi::bit_and_not, we can avoid the temporary and on some
targets use the andn/bic instruction.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

PR tree-optimization/118659
* tree-ssanames.cc (get_known_nonzero_bits_1): Use
wi::bit_and_not instead of `a & ~b`.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/tree-ssanames.cc