diff options
author | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2016-09-02 20:06:37 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2016-09-02 20:08:41 +0530 |
commit | 54c86ccab686605ce05198f10cae925ae486b623 (patch) | |
tree | b1d16b1bbc67f57abcb49c479abf049931a0d092 | |
parent | 25e440c6c7b32da8720a5a18cec0d5322f7eccd0 (diff) | |
download | glibc-54c86ccab686605ce05198f10cae925ae486b623.tar.gz glibc-54c86ccab686605ce05198f10cae925ae486b623.tar.xz glibc-54c86ccab686605ce05198f10cae925ae486b623.zip |
Inline all support functions for sin and cos
The support functions for sin and cos have a lot of identical functionality, so inlining them gives a pretty decent jump in functionality: ~19% in the sincos function. On SPEC2006 this translates to about 2.1% in the tonto test. * sysdeps/ieee754/dbl-64/s_sin.c (do_cos): Mark as inline. (do_cos_slow): Likewise. (do_sin): Likewise. (do_sin_slow): Likewise. (slow): Likewise. (slow1): Likewise. (slow2): Likewise. (sloww): Likewise. (sloww1): Likewise. (sloww2): Likewise. (bsloww): Likewise. (bsloww1): Likewise. (bsloww2): Likewise. (cslow2): Likewise.
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_sin.c | 52 |
2 files changed, 43 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog index 66bb46d050..f95b22f587 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,20 @@ 2016-09-02 Siddhesh Poyarekar <siddhesh@sourceware.org> + * sysdeps/ieee754/dbl-64/s_sin.c (do_cos): Mark as inline. + (do_cos_slow): Likewise. + (do_sin): Likewise. + (do_sin_slow): Likewise. + (slow): Likewise. + (slow1): Likewise. + (slow2): Likewise. + (sloww): Likewise. + (sloww1): Likewise. + (sloww2): Likewise. + (bsloww): Likewise. + (bsloww1): Likewise. + (bsloww2): Likewise. + (cslow2): Likewise. + * sysdeps/ieee754/dbl-64/s_sin.c (__sin): Use do_sin. * sysdeps/ieee754/dbl-64/s_sin.c (do_cos): Accept X and DX as input diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c index 7196e6433e..18f1789bba 100644 --- a/sysdeps/ieee754/dbl-64/s_sin.c +++ b/sysdeps/ieee754/dbl-64/s_sin.c @@ -145,7 +145,8 @@ static double cslow2 (double x); of the number by combining the sin and cos of X (as computed by a variation of the Taylor series) with the values looked up from the sin/cos table to get the result in RES and a correction value in COR. */ -static double +static inline double +__always_inline do_cos (double x, double dx, double *corp) { mynumber u; @@ -170,7 +171,8 @@ do_cos (double x, double dx, double *corp) /* A more precise variant of DO_COS. EPS is the adjustment to the correction COR. */ -static double +static inline double +__always_inline do_cos_slow (double x, double dx, double eps, double *corp) { mynumber u; @@ -205,7 +207,8 @@ do_cos_slow (double x, double dx, double eps, double *corp) the number by combining the sin and cos of X (as computed by a variation of the Taylor series) with the values looked up from the sin/cos table to get the result in RES and a correction value in COR. */ -static double +static inline double +__always_inline do_sin (double x, double dx, double *corp) { mynumber u; @@ -229,7 +232,8 @@ do_sin (double x, double dx, double *corp) /* A more precise variant of DO_SIN. EPS is the adjustment to the correction COR. */ -static double +static inline double +__always_inline do_sin_slow (double x, double dx, double eps, double *corp) { mynumber u; @@ -617,8 +621,8 @@ __cos (double x) /* precision and if still doesn't accurate enough by mpsin or dubsin */ /************************************************************************/ -static double -SECTION +static inline double +__always_inline slow (double x) { double res, cor, w[2]; @@ -638,8 +642,8 @@ slow (double x) /* and if result still doesn't accurate enough by mpsin or dubsin */ /*******************************************************************************/ -static double -SECTION +static inline double +__always_inline slow1 (double x) { double w[2], cor, res; @@ -659,8 +663,8 @@ slow1 (double x) /* Routine compute sin(x) for 0.855469 <|x|<2.426265 by __sincostab.tbl */ /* and if result still doesn't accurate enough by mpsin or dubsin */ /**************************************************************************/ -static double -SECTION +static inline double +__always_inline slow2 (double x) { double w[2], y, y1, y2, cor, res; @@ -688,8 +692,8 @@ slow2 (double x) /* result.And if result not accurate enough routine calls mpsin1 or dubsin */ /***************************************************************************/ -static double -SECTION +static inline double +__always_inline sloww (double x, double dx, double orig, int k) { double y, t, res, cor, w[2], a, da, xn; @@ -749,8 +753,8 @@ sloww (double x, double dx, double orig, int k) /* accurate enough routine calls mpsin1 or dubsin */ /***************************************************************************/ -static double -SECTION +static inline double +__always_inline sloww1 (double x, double dx, double orig, int k) { double w[2], cor, res; @@ -779,8 +783,8 @@ sloww1 (double x, double dx, double orig, int k) /* accurate enough routine calls mpsin1 or dubsin */ /***************************************************************************/ -static double -SECTION +static inline double +__always_inline sloww2 (double x, double dx, double orig, int n) { double w[2], cor, res; @@ -810,8 +814,8 @@ sloww2 (double x, double dx, double orig, int n) /* result.And if result not accurate enough routine calls other routines */ /***************************************************************************/ -static double -SECTION +static inline double +__always_inline bsloww (double x, double dx, double orig, int n) { double res, cor, w[2], a, da; @@ -839,8 +843,8 @@ bsloww (double x, double dx, double orig, int n) /* And if result not accurate enough routine calls other routines */ /***************************************************************************/ -static double -SECTION +static inline double +__always_inline bsloww1 (double x, double dx, double orig, int n) { double w[2], cor, res; @@ -867,8 +871,8 @@ bsloww1 (double x, double dx, double orig, int n) /* And if result not accurate enough routine calls other routines */ /***************************************************************************/ -static double -SECTION +static inline double +__always_inline bsloww2 (double x, double dx, double orig, int n) { double w[2], cor, res; @@ -893,8 +897,8 @@ bsloww2 (double x, double dx, double orig, int n) /* precision and if still doesn't accurate enough by mpcos or docos */ /************************************************************************/ -static double -SECTION +static inline double +__always_inline cslow2 (double x) { double w[2], cor, res; |