https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87528
--- Comment #5 from Martin Jambor <jamborm at gcc dot gnu.org> --- (In reply to Richard Biener from comment #3) > Can you point me to the source for which we generate the popcount call(s)? > It might be not final value replacement but instead code-generating a niter > analysis result. It turns out it is as simple as: ---------------------------------------- typedef unsigned long long BITBOARD; int PopCount (BITBOARD b) { int c = 0; while (b) { b &= b - 1; c++; } return c; } ---------------------------------------- with -O3. Trunk generates a call to __popcountdi2 when GCC 7 (or trunk with -march=skylake) does not.