This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: Old compiler optimizations in installed headers


On Fri, May 22, 2015 at 03:03:01PM +0000, Joseph Myers wrote:
> We've recently had a discussion of whether it makes sense to keep various 
> macros and inline functions in bits/string2.h that are only used for old 
> GCC versions and only serve to optimize cases of small / constant 
> arguments with those versions.  A similar issue applies to such things as 
> inline __signbit* definitions in bits/mathinline.h - given 
> <https://sourceware.org/ml/libc-alpha/2015-05/msg00521.html> could we just 
> remove the various inlines on the basis that optimization for compilers 
> before GCC 4.0 isn't a concern - and probably to various other inlines.
> 
While good idea in general I would be wary of signbit et al. macros.
Using gcc will cause performance regression in some cases as they
generate suboptimal branchless code. Adding branches is correct as
performance savings from branchless code are in branch misprediction
which doesn't happen. If you have more than 5% inputs NaN to offset
single cycle penalty of going branchless your problem is that you are
producing garbage instead performance.


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