glibc/sysdeps/ieee754
Wilco Dijkstra ea5c662c62 Improve performance of sincosf
This patch is a complete rewrite of sincosf.  The new version is
significantly faster, as well as simple and accurate.
The worst-case ULP is 0.5607, maximum relative error is 0.5303 * 2^-23 over
all 4 billion inputs.  In non-nearest rounding modes the error is 1ULP.

The algorithm uses 3 main cases: small inputs which don't need argument
reduction, small inputs which need a simple range reduction and large inputs
requiring complex range reduction.  The code uses approximate integer
comparisons to quickly decide between these cases.

The small range reducer uses a single reduction step to handle values up to
120.0.  It is fastest on targets which support inlined round instructions.

The large range reducer uses integer arithmetic for simplicity.  It does a
32x96 bit multiply to compute a 64-bit modulo result.  This is more than
accurate enough to handle the worst-case cancellation for values close to
an integer multiple of PI/4.  It could be further optimized, however it is
already much faster than necessary.

sincosf throughput gains on Cortex-A72:
* |x| < 0x1p-12 : 1.6x
* |x| < M_PI_4  : 1.7x
* |x| < 2 * M_PI: 1.5x
* |x| < 120.0   : 1.8x
* |x| < Inf     : 2.3x

	* math/Makefile: Add s_sincosf_data.c.
	* sysdeps/ia64/fpu/s_sincosf_data.c: New file.
	* sysdeps/ieee754/flt-32/s_sincosf.h (abstop12): Add new function.
	(sincosf_poly): Likewise.
	(reduce_small): Likewise.
	(reduce_large): Likewise.
	* sysdeps/ieee754/flt-32/s_sincosf.c (sincosf): Rewrite.
	* sysdeps/ieee754/flt-32/s_sincosf_data.c: New file with sincosf data.
	* sysdeps/m68k/m680x0/fpu/s_sincosf_data.c: New file.
	* sysdeps/x86_64/fpu/s_sincosf_data.c: New file.
2018-08-10 17:34:39 +01:00
..
dbl-64 Fix i686-linux-gnu build with GCC mainline. 2018-05-22 16:55:04 +00:00
float128 Add narrowing divide functions. 2018-05-17 00:40:52 +00:00
flt-32 Improve performance of sincosf 2018-08-10 17:34:39 +01:00
ldbl-64-128 Don't include math.h/math_private.h in math_ldbl_opt.h. 2018-03-10 15:18:08 -05:00
ldbl-96 Fix ldbl-96 fma (Inf, Inf, finite) (bug 23272). 2018-06-11 16:33:42 +00:00
ldbl-128 Add narrowing divide functions. 2018-05-17 00:40:52 +00:00
ldbl-128ibm Add narrowing divide functions. 2018-05-17 00:40:52 +00:00
ldbl-128ibm-compat ldbl-128ibm-compat: Add printf_size 2018-07-02 10:51:01 -03:00
ldbl-opt Add a generic significand implementation 2018-06-20 18:15:06 -03:00
soft-fp Add narrowing divide functions. 2018-05-17 00:40:52 +00:00
Makefile Avoid -Wno-write-strings for k_standard.c. 2015-02-26 22:50:54 +00:00
ieee754.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
k_standard.c Prefer new libm function wrappers for !LIBM_SVID_COMPAT. 2017-09-05 23:35:55 +00:00
k_standardf.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
k_standardl.c Do not include math-barriers.h in math_private.h. 2018-05-11 15:11:38 +00:00
s_lib_version.c Simplify math-svid-compat code. 2017-08-28 15:19:52 +00:00
s_matherr.c Obsolete matherr, _LIB_VERSION, libieee.a. 2017-08-21 17:45:10 +00:00
s_signgam.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00