diff options
author | Siddhesh Poyarekar <siddhesh.poyarekar@linaro.org> | 2015-11-17 16:20:20 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh.poyarekar@linaro.org> | 2015-11-17 21:11:31 +0530 |
commit | 463ac90dab7b90ba6089c1cadd980b6185d3cceb (patch) | |
tree | 146ad5bd9881fd472528d5dfd8663ade0ace52c2 /sysdeps/ieee754/dbl-64/s_sincos.c | |
parent | b7665e51633b98c316f0f8ffccc3278d6b10d14d (diff) | |
download | glibc-463ac90dab7b90ba6089c1cadd980b6185d3cceb.tar.gz glibc-463ac90dab7b90ba6089c1cadd980b6185d3cceb.tar.xz glibc-463ac90dab7b90ba6089c1cadd980b6185d3cceb.zip |
Include s_sin.c in s_sincos.c
Include the __sin and __cos functions as local static copies to allow deper optimization of the functions. This change shows an improvement of about 17% in the min case and 12.5% in the mean case for the sincos microbenchmark on x86_64. * sysdeps/ieee754/dbl-64/s_sin.c (__sin)[IN_SINCOS]: Mark function static and don't set or restore rounding. (__cos)[IN_SINCOS]: Likewise. * sysdeps/ieee754/dbl-64/s_sincos.c: Include s_sin.c. (__sincos): Set and restore rounding mode. Remove check for infinite or NaN input.
Diffstat (limited to 'sysdeps/ieee754/dbl-64/s_sincos.c')
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_sincos.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_sincos.c b/sysdeps/ieee754/dbl-64/s_sincos.c index d7431b7144..2a3fc06386 100644 --- a/sysdeps/ieee754/dbl-64/s_sincos.c +++ b/sysdeps/ieee754/dbl-64/s_sincos.c @@ -22,29 +22,18 @@ #include <math_private.h> +#define __sin __sin_local +#define __cos __cos_local +#define IN_SINCOS 1 +#include "s_sin.c" void __sincos (double x, double *sinx, double *cosx) { - int32_t ix; - - /* High word of x. */ - GET_HIGH_WORD (ix, x); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if (ix >= 0x7ff00000) - { - /* sin(Inf or NaN) is NaN */ - *sinx = *cosx = x - x; - if (isinf (x)) - __set_errno (EDOM); - } - else - { - *sinx = __sin (x); - *cosx = __cos (x); - } + SET_RESTORE_ROUND_53BIT (FE_TONEAREST); + + *sinx = __sin (x); + *cosx = __cos (x); } weak_alias (__sincos, sincos) #ifdef NO_LONG_DOUBLE |