This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/72785] [7 Regression] kernel build error since r236831


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72785

--- Comment #16 from dhowells at redhat dot com <dhowells at redhat dot com> ---
I guess the following could be used:

    int clz_ilog2(unsigned long x)
    {
        return __builtin_clz(x);
    }

which compiles to:

0000000000000027 <clz_ilog2>:
  27:   0f bd c7                bsr    %edi,%eax
  2a:   83 f0 1f                xor    $0x1f,%eax
  2d:   c3                      retq   

though the XOR is superfluous - for any valid input to ilog2(), I think the
output is always in the range 0-31.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]