[PATCH 05/13] math: Move the IBM cos implementation to s_cos.c

Adhemerval Zanella adhemerval.zanella@linaro.org
Tue Nov 17 20:46:43 GMT 2026


Move __cos to s_cos.c, so sin and cos can be replaced separately.

Checked on x86_64-linux-gnu.
---
 math/Makefile                             |   2 +-
 sysdeps/ieee754/dbl-64/s_cos.c            | 261 +++++++++++++++++++++-
 sysdeps/ieee754/dbl-64/s_sin.c            |  77 +------
 sysdeps/ieee754/dbl-64/s_sincos.c         |   2 +-
 sysdeps/x86_64/fpu/multiarch/Makefile     |   6 +
 sysdeps/x86_64/fpu/multiarch/s_cos-avx.c  |   4 +
 sysdeps/x86_64/fpu/multiarch/s_cos-fma.c  |   4 +
 sysdeps/x86_64/fpu/multiarch/s_cos-fma4.c |   4 +
 sysdeps/x86_64/fpu/multiarch/s_cos.c      |  33 +++
 sysdeps/x86_64/fpu/multiarch/s_sin-avx.c  |   1 -
 sysdeps/x86_64/fpu/multiarch/s_sin-fma.c  |   7 -
 sysdeps/x86_64/fpu/multiarch/s_sin-fma4.c |   7 -
 sysdeps/x86_64/fpu/multiarch/s_sin.c      |  11 +-
 13 files changed, 316 insertions(+), 103 deletions(-)
 create mode 100644 sysdeps/x86_64/fpu/multiarch/s_cos-avx.c
 create mode 100644 sysdeps/x86_64/fpu/multiarch/s_cos-fma.c
 create mode 100644 sysdeps/x86_64/fpu/multiarch/s_cos-fma4.c
 create mode 100644 sysdeps/x86_64/fpu/multiarch/s_cos.c

diff --git a/math/Makefile b/math/Makefile
index 5b48e533002..e6d3898f759 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -1529,7 +1529,7 @@ CFLAGS-s_scalbn.c += -fno-builtin-scalbnl
 CFLAGS-s_setpayload.c += -fno-builtin-setpayloadl
 CFLAGS-s_setpayloadsig.c += -fno-builtin-setpayloadsigl
 CFLAGS-s_significand.c += -fno-builtin-significandl
-CFLAGS-s_sin.c += -fno-builtin-sinl -fno-builtin-cosl
+CFLAGS-s_sin.c += -fno-builtin-sinl
 CFLAGS-s_sincos.c += -fno-builtin-sincosl
 CFLAGS-w_sinh.c += -fno-builtin-sinhl
 CFLAGS-s_sinpi.c += -fno-builtin-sinpil
diff --git a/sysdeps/ieee754/dbl-64/s_cos.c b/sysdeps/ieee754/dbl-64/s_cos.c
index 4be1276ccb6..2742260c160 100644
--- a/sysdeps/ieee754/dbl-64/s_cos.c
+++ b/sysdeps/ieee754/dbl-64/s_cos.c
@@ -1 +1,260 @@
-/* In s_sin.c.  */
+/*
+ * IBM Accurate Mathematical Library
+ * written by International Business Machines Corp.
+ * Copyright (C) 2001-2026 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU  Lesser General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
+ */
+/****************************************************************************/
+/*                                                                          */
+/* MODULE_NAME:usncs.c                                                      */
+/*                                                                          */
+/* FUNCTIONS: ucos                                                          */
+/* FILES NEEDED: dla.h endian.h mpa.h mydefs.h  usncs.h                     */
+/*		 e_rem_pio2.c sincos.tbl				    */
+/*                                                                          */
+/* An ultimate cos routine. Given an IEEE double machine number x it        */
+/* computes cos(x) with ~0.55 ULP.					    */
+/* Assumption: Machine arithmetic operations are performed in               */
+/* round to nearest mode of IEEE 754 standard.                              */
+/*                                                                          */
+/****************************************************************************/
+
+
+#include <errno.h>
+#include <float.h>
+#include "endian.h"
+#include "mydefs.h"
+#include "usncs.h"
+#include <math.h>
+#include <math_private.h>
+#include <fenv_private.h>
+#include <math-underflow.h>
+#include <libm-alias-double.h>
+#include <fenv.h>
+
+/* Helper macros to compute sin of the input values.  */
+#define POLYNOMIAL2(xx) ((((s5 * (xx) + s4) * (xx) + s3) * (xx) + s2) * (xx))
+
+#define POLYNOMIAL(xx) (POLYNOMIAL2 (xx) + s1)
+
+/* The computed polynomial is a variation of the Taylor series expansion for
+   sin(x):
+
+   x - x^3/3! + x^5/5! - x^7/7! + x^9/9! - x^11/11! - dx*x^2/2 + dx
+
+   The constants s1, s2, s3, etc. are pre-computed values of 1/3!, 1/5! and so
+   on.  The result is returned to LHS.  */
+#define TAYLOR_SIN(xx, x, dx) \
+({									      \
+  double t = ((POLYNOMIAL (xx)  * (x) - 0.5 * (dx))  * (xx) + (dx));	      \
+  double res = (x) + t;							      \
+  res;									      \
+})
+
+#define SINCOS_TABLE_LOOKUP(u, sn, ssn, cs, ccs) \
+({									      \
+  int4 k = u.i[LOW_HALF] << 2;						      \
+  sn = __sincostab.x[k];						      \
+  ssn = __sincostab.x[k + 1];						      \
+  cs = __sincostab.x[k + 2];						      \
+  ccs = __sincostab.x[k + 3];						      \
+})
+
+#ifndef SECTION
+# define SECTION
+#endif
+
+extern const union
+{
+  int4 i[880];
+  double x[440];
+} __sincostab attribute_hidden;
+
+static const double
+  sn3 = -1.66666666666664880952546298448555E-01,
+  sn5 = 8.33333214285722277379541354343671E-03,
+  cs2 = 4.99999999999999999999950396842453E-01,
+  cs4 = -4.16666666666664434524222570944589E-02,
+  cs6 = 1.38888874007937613028114285595617E-03;
+
+/* Given a number partitioned into X and DX, this function computes the cosine
+   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.  */
+static __always_inline double
+do_cos (double x, double dx)
+{
+  mynumber u;
+
+  if (x < 0)
+    dx = -dx;
+
+  u.x = big + fabs (x);
+  x = fabs (x) - (u.x - big) + dx;
+
+  double xx, s, sn, ssn, c, cs, ccs, cor;
+  xx = x * x;
+  s = x + x * xx * (sn3 + xx * sn5);
+  c = xx * (cs2 + xx * (cs4 + xx * cs6));
+  SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
+  cor = (ccs - s * ssn - cs * c) - sn * s;
+  return cs + cor;
+}
+
+/* Given a number partitioned into X and DX, this function computes the sine 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.  */
+static __always_inline double
+do_sin (double x, double dx)
+{
+  double xold = x;
+  /* Max ULP is 0.501 if |x| < 0.126, otherwise ULP is 0.518.  */
+  if (fabs (x) < 0.126)
+    return TAYLOR_SIN (x * x, x, dx);
+
+  mynumber u;
+
+  if (x <= 0)
+    dx = -dx;
+  u.x = big + fabs (x);
+  x = fabs (x) - (u.x - big);
+
+  double xx, s, sn, ssn, c, cs, ccs, cor;
+  xx = x * x;
+  s = x + (dx + x * xx * (sn3 + xx * sn5));
+  c = x * dx + xx * (cs2 + xx * (cs4 + xx * cs6));
+  SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
+  cor = (ssn + s * ccs - sn * c) + cs * s;
+  return copysign (sn + cor, xold);
+}
+
+/* Reduce range of x to within PI/2 with abs (x) < 105414350.  The high part
+   is written to *a, the low part to *da.  Range reduction is accurate to 136
+   bits so that when x is large and *a very close to zero, all 53 bits of *a
+   are correct.  */
+static __always_inline int4
+reduce_sincos (double x, double *a, double *da)
+{
+  mynumber v;
+
+  double t = (x * hpinv + toint);
+  double xn = t - toint;
+  v.x = t;
+  double y = (x - xn * mp1) - xn * mp2;
+  int4 n = v.i[LOW_HALF] & 3;
+
+  double b, db, t1, t2;
+  t1 = xn * pp3;
+  t2 = y - t1;
+  db = (y - t2) - t1;
+
+  t1 = xn * pp4;
+  b = t2 - t1;
+  db += (t2 - b) - t1;
+
+  *a = b;
+  *da = db;
+  return n;
+}
+
+/* Compute sin or cos (A + DA) for the given quadrant N.  */
+static __always_inline double
+do_sincos (double a, double da, int4 n)
+{
+  double retval;
+
+  if (n & 1)
+    /* Max ULP is 0.513.  */
+    retval = do_cos (a, da);
+  else
+    /* Max ULP is 0.501 if xx < 0.01588, otherwise ULP is 0.518.  */
+    retval = do_sin (a, da);
+
+  return (n & 2) ? -retval : retval;
+}
+
+
+#ifndef IN_SINCOS
+/*******************************************************************/
+/* An ultimate cos routine. Given an IEEE double machine number x  */
+/* it computes the rounded value of cos(x).			   */
+/*******************************************************************/
+
+double
+SECTION
+__cos (double x)
+{
+  double y, a, da;
+  mynumber u;
+  int4 k, m, n;
+
+  double retval = 0;
+
+  SET_RESTORE_ROUND_53BIT (FE_TONEAREST);
+
+  u.x = x;
+  m = u.i[HIGH_HALF];
+  k = 0x7fffffff & m;
+
+  /* |x|<2^-27 => cos(x)=1 */
+  if (k < 0x3e400000)
+    retval = 1.0;
+
+  else if (k < 0x3feb6000)
+    {				/* 2^-27 < |x| < 0.855469 */
+      /* Max ULP is 0.51.  */
+      retval = do_cos (x, 0);
+    }				/*   else  if (k < 0x3feb6000)    */
+
+  else if (k < 0x400368fd)
+    { /* 0.855469  <|x|<2.426265  */ ;
+      y = hp0 - fabs (x);
+      a = y + hp1;
+      da = (y - a) + hp1;
+      /* Max ULP is 0.501 if xx < 0.01588 or 0.518 otherwise.
+	 Range reduction uses 106 bits here which is sufficient.  */
+      retval = do_sin (a, da);
+    }				/*   else  if (k < 0x400368fd)    */
+
+  else if (k < 0x419921FB)
+    {				/* 2.426265<|x|< 105414350 */
+      n = reduce_sincos (x, &a, &da);
+      retval = do_sincos (a, da, n + 1);
+    }				/*   else  if (k <  0x419921FB )    */
+
+  /* 105414350 <|x| <2^1024 */
+  else if (k < 0x7ff00000)
+    {
+      double y[2];
+      n = __ieee754_rem_pio2 (x, y);
+      retval = do_sincos (y[0], y[1], n + 1);
+    }
+
+  else
+    {
+      if (k == 0x7ff00000 && u.i[LOW_HALF] == 0)
+	__set_errno (EDOM);
+      retval = x / x;		/* |x| > 2^1024 */
+    }
+
+  return retval;
+}
+
+#ifndef __cos
+libm_alias_double (__cos, cos)
+#endif
+
+#endif
diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c
index 4a5fb000fd2..55846b187bf 100644
--- a/sysdeps/ieee754/dbl-64/s_sin.c
+++ b/sysdeps/ieee754/dbl-64/s_sin.c
@@ -21,12 +21,11 @@
 /* MODULE_NAME:usncs.c                                                      */
 /*                                                                          */
 /* FUNCTIONS: usin                                                          */
-/*            ucos                                                          */
 /* FILES NEEDED: dla.h endian.h mpa.h mydefs.h  usncs.h                     */
 /*		 e_rem_pio2.c sincos.tbl				    */
 /*                                                                          */
-/* An ultimate sin and cos routine. Given an IEEE double machine number x   */
-/* it computes sin(x) or cos(x) with ~0.55 ULP.				    */
+/* An ultimate sin routine. Given an IEEE double machine number x it        */
+/* computes sin(x) with ~0.55 ULP.					    */
 /* Assumption: Machine arithmetic operations are performed in               */
 /* round to nearest mode of IEEE 754 standard.                              */
 /*                                                                          */
@@ -192,7 +191,6 @@ do_sincos (double a, double da, int4 n)
 /* An ultimate sin routine. Given an IEEE double machine number x  */
 /* it computes the rounded value of sin(x).			   */
 /*******************************************************************/
-#ifndef IN_SINCOS
 double
 SECTION
 __sin (double x)
@@ -252,77 +250,6 @@ __sin (double x)
   return retval;
 }
 
-
-/*******************************************************************/
-/* An ultimate cos routine. Given an IEEE double machine number x  */
-/* it computes the rounded value of cos(x).			   */
-/*******************************************************************/
-
-double
-SECTION
-__cos (double x)
-{
-  double y, a, da;
-  mynumber u;
-  int4 k, m, n;
-
-  double retval = 0;
-
-  SET_RESTORE_ROUND_53BIT (FE_TONEAREST);
-
-  u.x = x;
-  m = u.i[HIGH_HALF];
-  k = 0x7fffffff & m;
-
-  /* |x|<2^-27 => cos(x)=1 */
-  if (k < 0x3e400000)
-    retval = 1.0;
-
-  else if (k < 0x3feb6000)
-    {				/* 2^-27 < |x| < 0.855469 */
-      /* Max ULP is 0.51.  */
-      retval = do_cos (x, 0);
-    }				/*   else  if (k < 0x3feb6000)    */
-
-  else if (k < 0x400368fd)
-    { /* 0.855469  <|x|<2.426265  */ ;
-      y = hp0 - fabs (x);
-      a = y + hp1;
-      da = (y - a) + hp1;
-      /* Max ULP is 0.501 if xx < 0.01588 or 0.518 otherwise.
-	 Range reduction uses 106 bits here which is sufficient.  */
-      retval = do_sin (a, da);
-    }				/*   else  if (k < 0x400368fd)    */
-
-  else if (k < 0x419921FB)
-    {				/* 2.426265<|x|< 105414350 */
-      n = reduce_sincos (x, &a, &da);
-      retval = do_sincos (a, da, n + 1);
-    }				/*   else  if (k <  0x419921FB )    */
-
-  /* 105414350 <|x| <2^1024 */
-  else if (k < 0x7ff00000)
-    {
-      double y[2];
-      n = __ieee754_rem_pio2 (x, y);
-      retval = do_sincos (y[0], y[1], n + 1);
-    }
-
-  else
-    {
-      if (k == 0x7ff00000 && u.i[LOW_HALF] == 0)
-	__set_errno (EDOM);
-      retval = x / x;		/* |x| > 2^1024 */
-    }
-
-  return retval;
-}
-
-#ifndef __cos
-libm_alias_double (__cos, cos)
-#endif
 #ifndef __sin
 libm_alias_double (__sin, sin)
 #endif
-
-#endif
diff --git a/sysdeps/ieee754/dbl-64/s_sincos.c b/sysdeps/ieee754/dbl-64/s_sincos.c
index 501031dc378..03d118de4a5 100644
--- a/sysdeps/ieee754/dbl-64/s_sincos.c
+++ b/sysdeps/ieee754/dbl-64/s_sincos.c
@@ -29,7 +29,7 @@
 #endif
 
 #define IN_SINCOS
-#include "s_sin.c"
+#include "s_cos.c"
 
 void
 SECTION
diff --git a/sysdeps/x86_64/fpu/multiarch/Makefile b/sysdeps/x86_64/fpu/multiarch/Makefile
index 28e5123810d..3bef32fd32d 100644
--- a/sysdeps/x86_64/fpu/multiarch/Makefile
+++ b/sysdeps/x86_64/fpu/multiarch/Makefile
@@ -9,6 +9,7 @@ CFLAGS-e_pow-fma.c = -mfma -mavx2
 CFLAGS-e_cosh-fma.c = -mfma -mavx2
 CFLAGS-e_sinh-fma.c = -mfma -mavx2
 CFLAGS-s_atan-fma.c = -mfma -mavx2
+CFLAGS-s_cos-fma.c = -mfma -mavx2
 CFLAGS-s_expm1-fma.c = -mfma -mavx2
 CFLAGS-s_log1p-fma.c = -mfma -mavx2
 CFLAGS-s_sin-fma.c = -mfma -mavx2
@@ -64,6 +65,7 @@ libm-sysdep_routines += \
   e_log-fma4 \
   e_pow-fma4 \
   s_atan-fma4 \
+  s_cos-fma4 \
   s_sin-fma4 \
   s_sincos-fma4 \
   s_tan-fma4 \
@@ -91,6 +93,8 @@ libm-sysdep_routines += \
   s_atan-fma \
   s_ceil-sse4_1 \
   s_ceilf-sse4_1 \
+  s_cos-avx \
+  s_cos-fma \
   s_cosf-fma \
   s_cosf-sse2 \
   s_exp10m1f-fma \
@@ -148,6 +152,7 @@ CFLAGS-e_exp-fma4.c = -mfma4
 CFLAGS-e_log-fma4.c = -mfma4
 CFLAGS-e_pow-fma4.c = -mfma4
 CFLAGS-s_atan-fma4.c = -mfma4
+CFLAGS-s_cos-fma4.c = -mfma4
 CFLAGS-s_sin-fma4.c = -mfma4
 CFLAGS-s_tan-fma4.c = -mfma4
 CFLAGS-s_sincos-fma4.c = -mfma4
@@ -156,6 +161,7 @@ CFLAGS-e_atan2-avx.c = -mavx
 CFLAGS-e_exp-avx.c = -mavx
 CFLAGS-e_log-avx.c = -mavx
 CFLAGS-s_atan-avx.c = -mavx
+CFLAGS-s_cos-avx.c = -mavx
 CFLAGS-s_sin-avx.c = -mavx
 CFLAGS-s_tan-avx.c = -mavx
 CFLAGS-s_sincos-avx.c = -mavx
diff --git a/sysdeps/x86_64/fpu/multiarch/s_cos-avx.c b/sysdeps/x86_64/fpu/multiarch/s_cos-avx.c
new file mode 100644
index 00000000000..3c3eb8e3efb
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/s_cos-avx.c
@@ -0,0 +1,4 @@
+#define __cos __cos_avx
+#define SECTION __attribute__ ((section (".text.avx")))
+
+#include <sysdeps/ieee754/dbl-64/s_cos.c>
diff --git a/sysdeps/x86_64/fpu/multiarch/s_cos-fma.c b/sysdeps/x86_64/fpu/multiarch/s_cos-fma.c
new file mode 100644
index 00000000000..eca3b4dbe03
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/s_cos-fma.c
@@ -0,0 +1,4 @@
+#define __cos __cos_fma
+#define SECTION __attribute__ ((section (".text.fma")))
+
+#include <sysdeps/ieee754/dbl-64/s_cos.c>
diff --git a/sysdeps/x86_64/fpu/multiarch/s_cos-fma4.c b/sysdeps/x86_64/fpu/multiarch/s_cos-fma4.c
new file mode 100644
index 00000000000..3a251fde412
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/s_cos-fma4.c
@@ -0,0 +1,4 @@
+#define __cos __cos_fma4
+#define SECTION __attribute__ ((section (".text.fma4")))
+
+#include <sysdeps/ieee754/dbl-64/s_cos.c>
diff --git a/sysdeps/x86_64/fpu/multiarch/s_cos.c b/sysdeps/x86_64/fpu/multiarch/s_cos.c
new file mode 100644
index 00000000000..2e4ecbc22ce
--- /dev/null
+++ b/sysdeps/x86_64/fpu/multiarch/s_cos.c
@@ -0,0 +1,33 @@
+/* Multiple versions of cos.
+   Copyright (C) 2026 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <sysdeps/x86/isa-level.h>
+#if MINIMUM_X86_ISA_LEVEL < AVX2_X86_ISA_LEVEL
+# include <libm-alias-double.h>
+
+extern double __redirect_cos (double);
+
+# define SYMBOL_NAME cos
+# include "ifunc-avx-fma4.h"
+
+libc_ifunc_redirected (__redirect_cos, __cos, IFUNC_SELECTOR ());
+libm_alias_double (__cos, cos)
+
+# define __cos __cos_sse2
+#endif
+#include <sysdeps/ieee754/dbl-64/s_cos.c>
diff --git a/sysdeps/x86_64/fpu/multiarch/s_sin-avx.c b/sysdeps/x86_64/fpu/multiarch/s_sin-avx.c
index e1c6de02592..651943456f3 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_sin-avx.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_sin-avx.c
@@ -1,4 +1,3 @@
-#define __cos __cos_avx
 #define __sin __sin_avx
 #define SECTION __attribute__ ((section (".text.avx")))
 
diff --git a/sysdeps/x86_64/fpu/multiarch/s_sin-fma.c b/sysdeps/x86_64/fpu/multiarch/s_sin-fma.c
index 15f3c394d5c..c450adce204 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_sin-fma.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_sin-fma.c
@@ -1,11 +1,4 @@
-#define __cos __cos_fma
 #define __sin __sin_fma
-#define __docos __docos_fma
-#define __dubsin __dubsin_fma
-#define __mpcos __mpcos_fma
-#define __mpcos1 __mpcos1_fma
-#define __mpsin __mpsin_fma
-#define __mpsin1 __mpsin1_fma
 #define SECTION __attribute__ ((section (".text.fma")))
 
 #include <sysdeps/ieee754/dbl-64/s_sin.c>
diff --git a/sysdeps/x86_64/fpu/multiarch/s_sin-fma4.c b/sysdeps/x86_64/fpu/multiarch/s_sin-fma4.c
index 4c35739dc9b..1cd5cca3779 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_sin-fma4.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_sin-fma4.c
@@ -1,11 +1,4 @@
-#define __cos __cos_fma4
 #define __sin __sin_fma4
-#define __docos __docos_fma4
-#define __dubsin __dubsin_fma4
-#define __mpcos __mpcos_fma4
-#define __mpcos1 __mpcos1_fma4
-#define __mpsin __mpsin_fma4
-#define __mpsin1 __mpsin1_fma4
 #define SECTION __attribute__ ((section (".text.fma4")))
 
 #include <sysdeps/ieee754/dbl-64/s_sin.c>
diff --git a/sysdeps/x86_64/fpu/multiarch/s_sin.c b/sysdeps/x86_64/fpu/multiarch/s_sin.c
index c0010b25c10..c8cfb96b77d 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_sin.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_sin.c
@@ -1,4 +1,4 @@
-/* Multiple versions of sin and cos.
+/* Multiple versions of sin.
    Copyright (C) 2017-2026 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -21,7 +21,6 @@
 # include <libm-alias-double.h>
 
 extern double __redirect_sin (double);
-extern double __redirect_cos (double);
 
 # define SYMBOL_NAME sin
 # include "ifunc-avx-fma4.h"
@@ -29,14 +28,6 @@ extern double __redirect_cos (double);
 libc_ifunc_redirected (__redirect_sin, __sin, IFUNC_SELECTOR ());
 libm_alias_double (__sin, sin)
 
-# undef SYMBOL_NAME
-# define SYMBOL_NAME cos
-# include "ifunc-avx-fma4.h"
-
-libc_ifunc_redirected (__redirect_cos, __cos, IFUNC_SELECTOR ());
-libm_alias_double (__cos, cos)
-
-# define __cos __cos_sse2
 # define __sin __sin_sse2
 #endif
 #include <sysdeps/ieee754/dbl-64/s_sin.c>
-- 
2.53.0



More information about the Libc-alpha mailing list