This is the mail archive of the gcc-patches@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]

Re: floor_log2_wide speedup


> 
> 
> > If you want to micro-optimize this, you should be using __builtin_clz /
> > __builtin_clzl / __builtin_clzll when building with GCC versions that
> > support them, to get an expansion to a single instruction where available
> > on the host system.
> 
> My latest floor_log2 testcase.  Note that we rely on the table lookup
> in longlong.h for chips without a clz opcode.  Is there no way to
> detect when this will happen, or do we need to optimize that logic
> also?
> 

What about changing this into a static inline function and put it into
toplev.h, this way the compiler can optimize the function call out if
the instuction is implemented otherwise we would than just call the
function in libgcc.c as a libcall.

Thanks,
Andrew Pinski


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