summaryrefslogtreecommitdiff
path: root/libc/sysdeps/i386
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2012-03-21 20:25:11 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2012-03-21 20:25:11 +0000
commit11e8a843c1be2bfbacb427ca25282e6979ebb48f (patch)
tree3358bff2de223bb79aa10ff35c4273cb94dc04e8 /libc/sysdeps/i386
parent21983719922788c86799322b2b4cd68830712137 (diff)
downloadeglibc2-11e8a843c1be2bfbacb427ca25282e6979ebb48f.tar.gz
Merge changes between r17530 and r17700 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@17701 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/sysdeps/i386')
-rwxr-xr-xlibc/sysdeps/i386/configure18
-rw-r--r--libc/sysdeps/i386/configure.in48
-rw-r--r--libc/sysdeps/i386/fpu/branred.c1
-rw-r--r--libc/sysdeps/i386/fpu/dosincos.c1
-rw-r--r--libc/sysdeps/i386/fpu/e_pow.S47
-rw-r--r--libc/sysdeps/i386/fpu/e_powf.S47
-rw-r--r--libc/sysdeps/i386/fpu/e_powl.S41
-rw-r--r--libc/sysdeps/i386/fpu/e_rem_pio2f.c3
-rw-r--r--libc/sysdeps/i386/fpu/e_rem_pio2l.c3
-rw-r--r--libc/sysdeps/i386/fpu/feholdexcpt.c19
-rw-r--r--libc/sysdeps/i386/fpu/fenv_private.h304
-rw-r--r--libc/sysdeps/i386/fpu/k_rem_pio2.c3
-rw-r--r--libc/sysdeps/i386/fpu/k_rem_pio2f.c3
-rw-r--r--libc/sysdeps/i386/fpu/libm-test-ulps357
-rw-r--r--libc/sysdeps/i386/fpu/math_private.h17
-rw-r--r--libc/sysdeps/i386/fpu/mpa.c1
-rw-r--r--libc/sysdeps/i386/fpu/mptan.c1
-rw-r--r--libc/sysdeps/i386/fpu/s_cexp.S253
-rw-r--r--libc/sysdeps/i386/fpu/s_cexpf.S257
-rw-r--r--libc/sysdeps/i386/fpu/s_cexpl.S256
-rw-r--r--libc/sysdeps/i386/fpu/s_cos.S54
-rw-r--r--libc/sysdeps/i386/fpu/s_cosf.S54
-rw-r--r--libc/sysdeps/i386/fpu/s_cosl.S54
-rw-r--r--libc/sysdeps/i386/fpu/s_sin.S54
-rw-r--r--libc/sysdeps/i386/fpu/s_sincos.S64
-rw-r--r--libc/sysdeps/i386/fpu/s_sincosf.S64
-rw-r--r--libc/sysdeps/i386/fpu/s_sincosl.S64
-rw-r--r--libc/sysdeps/i386/fpu/s_sinf.S54
-rw-r--r--libc/sysdeps/i386/fpu/s_sinl.S54
-rw-r--r--libc/sysdeps/i386/fpu/s_tan.S55
-rw-r--r--libc/sysdeps/i386/fpu/s_tanf.S55
-rw-r--r--libc/sysdeps/i386/fpu/s_tanl.S55
-rw-r--r--libc/sysdeps/i386/fpu/sincos32.c1
-rw-r--r--libc/sysdeps/i386/i686/hp-timing.h2
34 files changed, 753 insertions, 1611 deletions
diff --git a/libc/sysdeps/i386/configure b/libc/sysdeps/i386/configure
index 49330e389..baa66096a 100755
--- a/libc/sysdeps/i386/configure
+++ b/libc/sysdeps/i386/configure
@@ -223,11 +223,12 @@ else
(eval $ac_try) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then
+ test $ac_status = 0; }; }; then :
libc_cv_cc_sse4=yes
else
libc_cv_cc_sse4=no
fi
+
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_sse4" >&5
$as_echo "$libc_cv_cc_sse4" >&6; }
@@ -246,11 +247,12 @@ else
(eval $ac_try) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then
+ test $ac_status = 0; }; }; then :
libc_cv_as_i686=yes
else
libc_cv_as_i686=no
fi
+
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_as_i686" >&5
$as_echo "$libc_cv_as_i686" >&6; }
@@ -265,11 +267,12 @@ else
(eval $ac_try) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then
+ test $ac_status = 0; }; }; then :
libc_cv_cc_avx=yes
else
libc_cv_cc_avx=no
fi
+
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_avx" >&5
$as_echo "$libc_cv_cc_avx" >&6; }
@@ -288,11 +291,12 @@ else
(eval $ac_try) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then
+ test $ac_status = 0; }; }; then :
libc_cv_cc_sse2avx=yes
else
libc_cv_cc_sse2avx=no
fi
+
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_sse2avx" >&5
$as_echo "$libc_cv_cc_sse2avx" >&6; }
@@ -311,11 +315,12 @@ else
(eval $ac_try) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then
+ test $ac_status = 0; }; }; then :
libc_cv_cc_fma4=yes
else
libc_cv_cc_fma4=no
fi
+
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_fma4" >&5
$as_echo "$libc_cv_cc_fma4" >&6; }
@@ -334,11 +339,12 @@ else
(eval $ac_try) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then
+ test $ac_status = 0; }; }; then :
libc_cv_cc_novzeroupper=yes
else
libc_cv_cc_novzeroupper=no
fi
+
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_novzeroupper" >&5
$as_echo "$libc_cv_cc_novzeroupper" >&6; }
diff --git a/libc/sysdeps/i386/configure.in b/libc/sysdeps/i386/configure.in
index f769019ac..7b4879d54 100644
--- a/libc/sysdeps/i386/configure.in
+++ b/libc/sysdeps/i386/configure.in
@@ -40,60 +40,48 @@ fi
dnl Check if -msse4 works.
AC_CACHE_CHECK(for SSE4 support, libc_cv_cc_sse4, [dnl
-if AC_TRY_COMMAND([${CC-cc} -msse4 -xc /dev/null -S -o /dev/null]); then
- libc_cv_cc_sse4=yes
-else
- libc_cv_cc_sse4=no
-fi])
+LIBC_TRY_CC_OPTION([-msse4], [libc_cv_cc_sse4=yes], [libc_cv_cc_sse4=no])
+])
if test $libc_cv_cc_sse4 = yes; then
AC_DEFINE(HAVE_SSE4_SUPPORT)
fi
dnl Check if -Wa,-mtune=i686 works.
AC_CACHE_CHECK(for assembler -mtune=i686 support, libc_cv_as_i686, [dnl
-if AC_TRY_COMMAND([${CC-cc} -Wa,-mtune=i686 -xc /dev/null -S -o /dev/null]); then
- libc_cv_as_i686=yes
-else
- libc_cv_as_i686=no
-fi])
+LIBC_TRY_CC_OPTION([-Wa,-mtune=i686],
+ [libc_cv_as_i686=yes],
+ [libc_cv_as_i686=no])
+])
dnl Check if -mavx works.
AC_CACHE_CHECK(for AVX support, libc_cv_cc_avx, [dnl
-if AC_TRY_COMMAND([${CC-cc} -mavx -xc /dev/null -S -o /dev/null]); then
- libc_cv_cc_avx=yes
-else
- libc_cv_cc_avx=no
-fi])
+LIBC_TRY_CC_OPTION([-mavx], [libc_cv_cc_avx=yes], [libc_cv_cc_avx=no])
+])
if test $libc_cv_cc_avx = yes; then
AC_DEFINE(HAVE_AVX_SUPPORT)
fi
dnl Check if -msse2avx works.
AC_CACHE_CHECK(for AVX encoding of SSE instructions, libc_cv_cc_sse2avx, [dnl
-if AC_TRY_COMMAND([${CC-cc} -msse2avx -xc /dev/null -S -o /dev/null]); then
- libc_cv_cc_sse2avx=yes
-else
- libc_cv_cc_sse2avx=no
-fi])
+LIBC_TRY_CC_OPTION([-msse2avx],
+ [libc_cv_cc_sse2avx=yes],
+ [libc_cv_cc_sse2avx=no])
+])
if test $libc_cv_cc_sse2avx = yes; then
AC_DEFINE(HAVE_SSE2AVX_SUPPORT)
fi
dnl Check if -mfma4 works.
AC_CACHE_CHECK(for FMA4 support, libc_cv_cc_fma4, [dnl
-if AC_TRY_COMMAND([${CC-cc} -mfma4 -xc /dev/null -S -o /dev/null]); then
- libc_cv_cc_fma4=yes
-else
- libc_cv_cc_fma4=no
-fi])
+LIBC_TRY_CC_OPTION([-mfma4], [libc_cv_cc_fma4=yes], [libc_cv_cc_fma4=no])
+])
if test $libc_cv_cc_fma4 = yes; then
AC_DEFINE(HAVE_FMA4_SUPPORT)
fi
dnl Check if -mno-vzeroupper works.
AC_CACHE_CHECK(for -mno-vzeroupper support, libc_cv_cc_novzeroupper, [dnl
-if AC_TRY_COMMAND([${CC-cc} -mno-vzeroupper -xc /dev/null -S -o /dev/null]); then
- libc_cv_cc_novzeroupper=yes
-else
- libc_cv_cc_novzeroupper=no
-fi])
+LIBC_TRY_CC_OPTION([-mno-vzeroupper],
+ [libc_cv_cc_novzeroupper=yes],
+ [libc_cv_cc_novzeroupper=no])
+])
diff --git a/libc/sysdeps/i386/fpu/branred.c b/libc/sysdeps/i386/fpu/branred.c
deleted file mode 100644
index 1cc893170..000000000
--- a/libc/sysdeps/i386/fpu/branred.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed. */
diff --git a/libc/sysdeps/i386/fpu/dosincos.c b/libc/sysdeps/i386/fpu/dosincos.c
deleted file mode 100644
index 1cc893170..000000000
--- a/libc/sysdeps/i386/fpu/dosincos.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed. */
diff --git a/libc/sysdeps/i386/fpu/e_pow.S b/libc/sysdeps/i386/fpu/e_pow.S
index 63c44f135..1abedf628 100644
--- a/libc/sysdeps/i386/fpu/e_pow.S
+++ b/libc/sysdeps/i386/fpu/e_pow.S
@@ -230,6 +230,16 @@ ENTRY(__ieee754_pow)
testb $2, %dh
jz 16f // jump if x == +inf
+ // fistpll raises invalid exception for |y| >= 1L<<63, so test
+ // that (in which case y is certainly even) before testing
+ // whether y is odd.
+ fld %st // y : y
+ fabs // |y| : y
+ fcompl MO(p63) // y
+ fnstsw
+ sahf
+ jnc 16f
+
// We must find out whether y is an odd integer.
fld %st // y : y
fistpll (%esp) // y
@@ -239,20 +249,13 @@ ENTRY(__ieee754_pow)
sahf
jne 17f
- // OK, the value is an integer, but is the number of bits small
- // enough so that all are coming from the mantissa?
+ // OK, the value is an integer.
popl %eax
cfi_adjust_cfa_offset (-4)
popl %edx
cfi_adjust_cfa_offset (-4)
andb $1, %al
jz 18f // jump if not odd
- movl %edx, %eax
- orl %edx, %edx
- jns 155f
- negl %eax
-155: cmpl $0x00200000, %eax
- ja 18f // does not fit in mantissa bits
// It's an odd integer.
shrl $31, %edx
fldl MOX(minf_mzero, %edx, 8)
@@ -289,6 +292,16 @@ ENTRY(__ieee754_pow)
testb $2, %dh
jz 25f
+ // fistpll raises invalid exception for |y| >= 1L<<63, so test
+ // that (in which case y is certainly even) before testing
+ // whether y is odd.
+ fld %st // y : y
+ fabs // |y| : y
+ fcompl MO(p63) // y
+ fnstsw
+ sahf
+ jnc 25f
+
fld %st // y : y
fistpll (%esp) // y
fildll (%esp) // int(y) : y
@@ -297,16 +310,13 @@ ENTRY(__ieee754_pow)
sahf
jne 26f
- // OK, the value is an integer, but is the number of bits small
- // enough so that all are coming from the mantissa?
+ // OK, the value is an integer.
popl %eax
cfi_adjust_cfa_offset (-4)
popl %edx
cfi_adjust_cfa_offset (-4)
andb $1, %al
jz 27f // jump if not odd
- cmpl $0xffe00000, %edx
- jbe 27f // does not fit in mantissa bits
// It's an odd integer.
// Raise divide-by-zero exception and get minus infinity value.
fldl MO(one)
@@ -329,6 +339,14 @@ ENTRY(__ieee754_pow)
21: testb $2, %dh
jz 22f
+ // fistpll raises invalid exception for |y| >= 1L<<63, so test
+ // that (in which case y is certainly even) before testing
+ // whether y is odd.
+ fcoml MO(p63) // y
+ fnstsw
+ sahf
+ jnc 22f
+
fld %st // y : y
fistpll (%esp) // y
fildll (%esp) // int(y) : y
@@ -337,16 +355,13 @@ ENTRY(__ieee754_pow)
sahf
jne 23f
- // OK, the value is an integer, but is the number of bits small
- // enough so that all are coming from the mantissa?
+ // OK, the value is an integer.
popl %eax
cfi_adjust_cfa_offset (-4)
popl %edx
cfi_adjust_cfa_offset (-4)
andb $1, %al
jz 24f // jump if not odd
- cmpl $0xffe00000, %edx
- jae 24f // does not fit in mantissa bits
// It's an odd integer.
fldl MO(mzero)
ret
diff --git a/libc/sysdeps/i386/fpu/e_powf.S b/libc/sysdeps/i386/fpu/e_powf.S
index cc8456d28..aa58ed2b6 100644
--- a/libc/sysdeps/i386/fpu/e_powf.S
+++ b/libc/sysdeps/i386/fpu/e_powf.S
@@ -224,6 +224,16 @@ ENTRY(__ieee754_powf)
testb $2, %dh
jz 16f // jump if x == +inf
+ // fistpl raises invalid exception for |y| >= 1L<<31, so test
+ // that (in which case y is certainly even) before testing
+ // whether y is odd.
+ fld %st // y : y
+ fabs // |y| : y
+ fcompl MO(p31) // y
+ fnstsw
+ sahf
+ jnc 16f
+
// We must find out whether y is an odd integer.
fld %st // y : y
fistpl (%esp) // y
@@ -233,18 +243,11 @@ ENTRY(__ieee754_powf)
sahf
jne 17f
- // OK, the value is an integer, but is the number of bits small
- // enough so that all are coming from the mantissa?
+ // OK, the value is an integer.
popl %edx
cfi_adjust_cfa_offset (-4)
testb $1, %dl
jz 18f // jump if not odd
- movl %edx, %eax
- orl %edx, %edx
- jns 155f
- negl %eax
-155: cmpl $0x01000000, %eax
- ja 18f // does not fit in mantissa bits
// It's an odd integer.
shrl $31, %edx
fldl MOX(minf_mzero, %edx, 8)
@@ -281,6 +284,16 @@ ENTRY(__ieee754_powf)
testb $2, %dh
jz 25f
+ // fistpl raises invalid exception for |y| >= 1L<<31, so test
+ // that (in which case y is certainly even) before testing
+ // whether y is odd.
+ fld %st // y : y
+ fabs // |y| : y
+ fcompl MO(p31) // y
+ fnstsw
+ sahf
+ jnc 25f
+
fld %st // y : y
fistpl (%esp) // y
fildl (%esp) // int(y) : y
@@ -289,14 +302,11 @@ ENTRY(__ieee754_powf)
sahf
jne 26f
- // OK, the value is an integer, but is the number of bits small
- // enough so that all are coming from the mantissa?
+ // OK, the value is an integer.
popl %edx
cfi_adjust_cfa_offset (-4)
testb $1, %dl
jz 27f // jump if not odd
- cmpl $0xff000000, %edx
- jbe 27f // does not fit in mantissa bits
// It's an odd integer.
// Raise divide-by-zero exception and get minus infinity value.
fldl MO(one)
@@ -319,6 +329,14 @@ ENTRY(__ieee754_powf)
21: testb $2, %dh
jz 22f
+ // fistpl raises invalid exception for |y| >= 1L<<31, so test
+ // that (in which case y is certainly even) before testing
+ // whether y is odd.
+ fcoml MO(p31) // y
+ fnstsw
+ sahf
+ jnc 22f
+
fld %st // y : y
fistpl (%esp) // y
fildl (%esp) // int(y) : y
@@ -327,14 +345,11 @@ ENTRY(__ieee754_powf)
sahf
jne 23f
- // OK, the value is an integer, but is the number of bits small
- // enough so that all are coming from the mantissa?
+ // OK, the value is an integer.
popl %edx
cfi_adjust_cfa_offset (-4)
testb $1, %dl
jz 24f // jump if not odd
- cmpl $0xff000000, %edx
- jae 24f // does not fit in mantissa bits
// It's an odd integer.
fldl MO(mzero)
ret
diff --git a/libc/sysdeps/i386/fpu/e_powl.S b/libc/sysdeps/i386/fpu/e_powl.S
index 5d850897c..c0aa194c6 100644
--- a/libc/sysdeps/i386/fpu/e_powl.S
+++ b/libc/sysdeps/i386/fpu/e_powl.S
@@ -32,6 +32,9 @@ limit: .double 0.29
ASM_TYPE_DIRECTIVE(p63,@object)
p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43
ASM_SIZE_DIRECTIVE(p63)
+ ASM_TYPE_DIRECTIVE(p64,@object)
+p64: .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x43
+ ASM_SIZE_DIRECTIVE(p64)
.section .rodata.cst16,"aM",@progbits,16
@@ -243,6 +246,19 @@ ENTRY(__ieee754_powl)
testb $2, %dh
jz 16f // jump if x == +inf
+ // fistpll raises invalid exception for |y| >= 1L<<63, but y
+ // may be odd unless we know |y| >= 1L<<64.
+ fld %st // y : y
+ fabs // |y| : y
+ fcompl MO(p64) // y
+ fnstsw
+ sahf
+ jnc 16f
+ fldl MO(p63) // p63 : y
+ fxch // y : p63
+ fprem // y%p63 : p63
+ fstp %st(1) // y%p63
+
// We must find out whether y is an odd integer.
fld %st // y : y
fistpll (%esp) // y
@@ -295,6 +311,19 @@ ENTRY(__ieee754_powl)
testb $2, %dh
jz 25f
+ // fistpll raises invalid exception for |y| >= 1L<<63, but y
+ // may be odd unless we know |y| >= 1L<<64.
+ fld %st // y : y
+ fabs // |y| : y
+ fcompl MO(p64) // y
+ fnstsw
+ sahf
+ jnc 25f
+ fldl MO(p63) // p63 : y
+ fxch // y : p63
+ fprem // y%p63 : p63
+ fstp %st(1) // y%p63
+
fld %st // y : y
fistpll (%esp) // y
fildll (%esp) // int(y) : y
@@ -332,6 +361,18 @@ ENTRY(__ieee754_powl)
21: testb $2, %dh
jz 22f
+ // fistpll raises invalid exception for |y| >= 1L<<63, but y
+ // may be odd unless we know |y| >= 1L<<64.
+ fld %st // y : y
+ fcompl MO(p64) // y
+ fnstsw
+ sahf
+ jnc 22f
+ fldl MO(p63) // p63 : y
+ fxch // y : p63
+ fprem // y%p63 : p63
+ fstp %st(1) // y%p63
+
fld %st // y : y
fistpll (%esp) // y
fildll (%esp) // int(y) : y
diff --git a/libc/sysdeps/i386/fpu/e_rem_pio2f.c b/libc/sysdeps/i386/fpu/e_rem_pio2f.c
deleted file mode 100644
index 1347b0468..000000000
--- a/libc/sysdeps/i386/fpu/e_rem_pio2f.c
+++ /dev/null
@@ -1,3 +0,0 @@
-/* Empty. This file is only meant to avoid compiling the file with the
- same name in the libm-ieee754 directory. The code is not used since
- there is an assembler version for all users of this file. */
diff --git a/libc/sysdeps/i386/fpu/e_rem_pio2l.c b/libc/sysdeps/i386/fpu/e_rem_pio2l.c
deleted file mode 100644
index 1347b0468..000000000
--- a/libc/sysdeps/i386/fpu/e_rem_pio2l.c
+++ /dev/null
@@ -1,3 +0,0 @@
-/* Empty. This file is only meant to avoid compiling the file with the
- same name in the libm-ieee754 directory. The code is not used since
- there is an assembler version for all users of this file. */
diff --git a/libc/sysdeps/i386/fpu/feholdexcpt.c b/libc/sysdeps/i386/fpu/feholdexcpt.c
index a09d45ebd..7e1038955 100644
--- a/libc/sysdeps/i386/fpu/feholdexcpt.c
+++ b/libc/sysdeps/i386/fpu/feholdexcpt.c
@@ -1,6 +1,5 @@
/* Store current floating-point environment and clear exceptions.
- Copyright (C) 1997, 1999, 2003, 2004, 2005, 2007
- Free Software Foundation, Inc.
+ Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -26,19 +25,9 @@
int
feholdexcept (fenv_t *envp)
{
- fenv_t temp;
-
- /* Store the environment. */
- __asm__ ("fnstenv %0" : "=m" (temp));
- *envp = temp;
-
- /* Now set all exceptions to non-stop. */
- temp.__control_word |= 0x3f;
-
- /* And clear all exceptions. */
- temp.__status_word &= ~0x3f;
-
- __asm__ ("fldenv %0" : : "m" (temp));
+ /* Store the environment. Recall that fnstenv has a side effect of
+ masking all exceptions. Then clear all exceptions. */
+ __asm__ volatile ("fnstenv %0; fnclex" : "=m" (*envp));
/* If the CPU supports SSE we set the MXCSR as well. */
if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0)
diff --git a/libc/sysdeps/i386/fpu/fenv_private.h b/libc/sysdeps/i386/fpu/fenv_private.h
new file mode 100644
index 000000000..f33f57c39
--- /dev/null
+++ b/libc/sysdeps/i386/fpu/fenv_private.h
@@ -0,0 +1,304 @@
+#ifndef FENV_PRIVATE_H
+#define FENV_PRIVATE_H 1
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+#ifdef __SSE2_MATH__
+# define math_opt_barrier(x) \
+ ({ __typeof(x) __x; \
+ if (sizeof (x) <= sizeof (double)) \
+ __asm ("" : "=x" (__x) : "0" (x)); \
+ else \
+ __asm ("" : "=t" (__x) : "0" (x)); \
+ __x; })
+# define math_force_eval(x) \
+ do { \
+ if (sizeof (x) <= sizeof (double)) \
+ __asm __volatile ("" : : "x" (x)); \
+ else \
+ __asm __volatile ("" : : "f" (x)); \
+ } while (0)
+#else
+# define math_opt_barrier(x) \
+ ({ __typeof (x) __x; \
+ __asm ("" : "=t" (__x) : "0" (x)); \
+ __x; })
+# define math_force_eval(x) \
+ do { \
+ __typeof (x) __x = (x); \
+ if (sizeof (x) <= sizeof (double)) \
+ __asm __volatile ("" : : "m" (__x)); \
+ else \
+ __asm __volatile ("" : : "f" (__x)); \
+ } while (0)
+#endif
+
+/* This file is used by both the 32- and 64-bit ports. The 64-bit port
+ has a field in the fenv_t for the mxcsr; the 32-bit port does not.
+ Instead, we (ab)use the only 32-bit field extant in the struct. */
+#ifndef __x86_64__
+# define __mxcsr __eip
+#endif
+
+
+/* All of these functions are private to libm, and are all used in pairs
+ to save+change the fp state and restore the original state. Thus we
+ need not care for both the 387 and the sse unit, only the one we're
+ actually using. */
+
+#if defined __AVX__ || defined SSE2AVX
+# define STMXCSR "vstmxcsr"
+# define LDMXCSR "vldmxcsr"
+#else
+# define STMXCSR "stmxcsr"
+# define LDMXCSR "ldmxcsr"
+#endif
+
+static __always_inline void
+libc_feholdexcept_sse (fenv_t *e)
+{
+ unsigned int mxcsr;
+ asm (STMXCSR " %0" : "=m" (*&mxcsr));
+ e->__mxcsr = mxcsr;
+ mxcsr = (mxcsr | 0x1f80) & ~0x3f;
+ asm volatile (LDMXCSR " %0" : : "m" (*&mxcsr));
+}
+
+static __always_inline void
+libc_feholdexcept_387 (fenv_t *e)
+{
+ /* Recall that fnstenv has a side-effect of masking exceptions.
+ Clobber all of the fp registers so that the TOS field is 0. */
+ asm volatile ("fnstenv %0; fnclex"
+ : "=m"(*e)
+ : : "st", "st(1)", "st(2)", "st(3)",
+ "st(4)", "st(5)", "st(6)", "st(7)");
+}
+
+static __always_inline void
+libc_feholdexcept_setround_sse (fenv_t *e, int r)
+{
+ unsigned int mxcsr;
+ asm (STMXCSR " %0" : "=m" (*&mxcsr));
+ e->__mxcsr = mxcsr;
+ mxcsr = ((mxcsr | 0x1f80) & ~0x603f) | (r << 3);
+ asm volatile (LDMXCSR " %0" : : "m" (*&mxcsr));
+}
+
+/* Set both rounding mode and precision. A convenience function for use
+ by libc_feholdexcept_setround and libc_feholdexcept_setround_53bit. */
+static __always_inline void
+libc_feholdexcept_setround_387_prec (fenv_t *e, int r)
+{
+ libc_feholdexcept_387 (e);
+
+ fpu_control_t cw = e->__control_word;
+ cw &= ~(_FPU_RC_ZERO | _FPU_EXTENDED);
+ cw |= r | 0x3f;
+ _FPU_SETCW (cw);
+}
+
+static __always_inline void
+libc_feholdexcept_setround_387 (fenv_t *e, int r)
+{
+ libc_feholdexcept_setround_387_prec (e, r | _FPU_EXTENDED);
+}
+
+static __always_inline void
+libc_feholdexcept_setround_387_53bit (fenv_t *e, int r)
+{
+ libc_feholdexcept_setround_387_prec (e, r | _FPU_DOUBLE);
+}
+
+static __always_inline int
+libc_fetestexcept_sse (int e)
+{
+ unsigned int mxcsr;
+ asm volatile (STMXCSR " %0" : "=m" (*&mxcsr));
+ return mxcsr & e & FE_ALL_EXCEPT;
+}
+
+static __always_inline int
+libc_fetestexcept_387 (int ex)
+{
+ fexcept_t temp;
+ asm volatile ("fnstsw %0" : "=a" (temp));
+ return temp & ex & FE_ALL_EXCEPT;
+}
+
+static __always_inline void
+libc_fesetenv_sse (fenv_t *e)
+{
+ asm volatile (LDMXCSR " %0" : : "m" (e->__mxcsr));
+}
+
+static __always_inline void
+libc_fesetenv_387 (fenv_t *e)
+{
+ /* Clobber all fp registers so that the TOS value we saved earlier is
+ compatible with the current state of the compiler. */
+ asm volatile ("fldenv %0"
+ : : "m" (*e)
+ : "st", "st(1)", "st(2)", "st(3)",
+ "st(4)", "st(5)", "st(6)", "st(7)");
+}
+
+static __always_inline int
+libc_feupdateenv_test_sse (fenv_t *e, int ex)
+{
+ unsigned int mxcsr, old_mxcsr, cur_ex;
+ asm volatile (STMXCSR " %0" : "=m" (*&mxcsr));
+ cur_ex = mxcsr & FE_ALL_EXCEPT;
+
+ /* Merge current exceptions with the old environment. */
+ old_mxcsr = e->__mxcsr;
+ mxcsr = old_mxcsr | cur_ex;
+ asm volatile (LDMXCSR " %0" : : "m" (*&mxcsr));
+
+ /* Raise SIGFPE for any new exceptions since the hold. Expect that
+ the normal environment has all exceptions masked. */
+ if (__builtin_expect ((old_mxcsr >> 7) & cur_ex, 0))
+ __feraiseexcept (cur_ex);
+
+ /* Test for exceptions raised since the hold. */
+ return cur_ex & ex;
+}
+
+static __always_inline int
+libc_feupdateenv_test_387 (fenv_t *e, int ex)
+{
+ fexcept_t cur_ex;
+
+ /* Save current exceptions. */
+ asm volatile ("fnstsw %0" : "=a" (cur_ex));
+ cur_ex &= FE_ALL_EXCEPT;
+
+ /* Reload original environment. */
+ libc_fesetenv_387 (e);
+
+ /* Merge current exceptions. */
+ __feraiseexcept (cur_ex);
+
+ /* Test for exceptions raised since the hold. */
+ return cur_ex & ex;
+}
+
+static __always_inline void
+libc_feupdateenv_sse (fenv_t *e)
+{
+ libc_feupdateenv_test_sse (e, 0);
+}
+
+static __always_inline void
+libc_feupdateenv_387 (fenv_t *e)
+{
+ libc_feupdateenv_test_387 (e, 0);
+}
+
+static __always_inline void
+libc_feholdsetround_sse (fenv_t *e, int r)
+{
+ unsigned int mxcsr;
+ asm (STMXCSR " %0" : "=m" (*&mxcsr));
+ e->__mxcsr = mxcsr;
+ mxcsr = (mxcsr & ~0x6000) | (r << 3);
+ asm volatile (LDMXCSR " %0" : : "m" (*&mxcsr));
+}
+
+static __always_inline void
+libc_feholdsetround_387_prec (fenv_t *e, int r)
+{
+ fpu_control_t cw;
+
+ _FPU_GETCW (cw);
+ e->__control_word = cw;
+ cw &= ~(_FPU_RC_ZERO | _FPU_EXTENDED);
+ cw |= r;
+ _FPU_SETCW (cw);
+}
+
+static __always_inline void
+libc_feholdsetround_387 (fenv_t *e, int r)
+{
+ libc_feholdsetround_387_prec (e, r | _FPU_EXTENDED);
+}
+
+static __always_inline void
+libc_feholdsetround_387_53bit (fenv_t *e, int r)
+{
+ libc_feholdsetround_387_prec (e, r | _FPU_DOUBLE);
+}
+
+static __always_inline void
+libc_feresetround_sse (fenv_t *e)
+{
+ unsigned int mxcsr;
+ asm (STMXCSR " %0" : "=m" (*&mxcsr));
+ mxcsr = (mxcsr & ~0x6000) | (e->__mxcsr & 0x6000);
+ asm volatile (LDMXCSR " %0" : : "m" (*&mxcsr));
+}
+
+static __always_inline void
+libc_feresetround_387 (fenv_t *e)
+{
+ _FPU_SETCW (e->__control_word);
+}
+
+#ifdef __SSE_MATH__
+# define libc_feholdexceptf libc_feholdexcept_sse
+# define libc_feholdexcept_setroundf libc_feholdexcept_setround_sse
+# define libc_fetestexceptf libc_fetestexcept_sse
+# define libc_fesetenvf libc_fesetenv_sse
+# define libc_feupdateenv_testf libc_feupdateenv_test_sse
+# define libc_feupdateenvf libc_feupdateenv_sse
+# define libc_feholdsetroundf libc_feholdsetround_sse
+# define libc_feresetroundf libc_feresetround_sse
+#else
+# define libc_feholdexceptf libc_feholdexcept_387
+# define libc_feholdexcept_setroundf libc_feholdexcept_setround_387
+# define libc_fetestexceptf libc_fetestexcept_387
+# define libc_fesetenvf libc_fesetenv_387
+# define libc_feupdateenv_testf libc_feupdateenv_test_387
+# define libc_feupdateenvf libc_feupdateenv_387
+# define libc_feholdsetroundf libc_feholdsetround_387
+# define libc_feresetroundf libc_feresetround_387
+#endif /* __SSE_MATH__ */
+
+#ifdef __SSE2_MATH__
+# define libc_feholdexcept libc_feholdexcept_sse
+# define libc_feholdexcept_setround libc_feholdexcept_setround_sse
+# define libc_fetestexcept libc_fetestexcept_sse
+# define libc_fesetenv libc_fesetenv_sse
+# define libc_feupdateenv_test libc_feupdateenv_test_sse
+# define libc_feupdateenv libc_feupdateenv_sse
+# define libc_feholdsetround libc_feholdsetround_sse
+# define libc_feresetround libc_feresetround_sse
+#else
+# define libc_feholdexcept libc_feholdexcept_387
+# define libc_feholdexcept_setround libc_feholdexcept_setround_387
+# define libc_fetestexcept libc_fetestexcept_387
+# define libc_fesetenv libc_fesetenv_387
+# define libc_feupdateenv_test libc_feupdateenv_test_387
+# define libc_feupdateenv libc_feupdateenv_387
+# define libc_feholdsetround libc_feholdsetround_387
+# define libc_feresetround libc_feresetround_387
+#endif /* __SSE2_MATH__ */
+
+#define libc_feholdexceptl libc_feholdexcept_387
+#define libc_feholdexcept_setroundl libc_feholdexcept_setround_387
+#define libc_fetestexceptl libc_fetestexcept_387
+#define libc_fesetenvl libc_fesetenv_387
+#define libc_feupdateenv_testl libc_feupdateenv_test_387
+#define libc_feupdateenvl libc_feupdateenv_387
+#define libc_feholdsetroundl libc_feholdsetround_387
+#define libc_feresetroundl libc_feresetround_387
+
+#ifndef __SSE2_MATH__
+# define libc_feholdexcept_setround_53bit libc_feholdexcept_setround_387_53bit
+# define libc_feholdsetround_53bit libc_feholdsetround_387_53bit
+#endif
+
+#undef __mxcsr
+
+#endif /* FENV_PRIVATE_H */
diff --git a/libc/sysdeps/i386/fpu/k_rem_pio2.c b/libc/sysdeps/i386/fpu/k_rem_pio2.c
deleted file mode 100644
index 1347b0468..000000000
--- a/libc/sysdeps/i386/fpu/k_rem_pio2.c
+++ /dev/null
@@ -1,3 +0,0 @@
-/* Empty. This file is only meant to avoid compiling the file with the
- same name in the libm-ieee754 directory. The code is not used since
- there is an assembler version for all users of this file. */
diff --git a/libc/sysdeps/i386/fpu/k_rem_pio2f.c b/libc/sysdeps/i386/fpu/k_rem_pio2f.c
deleted file mode 100644
index 1347b0468..000000000
--- a/libc/sysdeps/i386/fpu/k_rem_pio2f.c
+++ /dev/null
@@ -1,3 +0,0 @@
-/* Empty. This file is only meant to avoid compiling the file with the
- same name in the libm-ieee754 directory. The code is not used since
- there is an assembler version for all users of this file. */
diff --git a/libc/sysdeps/i386/fpu/libm-test-ulps b/libc/sysdeps/i386/fpu/libm-test-ulps
index 977a3abd1..4d61635f2 100644
--- a/libc/sysdeps/i386/fpu/libm-test-ulps
+++ b/libc/sysdeps/i386/fpu/libm-test-ulps
@@ -431,15 +431,44 @@ idouble: 1
ifloat: 1
# cexp
+Test "Real part of: cexp (-10000 + 0x1p16383 i) == 1.045876464564882298442774542991176546722e-4343 + 4.421154026488516836023811173959413420548e-4344 i":
+ildouble: 1
+ldouble: 1
Test "Real part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
ildouble: 1
ldouble: 1
Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
+Test "Imaginary part of: cexp (0 + 0x1p65 i) == 0.99888622066058013610642172179340364209972 - 0.047183876212354673805106149805700013943218 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: cexp (0 - 0x1p65 i) == 0.99888622066058013610642172179340364209972 + 0.047183876212354673805106149805700013943218 i":
+float: 1
+ifloat: 1
Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
+Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: cexp (50 + 0x1p127 i) == 4.053997150228616856622417636046265337193e21 + 3.232070315463388524466674772633810238819e21 i":
+double: 2
+idouble: 2
+Test "Imaginary part of: cexp (50 + 0x1p127 i) == 4.053997150228616856622417636046265337193e21 + 3.232070315463388524466674772633810238819e21 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: cexp (500 + 0x1p1023 i) == -1.159886268932754433233243794561351783426e217 + 7.904017694554466595359379965081774849708e216 i":
+double: 1
+idouble: 1
# clog
Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
@@ -447,6 +476,21 @@ float: 1
ifloat: 1
ildouble: 1
ldouble: 1
+Test "Real part of: clog (0x1.fffffep+127 + 0x1.fffffep+127 i) == 89.06941264234832570836679262104313101776 + pi/4 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1.fp+16383 + 0x1.fp+16383 i) == 11356.83823118610934184548269774874545400 + pi/4 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1.fp+16383 + 0x1p+16383 i) == 11356.60974243783798653123798337822335902 + 0.4764674194737066993385333770295162295856 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1p-1074 + 0x1p-1074 i) == -744.0934983311012896593986823853525458290 + pi/4 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog (0x1p-149 + 0x1p-149 i) == -102.9323563131518784484589700365392203592 + pi/4 i":
+ildouble: 1
+ldouble: 1
# clog10
Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
@@ -514,6 +558,51 @@ idouble: 1
ifloat: 1
ildouble: 1
ldouble: 1
+Test "Real part of: clog10 (0x1.fffffep+127 + 0x1.fffffep+127 i) == 38.68235441693561449174780668781319348761 + pi/4*log10(e) i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1.fffffep+127 + 0x1.fffffep+127 i) == 38.68235441693561449174780668781319348761 + pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0x1.fffffffffffffp+1023 + 0x1.fffffffffffffp+1023 i) == 308.4052305577487344482591243175787477115 + pi/4*log10(e) i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (0x1.fffffffffffffp+1023 + 0x1p+1023 i) == 308.3031705664207720674749211936626341569 + 0.2013595981366865903254995612594728746470 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x1.fp+16383 + 0x1.fp+16383 i) == 4932.212175672014259683102930239951947672 + pi/4*log10(e) i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: clog10 (0x1.fp+16383 + 0x1p+16383 i) == 4932.112944269463028900262609694408579449 + 0.2069271710841128115912940666587802677383 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1p-1073 + 0x1p-1073 i) == -322.8546703496198318667349645920187712089 + pi/4*log10(e) i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x1p-1074 + 0x1p-1074 i) == -323.1557003452838130619487034867432642357 + pi/4*log10(e) i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x1p-147 + 0x1p-147 i) == -44.10089436477324509881274807713822842154 + pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (0x1p-149 + 0x1p-149 i) == -44.70295435610120748924022586658721447508 + pi/4*log10(e) i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1p-149 + 0x1p-149 i) == -44.70295435610120748924022586658721447508 + pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (0x1p-16440 + 0x1p-16441 i) == -4948.884673709346821106688037612752099609 + 0.2013595981366865710389502301937289472543 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0x1p-16440 + 0x1p-16441 i) == -4948.884673709346821106688037612752099609 + 0.2013595981366865710389502301937289472543 i":
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
double: 1
float: 1
@@ -559,7 +648,9 @@ ldouble: 1
# cos_downward
Test "cos_downward (1) == 0.5403023058681397174009366074429766037323":
double: 1
+float: 2
idouble: 1
+ifloat: 2
ildouble: 1
ldouble: 1
Test "cos_downward (10) == -0.8390715290764524522588639478240648345199":
@@ -567,9 +658,18 @@ double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "cos_downward (2) == -0.4161468365471423869975682295007621897660":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
Test "cos_downward (3) == -0.9899924966004454572715727947312613023937":
double: 1
idouble: 1
+ildouble: 1
+ldouble: 1
Test "cos_downward (4) == -0.6536436208636119146391681830977503814241":
float: 1
ifloat: 1
@@ -584,6 +684,8 @@ ifloat: 1
ildouble: 1
ldouble: 1
Test "cos_downward (8) == -0.1455000338086135258688413818311946826093":
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
Test "cos_downward (9) == -0.9111302618846769883682947111811653112463":
@@ -595,6 +697,9 @@ ildouble: 1
ldouble: 1
# cos_tonearest
+Test "cos_tonearest (2) == -0.4161468365471423869975682295007621897660":
+float: 1
+ifloat: 1
Test "cos_tonearest (8) == -0.1455000338086135258688413818311946826093":
ildouble: 1
ldouble: 1
@@ -639,6 +744,8 @@ double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
# cos_upward
Test "cos_upward (1) == 0.5403023058681397174009366074429766037323":
@@ -662,6 +769,8 @@ ldouble: 1
Test "cos_upward (4) == -0.6536436208636119146391681830977503814241":
double: 1
idouble: 1
+ildouble: 1
+ldouble: 1
Test "cos_upward (5) == 0.2836621854632262644666391715135573083344":
double: 1
idouble: 1
@@ -682,6 +791,11 @@ double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "cos_upward (9) == -0.9111302618846769883682947111811653112463":
+ildouble: 1
+ldouble: 1
# cosh
Test "cosh (0.75) == 1.29468328467684468784170818539018176":
@@ -730,18 +844,22 @@ ifloat: 1
ildouble: 1
ldouble: 1
Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
-float: 3
-ifloat: 3
+double: 1
+float: 4
+idouble: 1
+ifloat: 4
ildouble: 6
ldouble: 6
Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
float: 1
ifloat: 1
-ildouble: 1
-ldouble: 1
+ildouble: 2
+ldouble: 2
Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
ildouble: 1
ldouble: 1
@@ -749,22 +867,27 @@ Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
float: 1
ifloat: 1
Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i":
-double: 1
+double: 2
float: 3
-idouble: 1
+idouble: 2
ifloat: 3
ildouble: 3
ldouble: 3
+Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i":
+ildouble: 1
+ldouble: 1
Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
double: 1
-float: 4
+float: 5
idouble: 1
-ifloat: 4
+ifloat: 5
+ildouble: 1
+ldouble: 1
Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
-float: 1
-ifloat: 1
-ildouble: 2
-ldouble: 2
+float: 2
+ifloat: 2
+ildouble: 4
+ldouble: 4
Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i":
double: 2
float: 3
@@ -774,6 +897,9 @@ ildouble: 1
ldouble: 1
# csin
+Test "Imaginary part of: csin (-2 - 3 i) == -9.15449914691142957346729954460983256 + 4.16890695996656435075481305885375484 i":
+float: 1
+ifloat: 1
Test "Real part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i":
float: 1
ifloat: 1
@@ -805,6 +931,26 @@ Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.2592948545511627791533498306
float: 1
ifloat: 1
+# csqrt
+Test "Imaginary part of: csqrt (0x1.fffffffffffffp+1023 + 0x1p+1023 i) == 1.379778091031440685006200821918878702861e+154 + 3.257214233483129514781233066898042490248e+153 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csqrt (0x1.fp+16383 + 0x1.fp+16383 i) == 1.179514222452201722651836720466795901016e+2466 + 4.885707879516577666702435054303191575148e+2465 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csqrt (0x1p-1073 + 0x1p-1073 i) == 3.453664695497464982856905711457966660085e-162 + 1.430554756764195530630723976279903095110e-162 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csqrt (0x1p-1074 + 0x1p-1074 i) == 2.442109726130830256743814843868934877597e-162 + 1.011554969366634726113090867589031782487e-162 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csqrt (0x1p-147 + 0x1p-147 i) == 8.225610928685557596194006925540350401606e-23 + 3.407159605465907500737319471202779419102e-23 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csqrt (0x1p-149 + 0x1p-149 i) == 4.112805464342778798097003462770175200803e-23 + 1.703579802732953750368659735601389709551e-23 i":
+ildouble: 1
+ldouble: 1
+
# ctan
Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
double: 1
@@ -976,13 +1122,19 @@ Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271":
float: 1
# j0
+Test "j0 (-0x1.001000001p+593) == -3.927269966354206207832593635798954916263e-90":
+ildouble: 2
+ldouble: 2
Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1":
double: 1
float: 2
idouble: 1
ifloat: 2
-ildouble: 1
-ldouble: 1
+ildouble: 2
+ldouble: 2
+Test "j0 (0x1.d7ce3ap+107) == 2.775523647291230802651040996274861694514e-17":
+float: 1
+ifloat: 1
Test "j0 (10.0) == -0.245935764451348335197760862485328754":
double: 3
float: 1
@@ -998,8 +1150,8 @@ double: 1
float: 2
idouble: 1
ifloat: 2
-ildouble: 1
-ldouble: 1
+ildouble: 2
+ldouble: 2
Test "j0 (8.0) == 0.171650807137553906090869407851972001":
float: 1
ifloat: 1
@@ -1008,10 +1160,18 @@ ifloat: 1
Test "j1 (0.75) == 0.349243602174862192523281016426251335":
double: 1
idouble: 1
-Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
-double: 1
+Test "j1 (0x1.3ffp+74) == 1.818984347516051243459364437186082741567e-12":
float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "j1 (0x1.ff00000000002p+840) == 1.846591691699331493194965158699937660696e-127":
+double: 1
idouble: 1
+Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
+double: 2
+float: 1
+idouble: 2
ifloat: 1
ildouble: 1
ldouble: 1
@@ -1032,8 +1192,8 @@ double: 1
float: 2
idouble: 1
ifloat: 2
-ildouble: 1
-ldouble: 1
+ildouble: 2
+ldouble: 2
Test "jn (0, 10.0) == -0.245935764451348335197760862485328754":
double: 3
float: 1
@@ -1049,8 +1209,8 @@ double: 1
float: 2
idouble: 1
ifloat: 2
-ildouble: 1
-ldouble: 1
+ildouble: 2
+ldouble: 2
Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
float: 1
ifloat: 1
@@ -1058,9 +1218,9 @@ Test "jn (1, 0.75) == 0.349243602174862192523281016426251335":
double: 1
idouble: 1
Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
-double: 1
+double: 2
float: 1
-idouble: 1
+idouble: 2
ifloat: 1
ildouble: 1
ldouble: 1
@@ -1110,6 +1270,11 @@ double: 2
idouble: 2
ildouble: 1
ldouble: 1
+Test "jn (2, 0x1.ffff62p+99) == -4.43860668048170034334926693188979974489e-16":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
Test "jn (2, 2.4048255576957729) == 0.43175480701968038399746111312430703":
double: 1
float: 1
@@ -1248,19 +1413,31 @@ idouble: 1
ildouble: 1
ldouble: 1
+# sin
+Test "sin (-0x1p65) == 0.047183876212354673805106149805700013943218":
+float: 1
+ifloat: 1
+Test "sin (0x1p65) == -0.047183876212354673805106149805700013943218":
+float: 1
+ifloat: 1
+
# sin_downward
Test "sin_downward (1) == 0.8414709848078965066525023216302989996226":
ildouble: 1
ldouble: 1
Test "sin_downward (10) == -0.5440211108893698134047476618513772816836":
double: 1
+float: 1
idouble: 1
+ifloat: 1
ildouble: 1
ldouble: 1
Test "sin_downward (2) == 0.9092974268256816953960198659117448427023":
double: 1
idouble: 1
Test "sin_downward (3) == 0.1411200080598672221007448028081102798469":
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
Test "sin_downward (4) == -0.7568024953079282513726390945118290941359":
@@ -1295,6 +1472,9 @@ ildouble: 1
ldouble: 1
# sin_tonearest
+Test "sin_tonearest (1) == 0.8414709848078965066525023216302989996226":
+float: 1
+ifloat: 1
Test "sin_tonearest (10) == -0.5440211108893698134047476618513772816836":
ildouble: 1
ldouble: 1
@@ -1352,6 +1532,8 @@ ifloat: 1
Test "sin_upward (10) == -0.5440211108893698134047476618513772816836":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "sin_upward (2) == 0.9092974268256816953960198659117448427023":
float: 1
ifloat: 1
@@ -1362,12 +1544,18 @@ double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "sin_upward (4) == -0.7568024953079282513726390945118290941359":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "sin_upward (5) == -0.9589242746631384688931544061559939733525":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "sin_upward (6) == -0.2794154981989258728115554466118947596280":
ildouble: 1
ldouble: 1
@@ -1379,8 +1567,17 @@ ifloat: 1
Test "sin_upward (8) == 0.9893582466233817778081235982452886721164":
float: 1
ifloat: 1
+Test "sin_upward (9) == 0.4121184852417565697562725663524351793439":
+float: 1
+ifloat: 1
# sincos
+Test "sincos (-0x1p65, &sin_res, &cos_res) puts 0.047183876212354673805106149805700013943218 in sin_res":
+float: 1
+ifloat: 1
+Test "sincos (0x1p65, &sin_res, &cos_res) puts -0.047183876212354673805106149805700013943218 in sin_res":
+float: 1
+ifloat: 1
Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
double: 1
float: 1
@@ -1459,19 +1656,31 @@ idouble: 1
ldouble: 7
# tan
+Test "tan (0x1p16383) == 0.422722393732022337800504160054440141575":
+ildouble: 1
+ldouble: 1
+Test "tan (1e22) == -1.628778225606898878549375936939548513545":
+ildouble: 1
+ldouble: 1
Test "tan (pi/4) == 1":
double: 1
+float: 1
idouble: 1
+ifloat: 1
# tan_downward
Test "tan_downward (1) == 1.5574077246549022305069748074583601730873":
double: 1
-float: 1
+float: 2
idouble: 1
-ifloat: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
Test "tan_downward (10) == 0.6483608274590866712591249330098086768169":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "tan_downward (2) == -2.1850398632615189916433061023136825434320":
double: 1
float: 1
@@ -1512,6 +1721,8 @@ Test "tan_tonearest (1) == 1.5574077246549022305069748074583601730873":
ildouble: 1
ldouble: 1
Test "tan_tonearest (2) == -2.1850398632615189916433061023136825434320":
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
Test "tan_tonearest (6) == -0.2910061913847491570536995888681755428312":
@@ -1530,9 +1741,13 @@ double: 1
float: 1
idouble: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "tan_towardzero (10) == 0.6483608274590866712591249330098086768169":
float: 1
ifloat: 1
+ildouble: 1
+ldouble: 1
Test "tan_towardzero (2) == -2.1850398632615189916433061023136825434320":
ildouble: 1
ldouble: 1
@@ -1572,6 +1787,8 @@ ldouble: 1
# tan_upward
Test "tan_upward (1) == 1.5574077246549022305069748074583601730873":
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
Test "tan_upward (10) == 0.6483608274590866712591249330098086768169":
@@ -1595,8 +1812,8 @@ double: 1
float: 1
idouble: 1
ifloat: 1
-ildouble: 1
-ldouble: 1
+ildouble: 2
+ldouble: 2
Test "tan_upward (6) == -0.2910061913847491570536995888681755428312":
ildouble: 1
ldouble: 1
@@ -1645,6 +1862,14 @@ double: 1
float: 1
idouble: 1
ifloat: 1
+Test "y0 (0x1.3ffp+74) == 1.818984347516051243459467456433028748678e-12":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y0 (0x1.ff00000000002p+840) == 1.846591691699331493194965158699937660696e-127":
+double: 1
+idouble: 1
Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
double: 2
float: 1
@@ -1676,6 +1901,16 @@ ldouble: 1
Test "y1 (0.125) == -5.19993611253477499595928744876579921":
ildouble: 1
ldouble: 1
+Test "y1 (0x1.001000001p+593) == 3.927269966354206207832593635798954916263e-90":
+ildouble: 2
+ldouble: 2
+Test "y1 (0x1.27e204p+99) == -8.881610148467797208469612080785210013461e-16":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
Test "y1 (1.0) == -0.781212821300288716547150000047964821":
double: 1
idouble: 1
@@ -1777,9 +2012,9 @@ float: 2
idouble: 1
ifloat: 2
Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
-double: 1
+double: 2
float: 3
-idouble: 1
+idouble: 2
ifloat: 3
Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
double: 2
@@ -1927,10 +2162,18 @@ ildouble: 1
ldouble: 1
Function: Real part of "cexp":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
ildouble: 1
ldouble: 1
Function: Imaginary part of "cexp":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
ildouble: 1
ldouble: 1
@@ -1966,13 +2209,15 @@ ldouble: 1
Function: "cos_downward":
double: 1
-float: 1
+float: 2
idouble: 1
-ifloat: 1
+ifloat: 2
ildouble: 1
ldouble: 1
Function: "cos_tonearest":
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
@@ -2013,20 +2258,20 @@ double: 1
ldouble: 1
Function: Real part of "cpow":
-double: 1
-float: 4
-idouble: 1
-ifloat: 4
-ildouble: 6
-ldouble: 6
+double: 2
+float: 5
+idouble: 2
+ifloat: 5
+ildouble: 5
+ldouble: 5
Function: Imaginary part of "cpow":
double: 2
float: 3
idouble: 2
ifloat: 3
-ildouble: 2
-ldouble: 2
+ildouble: 4
+ldouble: 4
Function: Real part of "csin":
float: 1
@@ -2054,6 +2299,10 @@ ifloat: 1
ildouble: 2
ldouble: 2
+Function: Imaginary part of "csqrt":
+ildouble: 1
+ldouble: 1
+
Function: Real part of "ctan":
double: 1
idouble: 1
@@ -2140,13 +2389,13 @@ double: 3
float: 2
idouble: 3
ifloat: 2
-ildouble: 1
-ldouble: 1
+ildouble: 2
+ldouble: 2
Function: "j1":
-double: 1
+double: 2
float: 1
-idouble: 1
+idouble: 2
ifloat: 1
ildouble: 1
ldouble: 1
@@ -2201,6 +2450,10 @@ ifloat: 1
ildouble: 1
ldouble: 1
+Function: "sin":
+float: 1
+ifloat: 1
+
Function: "sin_downward":
double: 1
float: 1
@@ -2210,6 +2463,8 @@ ildouble: 1
ldouble: 1
Function: "sin_tonearest":
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
@@ -2265,17 +2520,23 @@ ldouble: 27
Function: "tan":
double: 1
+float: 1
idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
Function: "tan_downward":
double: 1
-float: 1
+float: 2
idouble: 1
-ifloat: 1
+ifloat: 2
ildouble: 1
ldouble: 1
Function: "tan_tonearest":
+float: 1
+ifloat: 1
ildouble: 1
ldouble: 1
@@ -2316,8 +2577,8 @@ double: 2
float: 2
idouble: 2
ifloat: 2
-ildouble: 1
-ldouble: 1
+ildouble: 2
+ldouble: 2
Function: "yn":
double: 2
diff --git a/libc/sysdeps/i386/fpu/math_private.h b/libc/sysdeps/i386/fpu/math_private.h
index 5253998a5..541a7f8d9 100644
--- a/libc/sysdeps/i386/fpu/math_private.h
+++ b/libc/sysdeps/i386/fpu/math_private.h
@@ -1,19 +1,6 @@
#ifndef _MATH_PRIVATE_H
-#define math_opt_barrier(x) \
-({ __typeof (x) __x; \
- __asm ("" : "=t" (__x) : "0" (x)); \
- __x; })
-#define math_force_eval(x) \
-do \
- { \
- __typeof (x) __x = (x); \
- if (sizeof (x) <= sizeof (double)) \
- __asm __volatile ("" : : "m" (__x)); \
- else \
- __asm __volatile ("" : : "f" (__x)); \
- } \
-while (0)
-
+#include "fenv_private.h"
#include_next <math_private.h>
+
#endif
diff --git a/libc/sysdeps/i386/fpu/mpa.c b/libc/sysdeps/i386/fpu/mpa.c
deleted file mode 100644
index 1cc893170..000000000
--- a/libc/sysdeps/i386/fpu/mpa.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed. */
diff --git a/libc/sysdeps/i386/fpu/mptan.c b/libc/sysdeps/i386/fpu/mptan.c
deleted file mode 100644
index 1cc893170..000000000
--- a/libc/sysdeps/i386/fpu/mptan.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed. */
diff --git a/libc/sysdeps/i386/fpu/s_cexp.S b/libc/sysdeps/i386/fpu/s_cexp.S
deleted file mode 100644
index e5fdb7d73..000000000
--- a/libc/sysdeps/i386/fpu/s_cexp.S
+++ /dev/null
@@ -1,253 +0,0 @@
-/* ix87 specific implementation of complex exponential function for double.
- Copyright (C) 1997, 2005, 2012 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
- 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
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-
- .section .rodata
-
- .align ALIGNARG(4)
- ASM_TYPE_DIRECTIVE(huge_nan_null_null,@object)
-huge_nan_null_null:
- .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f
- .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
- .double 0.0
-zero: .double 0.0
-infinity:
- .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f
- .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
- .double 0.0
- .byte 0, 0, 0, 0, 0, 0, 0, 0x80
- ASM_SIZE_DIRECTIVE(huge_nan_null_null)
-
- ASM_TYPE_DIRECTIVE(twopi,@object)
-twopi:
- .byte 0x35, 0xc2, 0x68, 0x21, 0xa2, 0xda, 0xf, 0xc9, 0x1, 0x40
- .byte 0, 0, 0, 0, 0, 0
- ASM_SIZE_DIRECTIVE(twopi)
-
- ASM_TYPE_DIRECTIVE(l2e,@object)
-l2e:
- .byte 0xbc, 0xf0, 0x17, 0x5c, 0x29, 0x3b, 0xaa, 0xb8, 0xff, 0x3f
- .byte 0, 0, 0, 0, 0, 0
- ASM_SIZE_DIRECTIVE(l2e)
-
- ASM_TYPE_DIRECTIVE(one,@object)
-one: .double 1.0
- ASM_SIZE_DIRECTIVE(one)
-
-
-#ifdef PIC
-#define MO(op) op##@GOTOFF(%ecx)
-#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
-#else
-#define MO(op) op
-#define MOX(op,x,f) op(,x,f)
-#endif
-
- .text
-ENTRY(__cexp)
- fldl 8(%esp) /* x */
- fxam
- fnstsw
- fldl 16(%esp) /* y : x */
-#ifdef PIC
- LOAD_PIC_REG (cx)
-#endif
- movb %ah, %dh
- andb $0x45, %ah
- cmpb $0x05, %ah
- je 1f /* Jump if real part is +-Inf */
- cmpb $0x01, %ah
- je 2f /* Jump if real part is NaN */
-
- fxam /* y : x */
- fnstsw
- /* If the imaginary part is not finite we return NaN+i NaN, as
- for the case when the real part is NaN. A test for +-Inf and
- NaN would be necessary. But since we know the stack register
- we applied `fxam' to is not empty we can simply use one test.
- Check your FPU manual for more information. */
- andb $0x01, %ah
- cmpb $0x01, %ah
- je 20f
-
- /* We have finite numbers in the real and imaginary part. Do
- the real work now. */
- fxch /* x : y */
- fldt MO(l2e) /* log2(e) : x : y */
- fmulp /* x * log2(e) : y */
- fld %st /* x * log2(e) : x * log2(e) : y */
- frndint /* int(x * log2(e)) : x * log2(e) : y */
- fsubr %st, %st(1) /* int(x * log2(e)) : frac(x * log2(e)) : y */
- fxch /* frac(x * log2(e)) : int(x * log2(e)) : y */
- f2xm1 /* 2^frac(x * log2(e))-1 : int(x * log2(e)) : y */
- faddl MO(one) /* 2^frac(x * log2(e)) : int(x * log2(e)) : y */
- fscale /* e^x : int(x * log2(e)) : y */
- fst %st(1) /* e^x : e^x : y */
- fxch %st(2) /* y : e^x : e^x */
- fsincos /* cos(y) : sin(y) : e^x : e^x */
- fnstsw
- testl $0x400, %eax
- jnz 7f
- fmulp %st, %st(3) /* sin(y) : e^x : e^x * cos(y) */
- fmulp %st, %st(1) /* e^x * sin(y) : e^x * cos(y) */
- movl 4(%esp), %eax /* Pointer to memory for result. */
- fstpl 8(%eax)
- fstpl (%eax)
- ret $4
-
- /* We have to reduce the argument to fsincos. */
- .align ALIGNARG(4)
-7: fldt MO(twopi) /* 2*pi : y : e^x : e^x */
- fxch /* y : 2*pi : e^x : e^x */
-8: fprem1 /* y%(2*pi) : 2*pi : e^x : e^x */
- fnstsw
- testl $0x400, %eax
- jnz 8b
- fstp %st(1) /* y%(2*pi) : e^x : e^x */
- fsincos /* cos(y) : sin(y) : e^x : e^x */
- fmulp %st, %st(3)
- fmulp %st, %st(1)
- movl 4(%esp), %eax /* Pointer to memory for result. */
- fstpl 8(%eax)
- fstpl (%eax)
- ret $4
-
- /* The real part is +-inf. We must make further differences. */
- .align ALIGNARG(4)
-1: fxam /* y : x */
- fnstsw
- movb %ah, %dl
- testb $0x01, %ah /* See above why 0x01 is usable here. */
- jne 3f
-
-
- /* The real part is +-Inf and the imaginary part is finite. */
- andl $0x245, %edx
- cmpb $0x40, %dl /* Imaginary part == 0? */
- je 4f /* Yes -> */
-
- fxch /* x : y */
- shrl $5, %edx
- fstp %st(0) /* y */ /* Drop the real part. */
- andl $16, %edx /* This puts the sign bit of the real part
- in bit 4. So we can use it to index a
- small array to select 0 or Inf. */
- fsincos /* cos(y) : sin(y) */
- fnstsw
- testl $0x0400, %eax
- jnz 5f
- fldl MOX(huge_nan_null_null,%edx,1)
- movl 4(%esp), %edx /* Pointer to memory for result. */
- fstl 8(%edx)
- fstpl (%edx)
- ftst
- fnstsw
- shll $23, %eax
- andl $0x80000000, %eax
- orl %eax, 4(%edx)
- fstp %st(0)
- ftst
- fnstsw
- shll $23, %eax
- andl $0x80000000, %eax
- orl %eax, 12(%edx)
- fstp %st(0)
- ret $4
- /* We must reduce the argument to fsincos. */
- .align ALIGNARG(4)
-5: fldt MO(twopi)
- fxch
-6: fprem1
- fnstsw
- testl $0x400, %eax
- jnz 6b
- fstp %st(1)
- fsincos
- fldl MOX(huge_nan_null_null,%edx,1)
- movl 4(%esp), %edx /* Pointer to memory for result. */
- fstl 8(%edx)
- fstpl (%edx)
- ftst
- fnstsw
- shll $23, %eax
- andl $0x80000000, %eax
- orl %eax, 4(%edx)
- fstp %st(0)
- ftst
- fnstsw
- shll $23, %eax
- andl $0x80000000, %eax
- orl %eax, 12(%edx)
- fstp %st(0)
- ret $4
-
- /* The real part is +-Inf and the imaginary part is +-0. So return
- +-Inf+-0i. */
- .align ALIGNARG(4)
-4: movl 4(%esp), %eax /* Pointer to memory for result. */
- fstpl 8(%eax)
- shrl $5, %edx
- fstp %st(0)
- andl $16, %edx
- fldl MOX(huge_nan_null_null,%edx,1)
- fstpl (%eax)
- ret $4
-
- /* The real part is +-Inf, the imaginary is also is not finite. */
- .align ALIGNARG(4)
-3: fstp %st(0)
- fstp %st(0) /* <empty> */
- andb $0x45, %ah
- andb $0x47, %dh
- xorb %dh, %ah
- jnz 30f
- fldl MO(infinity) /* Raise invalid exception. */
- fmull MO(zero)
- fstp %st(0)
-30: movl %edx, %eax
- shrl $5, %edx
- shll $4, %eax
- andl $16, %edx
- andl $32, %eax
- orl %eax, %edx
- movl 4(%esp), %eax /* Pointer to memory for result. */
-
- fldl MOX(huge_nan_null_null,%edx,1)
- fldl MOX(huge_nan_null_null+8,%edx,1)
- fxch
- fstpl (%eax)
- fstpl 8(%eax)
- ret $4
-
- /* The real part is NaN. */
- .align ALIGNARG(4)
-20: fldl MO(infinity) /* Raise invalid exception. */
- fmull MO(zero)
- fstp %st(0)
-2: fstp %st(0)
- fstp %st(0)
- movl 4(%esp), %eax /* Pointer to memory for result. */
- fldl MO(huge_nan_null_null+8)
- fstl (%eax)
- fstpl 8(%eax)
- ret $4
-
-END(__cexp)
-weak_alias (__cexp, cexp)
diff --git a/libc/sysdeps/i386/fpu/s_cexpf.S b/libc/sysdeps/i386/fpu/s_cexpf.S
deleted file mode 100644
index 6ed66e6d0..000000000
--- a/libc/sysdeps/i386/fpu/s_cexpf.S
+++ /dev/null
@@ -1,257 +0,0 @@
-/* ix87 specific implementation of complex exponential function for double.
- Copyright (C) 1997, 2005, 2012 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
- 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
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-
- .section .rodata
-
- .align ALIGNARG(4)
- ASM_TYPE_DIRECTIVE(huge_nan_null_null,@object)
-huge_nan_null_null:
- .byte 0, 0, 0x80, 0x7f
- .byte 0, 0, 0xc0, 0x7f
- .float 0.0
-zero: .float 0.0
-infinity:
- .byte 0, 0, 0x80, 0x7f
- .byte 0, 0, 0xc0, 0x7f
- .float 0.0
- .byte 0, 0, 0, 0x80
- ASM_SIZE_DIRECTIVE(huge_nan_null_null)
-
- ASM_TYPE_DIRECTIVE(twopi,@object)
-twopi:
- .byte 0x35, 0xc2, 0x68, 0x21, 0xa2, 0xda, 0xf, 0xc9, 0x1, 0x40
- .byte 0, 0, 0, 0, 0, 0
- ASM_SIZE_DIRECTIVE(twopi)
-
- ASM_TYPE_DIRECTIVE(l2e,@object)
-l2e:
- .byte 0xbc, 0xf0, 0x17, 0x5c, 0x29, 0x3b, 0xaa, 0xb8, 0xff, 0x3f
- .byte 0, 0, 0, 0, 0, 0
- ASM_SIZE_DIRECTIVE(l2e)
-
- ASM_TYPE_DIRECTIVE(one,@object)
-one: .double 1.0
- ASM_SIZE_DIRECTIVE(one)
-
-
-#ifdef PIC
-#define MO(op) op##@GOTOFF(%ecx)
-#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
-#else
-#define MO(op) op
-#define MOX(op,x,f) op(,x,f)
-#endif
-
- .text
-ENTRY(__cexpf)
- flds 4(%esp) /* x */
- fxam
- fnstsw
- flds 8(%esp) /* y : x */
-#ifdef PIC
- LOAD_PIC_REG (cx)
-#endif
- movb %ah, %dh
- andb $0x45, %ah
- cmpb $0x05, %ah
- je 1f /* Jump if real part is +-Inf */
- cmpb $0x01, %ah
- je 2f /* Jump if real part is NaN */
-
- fxam /* y : x */
- fnstsw
- /* If the imaginary part is not finite we return NaN+i NaN, as
- for the case when the real part is NaN. A test for +-Inf and
- NaN would be necessary. But since we know the stack register
- we applied `fxam' to is not empty we can simply use one test.
- Check your FPU manual for more information. */
- andb $0x01, %ah
- cmpb $0x01, %ah
- je 20f
-
- /* We have finite numbers in the real and imaginary part. Do
- the real work now. */
- fxch /* x : y */
- fldt MO(l2e) /* log2(e) : x : y */
- fmulp /* x * log2(e) : y */
- fld %st /* x * log2(e) : x * log2(e) : y */
- frndint /* int(x * log2(e)) : x * log2(e) : y */
- fsubr %st, %st(1) /* int(x * log2(e)) : frac(x * log2(e)) : y */
- fxch /* frac(x * log2(e)) : int(x * log2(e)) : y */
- f2xm1 /* 2^frac(x * log2(e))-1 : int(x * log2(e)) : y */
- faddl MO(one) /* 2^frac(x * log2(e)) : int(x * log2(e)) : y */
- fscale /* e^x : int(x * log2(e)) : y */
- fst %st(1) /* e^x : e^x : y */
- fxch %st(2) /* y : e^x : e^x */
- fsincos /* cos(y) : sin(y) : e^x : e^x */
- fnstsw
- testl $0x400, %eax
- jnz 7f
- fmulp %st, %st(3) /* sin(y) : e^x : e^x * cos(y) */
- fmulp %st, %st(1) /* e^x * sin(y) : e^x * cos(y) */
- subl $8, %esp
- cfi_adjust_cfa_offset (8)
- fstps 4(%esp)
- fstps (%esp)
- popl %eax
- cfi_adjust_cfa_offset (-4)
- popl %edx
- cfi_adjust_cfa_offset (-4)
- ret
-
- /* We have to reduce the argument to fsincos. */
- .align ALIGNARG(4)
-7: fldt MO(twopi) /* 2*pi : y : e^x : e^x */
- fxch /* y : 2*pi : e^x : e^x */
-8: fprem1 /* y%(2*pi) : 2*pi : e^x : e^x */
- fnstsw
- testl $0x400, %eax
- jnz 8b
- fstp %st(1) /* y%(2*pi) : e^x : e^x */
- fsincos /* cos(y) : sin(y) : e^x : e^x */
- fmulp %st, %st(3)
- fmulp %st, %st(1)
- subl $8, %esp
- cfi_adjust_cfa_offset (8)
- fstps 4(%esp)
- fstps (%esp)
- popl %eax
- cfi_adjust_cfa_offset (-4)
- popl %edx
- cfi_adjust_cfa_offset (-4)
- ret
-
- /* The real part is +-inf. We must make further differences. */
- .align ALIGNARG(4)
-1: fxam /* y : x */
- fnstsw
- movb %ah, %dl
- testb $0x01, %ah /* See above why 0x01 is usable here. */
- jne 3f
-
-
- /* The real part is +-Inf and the imaginary part is finite. */
- andl $0x245, %edx
- cmpb $0x40, %dl /* Imaginary part == 0? */
- je 4f /* Yes -> */
-
- fxch /* x : y */
- shrl $6, %edx
- fstp %st(0) /* y */ /* Drop the real part. */
- andl $8, %edx /* This puts the sign bit of the real part
- in bit 3. So we can use it to index a
- small array to select 0 or Inf. */
- fsincos /* cos(y) : sin(y) */
- fnstsw
- testl $0x0400, %eax
- jnz 5f
- fxch
- ftst
- fnstsw
- fstp %st(0)
- shll $23, %eax
- andl $0x80000000, %eax
- orl MOX(huge_nan_null_null,%edx,1), %eax
- movl MOX(huge_nan_null_null,%edx,1), %ecx
- movl %eax, %edx
- ftst
- fnstsw
- fstp %st(0)
- shll $23, %eax
- andl $0x80000000, %eax
- orl %ecx, %eax
- ret
- /* We must reduce the argument to fsincos. */
- .align ALIGNARG(4)
-5: fldt MO(twopi)
- fxch
-6: fprem1
- fnstsw
- testl $0x400, %eax
- jnz 6b
- fstp %st(1)
- fsincos
- fxch
- ftst
- fnstsw
- fstp %st(0)
- shll $23, %eax
- andl $0x80000000, %eax
- orl MOX(huge_nan_null_null,%edx,1), %eax
- movl MOX(huge_nan_null_null,%edx,1), %ecx
- movl %eax, %edx
- ftst
- fnstsw
- fstp %st(0)
- shll $23, %eax
- andl $0x80000000, %eax
- orl %ecx, %eax
- ret
-
- /* The real part is +-Inf and the imaginary part is +-0. So return
- +-Inf+-0i. */
- .align ALIGNARG(4)
-4: subl $4, %esp
- cfi_adjust_cfa_offset (4)
- fstps (%esp)
- shrl $6, %edx
- fstp %st(0)
- andl $8, %edx
- movl MOX(huge_nan_null_null,%edx,1), %eax
- popl %edx
- cfi_adjust_cfa_offset (-4)
- ret
-
- /* The real part is +-Inf, the imaginary is also is not finite. */
- .align ALIGNARG(4)
-3: fstp %st(0)
- fstp %st(0) /* <empty> */
- andb $0x45, %ah
- andb $0x47, %dh
- xorb %dh, %ah
- jnz 30f
- flds MO(infinity) /* Raise invalid exception. */
- fmuls MO(zero)
- fstp %st(0)
-30: movl %edx, %eax
- shrl $6, %edx
- shll $3, %eax
- andl $8, %edx
- andl $16, %eax
- orl %eax, %edx
-
- movl MOX(huge_nan_null_null,%edx,1), %eax
- movl MOX(huge_nan_null_null+4,%edx,1), %edx
- ret
-
- /* The real part is NaN. */
- .align ALIGNARG(4)
-20: flds MO(infinity) /* Raise invalid exception. */
- fmuls MO(zero)
- fstp %st(0)
-2: fstp %st(0)
- fstp %st(0)
- movl MO(huge_nan_null_null+4), %eax
- movl %eax, %edx
- ret
-
-END(__cexpf)
-weak_alias (__cexpf, cexpf)
diff --git a/libc/sysdeps/i386/fpu/s_cexpl.S b/libc/sysdeps/i386/fpu/s_cexpl.S
deleted file mode 100644
index ab02a172a..000000000
--- a/libc/sysdeps/i386/fpu/s_cexpl.S
+++ /dev/null
@@ -1,256 +0,0 @@
-/* ix87 specific implementation of complex exponential function for double.
- Copyright (C) 1997, 2005, 2012 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
- 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
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-
- .section .rodata
-
- .align ALIGNARG(4)
- ASM_TYPE_DIRECTIVE(huge_nan_null_null,@object)
-huge_nan_null_null:
- .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f
- .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
- .double 0.0
-zero: .double 0.0
-infinity:
- .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f
- .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
- .double 0.0
- .byte 0, 0, 0, 0, 0, 0, 0, 0x80
- ASM_SIZE_DIRECTIVE(huge_nan_null_null)
-
- ASM_TYPE_DIRECTIVE(twopi,@object)
-twopi:
- .byte 0x35, 0xc2, 0x68, 0x21, 0xa2, 0xda, 0xf, 0xc9, 0x1, 0x40
- .byte 0, 0, 0, 0, 0, 0
- ASM_SIZE_DIRECTIVE(twopi)
-
- ASM_TYPE_DIRECTIVE(l2e,@object)
-l2e:
- .byte 0xbc, 0xf0, 0x17, 0x5c, 0x29, 0x3b, 0xaa, 0xb8, 0xff, 0x3f
- .byte 0, 0, 0, 0, 0, 0
- ASM_SIZE_DIRECTIVE(l2e)
-
- ASM_TYPE_DIRECTIVE(one,@object)
-one: .double 1.0
- ASM_SIZE_DIRECTIVE(one)
-
-
-#ifdef PIC
-#define MO(op) op##@GOTOFF(%ecx)
-#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
-#else
-#define MO(op) op
-#define MOX(op,x,f) op(,x,f)
-#endif
-
- .text
-ENTRY(__cexpl)
- fldt 8(%esp) /* x */
- fxam
- fnstsw
- fldt 20(%esp) /* y : x */
-#ifdef PIC
- LOAD_PIC_REG (cx)
-#endif
- movb %ah, %dh
- andb $0x45, %ah
- cmpb $0x05, %ah
- je 1f /* Jump if real part is +-Inf */
- cmpb $0x01, %ah
- je 2f /* Jump if real part is NaN */
-
- fxam /* y : x */
- fnstsw
- /* If the imaginary part is not finite we return NaN+i NaN, as
- for the case when the real part is NaN. A test for +-Inf and
- NaN would be necessary. But since we know the stack register
- we applied `fxam' to is not empty we can simply use one test.
- Check your FPU manual for more information. */
- andb $0x01, %ah
- cmpb $0x01, %ah
- je 20f
-
- /* We have finite numbers in the real and imaginary part. Do
- the real work now. */
- fxch /* x : y */
- fldt MO(l2e) /* log2(e) : x : y */
- fmulp /* x * log2(e) : y */
- fld %st /* x * log2(e) : x * log2(e) : y */
- frndint /* int(x * log2(e)) : x * log2(e) : y */
- fsubr %st, %st(1) /* int(x * log2(e)) : frac(x * log2(e)) : y */
- fxch /* frac(x * log2(e)) : int(x * log2(e)) : y */
- f2xm1 /* 2^frac(x * log2(e))-1 : int(x * log2(e)) : y */
- faddl MO(one) /* 2^frac(x * log2(e)) : int(x * log2(e)) : y */
- fscale /* e^x : int(x * log2(e)) : y */
- fst %st(1) /* e^x : e^x : y */
- fxch %st(2) /* y : e^x : e^x */
- fsincos /* cos(y) : sin(y) : e^x : e^x */
- fnstsw
- testl $0x400, %eax
- jnz 7f
- fmulp %st, %st(3) /* sin(y) : e^x : e^x * cos(y) */
- fmulp %st, %st(1) /* e^x * sin(y) : e^x * cos(y) */
- movl 4(%esp), %eax /* Pointer to memory for result. */
- fstpt 12(%eax)
- fstpt (%eax)
- ret $4
-
- /* We have to reduce the argument to fsincos. */
- .align ALIGNARG(4)
-7: fldt MO(twopi) /* 2*pi : y : e^x : e^x */
- fxch /* y : 2*pi : e^x : e^x */
-8: fprem1 /* y%(2*pi) : 2*pi : e^x : e^x */
- fnstsw
- testl $0x400, %eax
- jnz 8b
- fstp %st(1) /* y%(2*pi) : e^x : e^x */
- fsincos /* cos(y) : sin(y) : e^x : e^x */
- fmulp %st, %st(3)
- fmulp %st, %st(1)
- movl 4(%esp), %eax /* Pointer to memory for result. */
- fstpt 12(%eax)
- fstpt (%eax)
- ret $4
-
- /* The real part is +-inf. We must make further differences. */
- .align ALIGNARG(4)
-1: fxam /* y : x */
- fnstsw
- movb %ah, %dl
- testb $0x01, %ah /* See above why 0x01 is usable here. */
- jne 3f
-
-
- /* The real part is +-Inf and the imaginary part is finite. */
- andl $0x245, %edx
- cmpb $0x40, %dl /* Imaginary part == 0? */
- je 4f /* Yes -> */
-
- fxch /* x : y */
- shrl $5, %edx
- fstp %st(0) /* y */ /* Drop the real part. */
- andl $16, %edx /* This puts the sign bit of the real part
- in bit 4. So we can use it to index a
- small array to select 0 or Inf. */
- fsincos /* cos(y) : sin(y) */
- fnstsw
- testl $0x0400, %eax
- jnz 5f
- fldl MOX(huge_nan_null_null,%edx,1)
- movl 4(%esp), %edx /* Pointer to memory for result. */
- fld %st
- fstpt 12(%edx)
- fstpt (%edx)
- ftst
- fnstsw
- shll $7, %eax
- andl $0x8000, %eax
- orl %eax, 8(%edx)
- fstp %st(0)
- ftst
- fnstsw
- shll $7, %eax
- andl $0x8000, %eax
- orl %eax, 20(%edx)
- fstp %st(0)
- ret $4
- /* We must reduce the argument to fsincos. */
- .align ALIGNARG(4)
-5: fldt MO(twopi)
- fxch
-6: fprem1
- fnstsw
- testl $0x400, %eax
- jnz 6b
- fstp %st(1)
- fsincos
- fldl MOX(huge_nan_null_null,%edx,1)
- movl 4(%esp), %edx /* Pointer to memory for result. */
- fld %st
- fstpt 12(%edx)
- fstpt (%edx)
- ftst
- fnstsw
- shll $7, %eax
- andl $0x8000, %eax
- orl %eax, 8(%edx)
- fstp %st(0)
- ftst
- fnstsw
- shll $7, %eax
- andl $0x8000, %eax
- orl %eax, 20(%edx)
- fstp %st(0)
- ret $4
-
- /* The real part is +-Inf and the imaginary part is +-0. So return
- +-Inf+-0i. */
- .align ALIGNARG(4)
-4: movl 4(%esp), %eax /* Pointer to memory for result. */
- fstpt 12(%eax)
- shrl $5, %edx
- fstp %st(0)
- andl $16, %edx
- fldl MOX(huge_nan_null_null,%edx,1)
- fstpt (%eax)
- ret $4
-
- /* The real part is +-Inf, the imaginary is also is not finite. */
- .align ALIGNARG(4)
-3: fstp %st(0)
- fstp %st(0) /* <empty> */
- andb $0x45, %ah
- andb $0x47, %dh
- xorb %dh, %ah
- jnz 30f
- fldl MO(infinity) /* Raise invalid exception. */
- fmull MO(zero)
- fstp %st(0)
-30: movl %edx, %eax
- shrl $5, %edx
- shll $4, %eax
- andl $16, %edx
- andl $32, %eax
- orl %eax, %edx
- movl 4(%esp), %eax /* Pointer to memory for result. */
-
- fldl MOX(huge_nan_null_null,%edx,1)
- fldl MOX(huge_nan_null_null+8,%edx,1)
- fxch
- fstpt (%eax)
- fstpt 12(%eax)
- ret $4
-
- /* The real part is NaN. */
- .align ALIGNARG(4)
-20: fldl MO(infinity) /* Raise invalid exception. */
- fmull MO(zero)
- fstp %st(0)
-2: fstp %st(0)
- fstp %st(0)
- movl 4(%esp), %eax /* Pointer to memory for result. */
- fldl MO(huge_nan_null_null+8)
- fld %st(0)
- fstpt (%eax)
- fstpt 12(%eax)
- ret $4
-
-END(__cexpl)
-weak_alias (__cexpl, cexpl)
diff --git a/libc/sysdeps/i386/fpu/s_cos.S b/libc/sysdeps/i386/fpu/s_cos.S
deleted file mode 100644
index d341d008c..000000000
--- a/libc/sysdeps/i386/fpu/s_cos.S
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
- * Public domain.
- */
-
-#define __need_Emath
-#include <bits/errno.h>
-#include <machine/asm.h>
-
-RCSID("$NetBSD: s_cos.S,v 1.5 1995/05/08 23:54:00 jtc Exp $")
-
-ENTRY(__cos)
- fldl 4(%esp)
- fxam
- fstsw %ax
- movb $0x45, %dh
- andb %ah, %dh
- cmpb $0x05, %dh
- je 3f
-4: fcos
- fnstsw %ax
- testl $0x400,%eax
- jnz 1f
- ret
- .align ALIGNARG(4)
-1: fldpi
- fadd %st(0)
- fxch %st(1)
-2: fprem1
- fnstsw %ax
- testl $0x400,%eax
- jnz 2b
- fstp %st(1)
- fcos
- ret
-3:
-#ifdef PIC
- pushl %ebx
- cfi_adjust_cfa_offset (4)
- cfi_rel_offset (ebx, 0)
- LOAD_PIC_REG (bx)
- call __errno_location@PLT
- movl $EDOM, (%eax)
- popl %ebx
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebx)
-#else
- call __errno_location@PLT
- movl $EDOM, (%eax)
-#endif
- jmp 4b
-END (__cos)
-weak_alias (__cos, cos)
diff --git a/libc/sysdeps/i386/fpu/s_cosf.S b/libc/sysdeps/i386/fpu/s_cosf.S
deleted file mode 100644
index 578967ad3..000000000
--- a/libc/sysdeps/i386/fpu/s_cosf.S
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
- * Public domain.
- */
-
-#define __need_Emath
-#include <bits/errno.h>
-#include <machine/asm.h>
-
-RCSID("$NetBSD: s_cosf.S,v 1.3 1995/05/08 23:55:16 jtc Exp $")
-
-ENTRY(__cosf)
- flds 4(%esp)
- fxam
- fstsw %ax
- movb $0x45, %dh
- andb %ah, %dh
- cmpb $0x05, %dh
- je 3f
-4: fcos
- fnstsw %ax
- testl $0x400,%eax
- jnz 1f
- ret
- .align ALIGNARG(4)
-1: fldpi
- fadd %st(0)
- fxch %st(1)
-2: fprem1
- fnstsw %ax
- testl $0x400,%eax
- jnz 2b
- fstp %st(1)
- fcos
- ret
-3:
-#ifdef PIC
- pushl %ebx
- cfi_adjust_cfa_offset (4)
- cfi_rel_offset (ebx, 0)
- LOAD_PIC_REG (bx)
- call __errno_location@PLT
- movl $EDOM, (%eax)
- popl %ebx
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebx)
-#else
- call __errno_location@PLT
- movl $EDOM, (%eax)
-#endif
- jmp 4b
-END (__cosf)
-weak_alias (__cosf, cosf)
diff --git a/libc/sysdeps/i386/fpu/s_cosl.S b/libc/sysdeps/i386/fpu/s_cosl.S
deleted file mode 100644
index 27dd74f21..000000000
--- a/libc/sysdeps/i386/fpu/s_cosl.S
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Public domain.
- *
- * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
- * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
- */
-
-#define __need_Emath
-#include <bits/errno.h>
-#include <machine/asm.h>
-
-ENTRY(__cosl)
- fldt 4(%esp)
- fxam
- fstsw %ax
- movb $0x45, %dh
- andb %ah, %dh
- cmpb $0x05, %dh
- je 3f
-4: fcos
- fnstsw %ax
- testl $0x400,%eax
- jnz 1f
- ret
- .align ALIGNARG(4)
-1: fldpi
- fadd %st(0)
- fxch %st(1)
-2: fprem1
- fnstsw %ax
- testl $0x400,%eax
- jnz 2b
- fstp %st(1)
- fcos
- ret
-3:
-#ifdef PIC
- pushl %ebx
- cfi_adjust_cfa_offset (4)
- cfi_rel_offset (ebx, 0)
- LOAD_PIC_REG (bx)
- call __errno_location@PLT
- movl $EDOM, (%eax)
- popl %ebx
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebx)
-#else
- call __errno_location@PLT
- movl $EDOM, (%eax)
-#endif
- jmp 4b
-END (__cosl)
-weak_alias (__cosl, cosl)
diff --git a/libc/sysdeps/i386/fpu/s_sin.S b/libc/sysdeps/i386/fpu/s_sin.S
deleted file mode 100644
index 6b913992d..000000000
--- a/libc/sysdeps/i386/fpu/s_sin.S
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
- * Public domain.
- */
-
-#define __need_Emath
-#include <bits/errno.h>
-#include <machine/asm.h>
-
-RCSID("$NetBSD: s_sin.S,v 1.5 1995/05/09 00:25:54 jtc Exp $")
-
-ENTRY(__sin)
- fldl 4(%esp)
- fxam
- fstsw %ax
- movb $0x45, %dh
- andb %ah, %dh
- cmpb $0x05, %dh
- je 3f
-4: fsin
- fnstsw %ax
- testl $0x400,%eax
- jnz 1f
- ret
- .align ALIGNARG(4)
-1: fldpi
- fadd %st(0)
- fxch %st(1)
-2: fprem1
- fnstsw %ax
- testl $0x400,%eax
- jnz 2b
- fstp %st(1)
- fsin
- ret
-3:
-#ifdef PIC
- pushl %ebx
- cfi_adjust_cfa_offset (4)
- cfi_rel_offset (ebx, 0)
- LOAD_PIC_REG (bx)
- call __errno_location@PLT
- movl $EDOM, (%eax)
- popl %ebx
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebx)
-#else
- call __errno_location@PLT
- movl $EDOM, (%eax)
-#endif
- jmp 4b
-END (__sin)
-weak_alias (__sin, sin)
diff --git a/libc/sysdeps/i386/fpu/s_sincos.S b/libc/sysdeps/i386/fpu/s_sincos.S
deleted file mode 100644
index 86526c972..000000000
--- a/libc/sysdeps/i386/fpu/s_sincos.S
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Compute sine and cosine of argument.
- Copyright (C) 1997, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
- 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
- <http://www.gnu.org/licenses/>. */
-
-#include <machine/asm.h>
-#include "bp-sym.h"
-#include "bp-asm.h"
-
-#define PARMS LINKAGE /* no space for saved regs */
-#define ANGLE PARMS
-#define SINP ANGLE+8
-#define COSP SINP+PTR_SIZE
-
- .text
-ENTRY (BP_SYM (__sincos))
- ENTER
-
- fldl ANGLE(%esp)
- fsincos
- movl SINP(%esp), %ecx
- CHECK_BOUNDS_BOTH_WIDE (%ecx, SINP(%esp), $8)
- movl COSP(%esp), %edx
- CHECK_BOUNDS_BOTH_WIDE (%edx, COSP(%esp), $8)
- fnstsw %ax
- testl $0x400,%eax
- jnz 1f
- fstpl (%edx)
- fstpl (%ecx)
-
- LEAVE
- ret
-
- .align ALIGNARG(4)
-1: fldpi
- fadd %st(0)
- fxch %st(1)
-2: fprem1
- fnstsw %ax
- testl $0x400,%eax
- jnz 2b
- fstp %st(1)
- fsincos
- fstpl (%edx)
- fstpl (%ecx)
-
- LEAVE
- ret
-END (BP_SYM (__sincos))
-weak_alias (BP_SYM (__sincos), BP_SYM (sincos))
diff --git a/libc/sysdeps/i386/fpu/s_sincosf.S b/libc/sysdeps/i386/fpu/s_sincosf.S
deleted file mode 100644
index 677c7c41f..000000000
--- a/libc/sysdeps/i386/fpu/s_sincosf.S
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Compute sine and cosine of argument.
- Copyright (C) 1997, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
- 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
- <http://www.gnu.org/licenses/>. */
-
-#include <machine/asm.h>
-#include "bp-sym.h"
-#include "bp-asm.h"
-
-#define PARMS LINKAGE /* no space for saved regs */
-#define ANGLE PARMS
-#define SINP ANGLE+4
-#define COSP SINP+PTR_SIZE
-
- .text
-ENTRY (BP_SYM (__sincosf))
- ENTER
-
- flds ANGLE(%esp)
- fsincos
- movl SINP(%esp), %ecx
- CHECK_BOUNDS_BOTH_WIDE (%ecx, SINP(%esp), $4)
- movl COSP(%esp), %edx
- CHECK_BOUNDS_BOTH_WIDE (%edx, COSP(%esp), $4)
- fnstsw %ax
- testl $0x400,%eax
- jnz 1f
- fstps (%edx)
- fstps (%ecx)
-
- LEAVE
- ret
-
- .align ALIGNARG(4)
-1: fldpi
- fadd %st(0)
- fxch %st(1)
-2: fprem1
- fnstsw %ax
- testl $0x400,%eax
- jnz 2b
- fstp %st(1)
- fsincos
- fstps (%edx)
- fstps (%ecx)
-
- LEAVE
- ret
-END (BP_SYM (__sincosf))
-weak_alias (BP_SYM (__sincosf), BP_SYM (sincosf))
diff --git a/libc/sysdeps/i386/fpu/s_sincosl.S b/libc/sysdeps/i386/fpu/s_sincosl.S
deleted file mode 100644
index 42a96257a..000000000
--- a/libc/sysdeps/i386/fpu/s_sincosl.S
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Compute sine and cosine of argument.
- Copyright (C) 1997, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
- 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
- <http://www.gnu.org/licenses/>. */
-
-#include <machine/asm.h>
-#include "bp-sym.h"
-#include "bp-asm.h"
-
-#define PARMS LINKAGE /* no space for saved regs */
-#define ANGLE PARMS
-#define SINP ANGLE+12
-#define COSP SINP+PTR_SIZE
-
- .text
-ENTRY (BP_SYM (__sincosl))
- ENTER
-
- fldt ANGLE(%esp)
- fsincos
- movl SINP(%esp), %ecx
- CHECK_BOUNDS_BOTH_WIDE (%ecx, SINP(%esp), $12)
- movl COSP(%esp), %edx
- CHECK_BOUNDS_BOTH_WIDE (%edx, COSP(%esp), $12)
- fnstsw %ax
- testl $0x400,%eax
- jnz 1f
- fstpt (%edx)
- fstpt (%ecx)
-
- LEAVE
- ret
-
- .align ALIGNARG(4)
-1: fldpi
- fadd %st(0)
- fxch %st(1)
-2: fprem1
- fnstsw %ax
- testl $0x400,%eax
- jnz 2b
- fstp %st(1)
- fsincos
- fstpt (%edx)
- fstpt (%ecx)
-
- LEAVE
- ret
-END (BP_SYM (__sincosl))
-weak_alias (BP_SYM (__sincosl), BP_SYM (sincosl))
diff --git a/libc/sysdeps/i386/fpu/s_sinf.S b/libc/sysdeps/i386/fpu/s_sinf.S
deleted file mode 100644
index 67621f70f..000000000
--- a/libc/sysdeps/i386/fpu/s_sinf.S
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
- * Public domain.
- */
-
-#define __need_Emath
-#include <bits/errno.h>
-#include <machine/asm.h>
-
-RCSID("$NetBSD: s_sinf.S,v 1.3 1995/05/09 00:27:53 jtc Exp $")
-
-ENTRY(__sinf)
- flds 4(%esp)
- fxam
- fstsw %ax
- movb $0x45, %dh
- andb %ah, %dh
- cmpb $0x05, %dh
- je 3f
-4: fsin
- fnstsw %ax
- testl $0x400,%eax
- jnz 1f
- ret
- .align ALIGNARG(4)
-1: fldpi
- fadd %st(0)
- fxch %st(1)
-2: fprem1
- fnstsw %ax
- testl $0x400,%eax
- jnz 2b
- fstp %st(1)
- fsin
- ret
-3:
-#ifdef PIC
- pushl %ebx
- cfi_adjust_cfa_offset (4)
- cfi_rel_offset (ebx, 0)
- LOAD_PIC_REG (bx)
- call __errno_location@PLT
- movl $EDOM, (%eax)
- popl %ebx
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebx)
-#else
- call __errno_location@PLT
- movl $EDOM, (%eax)
-#endif
- jmp 4b
-END (__sinf)
-weak_alias (__sinf, sinf)
diff --git a/libc/sysdeps/i386/fpu/s_sinl.S b/libc/sysdeps/i386/fpu/s_sinl.S
deleted file mode 100644
index 68c4f9966..000000000
--- a/libc/sysdeps/i386/fpu/s_sinl.S
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Public domain.
- *
- * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
- * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
- */
-
-#define __need_Emath
-#include <bits/errno.h>
-#include <machine/asm.h>
-
-ENTRY(__sinl)
- fldt 4(%esp)
- fxam
- fstsw %ax
- movb $0x45, %dh
- andb %ah, %dh
- cmpb $0x05, %dh
- je 3f
-4: fsin
- fnstsw %ax
- testl $0x400,%eax
- jnz 1f
- ret
- .align ALIGNARG(4)
-1: fldpi
- fadd %st(0)
- fxch %st(1)
-2: fprem1
- fnstsw %ax
- testl $0x400,%eax
- jnz 2b
- fstp %st(1)
- fsin
- ret
-3:
-#ifdef PIC
- pushl %ebx
- cfi_adjust_cfa_offset (4)
- cfi_rel_offset (ebx, 0)
- LOAD_PIC_REG (bx)
- call __errno_location@PLT
- movl $EDOM, (%eax)
- popl %ebx
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebx)
-#else
- call __errno_location@PLT
- movl $EDOM, (%eax)
-#endif
- jmp 4b
-END (__sinl)
-weak_alias (__sinl, sinl)
diff --git a/libc/sysdeps/i386/fpu/s_tan.S b/libc/sysdeps/i386/fpu/s_tan.S
deleted file mode 100644
index b35bb835d..000000000
--- a/libc/sysdeps/i386/fpu/s_tan.S
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
- * Public domain.
- */
-
-#define __need_Emath
-#include <bits/errno.h>
-#include <machine/asm.h>
-
-RCSID("$NetBSD: s_tan.S,v 1.5 1995/05/09 00:30:00 jtc Exp $")
-
-ENTRY(__tan)
- fldl 4(%esp)
- fxam
- fstsw %ax
- movb $0x45, %dh
- andb %ah, %dh
- cmpb $0x05, %dh
- je 3f
-4: fptan
- fnstsw %ax
- testl $0x400,%eax
- jnz 1f
- fstp %st(0)
- ret
-1: fldpi
- fadd %st(0)
- fxch %st(1)
-2: fprem1
- fstsw %ax
- testl $0x400,%eax
- jnz 2b
- fstp %st(1)
- fptan
- fstp %st(0)
- ret
-3:
-#ifdef PIC
- pushl %ebx
- cfi_adjust_cfa_offset (4)
- cfi_rel_offset (ebx, 0)
- LOAD_PIC_REG (bx)
- call __errno_location@PLT
- movl $EDOM, (%eax)
- popl %ebx
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebx)
-#else
- call __errno_location@PLT
- movl $EDOM, (%eax)
-#endif
- jmp 4b
-END (__tan)
-weak_alias (__tan, tan)
diff --git a/libc/sysdeps/i386/fpu/s_tanf.S b/libc/sysdeps/i386/fpu/s_tanf.S
deleted file mode 100644
index 74bc22fce..000000000
--- a/libc/sysdeps/i386/fpu/s_tanf.S
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
- * Public domain.
- */
-
-#define __need_Emath
-#include <bits/errno.h>
-#include <machine/asm.h>
-
-RCSID("$NetBSD: s_tanf.S,v 1.3 1995/05/09 00:31:09 jtc Exp $")
-
-ENTRY(__tanf)
- flds 4(%esp)
- fxam
- fstsw %ax
- movb $0x45, %dh
- andb %ah, %dh
- cmpb $0x05, %dh
- je 3f
-4: fptan
- fnstsw %ax
- testl $0x400,%eax
- jnz 1f
- fstp %st(0)
- ret
-1: fldpi
- fadd %st(0)
- fxch %st(1)
-2: fprem1
- fstsw %ax
- testl $0x400,%eax
- jnz 2b
- fstp %st(1)
- fptan
- fstp %st(0)
- ret
-3:
-#ifdef PIC
- pushl %ebx
- cfi_adjust_cfa_offset (4)
- cfi_rel_offset (ebx, 0)
- LOAD_PIC_REG (bx)
- call __errno_location@PLT
- movl $EDOM, (%eax)
- popl %ebx
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebx)
-#else
- call __errno_location@PLT
- movl $EDOM, (%eax)
-#endif
- jmp 4b
-END (__tanf)
-weak_alias (__tanf, tanf)
diff --git a/libc/sysdeps/i386/fpu/s_tanl.S b/libc/sysdeps/i386/fpu/s_tanl.S
deleted file mode 100644
index 151b77113..000000000
--- a/libc/sysdeps/i386/fpu/s_tanl.S
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Public domain.
- *
- * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
- * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
- */
-
-#define __need_Emath
-#include <bits/errno.h>
-#include <machine/asm.h>
-
-ENTRY(__tanl)
- fldt 4(%esp)
- fxam
- fstsw %ax
- movb $0x45, %dh
- andb %ah, %dh
- cmpb $0x05, %dh
- je 3f
-4: fptan
- fnstsw %ax
- testl $0x400,%eax
- jnz 1f
- fstp %st(0)
- ret
-1: fldpi
- fadd %st(0)
- fxch %st(1)
-2: fprem1
- fstsw %ax
- testl $0x400,%eax
- jnz 2b
- fstp %st(1)
- fptan
- fstp %st(0)
- ret
-3:
-#ifdef PIC
- pushl %ebx
- cfi_adjust_cfa_offset (4)
- cfi_rel_offset (ebx, 0)
- LOAD_PIC_REG (bx)
- call __errno_location@PLT
- movl $EDOM, (%eax)
- popl %ebx
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebx)
-#else
- call __errno_location@PLT
- movl $EDOM, (%eax)
-#endif
- jmp 4b
-END (__tanl)
-weak_alias (__tanl, tanl)
diff --git a/libc/sysdeps/i386/fpu/sincos32.c b/libc/sysdeps/i386/fpu/sincos32.c
deleted file mode 100644
index 1cc893170..000000000
--- a/libc/sysdeps/i386/fpu/sincos32.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed. */
diff --git a/libc/sysdeps/i386/i686/hp-timing.h b/libc/sysdeps/i386/i686/hp-timing.h
index 852f77820..1d8684ce2 100644
--- a/libc/sysdeps/i386/i686/hp-timing.h
+++ b/libc/sysdeps/i386/i686/hp-timing.h
@@ -22,7 +22,7 @@
#include <string.h>
#include <sys/param.h>
-#include <stdio-common/_itoa.h>
+#include <_itoa.h>
/* The macros defined here use the timestamp counter in i586 and up versions
of the x86 processors. They provide a very accurate way to measure the