Hi,
The constant representation of 1 in the multiprecision implementation
in libm is repeated in a bunch of places as a local variable. This is
slow in comparison to having it declared in static scope (and hence
instantiated only once). Attached patch does exactly that. I have
verified that this does not cause any regressions in the testsuite.
As for verification of performance, I have tested this with the pow
function using the test case described in this blog:
http://entropymine.com/imageworsener/slowpow/
using the following commandline:
time ./powtest 1000000 1.0000000000000020 1.5000000050000000
The patch takes off approx 0.1 second with the patch. OK for 2.18?
Siddhesh
ChangeLog:
2012-12-20 Siddhesh Poyarekar <siddhesh@redhat.com>
* sysdeps/ieee754/dbl-64/mpa.c [! NO__CONST]: New constant
MPONE.
* sysdeps/ieee754/dbl-64/mpa.h: Declare MPONE.
* sysdeps/ieee754/dbl-64/mpatan.c (__mpatan): Remove local
variable MPONE.
* sysdeps/ieee754/dbl-64/mpatan2.c (__mpatan2): Likewise.
* sysdeps/ieee754/dbl-64/mpexp.c (__mpexp): Likewise.
* sysdeps/ieee754/dbl-64/mplog.c (__mplog): Remove mplog.h
include directive. Remove local variable MPONE.
* sysdeps/ieee754/dbl-64/mplog.h: Remove.
* sysdeps/x86_64/fpu/multiarch/mpa-avx.c: Define NO__CONST.
* sysdeps/x86_64/fpu/multiarch/mpa-fma4.c: Likewise.