This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Use floor functions not __floor functions in glibc libm
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>
- Cc: nd <nd at arm dot com>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Date: Fri, 14 Sep 2018 13:17:10 +0000
- Subject: Re: Use floor functions not __floor functions in glibc libm
- References: <HE1PR08MB1035234F4C64C1263009541B83190@HE1PR08MB1035.eurprd08.prod.outlook.com>
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
joseph@codesourcery.com