about summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64/s_sin.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh.poyarekar@linaro.org>2015-11-17 16:20:20 +0530
committerSiddhesh Poyarekar <siddhesh.poyarekar@linaro.org>2015-11-17 21:11:31 +0530
commit463ac90dab7b90ba6089c1cadd980b6185d3cceb (patch)
tree146ad5bd9881fd472528d5dfd8663ade0ace52c2 /sysdeps/ieee754/dbl-64/s_sin.c
parentb7665e51633b98c316f0f8ffccc3278d6b10d14d (diff)
downloadglibc-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_sin.c')
-rw-r--r--sysdeps/ieee754/dbl-64/s_sin.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c
index b8d49e2507..a635a86933 100644
--- a/sysdeps/ieee754/dbl-64/s_sin.c
+++ b/sysdeps/ieee754/dbl-64/s_sin.c
@@ -280,8 +280,12 @@ reduce_and_compute (double x, unsigned int k)
 /* An ultimate sin routine. Given an IEEE double machine number x   */
 /* it computes the correctly rounded (to nearest) value of sin(x)  */
 /*******************************************************************/
+#ifdef IN_SINCOS
+static double
+#else
 double
 SECTION
+#endif
 __sin (double x)
 {
   double xx, res, t, cor, y, s, c, sn, ssn, cs, ccs, xn, a, da, db, eps, xn1,
@@ -290,7 +294,9 @@ __sin (double x)
   int4 k, m, n;
   double retval = 0;
 
+#ifndef IN_SINCOS
   SET_RESTORE_ROUND_53BIT (FE_TONEAREST);
+#endif
 
   u.x = x;
   m = u.i[HIGH_HALF];
@@ -512,8 +518,12 @@ __sin (double x)
 /* it computes the correctly rounded (to nearest) value of cos(x)  */
 /*******************************************************************/
 
+#ifdef IN_SINCOS
+static double
+#else
 double
 SECTION
+#endif
 __cos (double x)
 {
   double y, xx, res, t, cor, xn, a, da, db, eps, xn1,
@@ -523,7 +533,9 @@ __cos (double x)
 
   double retval = 0;
 
+#ifndef IN_SINCOS
   SET_RESTORE_ROUND_53BIT (FE_TONEAREST);
+#endif
 
   u.x = x;
   m = u.i[HIGH_HALF];