https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97759
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |crazylht at gmail dot com Target| |x86_64-*-* i?86-*-* --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- I think using popcount () in the standard library is reasonable and instead GCC should eventually optimize popcount () == 1 during RTL expansion. An alternative would be to add an explicit __builtin_is_pow2 (). Note matching popcount (x) == 1 || x == 0 for the simple arithmetic trick would be always good IMHO.