This is the mail archive of the 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: Use floor functions not __floor functions in glibc libm

On Fri, 14 Sep 2018, Wilco Dijkstra wrote:

> Going via the PLT is expensive and it would be stupid to not inline simple
> functions like floor, lrint etc. I did a quick experiment on floorf: 
> On AArch64 a tight loop calling floorf is at least twice as fast than a library
> call. On x64 the PLT overhead is at least 2.5 times.
> The SSE2 floor instruction is twice as slow as the SSE4 version, however
> due to the high PLT call overhead, inlining the SSE2 version is still 25%
> faster than calling floorf using the SSE4 instruction. So inlining these
> functions is always better.

Thanks for the benchmarking - I've now committed the floor and rint 
patches.  (Three more will be needed to deal with round / trunc / ceil 
where the __* variants have macros in the powerpc math_private.h.  Once 
that's been done and copysign has been dealt with as well, it will be 
possible to look for and remove unused math_private.h includes based on an 
actual set of APIs provided by math_private.h - and with the expectation 
that wrongly removing an include will result in a build failure - rather 
than needing to allow for those __* macros where removing an include could 
result in less efficient code but no build failure.)

Joseph S. Myers

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