diff options
author | Andrew Pinski <quic_apinski@quicinc.com> | 2025-05-01 00:14:27 -0700 |
---|---|---|
committer | Andrew Pinski <quic_apinski@quicinc.com> | 2025-05-01 23:49:16 -0700 |
commit | adefadda3e87f693f20f0b2b34bced00aa525207 (patch) | |
tree | 530610709b233c223e4f822caf46f773b51a3424 | |
parent | 5d5bed0caef4570c255f35343be00e314dd8a08d (diff) | |
download | gcc-adefadda3e87f693f20f0b2b34bced00aa525207.zip gcc-adefadda3e87f693f20f0b2b34bced00aa525207.tar.gz gcc-adefadda3e87f693f20f0b2b34bced00aa525207.tar.bz2 |
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>
-rw-r--r-- | gcc/tree-ssanames.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/tree-ssanames.cc b/gcc/tree-ssanames.cc index d7865f2..de7b9b7 100644 --- a/gcc/tree-ssanames.cc +++ b/gcc/tree-ssanames.cc @@ -576,7 +576,7 @@ get_known_nonzero_bits_1 (const_tree name) if (tmp.undefined_p ()) return wi::shwi (0, precision); irange_bitmask bm = tmp.get_bitmask (); - return bm.value () & ~bm.mask (); + return wi::bit_and_not (bm.value (), bm.mask ()); } /* Return a wide_int with known non-zero bits in SSA_NAME |