[Bug middle-end/87528] Popcount changes caused 531.deepsjeng_r run-time regression on Skylake

jamborm at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Oct 8 10:46:00 GMT 2018


--- 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;

    return c;
with -O3.  Trunk generates a call to __popcountdi2 when GCC 7 (or
trunk with -march=skylake) does not.

More information about the Gcc-bugs mailing list