[Bug middle-end/126634] hwint.h pow2_or_zerop/pow2p_hwi could use popcount_hwi if supported.
"jakub at gcc dot gnu.org via Gcc-bugs" <[email protected]> Tue, 04 Aug 2026 11:31:24 +0000
| Newsgroups | gmane.comp.gcc.bugs |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D126634
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Why do you think it is a good idea? It seems exact deoptimization in the
common case.
popcount on many hosts is even a library call and even if it is not, popcou=
nt
instruction is rarely a win over what least_bit_hwi does.
Only gcc r14-5612 and newer can actually optimize __builtin_popcountll (x) =
=3D=3D 1
back to something smarter.=