[PATCH] PPC64 performance improvements for sqrt

Steven Munroe munroesj@us.ibm.com
Thu Nov 1 21:44:00 GMT 2007


For POWER4 and later, the performance of sqrt()/sqrtf() is limited by
the overhead of stacking a frame, addressing the GOT, testing for NaN
etc, which is only need in  case we need to report EDOM via
__kernel_standard(). For PowerPC the fsqrt[s] instruction does all the
work except for setting errno to EDOM for non-zero negative values.

So the attached patch simulates prologue shrink-wrapping such that the
fsqrt calculation  and basic error checking occurs before the prologure.
If there are no errors the result is returned directly. Otherwise stack
stack a frame and reports errors if needed via __kernel_standard().

This patch only impacts builds using:

    --with-cpu=[power4,970,power5,power5+,power6,power6x]

the code for power4/970 is slightly different from that for power5 and
later due to increased latency accessing the FPSCR. For micro benchmarks
I see the following improvement:

    1.74 X on ppc970 2.0GHz
    1.71 X on power4 1.0GHz
    2.60 X on power5 1.9GHz
    1.55 X on power6 4.2GHz

This patch will also be release with powerpc-cpu-V0.07.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ppcV07-sqrt-20071026.txt
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20071101/cabe13d7/attachment.txt>


More information about the Libc-alpha mailing list