diff --git a/sysdeps/i386/i686/fpu/multiarch/Makefile b/sysdeps/i386/i686/fpu/multiarch/Makefile
index 1de37fe..aa28f72 100644
--- a/sysdeps/i386/i686/fpu/multiarch/Makefile
+++ b/sysdeps/i386/i686/fpu/multiarch/Makefile
@@ -1,3 +1,3 @@
ifeq ($(subdir),math)
-libm-sysdep_routines += e_expf-sse2 e_expf-ia32
+libm-sysdep_routines += e_expf-sse2 e_expf-ia32 s_sinf-sse2 s_cosf-sse2
endif
diff --git a/sysdeps/i386/i686/fpu/multiarch/e_expf-sse2.S b/sysdeps/i386/i686/fpu/multiarch/e_expf-sse2.S
old mode 100644
new mode 100755
diff --git a/sysdeps/i386/i686/fpu/multiarch/e_expf.c b/sysdeps/i386/i686/fpu/multiarch/e_expf.c
old mode 100644
new mode 100755
index 65858a3..1966400
--- a/sysdeps/i386/i686/fpu/multiarch/e_expf.c
+++ b/sysdeps/i386/i686/fpu/multiarch/e_expf.c
@@ -1,3 +1,21 @@
+/* Multiple versions of expf
+ Copyright (C) 2012 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
+ . */
+
#include
extern double __ieee754_expf_sse2 (double);
diff --git a/sysdeps/i386/i686/fpu/multiarch/s_cosf-sse2.S b/sysdeps/i386/i686/fpu/multiarch/s_cosf-sse2.S
new file mode 100755
index 0000000..fb8e306
--- /dev/null
+++ b/sysdeps/i386/i686/fpu/multiarch/s_cosf-sse2.S
@@ -0,0 +1,542 @@
+/* Optimized with sse2 version of cosf
+ Copyright (C) 2012 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
+ . */
+
+#include
+#define __need_Emath
+#include
+
+/* Short algorithm description:
+ *
+ * 1) if |x| == 0: return 1.0-|x|.
+ * 2) if |x| < 2^-27: return 1.0-|x|.
+ * 3) if |x| < 2^-5 : return 1.0+x^2*DP_COS2_0+x^5*DP_COS2_1.
+ * 4) if |x| < Pi/4: return 1.0+x^2*(C0+x^2*(C1+x^2*(C2+x^2*(C3+x^2*C4)))).
+ * 5) if |x| < 9*Pi/4:
+ * 5.1) Range reduction: k=trunc(|x|/(Pi/4)), j=(k+1)&0x0e, n=k+3, t=|x|-j*Pi/4.
+ * 5.2) Reconstruction:
+ * s = (-1.0)^((n>>2)&1)
+ * if(n&2 != 0) {
+ * using cos(t) polynomial for |t|= 2^23, very large args:
+ * 7.1) Range reduction: k=trunc(|x|/(Pi/4)), j=(k+1)&0xfffffffe, n=k+3, t=|x|-j*Pi/4.
+ * 7.2) Reconstruction same as (5.2).
+ * 8) if x is Inf, return x-x, and set errno=EDOM.
+ * 9) if x is NaN, return x-x.
+ *
+ * Special cases:
+ * cos(+-0)==+-0 not raising inexact/underflow,
+ * cos(subnormal) raises inexact/underflow
+ * cos(min_normalized) raises inexact/underflow
+ * cos(normalized) raises inexact
+ * cos(Inf) = NaN, raises invalid, sets errno to EDOM
+ * cos(NaN) = NaN
+ */
+
+#ifdef PIC
+# define MO1(symbol) L(symbol)##@GOTOFF(%ebx)
+# define MO2(symbol,reg2,_scale) L(symbol)##@GOTOFF(%ebx,reg2,_scale)
+# define SAVE_BX pushl %ebx
+# define RESTORE_BX popl %ebx
+# define ARG_X 8(%esp)
+#else
+# define MO1(symbol) L(symbol)
+# define MO2(symbol,reg2,_scale) L(symbol)(,reg2,_scale)
+# define SAVE_BX
+# define RESTORE_BX
+# define ARG_X 4(%esp)
+#endif
+
+ .text
+ENTRY(__cosf_sse2)
+ /* Input: single precision x on stack at address ARG_X */
+
+#ifdef PIC
+ SAVE_BX
+ LOAD_PIC_REG(bx)
+#endif
+
+ movl ARG_X, %eax /* Bits of x */
+ cvtss2sd ARG_X, %xmm0 /* DP x */
+ andl $0x7fffffff, %eax /* |x| */
+
+ cmpl $0x3f490fdb, %eax /* |x|=Pi/4 */
+ movd %eax, %xmm3 /* SP |x| */
+ andpd MO1(DP_ABS_MASK),%xmm0 /* DP |x| */
+ movss MO1(SP_INVPIO4), %xmm2 /* SP 1/(Pi/4) */
+
+ cmpl $0x40e231d6, %eax /* |x|<9*Pi/4? */
+ jae L(large_args)
+
+ /* Here if Pi/4<=|x|<9*Pi/4 */
+ mulss %xmm3, %xmm2 /* SP |x|/(Pi/4) */
+ cvttss2si %xmm2, %eax /* k, number of Pi/4 in x */
+ addl $1, %eax /* k+1 */
+ movl $0x0e, %edx
+ andl %eax, %edx /* j = (k+1)&0x0e */
+ addl $2, %eax /* n */
+ subsd MO2(PIO4J,%edx,8), %xmm0 /* t = |x| - j * Pi/4 */
+
+L(reconstruction):
+ /* Input: %eax=n, %xmm0=t */
+ testl $2, %eax /* n&2 != 0? */
+ jz L(sin_poly)
+
+/*L(cos_poly):*/
+ /* Here if cos(x) calculated using cos(t) polynomial for |t|>2)&1)
+ // result = s * (1.0+t^2*(C0+t^2*(C1+t^2*(C2+t^2*(C3+t^2*C4)))))
+ */
+ shrl $2, %eax /* n>>2 */
+ mulsd %xmm0, %xmm0 /* y=t^2 */
+ andl $1, %eax /* (n>>2)&1 */
+ movaps %xmm0, %xmm1 /* y */
+ mulsd %xmm0, %xmm0 /* z=t^4 */
+
+ movsd MO1(DP_C4), %xmm4 /* C4 */
+ mulsd %xmm0, %xmm4 /* z*C4 */
+ movsd MO1(DP_C3), %xmm3 /* C3 */
+ mulsd %xmm0, %xmm3 /* z*C3 */
+ addsd MO1(DP_C2), %xmm4 /* C2+z*C4 */
+ mulsd %xmm0, %xmm4 /* z*(C2+z*C4) */
+ lea -8(%esp), %esp /* Borrow 4 bytes of stack frame */
+ addsd MO1(DP_C1), %xmm3 /* C1+z*C3 */
+ mulsd %xmm0, %xmm3 /* z*(C1+z*C3) */
+ addsd MO1(DP_C0), %xmm4 /* C0+z*(C2+z*C4) */
+ mulsd %xmm1, %xmm4 /* y*(C0+z*(C2+z*C4)) */
+
+ addsd %xmm4, %xmm3 /* y*(C0+y*(C1+y*(C2+y*(C3+y*C4)))) */
+ addsd MO1(DP_ONES), %xmm3 /* 1.0+y*(C0+y*(C1+y*(C2+y*(C3+y*C4)))) */
+
+ mulsd MO2(DP_ONES,%eax,8), %xmm3 /* DP result */
+ movsd %xmm3, 0(%esp) /* Move result from sse... */
+ fldl 0(%esp) /* ...to FPU. */
+ lea 8(%esp), %esp /* Return back 4 bytes of stack frame */
+ RESTORE_BX
+ ret
+
+ .p2align 4
+L(sin_poly):
+ /* Here if cos(x) calculated using sin(t) polynomial for |t|>2)&1)
+ // result = s * t * (1.0+t^2*(S0+t^2*(S1+t^2*(S2+t^2*(S3+t^2*S4)))))
+ */
+
+ movaps %xmm0, %xmm4 /* t */
+ shrl $2, %eax /* n>>2 */
+ mulsd %xmm0, %xmm0 /* y=t^2 */
+ andl $1, %eax /* (n>>2)&1 */
+ movaps %xmm0, %xmm1 /* y */
+ mulsd %xmm0, %xmm0 /* z=t^4 */
+
+ movsd MO1(DP_S4), %xmm2 /* S4 */
+ mulsd %xmm0, %xmm2 /* z*S4 */
+ movsd MO1(DP_S3), %xmm3 /* S3 */
+ mulsd %xmm0, %xmm3 /* z*S3 */
+ lea -8(%esp), %esp /* Borrow 4 bytes of stack frame */
+ addsd MO1(DP_S2), %xmm2 /* S2+z*S4 */
+ mulsd %xmm0, %xmm2 /* z*(S2+z*S4) */
+ addsd MO1(DP_S1), %xmm3 /* S1+z*S3 */
+ mulsd %xmm0, %xmm3 /* z*(S1+z*S3) */
+ addsd MO1(DP_S0), %xmm2 /* S0+z*(S2+z*S4) */
+ mulsd %xmm1, %xmm2 /* y*(S0+z*(S2+z*S4)) */
+ mulsd MO2(DP_ONES,%eax,8), %xmm4 /* t*s, where s = sign(x) * (-1.0)^((n>>2)&1) */
+ addsd %xmm2, %xmm3 /* y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ mulsd %xmm4, %xmm3 /* t*s*y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ addsd %xmm4, %xmm3 /* t*s*(1.0+y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ movsd %xmm3, 0(%esp) /* Move result from sse... */
+ fldl 0(%esp) /* ...to FPU. */
+ lea 8(%esp), %esp /* Return back 4 bytes of stack frame */
+ RESTORE_BX
+ ret
+
+
+ .p2align 4
+L(large_args):
+ /* Here if |x|>=9*Pi/4 */
+ cmpl $0x7f800000, %eax /* x is Inf or NaN? */
+ jae L(arg_inf_or_nan)
+
+ /* Here if finite |x|>=9*Pi/4 */
+ cmpl $0x4b000000, %eax /* |x|<2^23? */
+ jae L(very_large_args)
+
+ /* Here if 9*Pi/4<=|x|<2^23 */
+ movsd MO1(DP_INVPIO4), %xmm1 /* 1/(Pi/4) */
+ mulsd %xmm0, %xmm1 /* |x|/(Pi/4) */
+ cvttsd2si %xmm1, %eax /* k=trunc(|x|/(Pi/4)) */
+ addl $1, %eax /* k+1 */
+ movl %eax, %edx
+ andl $0xfffffffe, %edx /* j=(k+1)&0xfffffffe */
+ cvtsi2sdl %edx, %xmm4 /* DP j */
+ movsd MO1(DP_PIO4HI), %xmm2 /* -PIO4HI = high part of -Pi/4 */
+ mulsd %xmm4, %xmm2 /* -j*PIO4HI */
+ movsd MO1(DP_PIO4LO), %xmm3 /* -PIO4LO = low part of -Pi/4 */
+ addsd %xmm2, %xmm0 /* |x| - j*PIO4HI */
+ addl $2, %eax /* n */
+ mulsd %xmm3, %xmm4 /* j*PIO4LO */
+ addsd %xmm4, %xmm0 /* t = |x| - j*PIO4HI - j*PIO4LO */
+ jmp L(reconstruction)
+
+ .p2align 4
+L(very_large_args):
+ /* Here if finite |x|>=2^23 */
+
+ /* bitpos = (ix>>23) - BIAS_32 + 59; */
+ shrl $23, %eax /* eb = biased exponent of x */
+ subl $68, %eax /* bitpos = eb - 0x7f + 59, where 0x7f is exponent bias */
+ movl $28, %ecx /* %cl=28 */
+ movl %eax, %edx /* bitpos copy */
+
+ /* j = bitpos/28; */
+ div %cl /* j in register %al=%ax/%cl */
+ movapd %xmm0, %xmm3 /* |x| */
+ andl $0xff, %eax /* clear unneeded remainder from %ah */
+
+ imull $28, %eax, %ecx /* j*28 */
+ movsd MO1(DP_HI_MASK), %xmm4 /* DP_HI_MASK */
+ movapd %xmm0, %xmm5 /* |x| */
+ mulsd -2*8+MO2(_FPI,%eax,8), %xmm3 /* tmp3 = FPI[j-2]*|x| */
+ movapd %xmm0, %xmm1 /* |x| */
+ mulsd -1*8+MO2(_FPI,%eax,8), %xmm5 /* tmp2 = FPI[j-1]*|x| */
+ mulsd 0*8+MO2(_FPI,%eax,8), %xmm0 /* tmp0 = FPI[j]*|x| */
+ addl $19, %ecx /* j*28+19 */
+ mulsd 1*8+MO2(_FPI,%eax,8), %xmm1 /* tmp1 = FPI[j+1]*|x| */
+ cmpl %ecx, %edx /* bitpos>=j*28+19? */
+ jl L(very_large_skip1)
+
+ /* Here if bitpos>=j*28+19 */
+ andpd %xmm3, %xmm4 /* HI(tmp3) */
+ subsd %xmm4, %xmm3 /* tmp3 = tmp3 - HI(tmp3) */
+L(very_large_skip1):
+
+ movsd MO1(DP_2POW52), %xmm6
+ movapd %xmm5, %xmm2 /* tmp2 copy */
+ addsd %xmm3, %xmm5 /* tmp5 = tmp3 + tmp2 */
+ movl $1, %edx
+ addsd %xmm5, %xmm6 /* tmp6 = tmp5 + 2^52 */
+ movsd 8+MO1(DP_2POW52), %xmm4
+ movd %xmm6, %eax /* k = I64_LO(tmp6); */
+ addsd %xmm6, %xmm4 /* tmp4 = tmp6 - 2^52 */
+ comisd %xmm5, %xmm4 /* tmp4 > tmp5? */
+ jbe L(very_large_skip2)
+
+ /* Here if tmp4 > tmp5 */
+ subl $1, %eax /* k-- */
+ addsd 8+MO1(DP_ONES), %xmm4 /* tmp4 -= 1.0 */
+L(very_large_skip2):
+
+ andl %eax, %edx /* k&1 */
+ subsd %xmm4, %xmm3 /* tmp3 -= tmp4 */
+ addsd MO2(DP_ZERONE,%edx,8), %xmm3 /* t = DP_ZERONE[k&1] + tmp3 */
+ addsd %xmm2, %xmm3 /* t += tmp2 */
+ addsd %xmm3, %xmm0 /* t += tmp0 */
+ addl $3, %eax /* n=k+3 */
+ addsd %xmm1, %xmm0 /* t += tmp1 */
+ mulsd MO1(DP_PIO4), %xmm0 /* t *= PI04 */
+
+ jmp L(reconstruction) /* end of very_large_args peth */
+
+
+ .p2align 4
+L(arg_less_pio4):
+ /* Here if |x|. */
+
+#include
+
+extern float __cosf_sse2 (float);
+extern float __cosf_ia32 (float);
+float __cosf (float);
+
+libm_ifunc (__cosf, HAS_SSE2 ? __cosf_sse2 : __cosf_ia32);
+weak_alias (__cosf, cosf);
+
+#define COSF __cosf_ia32
+#include
diff --git a/sysdeps/i386/i686/fpu/multiarch/s_sinf-sse2.S b/sysdeps/i386/i686/fpu/multiarch/s_sinf-sse2.S
new file mode 100755
index 0000000..55bd6e6
--- /dev/null
+++ b/sysdeps/i386/i686/fpu/multiarch/s_sinf-sse2.S
@@ -0,0 +1,558 @@
+/* Optimized with sse2 version of sinf
+ Copyright (C) 2012 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
+ . */
+
+#include
+#define __need_Emath
+#include
+
+/* Short algorithm description:
+ *
+ * 1) if |x| == 0: return x.
+ * 2) if |x| < 2^-27: return x-x*DP_SMALL, raise underflow only when needed.
+ * 3) if |x| < 2^-5 : return x+x^3*DP_SIN2_0+x^5*DP_SIN2_1.
+ * 4) if |x| < Pi/4: return x+x^3*(S0+x^2*(S1+x^2*(S2+x^2*(S3+x^2*S4)))).
+ * 5) if |x| < 9*Pi/4:
+ * 5.1) Range reduction: k=trunc(|x|/(Pi/4)), j=(k+1)&0x0e, n=k+1, t=|x|-j*Pi/4.
+ * 5.2) Reconstruction:
+ * s = sign(x) * (-1.0)^((n>>2)&1)
+ * if(n&2 != 0) {
+ * using cos(t) polynomial for |t|= 2^23, very large args:
+ * 7.1) Range reduction: k=trunc(|x|/(Pi/4)), j=(k+1)&0xfffffffe, n=k+1, t=|x|-j*Pi/4.
+ * 7.2) Reconstruction same as (5.2).
+ * 8) if x is Inf, return x-x, and set errno=EDOM.
+ * 9) if x is NaN, return x-x.
+ *
+ * Special cases:
+ * sin(+-0)==+-0 not raising inexact/underflow,
+ * sin(subnormal) raises inexact/underflow
+ * sin(min_normalized) raises inexact/underflow
+ * sin(normalized) raises inexact
+ * sin(Inf) = NaN, raises invalid, sets errno to EDOM
+ * sin(NaN) = NaN
+ */
+
+#ifdef PIC
+# define MO1(symbol) L(symbol)##@GOTOFF(%ebx)
+# define MO2(symbol,reg2,_scale) L(symbol)##@GOTOFF(%ebx,reg2,_scale)
+# define SAVE_BX pushl %ebx
+# define RESTORE_BX popl %ebx
+# define ARG_X 8(%esp)
+#else
+# define MO1(symbol) L(symbol)
+# define MO2(symbol,reg2,_scale) L(symbol)(,reg2,_scale)
+# define SAVE_BX
+# define RESTORE_BX
+# define ARG_X 4(%esp)
+#endif
+
+ .text
+ENTRY(__sinf_sse2)
+ /* Input: single precision x on stack at address ARG_X */
+
+#ifdef PIC
+ SAVE_BX
+ LOAD_PIC_REG(bx)
+#endif
+
+ movl ARG_X, %eax /* Bits of x */
+ cvtss2sd ARG_X, %xmm0 /* DP x */
+ andl $0x7fffffff, %eax /* |x| */
+
+ cmpl $0x3f490fdb, %eax /* |x|=Pi/4 */
+ movd %eax, %xmm3 /* SP |x| */
+ andpd MO1(DP_ABS_MASK),%xmm0 /* DP |x| */
+ movss MO1(SP_INVPIO4), %xmm2 /* SP 1/(Pi/4) */
+
+ cmpl $0x40e231d6, %eax /* |x|<9*Pi/4? */
+ jae L(large_args)
+
+ /* Here if Pi/4<=|x|<9*Pi/4 */
+ mulss %xmm3, %xmm2 /* SP |x|/(Pi/4) */
+ movl ARG_X, %ecx /* Load x */
+ cvttss2si %xmm2, %eax /* k, number of Pi/4 in x */
+ shrl $31, %ecx /* sign of x */
+ addl $1, %eax /* k+1 */
+ movl $0x0e, %edx
+ andl %eax, %edx /* j = (k+1)&0x0e */
+ subsd MO2(PIO4J,%edx,8), %xmm0 /* t = |x| - j * Pi/4 */
+
+L(reconstruction):
+ /* Input: %eax=n, %xmm0=t, %ecx=sign(x) */
+ testl $2, %eax /* n&2 != 0? */
+ jz L(sin_poly)
+
+/*L(cos_poly):*/
+ /* Here if sin(x) calculated using cos(t) polynomial for |t|>2)&1)
+ // result = s * (1.0+t^2*(C0+t^2*(C1+t^2*(C2+t^2*(C3+t^2*C4)))))
+ */
+ shrl $2, %eax /* n>>2 */
+ mulsd %xmm0, %xmm0 /* y=t^2 */
+ andl $1, %eax /* (n>>2)&1 */
+ movaps %xmm0, %xmm1 /* y */
+ mulsd %xmm0, %xmm0 /* z=t^4 */
+
+ movsd MO1(DP_C4), %xmm4 /* C4 */
+ mulsd %xmm0, %xmm4 /* z*C4 */
+ xorl %eax, %ecx /* (-1.0)^((n>>2)&1) XOR sign(x) */
+ movsd MO1(DP_C3), %xmm3 /* C3 */
+ mulsd %xmm0, %xmm3 /* z*C3 */
+ addsd MO1(DP_C2), %xmm4 /* C2+z*C4 */
+ mulsd %xmm0, %xmm4 /* z*(C2+z*C4) */
+ lea -8(%esp), %esp /* Borrow 4 bytes of stack frame */
+ addsd MO1(DP_C1), %xmm3 /* C1+z*C3 */
+ mulsd %xmm0, %xmm3 /* z*(C1+z*C3) */
+ addsd MO1(DP_C0), %xmm4 /* C0+z*(C2+z*C4) */
+ mulsd %xmm1, %xmm4 /* y*(C0+z*(C2+z*C4)) */
+
+ addsd %xmm4, %xmm3 /* y*(C0+y*(C1+y*(C2+y*(C3+y*C4)))) */
+ addsd MO1(DP_ONES), %xmm3 /* 1.0+y*(C0+y*(C1+y*(C2+y*(C3+y*C4)))) */
+
+ mulsd MO2(DP_ONES,%ecx,8), %xmm3 /* DP result */
+ movsd %xmm3, 0(%esp) /* Move result from sse... */
+ fldl 0(%esp) /* ...to FPU. */
+ lea 8(%esp), %esp /* Return back 4 bytes of stack frame */
+ RESTORE_BX
+ ret
+
+ .p2align 4
+L(sin_poly):
+ /* Here if sin(x) calculated using sin(t) polynomial for |t|>2)&1)
+ // result = s * t * (1.0+t^2*(S0+t^2*(S1+t^2*(S2+t^2*(S3+t^2*S4)))))
+ */
+
+ movaps %xmm0, %xmm4 /* t */
+ shrl $2, %eax /* n>>2 */
+ mulsd %xmm0, %xmm0 /* y=t^2 */
+ andl $1, %eax /* (n>>2)&1 */
+ movaps %xmm0, %xmm1 /* y */
+ xorl %eax, %ecx /* (-1.0)^((n>>2)&1) XOR sign(x) */
+ mulsd %xmm0, %xmm0 /* z=t^4 */
+
+ movsd MO1(DP_S4), %xmm2 /* S4 */
+ mulsd %xmm0, %xmm2 /* z*S4 */
+ movsd MO1(DP_S3), %xmm3 /* S3 */
+ mulsd %xmm0, %xmm3 /* z*S3 */
+ lea -8(%esp), %esp /* Borrow 4 bytes of stack frame */
+ addsd MO1(DP_S2), %xmm2 /* S2+z*S4 */
+ mulsd %xmm0, %xmm2 /* z*(S2+z*S4) */
+ addsd MO1(DP_S1), %xmm3 /* S1+z*S3 */
+ mulsd %xmm0, %xmm3 /* z*(S1+z*S3) */
+ addsd MO1(DP_S0), %xmm2 /* S0+z*(S2+z*S4) */
+ mulsd %xmm1, %xmm2 /* y*(S0+z*(S2+z*S4)) */
+ mulsd MO2(DP_ONES,%ecx,8), %xmm4 /* t*s, where s = sign(x) * (-1.0)^((n>>2)&1) */
+ addsd %xmm2, %xmm3 /* y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ mulsd %xmm4, %xmm3 /* t*s*y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ addsd %xmm4, %xmm3 /* t*s*(1.0+y*(S0+y*(S1+y*(S2+y*(S3+y*S4)))) */
+ movsd %xmm3, 0(%esp) /* Move result from sse... */
+ fldl 0(%esp) /* ...to FPU. */
+ lea 8(%esp), %esp /* Return back 4 bytes of stack frame */
+ RESTORE_BX
+ ret
+
+
+ .p2align 4
+L(large_args):
+ /* Here if |x|>=9*Pi/4 */
+ cmpl $0x7f800000, %eax /* x is Inf or NaN? */
+ jae L(arg_inf_or_nan)
+
+ /* Here if finite |x|>=9*Pi/4 */
+ cmpl $0x4b000000, %eax /* |x|<2^23? */
+ jae L(very_large_args)
+
+ /* Here if 9*Pi/4<=|x|<2^23 */
+ movsd MO1(DP_INVPIO4), %xmm1 /* 1/(Pi/4) */
+ mulsd %xmm0, %xmm1 /* |x|/(Pi/4) */
+ cvttsd2si %xmm1, %eax /* k=trunc(|x|/(Pi/4)) */
+ addl $1, %eax /* k+1 */
+ movl %eax, %edx
+ andl $0xfffffffe, %edx /* j=(k+1)&0xfffffffe */
+ cvtsi2sdl %edx, %xmm4 /* DP j */
+ movl ARG_X, %ecx /* Load x */
+ movsd MO1(DP_PIO4HI), %xmm2 /* -PIO4HI = high part of -Pi/4 */
+ shrl $31, %ecx /* sign bit of x */
+ mulsd %xmm4, %xmm2 /* -j*PIO4HI */
+ movsd MO1(DP_PIO4LO), %xmm3 /* -PIO4LO = low part of -Pi/4 */
+ addsd %xmm2, %xmm0 /* |x| - j*PIO4HI */
+ mulsd %xmm3, %xmm4 /* j*PIO4LO */
+ addsd %xmm4, %xmm0 /* t = |x| - j*PIO4HI - j*PIO4LO */
+ jmp L(reconstruction)
+
+ .p2align 4
+L(very_large_args):
+ /* Here if finite |x|>=2^23 */
+
+ /* bitpos = (ix>>23) - BIAS_32 + 59; */
+ shrl $23, %eax /* eb = biased exponent of x */
+ subl $68, %eax /* bitpos = eb - 0x7f + 59, where 0x7f is exponent bias */
+ movl $28, %ecx /* %cl=28 */
+ movl %eax, %edx /* bitpos copy */
+
+ /* j = bitpos/28; */
+ div %cl /* j in register %al=%ax/%cl */
+ movapd %xmm0, %xmm3 /* |x| */
+ andl $0xff, %eax /* clear unneeded remainder from %ah */
+
+ imull $28, %eax, %ecx /* j*28 */
+ movsd MO1(DP_HI_MASK), %xmm4 /* DP_HI_MASK */
+ movapd %xmm0, %xmm5 /* |x| */
+ mulsd -2*8+MO2(_FPI,%eax,8), %xmm3 /* tmp3 = FPI[j-2]*|x| */
+ movapd %xmm0, %xmm1 /* |x| */
+ mulsd -1*8+MO2(_FPI,%eax,8), %xmm5 /* tmp2 = FPI[j-1]*|x| */
+ mulsd 0*8+MO2(_FPI,%eax,8), %xmm0 /* tmp0 = FPI[j]*|x| */
+ addl $19, %ecx /* j*28+19 */
+ mulsd 1*8+MO2(_FPI,%eax,8), %xmm1 /* tmp1 = FPI[j+1]*|x| */
+ cmpl %ecx, %edx /* bitpos>=j*28+19? */
+ jl L(very_large_skip1)
+
+ /* Here if bitpos>=j*28+19 */
+ andpd %xmm3, %xmm4 /* HI(tmp3) */
+ subsd %xmm4, %xmm3 /* tmp3 = tmp3 - HI(tmp3) */
+L(very_large_skip1):
+
+ movsd MO1(DP_2POW52), %xmm6
+ movapd %xmm5, %xmm2 /* tmp2 copy */
+ addsd %xmm3, %xmm5 /* tmp5 = tmp3 + tmp2 */
+ movl $1, %edx
+ addsd %xmm5, %xmm6 /* tmp6 = tmp5 + 2^52 */
+ movsd 8+MO1(DP_2POW52), %xmm4
+ movd %xmm6, %eax /* k = I64_LO(tmp6); */
+ addsd %xmm6, %xmm4 /* tmp4 = tmp6 - 2^52 */
+ movl ARG_X, %ecx /* Load x */
+ comisd %xmm5, %xmm4 /* tmp4 > tmp5? */
+ jbe L(very_large_skip2)
+
+ /* Here if tmp4 > tmp5 */
+ subl $1, %eax /* k-- */
+ addsd 8+MO1(DP_ONES), %xmm4 /* tmp4 -= 1.0 */
+L(very_large_skip2):
+
+ andl %eax, %edx /* k&1 */
+ subsd %xmm4, %xmm3 /* tmp3 -= tmp4 */
+ addsd MO2(DP_ZERONE,%edx,8), %xmm3 /* t = DP_ZERONE[k&1] + tmp3 */
+ addsd %xmm2, %xmm3 /* t += tmp2 */
+ shrl $31, %ecx /* sign of x */
+ addsd %xmm3, %xmm0 /* t += tmp0 */
+ addl $1, %eax /* n=k+1 */
+ addsd %xmm1, %xmm0 /* t += tmp1 */
+ mulsd MO1(DP_PIO4), %xmm0 /* t *= PI04 */
+
+ jmp L(reconstruction) /* end of very_large_args peth */
+
+
+
+
+
+ .p2align 4
+L(arg_less_pio4):
+ /* Here if |x|. */
+
+#include
+
+extern float __sinf_sse2 (float);
+extern float __sinf_ia32 (float);
+float __sinf (float);
+
+libm_ifunc (__sinf, HAS_SSE2 ? __sinf_sse2 : __sinf_ia32);
+weak_alias (__sinf, sinf);
+#define SINF __sinf_ia32
+#include
diff --git a/sysdeps/ieee754/flt-32/s_cosf.c b/sysdeps/ieee754/flt-32/s_cosf.c
index f4bd819..2124074 100644
--- a/sysdeps/ieee754/flt-32/s_cosf.c
+++ b/sysdeps/ieee754/flt-32/s_cosf.c
@@ -4,7 +4,7 @@
/*
* ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ * Copyright (C) 1993, 2012 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
@@ -23,7 +23,13 @@ static char rcsid[] = "$NetBSD: s_cosf.c,v 1.4 1995/05/10 20:47:03 jtc Exp $";
static const float one=1.0;
-float __cosf(float x)
+#ifndef COSF
+# define COSF_FUNC __cosf
+#else
+# define COSF_FUNC COSF
+#endif
+
+float COSF_FUNC(float x)
{
float y[2],z=0.0;
int32_t n,ix;
@@ -53,4 +59,7 @@ float __cosf(float x)
}
}
}
+
+#ifndef COSF
weak_alias (__cosf, cosf)
+#endif
diff --git a/sysdeps/ieee754/flt-32/s_sinf.c b/sysdeps/ieee754/flt-32/s_sinf.c
index 02fa29f..5bffe2b 100644
--- a/sysdeps/ieee754/flt-32/s_sinf.c
+++ b/sysdeps/ieee754/flt-32/s_sinf.c
@@ -4,7 +4,7 @@
/*
* ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ * Copyright (C) 1993, 2012 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
@@ -21,7 +21,13 @@ static char rcsid[] = "$NetBSD: s_sinf.c,v 1.4 1995/05/10 20:48:16 jtc Exp $";
#include
#include
-float __sinf(float x)
+#ifndef SINF
+# define SINF_FUNC __sinf
+#else
+# define SINF_FUNC SINF
+#endif
+
+float SINF_FUNC(float x)
{
float y[2],z=0.0;
int32_t n, ix;
@@ -51,4 +57,7 @@ float __sinf(float x)
}
}
}
+
+#ifndef SINF
weak_alias (__sinf, sinf)
+#endif