diff options
author | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2018-02-12 18:16:03 +0000 |
---|---|---|
committer | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2018-09-05 16:22:00 +0100 |
commit | e70c17682518fab2fad164fecf73341443bc2ed3 (patch) | |
tree | b51780512cbcf9b0ded12c313b7e034bf7162273 /sysdeps/powerpc | |
parent | b7cdc2aeb16c07fd9e6ec59f96f862b7fe2d3fdd (diff) | |
download | glibc-e70c17682518fab2fad164fecf73341443bc2ed3.zip glibc-e70c17682518fab2fad164fecf73341443bc2ed3.tar.gz glibc-e70c17682518fab2fad164fecf73341443bc2ed3.tar.bz2 |
Add new exp and exp2 implementations
Optimized exp and exp2 implementations using a lookup table for
fractional powers of 2. There are several variants, see e_exp_data.c,
they can be selected by modifying math_config.h allowing different
tradeoffs.
The default selection should be acceptable as generic libm code.
Worst case error is 0.509 ULP for exp and 0.507 ULP for exp2, on
aarch64 the rodata size is 2160 bytes, shared between exp and exp2.
On aarch64 .text + .rodata size decreased by 24912 bytes.
The non-nearest rounding error is less than 1 ULP even on targets
without efficient round implementation (although the error rate is
higher in that case). Targets with single instruction, rounding mode
independent, to nearest integer rounding and conversion can use them
by setting TOINT_INTRINSICS and adding the necessary code to their
math_private.h.
The __exp1 code uses the same algorithm, so the error bound of pow
increased a bit.
New double precision error handling code was added following the
style of the single precision error handling code.
Improvements on Cortex-A72 compared to current glibc master:
exp thruput: 1.61x in [-9.9 9.9]
exp latency: 1.53x in [-9.9 9.9]
exp thruput: 1.13x in [0.5 1]
exp latency: 1.30x in [0.5 1]
exp2 thruput: 2.03x in [-9.9 9.9]
exp2 latency: 1.64x in [-9.9 9.9]
For small (< 1) inputs the current exp code uses a separate algorithm
so the speed up there is less.
Was tested on
aarch64-linux-gnu (TOINT_INTRINSICS, fma contraction) and
arm-linux-gnueabihf (!TOINT_INTRINSICS, no fma contraction) and
x86_64-linux-gnu (!TOINT_INTRINSICS, no fma contraction) and
powerpc64le-linux-gnu (!TOINT_INTRINSICS, fma contraction) targets,
only non-nearest rounding ulp errors increase and they are within
acceptable bounds (ulp updates are in separate patches).
* NEWS: Mention exp and exp2 improvements.
* math/Makefile (libm-support): Remove t_exp.
(type-double-routines): Add math_err and e_exp_data.
* sysdeps/aarch64/libm-test-ulps: Update.
* sysdeps/arm/libm-test-ulps: Update.
* sysdeps/i386/fpu/e_exp_data.c: New file.
* sysdeps/i386/fpu/math_err.c: New file.
* sysdeps/i386/fpu/t_exp.c: Remove.
* sysdeps/ia64/fpu/e_exp_data.c: New file.
* sysdeps/ia64/fpu/math_err.c: New file.
* sysdeps/ia64/fpu/t_exp.c: Remove.
* sysdeps/ieee754/dbl-64/e_exp.c: Rewrite.
* sysdeps/ieee754/dbl-64/e_exp2.c: Rewrite.
* sysdeps/ieee754/dbl-64/e_exp_data.c: New file.
* sysdeps/ieee754/dbl-64/e_pow.c (__ieee754_pow): Update error bound.
* sysdeps/ieee754/dbl-64/eexp.tbl: Remove.
* sysdeps/ieee754/dbl-64/math_config.h: New file.
* sysdeps/ieee754/dbl-64/math_err.c: New file.
* sysdeps/ieee754/dbl-64/t_exp.c: Remove.
* sysdeps/ieee754/dbl-64/t_exp2.h: Remove.
* sysdeps/ieee754/dbl-64/uexp.h: Remove.
* sysdeps/ieee754/dbl-64/uexp.tbl: Remove.
* sysdeps/m68k/m680x0/fpu/e_exp_data.c: New file.
* sysdeps/m68k/m680x0/fpu/math_err.c: New file.
* sysdeps/m68k/m680x0/fpu/t_exp.c: Remove.
* sysdeps/powerpc/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Update.
Diffstat (limited to 'sysdeps/powerpc')
-rw-r--r-- | sysdeps/powerpc/fpu/libm-test-ulps | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps index f4c67c6..1eec27c 100644 --- a/sysdeps/powerpc/fpu/libm-test-ulps +++ b/sysdeps/powerpc/fpu/libm-test-ulps @@ -902,10 +902,10 @@ ildouble: 6 ldouble: 6 Function: Imaginary part of "ccos_downward": -double: 2 +double: 3 float: 3 float128: 2 -idouble: 2 +idouble: 3 ifloat: 3 ifloat128: 2 ildouble: 6 @@ -922,10 +922,10 @@ ildouble: 6 ldouble: 6 Function: Imaginary part of "ccos_towardzero": -double: 2 +double: 3 float: 3 float128: 2 -idouble: 2 +idouble: 3 ifloat: 3 ifloat128: 2 ildouble: 6 @@ -972,40 +972,40 @@ ildouble: 2 ldouble: 2 Function: Real part of "ccosh_downward": -double: 1 +double: 2 float: 3 float128: 2 -idouble: 1 +idouble: 2 ifloat: 3 ifloat128: 2 ildouble: 6 ldouble: 6 Function: Imaginary part of "ccosh_downward": -double: 2 +double: 3 float: 3 float128: 2 -idouble: 2 +idouble: 3 ifloat: 3 ifloat128: 2 ildouble: 6 ldouble: 6 Function: Real part of "ccosh_towardzero": -double: 1 +double: 2 float: 3 float128: 2 -idouble: 1 +idouble: 2 ifloat: 3 ifloat128: 2 ildouble: 6 ldouble: 6 Function: Imaginary part of "ccosh_towardzero": -double: 2 +double: 3 float: 3 float128: 2 -idouble: 2 +idouble: 3 ifloat: 3 ifloat128: 2 ildouble: 6 @@ -1052,40 +1052,40 @@ ildouble: 2 ldouble: 2 Function: Real part of "cexp_downward": -double: 1 +double: 2 float: 2 float128: 2 -idouble: 1 +idouble: 2 ifloat: 2 ifloat128: 2 ildouble: 11 ldouble: 11 Function: Imaginary part of "cexp_downward": -double: 1 +double: 3 float: 3 float128: 2 -idouble: 1 +idouble: 3 ifloat: 3 ifloat128: 2 ildouble: 11 ldouble: 11 Function: Real part of "cexp_towardzero": -double: 1 +double: 2 float: 2 float128: 2 -idouble: 1 +idouble: 2 ifloat: 2 ifloat128: 2 ildouble: 11 ldouble: 11 Function: Imaginary part of "cexp_towardzero": -double: 1 +double: 3 float: 3 float128: 2 -idouble: 1 +idouble: 3 ifloat: 3 ifloat128: 2 ildouble: 11 @@ -1102,10 +1102,10 @@ ildouble: 3 ldouble: 3 Function: Imaginary part of "cexp_upward": -double: 1 +double: 3 float: 2 float128: 3 -idouble: 1 +idouble: 3 ifloat: 2 ifloat128: 3 ildouble: 3 @@ -1322,30 +1322,30 @@ ildouble: 3 ldouble: 3 Function: "cosh_downward": -double: 1 +double: 2 float: 1 float128: 2 -idouble: 1 +idouble: 2 ifloat: 1 ifloat128: 1 ildouble: 2 ldouble: 2 Function: "cosh_towardzero": -double: 1 +double: 2 float: 1 float128: 2 -idouble: 1 +idouble: 2 ifloat: 1 ifloat128: 1 ildouble: 2 ldouble: 2 Function: "cosh_upward": -double: 1 +double: 2 float: 2 float128: 3 -idouble: 1 +idouble: 2 ifloat: 2 ifloat128: 1 ildouble: 2 @@ -1370,10 +1370,10 @@ ildouble: 2 ldouble: 2 Function: Real part of "cpow_downward": -double: 4 +double: 5 float: 8 float128: 6 -idouble: 4 +idouble: 5 ifloat: 8 ifloat128: 6 ildouble: 7 @@ -1390,10 +1390,10 @@ ildouble: 4 ldouble: 4 Function: Real part of "cpow_towardzero": -double: 4 +double: 5 float: 8 float128: 6 -idouble: 4 +idouble: 5 ifloat: 8 ifloat128: 6 ildouble: 8 @@ -1446,10 +1446,10 @@ ildouble: 1 ldouble: 1 Function: Real part of "csin_downward": -double: 2 +double: 3 float: 3 float128: 2 -idouble: 2 +idouble: 3 ifloat: 3 ifloat128: 2 ildouble: 6 @@ -1466,10 +1466,10 @@ ildouble: 6 ldouble: 6 Function: Real part of "csin_towardzero": -double: 2 +double: 3 float: 3 float128: 2 -idouble: 2 +idouble: 3 ifloat: 3 ifloat128: 2 ildouble: 6 @@ -1534,10 +1534,10 @@ ildouble: 6 ldouble: 6 Function: Imaginary part of "csinh_downward": -double: 2 +double: 3 float: 3 float128: 2 -idouble: 2 +idouble: 3 ifloat: 3 ifloat128: 2 ildouble: 6 @@ -1554,10 +1554,10 @@ ildouble: 6 ldouble: 6 Function: Imaginary part of "csinh_towardzero": -double: 2 +double: 3 float: 3 float128: 2 -idouble: 2 +idouble: 3 ifloat: 3 ifloat128: 2 ildouble: 6 @@ -1877,10 +1877,10 @@ ildouble: 3 ldouble: 3 Function: "erfc_downward": -double: 3 +double: 4 float: 4 float128: 5 -idouble: 3 +idouble: 4 ifloat: 4 ifloat128: 5 ildouble: 10 @@ -1897,10 +1897,10 @@ ildouble: 9 ldouble: 9 Function: "erfc_upward": -double: 3 +double: 4 float: 4 float128: 5 -idouble: 3 +idouble: 4 ifloat: 4 ifloat128: 5 ildouble: 7 @@ -1923,20 +1923,20 @@ ildouble: 1 ldouble: 1 Function: "exp10_downward": -double: 2 +double: 3 float: 1 float128: 3 -idouble: 2 +idouble: 3 ifloat: 1 ifloat128: 3 ildouble: 9 ldouble: 9 Function: "exp10_towardzero": -double: 2 +double: 3 float: 1 float128: 3 -idouble: 2 +idouble: 3 ifloat: 1 ifloat128: 3 ildouble: 9 |