aboutsummaryrefslogtreecommitdiff
path: root/REORG.TODO/sysdeps/i386/fpu
diff options
context:
space:
mode:
Diffstat (limited to 'REORG.TODO/sysdeps/i386/fpu')
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/Implies1
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/Versions6
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/doasin.c1
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_acos.S25
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_acosf.S24
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_acosh.S101
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_acoshf.S101
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_acoshl.S107
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_acosl.c29
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_asin.S38
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_asinf.S39
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_atan2.S30
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_atan2f.S30
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_atan2l.c19
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_atanh.S112
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_atanhf.S109
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_atanhl.S127
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_exp.S73
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_exp10.S53
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_exp10f.S53
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_exp10l.S2
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_exp2.S52
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_exp2f.S52
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_exp2l.S60
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_expf.S74
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_expl.S226
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_fmod.S18
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_fmodf.S19
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_fmodl.c23
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_hypot.S75
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_hypotf.S64
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_ilogb.S42
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_ilogbf.S42
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_ilogbl.S43
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_log.S92
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_log10.S68
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_log10f.S69
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_log10l.S71
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_log2.S69
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_log2f.S69
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_log2l.S70
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_logf.S93
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_logl.S97
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_pow.S456
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_powf.S392
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_powl.S459
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_rem_pio2.c3
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_remainder.S18
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_remainderf.S18
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_remainderl.S20
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_scalb.S100
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_scalbf.S102
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_scalbl.S90
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_sqrt.S23
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_sqrtf.S13
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/e_sqrtl.c20
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/fclrexcpt.c69
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/fedisblxcpt.c54
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/feenablxcpt.c54
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/fegetenv.c49
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/fegetexcept.c31
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/fegetmode.c32
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/fegetround.c33
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/feholdexcpt.c50
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/fenv_private.h501
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/fesetenv.c131
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/fesetexcept.c31
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/fesetmode.c54
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/fesetround.c54
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/feupdateenv.c60
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/fgetexcptflg.c57
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/fraiseexcpt.c124
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/fsetexcptflg.c69
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/ftestexcept.c40
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/halfulp.c1
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/i386-math-asm.h340
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/libm-test-ulps2202
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/libm-test-ulps-name1
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/math-tests.h27
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/math_private.h7
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/mpatan.c1
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/mpatan2.c1
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/mpexp.c1
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/mplog.c1
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/mpsqrt.c1
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_asinh.S139
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_asinhf.S139
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_asinhl.S144
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_atan.S30
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_atanf.S30
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_atanl.c22
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_cbrt.S200
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_cbrtf.S177
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_cbrtl.S229
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_ceil.S34
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_ceilf.S34
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_ceill.S40
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_copysign.S20
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_copysignf.S20
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_copysignl.S21
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_expm1.S113
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_expm1f.S113
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_expm1l.S2
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_fabs.S9
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_fabsf.S9
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_fabsl.S9
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_fdim.c50
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_finite.S17
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_finitef.S16
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_finitel.S15
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_floor.S34
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_floorf.S34
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_floorl.S40
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_fmax.S43
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_fmaxf.S43
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_fmaxl.S71
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_fmin.S43
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_fminf.S43
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_fminl.S71
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_fpclassifyl.c42
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_frexp.S83
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_frexpf.S80
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_frexpl.S92
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_isinfl.c32
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_isnanl.c43
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_llrint.S36
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_llrintf.S36
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_llrintl.S36
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_log1p.S67
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_log1pf.S67
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_log1pl.S76
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_logb.S16
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_logbf.S16
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_logbl.c19
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_lrint.S34
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_lrintf.S34
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_lrintl.S34
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_nearbyint.S20
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_nearbyintf.S20
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_nearbyintl.S23
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_nextafterl.c125
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_nexttoward.c93
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_nexttowardf.c77
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_remquo.S45
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_remquof.S45
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_remquol.S45
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_rint.S15
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_rintf.S15
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_rintl.c18
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_scalbln.c2
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_scalblnf.c2
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_scalblnl.c2
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_scalbn.S24
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_scalbnf.S24
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_scalbnl.S23
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_significand.S16
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_significandf.S16
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_significandl.c19
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_trunc.S37
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_truncf.S37
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/s_truncl.S40
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/slowexp.c1
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/slowpow.c1
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/t_exp.c1
-rw-r--r--REORG.TODO/sysdeps/i386/fpu/w_sqrt_compat.c8
165 files changed, 12049 insertions, 0 deletions
diff --git a/REORG.TODO/sysdeps/i386/fpu/Implies b/REORG.TODO/sysdeps/i386/fpu/Implies
new file mode 100644
index 0000000000..2b745a34fb
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/Implies
@@ -0,0 +1 @@
+x86/fpu
diff --git a/REORG.TODO/sysdeps/i386/fpu/Versions b/REORG.TODO/sysdeps/i386/fpu/Versions
new file mode 100644
index 0000000000..a2eec371f1
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/Versions
@@ -0,0 +1,6 @@
+libm {
+ GLIBC_2.2 {
+ # functions used in inline functions or macros
+ __expl; __expm1l;
+ }
+}
diff --git a/REORG.TODO/sysdeps/i386/fpu/doasin.c b/REORG.TODO/sysdeps/i386/fpu/doasin.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/doasin.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_acos.S b/REORG.TODO/sysdeps/i386/fpu/e_acos.S
new file mode 100644
index 0000000000..586c7fc406
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_acos.S
@@ -0,0 +1,25 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: e_acos.S,v 1.4 1995/05/08 23:44:37 jtc Exp $")
+
+/* acos = atan (sqrt((1-x) (1+x)) / x) */
+ENTRY(__ieee754_acos)
+ fldl 4(%esp) /* x */
+ fld %st /* x : x */
+ fld1 /* 1 : x : x */
+ fsubp /* 1 - x : x */
+ fld1 /* 1 : 1 - x : x */
+ fadd %st(2) /* 1 + x : 1 - x : x */
+ fmulp /* 1 - x^2 : x */
+ fsqrt /* sqrt (1 - x^2) : x */
+ fabs
+ fxch %st(1) /* x : sqrt (1 - x^2) */
+ fpatan /* atan (sqrt(1 - x^2) / x) */
+ ret
+END (__ieee754_acos)
+strong_alias (__ieee754_acos, __acos_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_acosf.S b/REORG.TODO/sysdeps/i386/fpu/e_acosf.S
new file mode 100644
index 0000000000..54930af8b2
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_acosf.S
@@ -0,0 +1,24 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+/* acos = atan (sqrt(1 - x^2) / x) */
+ENTRY(__ieee754_acosf)
+ flds 4(%esp) /* x */
+ fld %st
+ fmul %st(0) /* x^2 */
+ fld1
+ fsubp /* 1 - x^2 */
+ fsqrt /* sqrt (1 - x^2) */
+ fabs
+ fxch %st(1)
+ fpatan
+ ret
+END (__ieee754_acosf)
+strong_alias (__ieee754_acosf, __acosf_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_acosh.S b/REORG.TODO/sysdeps/i386/fpu/e_acosh.S
new file mode 100644
index 0000000000..9555ef8078
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_acosh.S
@@ -0,0 +1,101 @@
+/* ix87 specific implementation of arcsinh.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ 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>
+
+ .section .rodata.cst8,"aM",@progbits,8
+
+ .p2align 3
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ .type limit,@object
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_acosh)
+ movl 8(%esp), %ecx
+ cmpl $0x3ff00000, %ecx
+ jl 5f // < 1 => invalid
+ fldln2 // log(2)
+ fldl 4(%esp) // x : log(2)
+ cmpl $0x41b00000, %ecx
+ ja 3f // x > 2^28
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ cmpl $0x40000000, %ecx
+ ja 4f // x > 2
+
+ // 1 <= x <= 2 => y = log1p(x-1+sqrt(2*(x-1)+(x-1)^2))
+ fsubl MO(one) // x-1 : log(2)
+ fabs // acosh(1) is +0 in all rounding modes
+ fld %st // x-1 : x-1 : log(2)
+ fmul %st(1) // (x-1)^2 : x-1 : log(2)
+ fadd %st(1) // x-1+(x-1)^2 : x-1 : log(2)
+ fadd %st(1) // 2*(x-1)+(x-1)^2 : x-1 : log(2)
+ fsqrt // sqrt(2*(x-1)+(x-1)^2) : x-1 : log(2)
+ faddp // x-1+sqrt(2*(x-1)+(x-1)^2) : log(2)
+ fcoml MO(limit)
+ fnstsw
+ sahf
+ ja 2f
+ fyl2xp1 // log1p(x-1+sqrt(2*(x-1)+(x-1)^2))
+ ret
+
+2: faddl MO(one) // x+sqrt(2*(x-1)+(x-1)^2) : log(2)
+ fyl2x // log(x+sqrt(2*(x-1)+(x-1)^2))
+ ret
+
+ // x > 2^28 => y = log(x) + log(2)
+ .align ALIGNARG(4)
+3: fyl2x // log(x)
+ fldln2 // log(2) : log(x)
+ faddp // log(x)+log(2)
+ ret
+
+ // 2^28 > x > 2 => y = log(2*x - 1/(x+sqrt(x*x-1)))
+ .align ALIGNARG(4)
+4: fld %st // x : x : log(2)
+ fadd %st, %st(1) // x : 2*x : log(2)
+ fld %st // x : x : 2*x : log(2)
+ fmul %st(1) // x^2 : x : 2*x : log(2)
+ fsubl MO(one) // x^2-1 : x : 2*x : log(2)
+ fsqrt // sqrt(x^2-1) : x : 2*x : log(2)
+ faddp // x+sqrt(x^2-1) : 2*x : log(2)
+ fdivrl MO(one) // 1/(x+sqrt(x^2-1)) : 2*x : log(2)
+ fsubrp // 2*x+1/(x+sqrt(x^2)-1) : log(2)
+ fyl2x // log(2*x+1/(x+sqrt(x^2-1)))
+ ret
+
+ // x < 1 (or -NaN) => NaN
+ .align ALIGNARG(4)
+5: fldl 4(%esp)
+ fsub %st
+ fdiv %st, %st(0)
+ ret
+END(__ieee754_acosh)
+strong_alias (__ieee754_acosh, __acosh_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_acoshf.S b/REORG.TODO/sysdeps/i386/fpu/e_acoshf.S
new file mode 100644
index 0000000000..662fda3c06
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_acoshf.S
@@ -0,0 +1,101 @@
+/* ix87 specific implementation of arcsinh.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ 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>
+
+ .section .rodata.cst8,"aM",@progbits,8
+
+ .p2align 3
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ .type limit,@object
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_acoshf)
+ movl 4(%esp), %ecx
+ cmpl $0x3f800000, %ecx
+ jl 5f // < 1 => invalid
+ fldln2 // log(2)
+ flds 4(%esp) // x : log(2)
+ cmpl $0x47000000, %ecx
+ ja 3f // x > 2^14
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ cmpl $0x40000000, %ecx
+ ja 4f // x > 2
+
+ // 1 <= x <= 2 => y = log1p(x-1+sqrt(2*(x-1)+(x-1)^2))
+ fsubl MO(one) // x-1 : log(2)
+ fabs // acosh(1) is +0 in all rounding modes
+ fld %st // x-1 : x-1 : log(2)
+ fmul %st(1) // (x-1)^2 : x-1 : log(2)
+ fadd %st(1) // x-1+(x-1)^2 : x-1 : log(2)
+ fadd %st(1) // 2*(x-1)+(x-1)^2 : x-1 : log(2)
+ fsqrt // sqrt(2*(x-1)+(x-1)^2) : x-1 : log(2)
+ faddp // x-1+sqrt(2*(x-1)+(x-1)^2) : log(2)
+ fcoml MO(limit)
+ fnstsw
+ sahf
+ ja 2f
+ fyl2xp1 // log1p(x-1+sqrt(2*(x-1)+(x-1)^2))
+ ret
+
+2: faddl MO(one) // x+sqrt(2*(x-1)+(x-1)^2) : log(2)
+ fyl2x // log(x+sqrt(2*(x-1)+(x-1)^2))
+ ret
+
+ // x > 2^14 => y = log(x) + log(2)
+ .align ALIGNARG(4)
+3: fyl2x // log(x)
+ fldln2 // log(2) : log(x)
+ faddp // log(x)+log(2)
+ ret
+
+ // 2^28 > x > 2 => y = log(2*x - 1/(x+sqrt(x*x-1)))
+ .align ALIGNARG(4)
+4: fld %st // x : x : log(2)
+ fadd %st, %st(1) // x : 2*x : log(2)
+ fld %st // x : x : 2*x : log(2)
+ fmul %st(1) // x^2 : x : 2*x : log(2)
+ fsubl MO(one) // x^2-1 : x : 2*x : log(2)
+ fsqrt // sqrt(x^2-1) : x : 2*x : log(2)
+ faddp // x+sqrt(x^2-1) : 2*x : log(2)
+ fdivrl MO(one) // 1/(x+sqrt(x^2-1)) : 2*x : log(2)
+ fsubrp // 2*x+1/(x+sqrt(x^2)-1) : log(2)
+ fyl2x // log(2*x+1/(x+sqrt(x^2-1)))
+ ret
+
+ // x < 1 (or -NaN) => NaN
+ .align ALIGNARG(4)
+5: flds 4(%esp)
+ fsub %st
+ fdiv %st, %st(0)
+ ret
+END(__ieee754_acoshf)
+strong_alias (__ieee754_acoshf, __acoshf_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_acoshl.S b/REORG.TODO/sysdeps/i386/fpu/e_acoshl.S
new file mode 100644
index 0000000000..e0d6466aac
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_acoshl.S
@@ -0,0 +1,107 @@
+/* ix87 specific implementation of arcsinh.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ 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>
+
+ .section .rodata.cst8,"aM",@progbits,8
+
+ .p2align 3
+ /* Please note that we use double value for 1.0. This number
+ has an exact representation and so we don't get accuracy
+ problems. The advantage is that the code is simpler. */
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ /* It is not important that this constant is precise. It is only
+ a value which is known to be on the safe side for using the
+ fyl2xp1 instruction. */
+ .type limit,@object
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_acoshl)
+ movl 12(%esp), %ecx
+ andl $0xffff, %ecx
+ cmpl $0x3fff, %ecx
+ jl 5f // < 1 => invalid
+ fldln2 // log(2)
+ fldt 4(%esp) // x : log(2)
+ cmpl $0x4020, %ecx
+ ja 3f // x > 2^34
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ cmpl $0x4000, %ecx
+ ja 4f // x > 2
+
+ // 1 <= x <= 2 => y = log1p(x-1+sqrt(2*(x-1)+(x-1)^2))
+ fsubl MO(one) // x-1 : log(2)
+ fabs // acosh(1) is +0 in all rounding modes
+ fld %st // x-1 : x-1 : log(2)
+ fmul %st(1) // (x-1)^2 : x-1 : log(2)
+ fadd %st(1) // x-1+(x-1)^2 : x-1 : log(2)
+ fadd %st(1) // 2*(x-1)+(x-1)^2 : x-1 : log(2)
+ fsqrt // sqrt(2*(x-1)+(x-1)^2) : x-1 : log(2)
+ faddp // x-1+sqrt(2*(x-1)+(x-1)^2) : log(2)
+ fcoml MO(limit)
+ fnstsw
+ sahf
+ ja 2f
+ fyl2xp1 // log1p(x-1+sqrt(2*(x-1)+(x-1)^2))
+ ret
+
+2: faddl MO(one) // x+sqrt(2*(x-1)+(x-1)^2) : log(2)
+ fyl2x // log(x+sqrt(2*(x-1)+(x-1)^2))
+ ret
+
+ // x > 2^34 => y = log(x) + log(2)
+ .align ALIGNARG(4)
+3: fyl2x // log(x)
+ fldln2 // log(2) : log(x)
+ faddp // log(x)+log(2)
+ ret
+
+ // 2^34 > x > 2 => y = log(2*x - 1/(x+sqrt(x*x-1)))
+ .align ALIGNARG(4)
+4: fld %st // x : x : log(2)
+ fadd %st, %st(1) // x : 2*x : log(2)
+ fld %st // x : x : 2*x : log(2)
+ fmul %st(1) // x^2 : x : 2*x : log(2)
+ fsubl MO(one) // x^2-1 : x : 2*x : log(2)
+ fsqrt // sqrt(x^2-1) : x : 2*x : log(2)
+ faddp // x+sqrt(x^2-1) : 2*x : log(2)
+ fdivrl MO(one) // 1/(x+sqrt(x^2-1)) : 2*x : log(2)
+ fsubrp // 2*x+1/(x+sqrt(x^2)-1) : log(2)
+ fyl2x // log(2*x+1/(x+sqrt(x^2-1)))
+ ret
+
+ // x < 1 => NaN
+ .align ALIGNARG(4)
+5: fldz
+ fdiv %st, %st(0)
+ ret
+END(__ieee754_acoshl)
+strong_alias (__ieee754_acoshl, __acoshl_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_acosl.c b/REORG.TODO/sysdeps/i386/fpu/e_acosl.c
new file mode 100644
index 0000000000..ab08931924
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_acosl.c
@@ -0,0 +1,29 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <math_private.h>
+
+long double
+__ieee754_acosl (long double x)
+{
+ long double res;
+
+ /* acosl = atanl (sqrtl((1-x) (1+x)) / x) */
+ asm ( "fld %%st\n"
+ "fld1\n"
+ "fsubp\n"
+ "fld1\n"
+ "fadd %%st(2)\n"
+ "fmulp\n" /* 1 - x^2 */
+ "fsqrt\n" /* sqrtl (1 - x^2) */
+ "fabs\n"
+ "fxch %%st(1)\n"
+ "fpatan"
+ : "=t" (res) : "0" (x) : "st(1)");
+ return res;
+}
+strong_alias (__ieee754_acosl, __acosl_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_asin.S b/REORG.TODO/sysdeps/i386/fpu/e_asin.S
new file mode 100644
index 0000000000..39c8b47da4
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_asin.S
@@ -0,0 +1,38 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+RCSID("$NetBSD: e_asin.S,v 1.4 1995/05/08 23:45:40 jtc Exp $")
+
+DEFINE_DBL_MIN
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%ecx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+
+/* asin = atan (x / sqrt((1-x) (1+x))) */
+ENTRY(__ieee754_asin)
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ fldl 4(%esp) /* x */
+ fld %st
+ fld1 /* 1 : x : x */
+ fsubp /* 1 - x : x */
+ fld1 /* 1 : 1 - x : x */
+ fadd %st(2) /* 1 + x : 1 - x : x */
+ fmulp /* 1 - x^2 */
+ fsqrt /* sqrt (1 - x^2) */
+ fpatan
+ DBL_CHECK_FORCE_UFLOW
+ ret
+END (__ieee754_asin)
+strong_alias (__ieee754_asin, __asin_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_asinf.S b/REORG.TODO/sysdeps/i386/fpu/e_asinf.S
new file mode 100644
index 0000000000..1102bdedfd
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_asinf.S
@@ -0,0 +1,39 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+RCSID("$NetBSD: $")
+
+ .section .rodata.cst4,"aM",@progbits,4
+
+DEFINE_FLT_MIN
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%ecx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+
+/* asin = atan (x / sqrt(1 - x^2)) */
+ENTRY(__ieee754_asinf)
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ flds 4(%esp) /* x */
+ fld %st
+ fmul %st(0) /* x^2 */
+ fld1
+ fsubp /* 1 - x^2 */
+ fsqrt /* sqrt (1 - x^2) */
+ fpatan
+ FLT_CHECK_FORCE_UFLOW
+ ret
+END (__ieee754_asinf)
+strong_alias (__ieee754_asinf, __asinf_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_atan2.S b/REORG.TODO/sysdeps/i386/fpu/e_atan2.S
new file mode 100644
index 0000000000..25f43bb5a1
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_atan2.S
@@ -0,0 +1,30 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+RCSID("$NetBSD: e_atan2.S,v 1.4 1995/05/08 23:46:28 jtc Exp $")
+
+DEFINE_DBL_MIN
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%ecx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_atan2)
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ fldl 4(%esp)
+ fldl 12(%esp)
+ fpatan
+ DBL_CHECK_FORCE_UFLOW_NARROW
+ ret
+END (__ieee754_atan2)
+strong_alias (__ieee754_atan2, __atan2_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_atan2f.S b/REORG.TODO/sysdeps/i386/fpu/e_atan2f.S
new file mode 100644
index 0000000000..2bc909a762
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_atan2f.S
@@ -0,0 +1,30 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+RCSID("$NetBSD: e_atan2f.S,v 1.1 1995/05/08 23:35:10 jtc Exp $")
+
+DEFINE_FLT_MIN
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%ecx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_atan2f)
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ flds 4(%esp)
+ flds 8(%esp)
+ fpatan
+ FLT_CHECK_FORCE_UFLOW_NARROW
+ ret
+END (__ieee754_atan2f)
+strong_alias (__ieee754_atan2f, __atan2f_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_atan2l.c b/REORG.TODO/sysdeps/i386/fpu/e_atan2l.c
new file mode 100644
index 0000000000..9f88bfcc08
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_atan2l.c
@@ -0,0 +1,19 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <math_private.h>
+
+long double
+__ieee754_atan2l (long double y, long double x)
+{
+ long double res;
+
+ asm ("fpatan" : "=t" (res) : "u" (y), "0" (x) : "st(1)");
+
+ return res;
+}
+strong_alias (__ieee754_atan2l, __atan2l_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_atanh.S b/REORG.TODO/sysdeps/i386/fpu/e_atanh.S
new file mode 100644
index 0000000000..cbc93d5da2
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_atanh.S
@@ -0,0 +1,112 @@
+/* ix87 specific implementation of arctanh function.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ 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 <i386-math-asm.h>
+
+ .section .rodata
+
+ .align ALIGNARG(4)
+ .type half,@object
+half: .double 0.5
+ ASM_SIZE_DIRECTIVE(half)
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ .type limit,@object
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+ .type ln2_2,@object
+ln2_2: .tfloat 0.3465735902799726547086160
+ ASM_SIZE_DIRECTIVE(ln2_2)
+
+DEFINE_DBL_MIN
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_atanh)
+ movl 8(%esp), %ecx
+
+ movl %ecx, %eax
+ andl $0x7fffffff, %eax
+ cmpl $0x7ff00000, %eax
+ jae 5f
+7:
+
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+
+ andl $0x80000000, %ecx // ECX == 0 iff X >= 0
+
+ fldt MO(ln2_2) // 0.5*ln2
+ xorl %ecx, 8(%esp)
+ fldl 4(%esp) // |x| : 0.5*ln2
+ fcoml MO(half) // |x| : 0.5*ln2
+ fld %st // |x| : |x| : 0.5*ln2
+ fnstsw // |x| : |x| : 0.5*ln2
+ sahf
+ jae 2f
+ fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2
+ fld %st // |x| : |x| : 2*|x| : 0.5*ln2
+ fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2
+ fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2
+ fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2
+ fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2
+ faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
+ fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
+ fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
+ sahf
+ jae 4f
+ fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
+ DBL_CHECK_FORCE_UFLOW_NONNEG
+ jecxz 3f
+ fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
+3: ret
+
+ .align ALIGNARG(4)
+4: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
+ fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
+ jecxz 3f
+ fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
+3: ret
+
+ .align ALIGNARG(4)
+2: faddl MO(one) // 1+|x| : |x| : 0.5*ln2
+ fxch // |x| : 1+|x| : 0.5*ln2
+ fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2
+ fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2
+ fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|))
+ jecxz 3f
+ fchs // 0.5*ln2*ld((1+x)/(1-x))
+3: ret
+
+ // x == NaN or ħInf
+5: ja 6f
+ cmpl $0, 4(%esp)
+ je 7b
+6: fldl 4(%esp)
+ ret
+END(__ieee754_atanh)
+strong_alias (__ieee754_atanh, __atanh_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_atanhf.S b/REORG.TODO/sysdeps/i386/fpu/e_atanhf.S
new file mode 100644
index 0000000000..92fda3fd82
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_atanhf.S
@@ -0,0 +1,109 @@
+/* ix87 specific implementation of arctanh function.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ 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 <i386-math-asm.h>
+
+ .section .rodata
+
+ .align ALIGNARG(4)
+ .type half,@object
+half: .double 0.5
+ ASM_SIZE_DIRECTIVE(half)
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ .type limit,@object
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+ .align ALIGNARG(4)
+ .type ln2_2,@object
+ln2_2: .tfloat 0.3465735902799726547086160
+ ASM_SIZE_DIRECTIVE(ln2_2)
+
+DEFINE_FLT_MIN
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_atanhf)
+ movl 4(%esp), %ecx
+
+ movl %ecx, %eax
+ andl $0x7fffffff, %eax
+ cmpl $0x7f800000, %eax
+ ja 5f
+
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+
+ andl $0x80000000, %ecx // ECX == 0 iff X >= 0
+
+ fldt MO(ln2_2) // 0.5*ln2
+ xorl %ecx, 4(%esp)
+ flds 4(%esp) // |x| : 0.5*ln2
+ fcoml MO(half) // |x| : 0.5*ln2
+ fld %st(0) // |x| : |x| : 0.5*ln2
+ fnstsw // |x| : |x| : 0.5*ln2
+ sahf
+ jae 2f
+ fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2
+ fld %st // |x| : |x| : 2*|x| : 0.5*ln2
+ fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2
+ fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2
+ fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2
+ fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2
+ faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
+ fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
+ fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
+ sahf
+ jae 4f
+ fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
+ FLT_CHECK_FORCE_UFLOW_NONNEG
+ jecxz 3f
+ fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
+3: ret
+
+ .align ALIGNARG(4)
+4: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
+ fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
+ jecxz 3f
+ fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
+3: ret
+
+ .align ALIGNARG(4)
+2: faddl MO(one) // 1+|x| : |x| : 0.5*ln2
+ fxch // |x| : 1+|x| : 0.5*ln2
+ fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2
+ fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2
+ fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|))
+ jecxz 3f
+ fchs // 0.5*ln2*ld((1+x)/(1-x))
+3: ret
+
+ // x == NaN
+5: flds 4(%esp)
+ ret
+END(__ieee754_atanhf)
+strong_alias (__ieee754_atanhf, __atanhf_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_atanhl.S b/REORG.TODO/sysdeps/i386/fpu/e_atanhl.S
new file mode 100644
index 0000000000..31ff7e5182
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_atanhl.S
@@ -0,0 +1,127 @@
+/* ix87 specific implementation of arctanh function.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ 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>
+
+ .section .rodata
+
+ .align ALIGNARG(4)
+ /* Please note that we use double values for 0.5 and 1.0. These
+ numbers have exact representations and so we don't get accuracy
+ problems. The advantage is that the code is simpler. */
+ .type half,@object
+half: .double 0.5
+ ASM_SIZE_DIRECTIVE(half)
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ /* It is not important that this constant is precise. It is only
+ a value which is known to be on the safe side for using the
+ fyl2xp1 instruction. */
+ .type limit,@object
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+ .align ALIGNARG(4)
+ .type ln2_2,@object
+ln2_2: .tfloat 0.3465735902799726547086160
+ ASM_SIZE_DIRECTIVE(ln2_2)
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_atanhl)
+ movl 12(%esp), %ecx
+
+ movl %ecx, %eax
+ andl $0x7fff, %eax
+ cmpl $0x7fff, %eax
+ je 5f
+ cmpl $0x3fdf, %eax
+ jge 7f
+ // Exponent below -32; return x, with underflow if subnormal.
+ fldt 4(%esp)
+ cmpl $0, %eax
+ jne 8f
+ fld %st(0)
+ fmul %st(0)
+ fstp %st(0)
+8: ret
+7:
+
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+
+ andl $0x8000, %ecx // ECX == 0 iff X >= 0
+
+ fldt MO(ln2_2) // 0.5*ln2
+ xorl %ecx, 12(%esp)
+ fldt 4(%esp) // |x| : 0.5*ln2
+ fcoml MO(half) // |x| : 0.5*ln2
+ fld %st(0) // |x| : |x| : 0.5*ln2
+ fnstsw // |x| : |x| : 0.5*ln2
+ sahf
+ jae 2f
+ fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2
+ fld %st // |x| : |x| : 2*|x| : 0.5*ln2
+ fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2
+ fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2
+ fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2
+ fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2
+ faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
+ fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
+ fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
+ sahf
+ jae 4f
+ fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
+ jecxz 3f
+ fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
+3: ret
+
+ .align ALIGNARG(4)
+4: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2
+ fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|))
+ jecxz 3f
+ fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x))
+3: ret
+
+ .align ALIGNARG(4)
+2: faddl MO(one) // 1+|x| : |x| : 0.5*ln2
+ fxch // |x| : 1+|x| : 0.5*ln2
+ fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2
+ fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2
+ fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|))
+ jecxz 3f
+ fchs // 0.5*ln2*ld((1+x)/(1-x))
+3: ret
+
+ // x == NaN or ħInf
+5: cmpl $0x80000000, 8(%esp)
+ ja 6f
+ cmpl $0, 4(%esp)
+ je 7b
+6: fldt 4(%esp)
+ fadd %st(0)
+ ret
+END(__ieee754_atanhl)
+strong_alias (__ieee754_atanhl, __atanhl_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_exp.S b/REORG.TODO/sysdeps/i386/fpu/e_exp.S
new file mode 100644
index 0000000000..a7e7f13f6f
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_exp.S
@@ -0,0 +1,73 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+DEFINE_DBL_MIN
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%ecx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+/* e^x = 2^(x * log2(e)) */
+ENTRY(__ieee754_exp)
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ fldl 4(%esp)
+/* I added the following ugly construct because exp(+-Inf) resulted
+ in NaN. The ugliness results from the bright minds at Intel.
+ For the i686 the code can be written better.
+ -- drepper@cygnus.com. */
+ fxam /* Is NaN or +-Inf? */
+ fstsw %ax
+ movb $0x45, %dh
+ andb %ah, %dh
+ cmpb $0x05, %dh
+ je 1f /* Is +-Inf, jump. */
+ fldl2e
+ fmulp /* x * log2(e) */
+ fld %st
+ frndint /* int(x * log2(e)) */
+ fsubr %st,%st(1) /* fract(x * log2(e)) */
+ fxch
+ f2xm1 /* 2^(fract(x * log2(e))) - 1 */
+ fld1
+ faddp /* 2^(fract(x * log2(e))) */
+ fscale /* e^x */
+ fstp %st(1)
+ DBL_NARROW_EVAL_UFLOW_NONNEG_NAN
+ ret
+
+1: testl $0x200, %eax /* Test sign. */
+ jz 2f /* If positive, jump. */
+ fstp %st
+ fldz /* Set result to 0. */
+2: ret
+END (__ieee754_exp)
+
+
+ENTRY(__exp_finite)
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ fldl2e
+ fmull 4(%esp) /* x * log2(e) */
+ fld %st
+ frndint /* int(x * log2(e)) */
+ fsubr %st,%st(1) /* fract(x * log2(e)) */
+ fxch
+ f2xm1 /* 2^(fract(x * log2(e))) - 1 */
+ fld1
+ faddp /* 2^(fract(x * log2(e))) */
+ fscale /* e^x */
+ fstp %st(1)
+ DBL_NARROW_EVAL_UFLOW_NONNEG
+ ret
+END(__exp_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_exp10.S b/REORG.TODO/sysdeps/i386/fpu/e_exp10.S
new file mode 100644
index 0000000000..acb5160a3f
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_exp10.S
@@ -0,0 +1,53 @@
+/*
+ * Written by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+DEFINE_DBL_MIN
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%ecx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+/* 10^x = 2^(x * log2(10)) */
+ENTRY(__ieee754_exp10)
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ fldl 4(%esp)
+/* I added the following ugly construct because exp(+-Inf) resulted
+ in NaN. The ugliness results from the bright minds at Intel.
+ For the i686 the code can be written better.
+ -- drepper@cygnus.com. */
+ fxam /* Is NaN or +-Inf? */
+ fstsw %ax
+ movb $0x45, %dh
+ andb %ah, %dh
+ cmpb $0x05, %dh
+ je 1f /* Is +-Inf, jump. */
+ fldl2t
+ fmulp /* x * log2(10) */
+ fld %st
+ frndint /* int(x * log2(10)) */
+ fsubr %st,%st(1) /* fract(x * log2(10)) */
+ fxch
+ f2xm1 /* 2^(fract(x * log2(10))) - 1 */
+ fld1
+ faddp /* 2^(fract(x * log2(10))) */
+ fscale /* e^x */
+ fstp %st(1)
+ DBL_NARROW_EVAL_UFLOW_NONNEG_NAN
+ ret
+
+1: testl $0x200, %eax /* Test sign. */
+ jz 2f /* If positive, jump. */
+ fstp %st
+ fldz /* Set result to 0. */
+2: ret
+END (__ieee754_exp10)
+strong_alias (__ieee754_exp10, __exp10_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_exp10f.S b/REORG.TODO/sysdeps/i386/fpu/e_exp10f.S
new file mode 100644
index 0000000000..1812b34398
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_exp10f.S
@@ -0,0 +1,53 @@
+/*
+ * Written by Ulrich Drepper.
+ */
+
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+DEFINE_FLT_MIN
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%ecx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+/* 10^x = 2^(x * log2(10)) */
+ENTRY(__ieee754_exp10f)
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ flds 4(%esp)
+/* I added the following ugly construct because exp(+-Inf) resulted
+ in NaN. The ugliness results from the bright minds at Intel.
+ For the i686 the code can be written better.
+ -- drepper@cygnus.com. */
+ fxam /* Is NaN or +-Inf? */
+ fstsw %ax
+ movb $0x45, %dh
+ andb %ah, %dh
+ cmpb $0x05, %dh
+ je 1f /* Is +-Inf, jump. */
+ fldl2t
+ fmulp /* x * log2(10) */
+ fld %st
+ frndint /* int(x * log2(10)) */
+ fsubr %st,%st(1) /* fract(x * log2(10)) */
+ fxch
+ f2xm1 /* 2^(fract(x * log2(10))) - 1 */
+ fld1
+ faddp /* 2^(fract(x * log2(10))) */
+ fscale /* e^x */
+ fstp %st(1)
+ FLT_NARROW_EVAL_UFLOW_NONNEG_NAN
+ ret
+
+1: testl $0x200, %eax /* Test sign. */
+ jz 2f /* If positive, jump. */
+ fstp %st
+ fldz /* Set result to 0. */
+2: ret
+END (__ieee754_exp10f)
+strong_alias (__ieee754_exp10f, __exp10f_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_exp10l.S b/REORG.TODO/sysdeps/i386/fpu/e_exp10l.S
new file mode 100644
index 0000000000..d843e2b5e8
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_exp10l.S
@@ -0,0 +1,2 @@
+#define USE_AS_EXP10L
+#include <e_expl.S>
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_exp2.S b/REORG.TODO/sysdeps/i386/fpu/e_exp2.S
new file mode 100644
index 0000000000..fc16a96053
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_exp2.S
@@ -0,0 +1,52 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Adapted for exp2 by Ulrich Drepper <drepper@cygnus.com>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+DEFINE_DBL_MIN
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%ecx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_exp2)
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ fldl 4(%esp)
+/* I added the following ugly construct because exp(+-Inf) resulted
+ in NaN. The ugliness results from the bright minds at Intel.
+ For the i686 the code can be written better.
+ -- drepper@cygnus.com. */
+ fxam /* Is NaN or +-Inf? */
+ fstsw %ax
+ movb $0x45, %dh
+ andb %ah, %dh
+ cmpb $0x05, %dh
+ je 1f /* Is +-Inf, jump. */
+ fld %st
+ frndint /* int(x) */
+ fsubr %st,%st(1) /* fract(x) */
+ fxch
+ f2xm1 /* 2^(fract(x)) - 1 */
+ fld1
+ faddp /* 2^(fract(x)) */
+ fscale /* e^x */
+ fstp %st(1)
+ DBL_NARROW_EVAL_UFLOW_NONNEG_NAN
+ ret
+
+1: testl $0x200, %eax /* Test sign. */
+ jz 2f /* If positive, jump. */
+ fstp %st
+ fldz /* Set result to 0. */
+2: ret
+END (__ieee754_exp2)
+strong_alias (__ieee754_exp2, __exp2_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_exp2f.S b/REORG.TODO/sysdeps/i386/fpu/e_exp2f.S
new file mode 100644
index 0000000000..30623cd850
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_exp2f.S
@@ -0,0 +1,52 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Adapted for exp2 by Ulrich Drepper <drepper@cygnus.com>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+DEFINE_FLT_MIN
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%ecx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_exp2f)
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ flds 4(%esp)
+/* I added the following ugly construct because exp(+-Inf) resulted
+ in NaN. The ugliness results from the bright minds at Intel.
+ For the i686 the code can be written better.
+ -- drepper@cygnus.com. */
+ fxam /* Is NaN or +-Inf? */
+ fstsw %ax
+ movb $0x45, %dh
+ andb %ah, %dh
+ cmpb $0x05, %dh
+ je 1f /* Is +-Inf, jump. */
+ fld %st
+ frndint /* int(x) */
+ fsubr %st,%st(1) /* fract(x) */
+ fxch
+ f2xm1 /* 2^(fract(x)) - 1 */
+ fld1
+ faddp /* 2^(fract(x)) */
+ fscale /* e^x */
+ fstp %st(1)
+ FLT_NARROW_EVAL_UFLOW_NONNEG_NAN
+ ret
+
+1: testl $0x200, %eax /* Test sign. */
+ jz 2f /* If positive, jump. */
+ fstp %st
+ fldz /* Set result to 0. */
+2: ret
+END (__ieee754_exp2f)
+strong_alias (__ieee754_exp2f, __exp2f_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_exp2l.S b/REORG.TODO/sysdeps/i386/fpu/e_exp2l.S
new file mode 100644
index 0000000000..c4cb73d589
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_exp2l.S
@@ -0,0 +1,60 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Adapted for exp2 by Ulrich Drepper <drepper@cygnus.com>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+DEFINE_LDBL_MIN
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%ecx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_exp2l)
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ fldt 4(%esp)
+/* I added the following ugly construct because exp(+-Inf) resulted
+ in NaN. The ugliness results from the bright minds at Intel.
+ For the i686 the code can be written better.
+ -- drepper@cygnus.com. */
+ fxam /* Is NaN or +-Inf? */
+ fstsw %ax
+ movb $0x45, %dh
+ andb %ah, %dh
+ cmpb $0x05, %dh
+ je 1f /* Is +-Inf, jump. */
+ movzwl 4+8(%esp), %eax
+ andl $0x7fff, %eax
+ cmpl $0x3fbe, %eax
+ jge 3f
+ /* Argument's exponent below -65, result rounds to 1. */
+ fld1
+ faddp
+ ret
+3: fld %st
+ frndint /* int(x) */
+ fsubr %st,%st(1) /* fract(x) */
+ fxch
+ f2xm1 /* 2^(fract(x)) - 1 */
+ fld1
+ faddp /* 2^(fract(x)) */
+ fscale /* e^x */
+ fstp %st(1)
+ LDBL_CHECK_FORCE_UFLOW_NONNEG_NAN
+ ret
+
+1: testl $0x200, %eax /* Test sign. */
+ jz 2f /* If positive, jump. */
+ fstp %st
+ fldz /* Set result to 0. */
+2: ret
+END (__ieee754_exp2l)
+strong_alias (__ieee754_exp2l, __exp2l_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_expf.S b/REORG.TODO/sysdeps/i386/fpu/e_expf.S
new file mode 100644
index 0000000000..65cb4ec204
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_expf.S
@@ -0,0 +1,74 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+DEFINE_FLT_MIN
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%ecx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+/* e^x = 2^(x * log2(e)) */
+ENTRY(__ieee754_expf)
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ flds 4(%esp)
+/* I added the following ugly construct because exp(+-Inf) resulted
+ in NaN. The ugliness results from the bright minds at Intel.
+ For the i686 the code can be written better.
+ -- drepper@cygnus.com. */
+ fxam /* Is NaN or +-Inf? */
+ fstsw %ax
+ movb $0x45, %dh
+ andb %ah, %dh
+ cmpb $0x05, %dh
+ je 1f /* Is +-Inf, jump. */
+ fldl2e
+ fmulp /* x * log2(e) */
+ fld %st
+ frndint /* int(x * log2(e)) */
+ fsubr %st,%st(1) /* fract(x * log2(e)) */
+ fxch
+ f2xm1 /* 2^(fract(x * log2(e))) - 1 */
+ fld1
+ faddp /* 2^(fract(x * log2(e))) */
+ fscale /* e^x */
+ fstp %st(1)
+ FLT_NARROW_EVAL_UFLOW_NONNEG_NAN
+ ret
+
+1: testl $0x200, %eax /* Test sign. */
+ jz 2f /* If positive, jump. */
+ fstp %st
+ fldz /* Set result to 0. */
+2: ret
+END (__ieee754_expf)
+
+
+ENTRY(__expf_finite)
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ fldl2e
+ fmuls 4(%esp) /* x * log2(e) */
+ fld %st
+ frndint /* int(x * log2(e)) */
+ fsubr %st,%st(1) /* fract(x * log2(e)) */
+ fxch
+ f2xm1 /* 2^(fract(x * log2(e))) - 1 */
+ fld1
+ faddp /* 2^(fract(x * log2(e))) */
+ fscale /* e^x */
+ fstp %st(1)
+ FLT_NARROW_EVAL_UFLOW_NONNEG
+ ret
+END(__expf_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_expl.S b/REORG.TODO/sysdeps/i386/fpu/e_expl.S
new file mode 100644
index 0000000000..7d75fe22a1
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_expl.S
@@ -0,0 +1,226 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+/*
+ * The 8087 method for the exponential function is to calculate
+ * exp(x) = 2^(x log2(e))
+ * after separating integer and fractional parts
+ * x log2(e) = i + f, |f| <= .5
+ * 2^i is immediate but f needs to be precise for long double accuracy.
+ * Suppress range reduction error in computing f by the following.
+ * Separate x into integer and fractional parts
+ * x = xi + xf, |xf| <= .5
+ * Separate log2(e) into the sum of an exact number c0 and small part c1.
+ * c0 + c1 = log2(e) to extra precision
+ * Then
+ * f = (c0 xi - i) + c0 xf + c1 x
+ * where c0 xi is exact and so also is (c0 xi - i).
+ * -- moshier@na-net.ornl.gov
+ */
+
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+#ifdef USE_AS_EXP10L
+# define IEEE754_EXPL __ieee754_exp10l
+# define EXPL_FINITE __exp10l_finite
+# define FLDLOG fldl2t
+#elif defined USE_AS_EXPM1L
+# define IEEE754_EXPL __expm1l
+# undef EXPL_FINITE
+# define FLDLOG fldl2e
+#else
+# define IEEE754_EXPL __ieee754_expl
+# define EXPL_FINITE __expl_finite
+# define FLDLOG fldl2e
+#endif
+
+ .section .rodata.cst16,"aM",@progbits,16
+
+ .p2align 4
+#ifdef USE_AS_EXP10L
+ .type c0,@object
+c0: .byte 0, 0, 0, 0, 0, 0, 0x9a, 0xd4, 0x00, 0x40
+ .byte 0, 0, 0, 0, 0, 0
+ ASM_SIZE_DIRECTIVE(c0)
+ .type c1,@object
+c1: .byte 0x58, 0x92, 0xfc, 0x15, 0x37, 0x9a, 0x97, 0xf0, 0xef, 0x3f
+ .byte 0, 0, 0, 0, 0, 0
+ ASM_SIZE_DIRECTIVE(c1)
+#else
+ .type c0,@object
+c0: .byte 0, 0, 0, 0, 0, 0, 0xaa, 0xb8, 0xff, 0x3f
+ .byte 0, 0, 0, 0, 0, 0
+ ASM_SIZE_DIRECTIVE(c0)
+ .type c1,@object
+c1: .byte 0x20, 0xfa, 0xee, 0xc2, 0x5f, 0x70, 0xa5, 0xec, 0xed, 0x3f
+ .byte 0, 0, 0, 0, 0, 0
+ ASM_SIZE_DIRECTIVE(c1)
+#endif
+#ifndef USE_AS_EXPM1L
+ .type csat,@object
+csat: .byte 0, 0, 0, 0, 0, 0, 0, 0x80, 0x0e, 0x40
+ .byte 0, 0, 0, 0, 0, 0
+ ASM_SIZE_DIRECTIVE(csat)
+DEFINE_LDBL_MIN
+#endif
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%ecx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+ENTRY(IEEE754_EXPL)
+#ifdef USE_AS_EXPM1L
+ movzwl 4+8(%esp), %eax
+ xorb $0x80, %ah // invert sign bit (now 1 is "positive")
+ cmpl $0xc006, %eax // is num positive and exp >= 6 (number is >= 128.0)?
+ jae HIDDEN_JUMPTARGET (__expl) // (if num is denormal, it is at least >= 64.0)
+#endif
+ fldt 4(%esp)
+/* I added the following ugly construct because expl(+-Inf) resulted
+ in NaN. The ugliness results from the bright minds at Intel.
+ For the i686 the code can be written better.
+ -- drepper@cygnus.com. */
+ fxam /* Is NaN or +-Inf? */
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+#ifdef USE_AS_EXPM1L
+ xorb $0x80, %ah
+ cmpl $0xc006, %eax
+ fstsw %ax
+ movb $0x45, %dh
+ jb 4f
+
+ /* Below -64.0 (may be -NaN or -Inf). */
+ andb %ah, %dh
+ cmpb $0x01, %dh
+ je 6f /* Is +-NaN, jump. */
+ jmp 1f /* -large, possibly -Inf. */
+
+4: /* In range -64.0 to 64.0 (may be +-0 but not NaN or +-Inf). */
+ /* Test for +-0 as argument. */
+ andb %ah, %dh
+ cmpb $0x40, %dh
+ je 2f
+
+ /* Test for arguments that are small but not subnormal. */
+ movzwl 4+8(%esp), %eax
+ andl $0x7fff, %eax
+ cmpl $0x3fbf, %eax
+ jge 3f
+ /* Argument's exponent below -64; avoid spurious underflow if
+ normal. */
+ cmpl $0x0001, %eax
+ jge 2f
+ /* Force underflow and return the argument, to avoid wrong signs
+ of zero results from the code below in some rounding modes. */
+ fld %st
+ fmul %st
+ fstp %st
+ jmp 2f
+#else
+ movzwl 4+8(%esp), %eax
+ andl $0x7fff, %eax
+ cmpl $0x400d, %eax
+ jg 5f
+ cmpl $0x3fbc, %eax
+ jge 3f
+ /* Argument's exponent below -67, result rounds to 1. */
+ fld1
+ faddp
+ jmp 2f
+5: /* Overflow, underflow or infinity or NaN as argument. */
+ fstsw %ax
+ movb $0x45, %dh
+ andb %ah, %dh
+ cmpb $0x05, %dh
+ je 1f /* Is +-Inf, jump. */
+ cmpb $0x01, %dh
+ je 6f /* Is +-NaN, jump. */
+ /* Overflow or underflow; saturate. */
+ fstp %st
+ fldt MO(csat)
+ andb $2, %ah
+ jz 3f
+ fchs
+#endif
+3: FLDLOG /* 1 log2(base) */
+ fmul %st(1), %st /* 1 x log2(base) */
+ /* Set round-to-nearest temporarily. */
+ subl $8, %esp
+ cfi_adjust_cfa_offset (8)
+ fstcw 4(%esp)
+ movl $0xf3ff, %edx
+ andl 4(%esp), %edx
+ movl %edx, (%esp)
+ fldcw (%esp)
+ frndint /* 1 i */
+ fld %st(1) /* 2 x */
+ frndint /* 2 xi */
+ fldcw 4(%esp)
+ addl $8, %esp
+ cfi_adjust_cfa_offset (-8)
+ fld %st(1) /* 3 i */
+ fldt MO(c0) /* 4 c0 */
+ fld %st(2) /* 5 xi */
+ fmul %st(1), %st /* 5 c0 xi */
+ fsubp %st, %st(2) /* 4 f = c0 xi - i */
+ fld %st(4) /* 5 x */
+ fsub %st(3), %st /* 5 xf = x - xi */
+ fmulp %st, %st(1) /* 4 c0 xf */
+ faddp %st, %st(1) /* 3 f = f + c0 xf */
+ fldt MO(c1) /* 4 */
+ fmul %st(4), %st /* 4 c1 * x */
+ faddp %st, %st(1) /* 3 f = f + c1 * x */
+ f2xm1 /* 3 2^(fract(x * log2(base))) - 1 */
+#ifdef USE_AS_EXPM1L
+ fstp %st(1) /* 2 */
+ fscale /* 2 scale factor is st(1); base^x - 2^i */
+ fxch /* 2 i */
+ fld1 /* 3 1.0 */
+ fscale /* 3 2^i */
+ fld1 /* 4 1.0 */
+ fsubrp %st, %st(1) /* 3 2^i - 1.0 */
+ fstp %st(1) /* 2 */
+ faddp %st, %st(1) /* 1 base^x - 1.0 */
+#else
+ fld1 /* 4 1.0 */
+ faddp /* 3 2^(fract(x * log2(base))) */
+ fstp %st(1) /* 2 */
+ fscale /* 2 scale factor is st(1); base^x */
+ fstp %st(1) /* 1 */
+ LDBL_CHECK_FORCE_UFLOW_NONNEG
+#endif
+ fstp %st(1) /* 0 */
+ jmp 2f
+1:
+#ifdef USE_AS_EXPM1L
+ /* For expm1l, only negative sign gets here. */
+ fstp %st
+ fld1
+ fchs
+#else
+ testl $0x200, %eax /* Test sign. */
+ jz 2f /* If positive, jump. */
+ fstp %st
+ fldz /* Set result to 0. */
+#endif
+2: ret
+6: /* NaN argument. */
+ fadd %st
+ ret
+END(IEEE754_EXPL)
+#ifdef USE_AS_EXPM1L
+libm_hidden_def (__expm1l)
+weak_alias (__expm1l, expm1l)
+#else
+strong_alias (IEEE754_EXPL, EXPL_FINITE)
+#endif
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_fmod.S b/REORG.TODO/sysdeps/i386/fpu/e_fmod.S
new file mode 100644
index 0000000000..26b3acc392
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_fmod.S
@@ -0,0 +1,18 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(__ieee754_fmod)
+ fldl 12(%esp)
+ fldl 4(%esp)
+1: fprem
+ fstsw %ax
+ sahf
+ jp 1b
+ fstp %st(1)
+ ret
+END (__ieee754_fmod)
+strong_alias (__ieee754_fmod, __fmod_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_fmodf.S b/REORG.TODO/sysdeps/i386/fpu/e_fmodf.S
new file mode 100644
index 0000000000..ece4d98427
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_fmodf.S
@@ -0,0 +1,19 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(__ieee754_fmodf)
+ flds 8(%esp)
+ flds 4(%esp)
+1: fprem
+ fstsw %ax
+ sahf
+ jp 1b
+ fstp %st(1)
+ ret
+END(__ieee754_fmodf)
+strong_alias (__ieee754_fmodf, __fmodf_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_fmodl.c b/REORG.TODO/sysdeps/i386/fpu/e_fmodl.c
new file mode 100644
index 0000000000..49700ae8f6
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_fmodl.c
@@ -0,0 +1,23 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <math_private.h>
+
+long double
+__ieee754_fmodl (long double x, long double y)
+{
+ long double res;
+
+ asm ("1:\tfprem\n"
+ "fstsw %%ax\n"
+ "sahf\n"
+ "jp 1b\n"
+ "fstp %%st(1)"
+ : "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)");
+ return res;
+}
+strong_alias (__ieee754_fmodl, __fmodl_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_hypot.S b/REORG.TODO/sysdeps/i386/fpu/e_hypot.S
new file mode 100644
index 0000000000..7403566fd7
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_hypot.S
@@ -0,0 +1,75 @@
+/* Compute the hypothenuse of X and Y.
+ Copyright (C) 1998-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ 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>
+#include <i386-math-asm.h>
+
+DEFINE_DBL_MIN
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%edx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_hypot)
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ fldl 4(%esp) // x
+ fxam
+ fnstsw
+ fldl 12(%esp) // y : x
+ movb %ah, %ch
+ fxam
+ fnstsw
+ movb %ah, %al
+ orb %ch, %ah
+ sahf
+ jc 1f
+ fmul %st(0) // y * y : x
+ fxch // x : y * y
+ fmul %st(0) // x * x : y * y
+ faddp // x * x + y * y
+ fsqrt
+ DBL_NARROW_EVAL_UFLOW_NONNEG
+2: ret
+
+ // We have to test whether any of the parameters is Inf.
+ // In this case the result is infinity.
+1: andb $0x45, %al
+ cmpb $5, %al
+ je 3f // jump if y is Inf
+ andb $0x45, %ch
+ cmpb $5, %ch
+ jne 4f // jump if x is not Inf
+ fxch
+3: fstp %st(1)
+ fabs
+ jmp 2b
+
+4: testb $1, %al
+ jnz 5f // y is NaN
+ fxch
+5: fstp %st(1)
+ jmp 2b
+
+END(__ieee754_hypot)
+strong_alias (__ieee754_hypot, __hypot_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_hypotf.S b/REORG.TODO/sysdeps/i386/fpu/e_hypotf.S
new file mode 100644
index 0000000000..6a2c7052b2
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_hypotf.S
@@ -0,0 +1,64 @@
+/* Compute the hypothenuse of X and Y.
+ Copyright (C) 1998-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ 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>
+#include <i386-math-asm.h>
+
+ .text
+ENTRY(__ieee754_hypotf)
+ flds 4(%esp) // x
+ fxam
+ fnstsw
+ flds 8(%esp) // y : x
+ movb %ah, %ch
+ fxam
+ fnstsw
+ movb %ah, %al
+ orb %ch, %ah
+ sahf
+ jc 1f
+ fmul %st(0) // y * y : x
+ fxch // x : y * y
+ fmul %st(0) // x * x : y * y
+ faddp // x * x + y * y
+ fsqrt
+ FLT_NARROW_EVAL
+2: ret
+
+ // We have to test whether any of the parameters is Inf.
+ // In this case the result is infinity.
+1: andb $0x45, %al
+ cmpb $5, %al
+ je 3f // jump if y is Inf
+ andb $0x45, %ch
+ cmpb $5, %ch
+ jne 4f // jump if x is not Inf
+ fxch
+3: fstp %st(1)
+ fabs
+ jmp 2b
+
+4: testb $1, %al
+ jnz 5f // y is NaN
+ fxch
+5: fstp %st(1)
+ jmp 2b
+
+END(__ieee754_hypotf)
+strong_alias (__ieee754_hypotf, __hypotf_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_ilogb.S b/REORG.TODO/sysdeps/i386/fpu/e_ilogb.S
new file mode 100644
index 0000000000..29ef2214e6
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_ilogb.S
@@ -0,0 +1,42 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_ilogb.S,v 1.5 1995/10/12 15:53:09 jtc Exp $")
+
+ENTRY(__ieee754_ilogb)
+ fldl 4(%esp)
+/* I added the following ugly construct because ilogb(+-Inf) is
+ required to return INT_MAX in ISO C99.
+ -- jakub@redhat.com. */
+ fxam /* Is NaN or +-Inf? */
+ fstsw %ax
+ movb $0x45, %dh
+ andb %ah, %dh
+ cmpb $0x05, %dh
+ je 1f /* Is +-Inf, jump. */
+ cmpb $0x40, %dh
+ je 2f /* Is +-0, jump. */
+
+ fxtract
+ pushl %eax
+ cfi_adjust_cfa_offset (4)
+ fstp %st
+
+ fistpl (%esp)
+ fwait
+ popl %eax
+ cfi_adjust_cfa_offset (-4)
+
+ ret
+
+1: fstp %st
+ movl $0x7fffffff, %eax
+ ret
+2: fstp %st
+ movl $0x80000000, %eax /* FP_ILOGB0 */
+ ret
+END (__ieee754_ilogb)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_ilogbf.S b/REORG.TODO/sysdeps/i386/fpu/e_ilogbf.S
new file mode 100644
index 0000000000..d72de6c84a
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_ilogbf.S
@@ -0,0 +1,42 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_ilogbf.S,v 1.4 1995/10/22 20:32:43 pk Exp $")
+
+ENTRY(__ieee754_ilogbf)
+ flds 4(%esp)
+/* I added the following ugly construct because ilogb(+-Inf) is
+ required to return INT_MAX in ISO C99.
+ -- jakub@redhat.com. */
+ fxam /* Is NaN or +-Inf? */
+ fstsw %ax
+ movb $0x45, %dh
+ andb %ah, %dh
+ cmpb $0x05, %dh
+ je 1f /* Is +-Inf, jump. */
+ cmpb $0x40, %dh
+ je 2f /* Is +-0, jump. */
+
+ fxtract
+ pushl %eax
+ cfi_adjust_cfa_offset (4)
+ fstp %st
+
+ fistpl (%esp)
+ fwait
+ popl %eax
+ cfi_adjust_cfa_offset (-4)
+
+ ret
+
+1: fstp %st
+ movl $0x7fffffff, %eax
+ ret
+2: fstp %st
+ movl $0x80000000, %eax /* FP_ILOGB0 */
+ ret
+END (__ieee754_ilogbf)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_ilogbl.S b/REORG.TODO/sysdeps/i386/fpu/e_ilogbl.S
new file mode 100644
index 0000000000..60761dfa38
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_ilogbl.S
@@ -0,0 +1,43 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__ieee754_ilogbl)
+ fldt 4(%esp)
+/* I added the following ugly construct because ilogb(+-Inf) is
+ required to return INT_MAX in ISO C99.
+ -- jakub@redhat.com. */
+ fxam /* Is NaN or +-Inf? */
+ fstsw %ax
+ movb $0x45, %dh
+ andb %ah, %dh
+ cmpb $0x05, %dh
+ je 1f /* Is +-Inf, jump. */
+ cmpb $0x40, %dh
+ je 2f /* Is +-0, jump. */
+
+ fxtract
+ pushl %eax
+ cfi_adjust_cfa_offset (4)
+ fstp %st
+
+ fistpl (%esp)
+ fwait
+ popl %eax
+ cfi_adjust_cfa_offset (-4)
+
+ ret
+
+1: fstp %st
+ movl $0x7fffffff, %eax
+ ret
+2: fstp %st
+ movl $0x80000000, %eax /* FP_ILOGB0 */
+ ret
+END (__ieee754_ilogbl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_log.S b/REORG.TODO/sysdeps/i386/fpu/e_log.S
new file mode 100644
index 0000000000..335df22577
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_log.S
@@ -0,0 +1,92 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+ .section .rodata.cst8,"aM",@progbits,8
+
+ .p2align 3
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ /* It is not important that this constant is precise. It is only
+ a value which is known to be on the safe side for using the
+ fyl2xp1 instruction. */
+ .type limit,@object
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%edx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_log)
+ fldln2 // log(2)
+ fldl 4(%esp) // x : log(2)
+ fxam
+ fnstsw
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ fld %st // x : x : log(2)
+ sahf
+ jc 3f // in case x is NaN or +-Inf
+4: fsubl MO(one) // x-1 : x : log(2)
+ fld %st // x-1 : x-1 : x : log(2)
+ fabs // |x-1| : x-1 : x : log(2)
+ fcompl MO(limit) // x-1 : x : log(2)
+ fnstsw // x-1 : x : log(2)
+ andb $0x45, %ah
+ jz 2f
+ fxam
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x40, %ah
+ jne 5f
+ fabs // log(1) is +0 in all rounding modes.
+5: fstp %st(1) // x-1 : log(2)
+ fyl2xp1 // log(x)
+ ret
+
+2: fstp %st(0) // x : log(2)
+ fyl2x // log(x)
+ ret
+
+3: jp 4b // in case x is +-Inf
+ fstp %st(1)
+ fstp %st(1)
+ ret
+END (__ieee754_log)
+
+ENTRY(__log_finite)
+ fldln2 // log(2)
+ fldl 4(%esp) // x : log(2)
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ fld %st // x : x : log(2)
+ fsubl MO(one) // x-1 : x : log(2)
+ fld %st // x-1 : x-1 : x : log(2)
+ fabs // |x-1| : x-1 : x : log(2)
+ fcompl MO(limit) // x-1 : x : log(2)
+ fnstsw // x-1 : x : log(2)
+ andb $0x45, %ah
+ jz 2b
+ fxam
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x40, %ah
+ jne 6f
+ fabs // log(1) is +0 in all rounding modes.
+6: fstp %st(1) // x-1 : log(2)
+ fyl2xp1 // log(x)
+ ret
+END(__log_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_log10.S b/REORG.TODO/sysdeps/i386/fpu/e_log10.S
new file mode 100644
index 0000000000..17277084ca
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_log10.S
@@ -0,0 +1,68 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+ .section .rodata.cst8,"aM",@progbits,8
+
+ .p2align 3
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ /* It is not important that this constant is precise. It is only
+ a value which is known to be on the safe side for using the
+ fyl2xp1 instruction. */
+ .type limit,@object
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%edx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_log10)
+ fldlg2 // log10(2)
+ fldl 4(%esp) // x : log10(2)
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ fxam
+ fnstsw
+ fld %st // x : x : log10(2)
+ sahf
+ jc 3f // in case x is NaN or ħInf
+4: fsubl MO(one) // x-1 : x : log10(2)
+ fld %st // x-1 : x-1 : x : log10(2)
+ fabs // |x-1| : x-1 : x : log10(2)
+ fcompl MO(limit) // x-1 : x : log10(2)
+ fnstsw // x-1 : x : log10(2)
+ andb $0x45, %ah
+ jz 2f
+ fxam
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x40, %ah
+ jne 5f
+ fabs // log10(1) is +0 in all rounding modes.
+5: fstp %st(1) // x-1 : log10(2)
+ fyl2xp1 // log10(x)
+ ret
+
+2: fstp %st(0) // x : log10(2)
+ fyl2x // log10(x)
+ ret
+
+3: jp 4b // in case x is ħInf
+ fstp %st(1)
+ fstp %st(1)
+ ret
+END (__ieee754_log10)
+strong_alias (__ieee754_log10, __log10_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_log10f.S b/REORG.TODO/sysdeps/i386/fpu/e_log10f.S
new file mode 100644
index 0000000000..72a3b88251
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_log10f.S
@@ -0,0 +1,69 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>.
+ *
+ * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+ .section .rodata.cst8,"aM",@progbits,8
+
+ .p2align 3
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ /* It is not important that this constant is precise. It is only
+ a value which is known to be on the safe side for using the
+ fyl2xp1 instruction. */
+ .type limit,@object
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%edx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_log10f)
+ fldlg2 // log10(2)
+ flds 4(%esp) // x : log10(2)
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ fxam
+ fnstsw
+ fld %st // x : x : log10(2)
+ sahf
+ jc 3f // in case x is NaN or ħInf
+4: fsubl MO(one) // x-1 : x : log10(2)
+ fld %st // x-1 : x-1 : x : log10(2)
+ fabs // |x-1| : x-1 : x : log10(2)
+ fcompl MO(limit) // x-1 : x : log10(2)
+ fnstsw // x-1 : x : log10(2)
+ andb $0x45, %ah
+ jz 2f
+ fxam
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x40, %ah
+ jne 5f
+ fabs // log10(1) is +0 in all rounding modes.
+5: fstp %st(1) // x-1 : log10(2)
+ fyl2xp1 // log10(x)
+ ret
+
+2: fstp %st(0) // x : log10(2)
+ fyl2x // log10(x)
+ ret
+
+3: jp 4b // in case x is ħInf
+ fstp %st(1)
+ fstp %st(1)
+ ret
+END (__ieee754_log10f)
+strong_alias (__ieee754_log10f, __log10f_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_log10l.S b/REORG.TODO/sysdeps/i386/fpu/e_log10l.S
new file mode 100644
index 0000000000..9326b19796
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_log10l.S
@@ -0,0 +1,71 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ *
+ * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+ .section .rodata.cst8,"aM",@progbits,8
+
+ .p2align 3
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ /* It is not important that this constant is precise. It is only
+ a value which is known to be on the safe side for using the
+ fyl2xp1 instruction. */
+ .type limit,@object
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%edx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_log10l)
+ fldlg2 // log10(2)
+ fldt 4(%esp) // x : log10(2)
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ fxam
+ fnstsw
+ fld %st // x : x : log10(2)
+ sahf
+ jc 3f // in case x is NaN or ħInf
+4: fsubl MO(one) // x-1 : x : log10(2)
+ fld %st // x-1 : x-1 : x : log10(2)
+ fabs // |x-1| : x-1 : x : log10(2)
+ fcompl MO(limit) // x-1 : x : log10(2)
+ fnstsw // x-1 : x : log10(2)
+ andb $0x45, %ah
+ jz 2f
+ fxam
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x40, %ah
+ jne 5f
+ fabs // log10(1) is +0 in all rounding modes.
+5: fstp %st(1) // x-1 : log10(2)
+ fyl2xp1 // log10(x)
+ ret
+
+2: fstp %st(0) // x : log10(2)
+ fyl2x // log10(x)
+ ret
+
+3: jp 4b // in case x is ħInf
+ fstp %st(1)
+ fstp %st(1)
+ fadd %st(0)
+ ret
+END(__ieee754_log10l)
+strong_alias (__ieee754_log10l, __log10l_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_log2.S b/REORG.TODO/sysdeps/i386/fpu/e_log2.S
new file mode 100644
index 0000000000..73ff0fffd3
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_log2.S
@@ -0,0 +1,69 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Adapted for use as log2 by Ulrich Drepper <drepper@cygnus.com>.
+ * Public domain.
+ *
+ * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+ .section .rodata.cst8,"aM",@progbits,8
+
+ .p2align 3
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ /* It is not important that this constant is precise. It is only
+ a value which is known to be on the safe side for using the
+ fyl2xp1 instruction. */
+ .type limit,@object
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%edx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_log2)
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ fldl MO(one)
+ fldl 4(%esp) // x : 1
+ fxam
+ fnstsw
+ fld %st // x : x : 1
+ sahf
+ jc 3f // in case x is NaN or ħInf
+4: fsub %st(2), %st // x-1 : x : 1
+ fld %st // x-1 : x-1 : x : 1
+ fabs // |x-1| : x-1 : x : 1
+ fcompl MO(limit) // x-1 : x : 1
+ fnstsw // x-1 : x : 1
+ andb $0x45, %ah
+ jz 2f
+ fxam
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x40, %ah
+ jne 5f
+ fabs // log2(1) is +0 in all rounding modes.
+5: fstp %st(1) // x-1 : 1
+ fyl2xp1 // log(x)
+ ret
+
+2: fstp %st(0) // x : 1
+ fyl2x // log(x)
+ ret
+
+3: jp 4b // in case x is ħInf
+ fstp %st(1)
+ fstp %st(1)
+ ret
+END (__ieee754_log2)
+strong_alias (__ieee754_log2, __log2_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_log2f.S b/REORG.TODO/sysdeps/i386/fpu/e_log2f.S
new file mode 100644
index 0000000000..344eeb495e
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_log2f.S
@@ -0,0 +1,69 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Adapted for use as log2 by Ulrich Drepper <drepper@cygnus.com>.
+ * Public domain.
+ *
+ * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+ .section .rodata.cst8,"aM",@progbits,8
+
+ .p2align 3
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ /* It is not important that this constant is precise. It is only
+ a value which is known to be on the safe side for using the
+ fyl2xp1 instruction. */
+ .type limit,@object
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%edx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_log2f)
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ fldl MO(one)
+ flds 4(%esp) // x : 1
+ fxam
+ fnstsw
+ fld %st // x : x : 1
+ sahf
+ jc 3f // in case x is NaN or ħInf
+4: fsub %st(2), %st // x-1 : x : 1
+ fld %st // x-1 : x-1 : x : 1
+ fabs // |x-1| : x-1 : x : 1
+ fcompl MO(limit) // x-1 : x : 1
+ fnstsw // x-1 : x : 1
+ andb $0x45, %ah
+ jz 2f
+ fxam
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x40, %ah
+ jne 5f
+ fabs // log2(1) is +0 in all rounding modes.
+5: fstp %st(1) // x-1 : 1
+ fyl2xp1 // log(x)
+ ret
+
+2: fstp %st(0) // x : 1
+ fyl2x // log(x)
+ ret
+
+3: jp 4b // in case x is ħInf
+ fstp %st(1)
+ fstp %st(1)
+ ret
+END (__ieee754_log2f)
+strong_alias (__ieee754_log2f, __log2f_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_log2l.S b/REORG.TODO/sysdeps/i386/fpu/e_log2l.S
new file mode 100644
index 0000000000..73e62ea908
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_log2l.S
@@ -0,0 +1,70 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Adapted for use as log2 by Ulrich Drepper <drepper@cygnus.com>.
+ * Public domain.
+ *
+ * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+ .section .rodata.cst8,"aM",@progbits,8
+
+ .p2align 3
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ /* It is not important that this constant is precise. It is only
+ a value which is known to be on the safe side for using the
+ fyl2xp1 instruction. */
+ .type limit,@object
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%edx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_log2l)
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ fldl MO(one)
+ fldt 4(%esp) // x : 1
+ fxam
+ fnstsw
+ fld %st // x : x : 1
+ sahf
+ jc 3f // in case x is NaN or ħInf
+4: fsub %st(2), %st // x-1 : x : 1
+ fld %st // x-1 : x-1 : x : 1
+ fabs // |x-1| : x-1 : x : 1
+ fcompl MO(limit) // x-1 : x : 1
+ fnstsw // x-1 : x : 1
+ andb $0x45, %ah
+ jz 2f
+ fxam
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x40, %ah
+ jne 5f
+ fabs // log2(1) is +0 in all rounding modes.
+5: fstp %st(1) // x-1 : 1
+ fyl2xp1 // log(x)
+ ret
+
+2: fstp %st(0) // x : 1
+ fyl2x // log(x)
+ ret
+
+3: jp 4b // in case x is ħInf
+ fstp %st(1)
+ fstp %st(1)
+ fadd %st(0)
+ ret
+END (__ieee754_log2l)
+strong_alias (__ieee754_log2l, __log2l_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_logf.S b/REORG.TODO/sysdeps/i386/fpu/e_logf.S
new file mode 100644
index 0000000000..de967a31f5
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_logf.S
@@ -0,0 +1,93 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ * Adapted for float by Ulrich Drepper <drepper@cygnus.com>.
+ *
+ * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+ .section .rodata.cst8,"aM",@progbits,8
+
+ .p2align 3
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ /* It is not important that this constant is precise. It is only
+ a value which is known to be on the safe side for using the
+ fyl2xp1 instruction. */
+ .type limit,@object
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%edx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_logf)
+ fldln2 // log(2)
+ flds 4(%esp) // x : log(2)
+ fxam
+ fnstsw
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ fld %st // x : x : log(2)
+ sahf
+ jc 3f // in case x is NaN or +-Inf
+4: fsubl MO(one) // x-1 : x : log(2)
+ fld %st // x-1 : x-1 : x : log(2)
+ fabs // |x-1| : x-1 : x : log(2)
+ fcompl MO(limit) // x-1 : x : log(2)
+ fnstsw // x-1 : x : log(2)
+ andb $0x45, %ah
+ jz 2f
+ fxam
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x40, %ah
+ jne 5f
+ fabs // log(1) is +0 in all rounding modes.
+5: fstp %st(1) // x-1 : log(2)
+ fyl2xp1 // log(x)
+ ret
+
+2: fstp %st(0) // x : log(2)
+ fyl2x // log(x)
+ ret
+
+3: jp 4b // in case x is +-Inf
+ fstp %st(1)
+ fstp %st(1)
+ ret
+END (__ieee754_logf)
+
+ENTRY(__logf_finite)
+ fldln2 // log(2)
+ flds 4(%esp) // x : log(2)
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ fld %st // x : x : log(2)
+ fsubl MO(one) // x-1 : x : log(2)
+ fld %st // x-1 : x-1 : x : log(2)
+ fabs // |x-1| : x-1 : x : log(2)
+ fcompl MO(limit) // x-1 : x : log(2)
+ fnstsw // x-1 : x : log(2)
+ andb $0x45, %ah
+ jz 2b
+ fxam
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x40, %ah
+ jne 6f
+ fabs // log(1) is +0 in all rounding modes.
+6: fstp %st(1) // x-1 : log(2)
+ fyl2xp1 // log(x)
+ ret
+END(__logf_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_logl.S b/REORG.TODO/sysdeps/i386/fpu/e_logl.S
new file mode 100644
index 0000000000..53127d704e
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_logl.S
@@ -0,0 +1,97 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+
+ .section .rodata.cst8,"aM",@progbits,8
+
+ .p2align 3
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ /* It is not important that this constant is precise. It is only
+ a value which is known to be on the safe side for using the
+ fyl2xp1 instruction. */
+ .type limit,@object
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%edx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_logl)
+ fldln2 // log(2)
+ fldt 4(%esp) // x : log(2)
+ fxam
+ fnstsw
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ fld %st // x : x : log(2)
+ sahf
+ jc 3f // in case x is NaN or +-Inf
+ movzwl 4+8(%esp), %eax
+ cmpl $0xc000, %eax
+ jae 6f // x <= -2, avoid overflow from -LDBL_MAX - 1.
+4: fsubl MO(one) // x-1 : x : log(2)
+6: fld %st // x-1 : x-1 : x : log(2)
+ fabs // |x-1| : x-1 : x : log(2)
+ fcompl MO(limit) // x-1 : x : log(2)
+ fnstsw // x-1 : x : log(2)
+ andb $0x45, %ah
+ jz 2f
+ fxam
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x40, %ah
+ jne 5f
+ fabs // log(1) is +0 in all rounding modes.
+5: fstp %st(1) // x-1 : log(2)
+ fyl2xp1 // log(x)
+ ret
+
+2: fstp %st(0) // x : log(2)
+ fyl2x // log(x)
+ ret
+
+3: jp 4b // in case x is +-Inf
+ fstp %st(1)
+ fstp %st(1)
+ fadd %st(0)
+ ret
+END (__ieee754_logl)
+
+ENTRY(__logl_finite)
+ fldln2 // log(2)
+ fldt 4(%esp) // x : log(2)
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ fld %st // x : x : log(2)
+ fsubl MO(one) // x-1 : x : log(2)
+ fld %st // x-1 : x-1 : x : log(2)
+ fabs // |x-1| : x-1 : x : log(2)
+ fcompl MO(limit) // x-1 : x : log(2)
+ fnstsw // x-1 : x : log(2)
+ andb $0x45, %ah
+ jz 2b
+ fxam
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x40, %ah
+ jne 7f
+ fabs // log(1) is +0 in all rounding modes.
+7: fstp %st(1) // x-1 : log(2)
+ fyl2xp1 // log(x)
+ ret
+END(__logl_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_pow.S b/REORG.TODO/sysdeps/i386/fpu/e_pow.S
new file mode 100644
index 0000000000..2edb9a9fbc
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_pow.S
@@ -0,0 +1,456 @@
+/* ix87 specific implementation of pow function.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ 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 <i386-math-asm.h>
+
+ .section .rodata.cst8,"aM",@progbits,8
+
+ .p2align 3
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ .type limit,@object
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+ .type p63,@object
+p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43
+ ASM_SIZE_DIRECTIVE(p63)
+ .type p10,@object
+p10: .byte 0, 0, 0, 0, 0, 0, 0x90, 0x40
+ ASM_SIZE_DIRECTIVE(p10)
+
+ .section .rodata.cst16,"aM",@progbits,16
+
+ .p2align 3
+ .type infinity,@object
+inf_zero:
+infinity:
+ .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f
+ ASM_SIZE_DIRECTIVE(infinity)
+ .type zero,@object
+zero: .double 0.0
+ ASM_SIZE_DIRECTIVE(zero)
+ .type minf_mzero,@object
+minf_mzero:
+minfinity:
+ .byte 0, 0, 0, 0, 0, 0, 0xf0, 0xff
+mzero:
+ .byte 0, 0, 0, 0, 0, 0, 0, 0x80
+ ASM_SIZE_DIRECTIVE(minf_mzero)
+DEFINE_DBL_MIN
+
+#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(__ieee754_pow)
+ fldl 12(%esp) // y
+ fxam
+
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+
+ fnstsw
+ movb %ah, %dl
+ andb $0x45, %ah
+ cmpb $0x40, %ah // is y == 0 ?
+ je 11f
+
+ cmpb $0x05, %ah // is y == ħinf ?
+ je 12f
+
+ cmpb $0x01, %ah // is y == NaN ?
+ je 30f
+
+ fldl 4(%esp) // x : y
+
+ subl $8,%esp
+ cfi_adjust_cfa_offset (8)
+
+ fxam
+ fnstsw
+ movb %ah, %dh
+ andb $0x45, %ah
+ cmpb $0x40, %ah
+ je 20f // x is ħ0
+
+ cmpb $0x05, %ah
+ je 15f // x is ħinf
+
+ cmpb $0x01, %ah
+ je 32f // x is NaN
+
+ fxch // y : x
+
+ /* fistpll raises invalid exception for |y| >= 1L<<63. */
+ fld %st // y : y : x
+ fabs // |y| : y : x
+ fcompl MO(p63) // y : x
+ fnstsw
+ sahf
+ jnc 2f
+
+ /* First see whether `y' is a natural number. In this case we
+ can use a more precise algorithm. */
+ fld %st // y : y : x
+ fistpll (%esp) // y : x
+ fildll (%esp) // int(y) : y : x
+ fucomp %st(1) // y : x
+ fnstsw
+ sahf
+ jne 3f
+
+ /* OK, we have an integer value for y. If large enough that
+ errors may propagate out of the 11 bits excess precision, use
+ the algorithm for real exponent instead. */
+ fld %st // y : y : x
+ fabs // |y| : y : x
+ fcompl MO(p10) // y : x
+ fnstsw
+ sahf
+ jnc 2f
+ popl %eax
+ cfi_adjust_cfa_offset (-4)
+ popl %edx
+ cfi_adjust_cfa_offset (-4)
+ orl $0, %edx
+ fstp %st(0) // x
+ jns 4f // y >= 0, jump
+ fdivrl MO(one) // 1/x (now referred to as x)
+ negl %eax
+ adcl $0, %edx
+ negl %edx
+4: fldl MO(one) // 1 : x
+ fxch
+
+ /* If y is even, take the absolute value of x. Otherwise,
+ ensure all intermediate values that might overflow have the
+ sign of x. */
+ testb $1, %al
+ jnz 6f
+ fabs
+
+6: shrdl $1, %edx, %eax
+ jnc 5f
+ fxch
+ fabs
+ fmul %st(1) // x : ST*x
+ fxch
+5: fld %st // x : x : ST*x
+ fabs // |x| : x : ST*x
+ fmulp // |x|*x : ST*x
+ shrl $1, %edx
+ movl %eax, %ecx
+ orl %edx, %ecx
+ jnz 6b
+ fstp %st(0) // ST*x
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ DBL_NARROW_EVAL_UFLOW_NONNAN
+ ret
+
+ /* y is ħNAN */
+30: fldl 4(%esp) // x : y
+ fldl MO(one) // 1.0 : x : y
+ fucomp %st(1) // x : y
+ fnstsw
+ sahf
+ je 31f
+ fxch // y : x
+31: fstp %st(1)
+ ret
+
+ cfi_adjust_cfa_offset (8)
+32: addl $8, %esp
+ cfi_adjust_cfa_offset (-8)
+ fstp %st(1)
+ ret
+
+ cfi_adjust_cfa_offset (8)
+ .align ALIGNARG(4)
+2: // y is a large integer (absolute value at least 1L<<10), but
+ // may be odd unless at least 1L<<64. So it may be necessary
+ // to adjust the sign of a negative result afterwards.
+ fxch // x : y
+ fabs // |x| : y
+ fxch // y : x
+ .align ALIGNARG(4)
+3: /* y is a real number. */
+ fxch // x : y
+ fldl MO(one) // 1.0 : x : y
+ fldl MO(limit) // 0.29 : 1.0 : x : y
+ fld %st(2) // x : 0.29 : 1.0 : x : y
+ fsub %st(2) // x-1 : 0.29 : 1.0 : x : y
+ fabs // |x-1| : 0.29 : 1.0 : x : y
+ fucompp // 1.0 : x : y
+ fnstsw
+ fxch // x : 1.0 : y
+ sahf
+ ja 7f
+ fsub %st(1) // x-1 : 1.0 : y
+ fyl2xp1 // log2(x) : y
+ jmp 8f
+
+7: fyl2x // log2(x) : y
+8: fmul %st(1) // y*log2(x) : y
+ fst %st(1) // y*log2(x) : y*log2(x)
+ frndint // int(y*log2(x)) : y*log2(x)
+ fsubr %st, %st(1) // int(y*log2(x)) : fract(y*log2(x))
+ fxch // fract(y*log2(x)) : int(y*log2(x))
+ f2xm1 // 2^fract(y*log2(x))-1 : int(y*log2(x))
+ faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x))
+
+ // Before scaling, we must negate if x is negative and y is an
+ // odd integer.
+ testb $2, %dh
+ jz 291f
+ // x is negative. If y is an odd integer, negate the result.
+ fldl 20(%esp) // y : 2^fract(y*log2(x)) : int(y*log2(x))
+ fld %st // y : y : 2^fract(y*log2(x)) : int(y*log2(x))
+ fabs // |y| : y : 2^fract(y*log2(x)) : int(y*log2(x))
+ fcompl MO(p63) // y : 2^fract(y*log2(x)) : int(y*log2(x))
+ fnstsw
+ sahf
+ jnc 290f
+
+ // We must find out whether y is an odd integer.
+ fld %st // y : y : 2^fract(y*log2(x)) : int(y*log2(x))
+ fistpll (%esp) // y : 2^fract(y*log2(x)) : int(y*log2(x))
+ fildll (%esp) // int(y) : y : 2^fract(y*log2(x)) : int(y*log2(x))
+ fucompp // 2^fract(y*log2(x)) : int(y*log2(x))
+ fnstsw
+ sahf
+ jne 291f
+
+ // OK, the value is an integer, but is it odd?
+ popl %eax
+ cfi_adjust_cfa_offset (-4)
+ popl %edx
+ cfi_adjust_cfa_offset (-4)
+ andb $1, %al
+ jz 292f // jump if not odd
+ // It's an odd integer.
+ fchs
+ jmp 292f
+
+ cfi_adjust_cfa_offset (8)
+290: fstp %st(0) // 2^fract(y*log2(x)) : int(y*log2(x))
+291: addl $8, %esp
+ cfi_adjust_cfa_offset (-8)
+292: fscale // +/- 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x))
+ fstp %st(1) // +/- 2^fract(y*log2(x))*2^int(y*log2(x))
+ DBL_NARROW_EVAL_UFLOW_NONNAN
+ ret
+
+
+ // pow(x,ħ0) = 1
+ .align ALIGNARG(4)
+11: fstp %st(0) // pop y
+ fldl MO(one)
+ ret
+
+ // y == ħinf
+ .align ALIGNARG(4)
+12: fstp %st(0) // pop y
+ fldl MO(one) // 1
+ fldl 4(%esp) // x : 1
+ fabs // abs(x) : 1
+ fucompp // < 1, == 1, or > 1
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x45, %ah
+ je 13f // jump if x is NaN
+
+ cmpb $0x40, %ah
+ je 14f // jump if |x| == 1
+
+ shlb $1, %ah
+ xorb %ah, %dl
+ andl $2, %edx
+ fldl MOX(inf_zero, %edx, 4)
+ ret
+
+ .align ALIGNARG(4)
+14: fldl MO(one)
+ ret
+
+ .align ALIGNARG(4)
+13: fldl 4(%esp) // load x == NaN
+ ret
+
+ cfi_adjust_cfa_offset (8)
+ .align ALIGNARG(4)
+ // x is ħinf
+15: fstp %st(0) // y
+ 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
+ fildll (%esp) // int(y) : y
+ fucompp // <empty>
+ fnstsw
+ sahf
+ jne 17f
+
+ // 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
+ // It's an odd integer.
+ shrl $31, %edx
+ fldl MOX(minf_mzero, %edx, 8)
+ ret
+
+ cfi_adjust_cfa_offset (8)
+ .align ALIGNARG(4)
+16: fcompl MO(zero)
+ addl $8, %esp
+ cfi_adjust_cfa_offset (-8)
+ fnstsw
+ shrl $5, %eax
+ andl $8, %eax
+ fldl MOX(inf_zero, %eax, 1)
+ ret
+
+ cfi_adjust_cfa_offset (8)
+ .align ALIGNARG(4)
+17: shll $30, %edx // sign bit for y in right position
+ addl $8, %esp
+ cfi_adjust_cfa_offset (-8)
+18: shrl $31, %edx
+ fldl MOX(inf_zero, %edx, 8)
+ ret
+
+ cfi_adjust_cfa_offset (8)
+ .align ALIGNARG(4)
+ // x is ħ0
+20: fstp %st(0) // y
+ testb $2, %dl
+ jz 21f // y > 0
+
+ // x is ħ0 and y is < 0. We must find out whether y is an odd integer.
+ 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
+ fucompp // <empty>
+ fnstsw
+ sahf
+ jne 26f
+
+ // 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
+ // It's an odd integer.
+ // Raise divide-by-zero exception and get minus infinity value.
+ fldl MO(one)
+ fdivl MO(zero)
+ fchs
+ ret
+
+ cfi_adjust_cfa_offset (8)
+25: fstp %st(0)
+26: addl $8, %esp
+ cfi_adjust_cfa_offset (-8)
+27: // Raise divide-by-zero exception and get infinity value.
+ fldl MO(one)
+ fdivl MO(zero)
+ ret
+
+ cfi_adjust_cfa_offset (8)
+ .align ALIGNARG(4)
+ // x is ħ0 and y is > 0. We must find out whether y is an odd integer.
+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
+ fucompp // <empty>
+ fnstsw
+ sahf
+ jne 23f
+
+ // 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
+ // It's an odd integer.
+ fldl MO(mzero)
+ ret
+
+ cfi_adjust_cfa_offset (8)
+22: fstp %st(0)
+23: addl $8, %esp // Don't use 2 x pop
+ cfi_adjust_cfa_offset (-8)
+24: fldl MO(zero)
+ ret
+
+END(__ieee754_pow)
+strong_alias (__ieee754_pow, __pow_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_powf.S b/REORG.TODO/sysdeps/i386/fpu/e_powf.S
new file mode 100644
index 0000000000..467ef2380b
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_powf.S
@@ -0,0 +1,392 @@
+/* ix87 specific implementation of pow function.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ 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 <i386-math-asm.h>
+
+ .section .rodata.cst8,"aM",@progbits,8
+
+ .p2align 3
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ .type limit,@object
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+ .type p31,@object
+p31: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x41
+ ASM_SIZE_DIRECTIVE(p31)
+
+ .section .rodata.cst16,"aM",@progbits,16
+
+ .p2align 3
+ .type infinity,@object
+inf_zero:
+infinity:
+ .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f
+ ASM_SIZE_DIRECTIVE(infinity)
+ .type zero,@object
+zero: .double 0.0
+ ASM_SIZE_DIRECTIVE(zero)
+ .type minf_mzero,@object
+minf_mzero:
+minfinity:
+ .byte 0, 0, 0, 0, 0, 0, 0xf0, 0xff
+mzero:
+ .byte 0, 0, 0, 0, 0, 0, 0, 0x80
+ ASM_SIZE_DIRECTIVE(minf_mzero)
+DEFINE_FLT_MIN
+
+#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(__ieee754_powf)
+ flds 8(%esp) // y
+ fxam
+
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+
+ fnstsw
+ movb %ah, %dl
+ andb $0x45, %ah
+ cmpb $0x40, %ah // is y == 0 ?
+ je 11f
+
+ cmpb $0x05, %ah // is y == ħinf ?
+ je 12f
+
+ cmpb $0x01, %ah // is y == NaN ?
+ je 30f
+
+ flds 4(%esp) // x : y
+
+ subl $4, %esp
+ cfi_adjust_cfa_offset (4)
+
+ fxam
+ fnstsw
+ movb %ah, %dh
+ andb $0x45, %ah
+ cmpb $0x40, %ah
+ je 20f // x is ħ0
+
+ cmpb $0x05, %ah
+ je 15f // x is ħinf
+
+ cmpb $0x01, %ah
+ je 33f // x is NaN
+
+ fxch // y : x
+
+ /* fistpl raises invalid exception for |y| >= 1L<<31. */
+ fld %st // y : y : x
+ fabs // |y| : y : x
+ fcompl MO(p31) // y : x
+ fnstsw
+ sahf
+ jnc 2f
+
+ /* First see whether `y' is a natural number. In this case we
+ can use a more precise algorithm. */
+ fld %st // y : y : x
+ fistpl (%esp) // y : x
+ fildl (%esp) // int(y) : y : x
+ fucomp %st(1) // y : x
+ fnstsw
+ sahf
+ jne 3f
+
+ /* OK, we have an integer value for y. */
+ popl %edx
+ cfi_adjust_cfa_offset (-4)
+ orl $0, %edx
+ fstp %st(0) // x
+ jns 4f // y >= 0, jump
+ fdivrl MO(one) // 1/x (now referred to as x)
+ negl %edx
+4: fldl MO(one) // 1 : x
+ fxch
+
+ /* If y is even, take the absolute value of x. Otherwise,
+ ensure all intermediate values that might overflow have the
+ sign of x. */
+ testb $1, %dl
+ jnz 6f
+ fabs
+
+6: shrl $1, %edx
+ jnc 5f
+ fxch
+ fabs
+ fmul %st(1) // x : ST*x
+ fxch
+5: fld %st // x : x : ST*x
+ fabs // |x| : x : ST*x
+ fmulp // |x|*x : ST*x
+ testl %edx, %edx
+ jnz 6b
+ fstp %st(0) // ST*x
+ FLT_NARROW_EVAL_UFLOW_NONNAN
+ ret
+
+ /* y is ħNAN */
+30: flds 4(%esp) // x : y
+ fldl MO(one) // 1.0 : x : y
+ fucomp %st(1) // x : y
+ fnstsw
+ sahf
+ je 31f
+ fxch // y : x
+31: fstp %st(1)
+ ret
+
+ cfi_adjust_cfa_offset (4)
+ .align ALIGNARG(4)
+2: /* y is a large integer (so even). */
+ fxch // x : y
+ fabs // |x| : y
+ fxch // y : x
+ .align ALIGNARG(4)
+3: /* y is a real number. */
+ fxch // x : y
+ fldl MO(one) // 1.0 : x : y
+ fldl MO(limit) // 0.29 : 1.0 : x : y
+ fld %st(2) // x : 0.29 : 1.0 : x : y
+ fsub %st(2) // x-1 : 0.29 : 1.0 : x : y
+ fabs // |x-1| : 0.29 : 1.0 : x : y
+ fucompp // 1.0 : x : y
+ fnstsw
+ fxch // x : 1.0 : y
+ sahf
+ ja 7f
+ fsub %st(1) // x-1 : 1.0 : y
+ fyl2xp1 // log2(x) : y
+ jmp 8f
+
+7: fyl2x // log2(x) : y
+8: fmul %st(1) // y*log2(x) : y
+ fst %st(1) // y*log2(x) : y*log2(x)
+ frndint // int(y*log2(x)) : y*log2(x)
+ fsubr %st, %st(1) // int(y*log2(x)) : fract(y*log2(x))
+ fxch // fract(y*log2(x)) : int(y*log2(x))
+ f2xm1 // 2^fract(y*log2(x))-1 : int(y*log2(x))
+ faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x))
+ fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x))
+32: addl $4, %esp
+ cfi_adjust_cfa_offset (-4)
+ fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x))
+ FLT_NARROW_EVAL_UFLOW_NONNAN
+ ret
+
+ /* x is NaN. */
+ cfi_adjust_cfa_offset (4)
+33: addl $4, %esp
+ cfi_adjust_cfa_offset (-4)
+ fstp %st(1)
+ ret
+
+ // pow(x,ħ0) = 1
+ .align ALIGNARG(4)
+11: fstp %st(0) // pop y
+ fldl MO(one)
+ ret
+
+ // y == ħinf
+ .align ALIGNARG(4)
+12: fstp %st(0) // pop y
+ fldl MO(one) // 1
+ flds 4(%esp) // x : 1
+ fabs // abs(x) : 1
+ fucompp // < 1, == 1, or > 1
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x45, %ah
+ je 13f // jump if x is NaN
+
+ cmpb $0x40, %ah
+ je 14f // jump if |x| == 1
+
+ shlb $1, %ah
+ xorb %ah, %dl
+ andl $2, %edx
+ fldl MOX(inf_zero, %edx, 4)
+ ret
+
+ .align ALIGNARG(4)
+14: fldl MO(one)
+ ret
+
+ .align ALIGNARG(4)
+13: flds 4(%esp) // load x == NaN
+ ret
+
+ cfi_adjust_cfa_offset (4)
+ .align ALIGNARG(4)
+ // x is ħinf
+15: fstp %st(0) // y
+ 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
+ fildl (%esp) // int(y) : y
+ fucompp // <empty>
+ fnstsw
+ sahf
+ jne 17f
+
+ // OK, the value is an integer.
+ popl %edx
+ cfi_adjust_cfa_offset (-4)
+ testb $1, %dl
+ jz 18f // jump if not odd
+ // It's an odd integer.
+ shrl $31, %edx
+ fldl MOX(minf_mzero, %edx, 8)
+ ret
+
+ cfi_adjust_cfa_offset (4)
+ .align ALIGNARG(4)
+16: fcompl MO(zero)
+ addl $4, %esp
+ cfi_adjust_cfa_offset (-4)
+ fnstsw
+ shrl $5, %eax
+ andl $8, %eax
+ fldl MOX(inf_zero, %eax, 1)
+ ret
+
+ cfi_adjust_cfa_offset (4)
+ .align ALIGNARG(4)
+17: shll $30, %edx // sign bit for y in right position
+ addl $4, %esp
+ cfi_adjust_cfa_offset (-4)
+18: shrl $31, %edx
+ fldl MOX(inf_zero, %edx, 8)
+ ret
+
+ cfi_adjust_cfa_offset (4)
+ .align ALIGNARG(4)
+ // x is ħ0
+20: fstp %st(0) // y
+ testb $2, %dl
+ jz 21f // y > 0
+
+ // x is ħ0 and y is < 0. We must find out whether y is an odd integer.
+ 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
+ fucompp // <empty>
+ fnstsw
+ sahf
+ jne 26f
+
+ // OK, the value is an integer.
+ popl %edx
+ cfi_adjust_cfa_offset (-4)
+ testb $1, %dl
+ jz 27f // jump if not odd
+ // It's an odd integer.
+ // Raise divide-by-zero exception and get minus infinity value.
+ fldl MO(one)
+ fdivl MO(zero)
+ fchs
+ ret
+
+ cfi_adjust_cfa_offset (4)
+25: fstp %st(0)
+26: addl $4, %esp
+ cfi_adjust_cfa_offset (-4)
+27: // Raise divide-by-zero exception and get infinity value.
+ fldl MO(one)
+ fdivl MO(zero)
+ ret
+
+ cfi_adjust_cfa_offset (4)
+ .align ALIGNARG(4)
+ // x is ħ0 and y is > 0. We must find out whether y is an odd integer.
+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
+ fucompp // <empty>
+ fnstsw
+ sahf
+ jne 23f
+
+ // OK, the value is an integer.
+ popl %edx
+ cfi_adjust_cfa_offset (-4)
+ testb $1, %dl
+ jz 24f // jump if not odd
+ // It's an odd integer.
+ fldl MO(mzero)
+ ret
+
+ cfi_adjust_cfa_offset (4)
+22: fstp %st(0)
+23: addl $4, %esp // Don't use pop.
+ cfi_adjust_cfa_offset (-4)
+24: fldl MO(zero)
+ ret
+
+END(__ieee754_powf)
+strong_alias (__ieee754_powf, __powf_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_powl.S b/REORG.TODO/sysdeps/i386/fpu/e_powl.S
new file mode 100644
index 0000000000..9e162848e4
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_powl.S
@@ -0,0 +1,459 @@
+/* ix87 specific implementation of pow function.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ 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 <i386-math-asm.h>
+
+ .section .rodata.cst8,"aM",@progbits,8
+
+ .p2align 3
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ .type p2,@object
+p2: .byte 0, 0, 0, 0, 0, 0, 0x10, 0x40
+ ASM_SIZE_DIRECTIVE(p2)
+ .type p63,@object
+p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43
+ ASM_SIZE_DIRECTIVE(p63)
+ .type p64,@object
+p64: .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x43
+ ASM_SIZE_DIRECTIVE(p64)
+ .type p78,@object
+p78: .byte 0, 0, 0, 0, 0, 0, 0xd0, 0x44
+ ASM_SIZE_DIRECTIVE(p78)
+ .type pm79,@object
+pm79: .byte 0, 0, 0, 0, 0, 0, 0, 0x3b
+ ASM_SIZE_DIRECTIVE(pm79)
+
+ .section .rodata.cst16,"aM",@progbits,16
+
+ .p2align 3
+ .type infinity,@object
+inf_zero:
+infinity:
+ .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f
+ ASM_SIZE_DIRECTIVE(infinity)
+ .type zero,@object
+zero: .double 0.0
+ ASM_SIZE_DIRECTIVE(zero)
+ .type minf_mzero,@object
+minf_mzero:
+minfinity:
+ .byte 0, 0, 0, 0, 0, 0, 0xf0, 0xff
+mzero:
+ .byte 0, 0, 0, 0, 0, 0, 0, 0x80
+ ASM_SIZE_DIRECTIVE(minf_mzero)
+DEFINE_LDBL_MIN
+
+#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(__ieee754_powl)
+ fldt 16(%esp) // y
+ fxam
+
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+
+ fnstsw
+ movb %ah, %dl
+ andb $0x45, %ah
+ cmpb $0x40, %ah // is y == 0 ?
+ je 11f
+
+ cmpb $0x05, %ah // is y == ħinf ?
+ je 12f
+
+ cmpb $0x01, %ah // is y == NaN ?
+ je 30f
+
+ fldt 4(%esp) // x : y
+
+ subl $8,%esp
+ cfi_adjust_cfa_offset (8)
+
+ fxam
+ fnstsw
+ movb %ah, %dh
+ andb $0x45, %ah
+ cmpb $0x40, %ah
+ je 20f // x is ħ0
+
+ cmpb $0x05, %ah
+ je 15f // x is ħinf
+
+ cmpb $0x01, %ah
+ je 32f // x is NaN
+
+ fxch // y : x
+
+ /* fistpll raises invalid exception for |y| >= 1L<<63. */
+ fld %st // y : y : x
+ fabs // |y| : y : x
+ fcompl MO(p63) // y : x
+ fnstsw
+ sahf
+ jnc 2f
+
+ /* First see whether `y' is a natural number. In this case we
+ can use a more precise algorithm. */
+ fld %st // y : y : x
+ fistpll (%esp) // y : x
+ fildll (%esp) // int(y) : y : x
+ fucomp %st(1) // y : x
+ fnstsw
+ sahf
+ je 9f
+
+ // If y has absolute value at most 0x1p-79, then any finite
+ // nonzero x will result in 1. Saturate y to those bounds to
+ // avoid underflow in the calculation of y*log2(x).
+ fld %st // y : y : x
+ fabs // |y| : y : x
+ fcompl MO(pm79) // y : x
+ fnstsw
+ sahf
+ jnc 3f
+ fstp %st(0) // pop y
+ fldl MO(pm79) // 0x1p-79 : x
+ testb $2, %dl
+ jnz 3f // y > 0
+ fchs // -0x1p-79 : x
+ jmp 3f
+
+9: /* OK, we have an integer value for y. Unless very small
+ (we use < 4), use the algorithm for real exponent to avoid
+ accumulation of errors. */
+ fld %st // y : y : x
+ fabs // |y| : y : x
+ fcompl MO(p2) // y : x
+ fnstsw
+ sahf
+ jnc 3f
+ popl %eax
+ cfi_adjust_cfa_offset (-4)
+ popl %edx
+ cfi_adjust_cfa_offset (-4)
+ orl $0, %edx
+ fstp %st(0) // x
+ jns 4f // y >= 0, jump
+ fdivrl MO(one) // 1/x (now referred to as x)
+ negl %eax
+ adcl $0, %edx
+ negl %edx
+4: fldl MO(one) // 1 : x
+ fxch
+
+ /* If y is even, take the absolute value of x. Otherwise,
+ ensure all intermediate values that might overflow have the
+ sign of x. */
+ testb $1, %al
+ jnz 6f
+ fabs
+
+6: shrdl $1, %edx, %eax
+ jnc 5f
+ fxch
+ fabs
+ fmul %st(1) // x : ST*x
+ fxch
+5: fld %st // x : x : ST*x
+ fabs // |x| : x : ST*x
+ fmulp // |x|*x : ST*x
+ shrl $1, %edx
+ movl %eax, %ecx
+ orl %edx, %ecx
+ jnz 6b
+ fstp %st(0) // ST*x
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ LDBL_CHECK_FORCE_UFLOW_NONNAN
+ ret
+
+ /* y is ħNAN */
+30: fldt 4(%esp) // x : y
+ fldl MO(one) // 1.0 : x : y
+ fucomp %st(1) // x : y
+ fnstsw
+ sahf
+ je 33f
+31: /* At least one argument NaN, and result should be NaN. */
+ faddp
+ ret
+33: jp 31b
+ /* pow (1, NaN); check if the NaN signaling. */
+ testb $0x40, 23(%esp)
+ jz 31b
+ fstp %st(1)
+ ret
+
+ cfi_adjust_cfa_offset (8)
+32: addl $8, %esp
+ cfi_adjust_cfa_offset (-8)
+ faddp
+ ret
+
+ cfi_adjust_cfa_offset (8)
+ .align ALIGNARG(4)
+2: // y is a large integer (absolute value at least 1L<<63).
+ // If y has absolute value at least 1L<<78, then any finite
+ // nonzero x will result in 0 (underflow), 1 or infinity (overflow).
+ // Saturate y to those bounds to avoid overflow in the calculation
+ // of y*log2(x).
+ fld %st // y : y : x
+ fabs // |y| : y : x
+ fcompl MO(p78) // y : x
+ fnstsw
+ sahf
+ jc 3f
+ fstp %st(0) // pop y
+ fldl MO(p78) // 1L<<78 : x
+ testb $2, %dl
+ jz 3f // y > 0
+ fchs // -(1L<<78) : x
+ .align ALIGNARG(4)
+3: /* y is a real number. */
+ subl $28, %esp
+ cfi_adjust_cfa_offset (28)
+ fstpt 12(%esp) // x
+ fstpt (%esp) // <empty>
+ call HIDDEN_JUMPTARGET (__powl_helper) // <result>
+ addl $36, %esp
+ cfi_adjust_cfa_offset (-36)
+ ret
+
+ // pow(x,ħ0) = 1, unless x is sNaN
+ .align ALIGNARG(4)
+11: fstp %st(0) // pop y
+ fldt 4(%esp) // x
+ fxam
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x01, %ah
+ je 112f // x is NaN
+111: fstp %st(0)
+ fldl MO(one)
+ ret
+
+112: testb $0x40, 11(%esp)
+ jnz 111b
+ fadd %st(0)
+ ret
+
+ // y == ħinf
+ .align ALIGNARG(4)
+12: fstp %st(0) // pop y
+ fldl MO(one) // 1
+ fldt 4(%esp) // x : 1
+ fabs // abs(x) : 1
+ fucompp // < 1, == 1, or > 1
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x45, %ah
+ je 13f // jump if x is NaN
+
+ cmpb $0x40, %ah
+ je 14f // jump if |x| == 1
+
+ shlb $1, %ah
+ xorb %ah, %dl
+ andl $2, %edx
+ fldl MOX(inf_zero, %edx, 4)
+ ret
+
+ .align ALIGNARG(4)
+14: fldl MO(one)
+ ret
+
+ .align ALIGNARG(4)
+13: fldt 4(%esp) // load x == NaN
+ fadd %st(0)
+ ret
+
+ cfi_adjust_cfa_offset (8)
+ .align ALIGNARG(4)
+ // x is ħinf
+15: fstp %st(0) // y
+ 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
+ fildll (%esp) // int(y) : y
+ fucompp // <empty>
+ fnstsw
+ sahf
+ jne 17f
+
+ // OK, the value is an integer, but is it odd?
+ popl %eax
+ cfi_adjust_cfa_offset (-4)
+ popl %edx
+ cfi_adjust_cfa_offset (-4)
+ andb $1, %al
+ jz 18f // jump if not odd
+ // It's an odd integer.
+ shrl $31, %edx
+ fldl MOX(minf_mzero, %edx, 8)
+ ret
+
+ cfi_adjust_cfa_offset (8)
+ .align ALIGNARG(4)
+16: fcompl MO(zero)
+ addl $8, %esp
+ cfi_adjust_cfa_offset (-8)
+ fnstsw
+ shrl $5, %eax
+ andl $8, %eax
+ fldl MOX(inf_zero, %eax, 1)
+ ret
+
+ cfi_adjust_cfa_offset (8)
+ .align ALIGNARG(4)
+17: shll $30, %edx // sign bit for y in right position
+ addl $8, %esp
+ cfi_adjust_cfa_offset (-8)
+18: shrl $31, %edx
+ fldl MOX(inf_zero, %edx, 8)
+ ret
+
+ cfi_adjust_cfa_offset (8)
+ .align ALIGNARG(4)
+ // x is ħ0
+20: fstp %st(0) // y
+ testb $2, %dl
+ jz 21f // y > 0
+
+ // x is ħ0 and y is < 0. We must find out whether y is an odd integer.
+ 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
+ fucompp // <empty>
+ fnstsw
+ sahf
+ jne 26f
+
+ // OK, the value is an integer, but is it odd?
+ popl %eax
+ cfi_adjust_cfa_offset (-4)
+ popl %edx
+ cfi_adjust_cfa_offset (-4)
+ andb $1, %al
+ jz 27f // jump if not odd
+ // It's an odd integer.
+ // Raise divide-by-zero exception and get minus infinity value.
+ fldl MO(one)
+ fdivl MO(zero)
+ fchs
+ ret
+
+ cfi_adjust_cfa_offset (8)
+25: fstp %st(0)
+26: addl $8, %esp
+ cfi_adjust_cfa_offset (-8)
+27: // Raise divide-by-zero exception and get infinity value.
+ fldl MO(one)
+ fdivl MO(zero)
+ ret
+
+ cfi_adjust_cfa_offset (8)
+ .align ALIGNARG(4)
+ // x is ħ0 and y is > 0. We must find out whether y is an odd integer.
+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
+ fucompp // <empty>
+ fnstsw
+ sahf
+ jne 23f
+
+ // OK, the value is an integer, but is it odd?
+ popl %eax
+ cfi_adjust_cfa_offset (-4)
+ popl %edx
+ cfi_adjust_cfa_offset (-4)
+ andb $1, %al
+ jz 24f // jump if not odd
+ // It's an odd integer.
+ fldl MO(mzero)
+ ret
+
+ cfi_adjust_cfa_offset (8)
+22: fstp %st(0)
+23: addl $8, %esp // Don't use 2 x pop
+ cfi_adjust_cfa_offset (-8)
+24: fldl MO(zero)
+ ret
+
+END(__ieee754_powl)
+strong_alias (__ieee754_powl, __powl_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_rem_pio2.c b/REORG.TODO/sysdeps/i386/fpu/e_rem_pio2.c
new file mode 100644
index 0000000000..1347b0468c
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_rem_pio2.c
@@ -0,0 +1,3 @@
+/* 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/REORG.TODO/sysdeps/i386/fpu/e_remainder.S b/REORG.TODO/sysdeps/i386/fpu/e_remainder.S
new file mode 100644
index 0000000000..f7867aa90b
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_remainder.S
@@ -0,0 +1,18 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(__ieee754_remainder)
+ fldl 12(%esp)
+ fldl 4(%esp)
+1: fprem1
+ fstsw %ax
+ sahf
+ jp 1b
+ fstp %st(1)
+ ret
+END (__ieee754_remainder)
+strong_alias (__ieee754_remainder, __remainder_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_remainderf.S b/REORG.TODO/sysdeps/i386/fpu/e_remainderf.S
new file mode 100644
index 0000000000..cfd390bc69
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_remainderf.S
@@ -0,0 +1,18 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(__ieee754_remainderf)
+ flds 8(%esp)
+ flds 4(%esp)
+1: fprem1
+ fstsw %ax
+ sahf
+ jp 1b
+ fstp %st(1)
+ ret
+END (__ieee754_remainderf)
+strong_alias (__ieee754_remainderf, __remainderf_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_remainderl.S b/REORG.TODO/sysdeps/i386/fpu/e_remainderl.S
new file mode 100644
index 0000000000..5ec23a37a3
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_remainderl.S
@@ -0,0 +1,20 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(__ieee754_remainderl)
+ fldt 16(%esp)
+ fldt 4(%esp)
+1: fprem1
+ fstsw %ax
+ sahf
+ jp 1b
+ fstp %st(1)
+ ret
+END (__ieee754_remainderl)
+strong_alias (__ieee754_remainderl, __remainderl_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_scalb.S b/REORG.TODO/sysdeps/i386/fpu/e_scalb.S
new file mode 100644
index 0000000000..370924c29f
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_scalb.S
@@ -0,0 +1,100 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Correct handling of y==-inf <drepper@gnu>
+ */
+
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+ .section .rodata
+
+ .align ALIGNARG(4)
+ .type zero_nan,@object
+zero_nan:
+ .double 0.0
+nan: .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
+ .byte 0, 0, 0, 0, 0, 0, 0, 0x80
+ .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
+ ASM_SIZE_DIRECTIVE(zero_nan)
+
+
+#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(__ieee754_scalb)
+ fldl 12(%esp)
+ fxam
+ fnstsw
+ fldl 4(%esp)
+ andl $0x4700, %eax
+ cmpl $0x0700, %eax
+ je 1f
+ andl $0x4500, %eax
+ cmpl $0x0100, %eax
+ je 2f
+ fxam
+ fnstsw
+ andl $0x4500, %eax
+ cmpl $0x0100, %eax
+ je 3f
+ fld %st(1)
+ frndint
+ fcomp %st(2)
+ fnstsw
+ sahf
+ jne 4f
+ fscale
+ fstp %st(1)
+ DBL_NARROW_EVAL
+ ret
+
+ /* y is -inf */
+1: fxam
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ fnstsw
+ movl 8(%esp), %edx
+ shrl $5, %eax
+ fstp %st
+ fstp %st
+ andl $0x80000000, %edx
+ andl $0x0228, %eax
+ cmpl $0x0028, %eax
+ je 4f
+ andl $8, %eax
+ shrl $27, %edx
+ addl %edx, %eax
+ fldl MOX(zero_nan, %eax, 1)
+ ret
+
+ /* The result is NaN, but we must not raise an exception.
+ So use a variable. */
+2: fstp %st
+ fstp %st
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ fldl MO(nan)
+ ret
+
+ /* The first parameter is a NaN. Return it. */
+3: fstp %st(1)
+ ret
+
+ /* Return NaN and raise the invalid exception. */
+4: fstp %st
+ fstp %st
+ fldz
+ fdiv %st
+ ret
+END(__ieee754_scalb)
+strong_alias (__ieee754_scalb, __scalb_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_scalbf.S b/REORG.TODO/sysdeps/i386/fpu/e_scalbf.S
new file mode 100644
index 0000000000..4f2dfa3acf
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_scalbf.S
@@ -0,0 +1,102 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>.
+ *
+ * Correct handling of y==-inf <drepper@gnu>
+ */
+
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+ .section .rodata
+
+ .align ALIGNARG(4)
+ .type zero_nan,@object
+zero_nan:
+ .double 0.0
+nan: .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
+ .byte 0, 0, 0, 0, 0, 0, 0, 0x80
+ .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
+ ASM_SIZE_DIRECTIVE(zero_nan)
+
+
+#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(__ieee754_scalbf)
+ flds 8(%esp)
+ fxam
+ fnstsw
+ flds 4(%esp)
+ andl $0x4700, %eax
+ cmpl $0x0700, %eax
+ je 1f
+ andl $0x4500, %eax
+ cmpl $0x0100, %eax
+ je 2f
+ fxam
+ fnstsw
+ andl $0x4500, %eax
+ cmpl $0x0100, %eax
+ je 3f
+ fld %st(1)
+ frndint
+ fcomp %st(2)
+ fnstsw
+ sahf
+ jne 4f
+ fscale
+ fstp %st(1)
+ FLT_NARROW_EVAL
+ ret
+
+ /* y is -inf */
+1: fxam
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ fnstsw
+ movl 4(%esp), %edx
+ shrl $5, %eax
+ fstp %st
+ fstp %st
+ andl $0x80000000, %edx
+ andl $0x0228, %eax
+ cmpl $0x0028, %eax
+ je 4f
+ andl $8, %eax
+ shrl $27, %edx
+ addl %edx, %eax
+ fldl MOX(zero_nan, %eax, 1)
+ ret
+
+ /* The result is NaN, but we must not raise an exception.
+ So use a variable. */
+2: fstp %st
+ fstp %st
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ fldl MO(nan)
+ ret
+
+ /* The first parameter is a NaN. Return it. */
+3: fstp %st(1)
+ ret
+
+ /* Return NaN and raise the invalid exception. */
+4: fstp %st
+ fstp %st
+ fldz
+ fdiv %st
+ ret
+END(__ieee754_scalbf)
+strong_alias (__ieee754_scalbf, __scalbf_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_scalbl.S b/REORG.TODO/sysdeps/i386/fpu/e_scalbl.S
new file mode 100644
index 0000000000..896f599cb0
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_scalbl.S
@@ -0,0 +1,90 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ *
+ * Correct handling of y==-inf <drepper@gnu>
+ */
+
+#include <machine/asm.h>
+
+ .section .rodata
+
+ .align ALIGNARG(4)
+ .type zero_nan,@object
+zero_nan:
+ .double 0.0
+nan: .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
+ .byte 0, 0, 0, 0, 0, 0, 0, 0x80
+ .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
+ ASM_SIZE_DIRECTIVE(zero_nan)
+
+
+#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(__ieee754_scalbl)
+ fldt 16(%esp)
+ fxam
+ fnstsw
+ fldt 4(%esp)
+ andl $0x4700, %eax
+ cmpl $0x0700, %eax
+ je 1f
+ andl $0x4500, %eax
+ cmpl $0x0100, %eax
+ je 2f
+ fxam
+ fnstsw
+ andl $0x4500, %eax
+ cmpl $0x0100, %eax
+ je 2f
+ fld %st(1)
+ frndint
+ fcomp %st(2)
+ fnstsw
+ sahf
+ jne 4f
+ fscale
+ fstp %st(1)
+ ret
+
+ /* y is -inf */
+1: fxam
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ fnstsw
+ movl 12(%esp), %edx
+ shrl $5, %eax
+ fstp %st
+ fstp %st
+ andl $0x8000, %edx
+ andl $0x0228, %eax
+ cmpl $0x0028, %eax
+ je 4f
+ andl $8, %eax
+ shrl $11, %edx
+ addl %edx, %eax
+ fldl MOX(zero_nan, %eax, 1)
+ ret
+
+ /* The result is NaN; raise an exception for sNaN arguments. */
+2: faddp
+ ret
+
+ /* Return NaN and raise the invalid exception. */
+4: fstp %st
+ fstp %st
+ fldz
+ fdiv %st
+ ret
+END(__ieee754_scalbl)
+strong_alias (__ieee754_scalbl, __scalbl_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_sqrt.S b/REORG.TODO/sysdeps/i386/fpu/e_sqrt.S
new file mode 100644
index 0000000000..fba5833a9a
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_sqrt.S
@@ -0,0 +1,23 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(__ieee754_sqrt)
+ fldl 4(%esp)
+ subl $8, %esp
+ cfi_adjust_cfa_offset (8)
+ fstcw 4(%esp)
+ movl $0xfeff, %edx
+ andl 4(%esp), %edx
+ movl %edx, (%esp)
+ fldcw (%esp)
+ fsqrt
+ fldcw 4(%esp)
+ addl $8, %esp
+ cfi_adjust_cfa_offset (-8)
+ ret
+END (__ieee754_sqrt)
+strong_alias (__ieee754_sqrt, __sqrt_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_sqrtf.S b/REORG.TODO/sysdeps/i386/fpu/e_sqrtf.S
new file mode 100644
index 0000000000..6f7e4b015f
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_sqrtf.S
@@ -0,0 +1,13 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(__ieee754_sqrtf)
+ flds 4(%esp)
+ fsqrt
+ ret
+END (__ieee754_sqrtf)
+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/e_sqrtl.c b/REORG.TODO/sysdeps/i386/fpu/e_sqrtl.c
new file mode 100644
index 0000000000..41bcd7eeb7
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/e_sqrtl.c
@@ -0,0 +1,20 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <math_private.h>
+
+#undef __ieee754_sqrtl
+long double
+__ieee754_sqrtl (long double x)
+{
+ long double res;
+
+ asm ("fsqrt" : "=t" (res) : "0" (x));
+
+ return res;
+}
+strong_alias (__ieee754_sqrtl, __sqrtl_finite)
diff --git a/REORG.TODO/sysdeps/i386/fpu/fclrexcpt.c b/REORG.TODO/sysdeps/i386/fpu/fclrexcpt.c
new file mode 100644
index 0000000000..5d8596964b
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/fclrexcpt.c
@@ -0,0 +1,69 @@
+/* Clear given exceptions in current floating-point environment.
+ Copyright (C) 1997-2017 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 <fenv.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+#include <dl-procinfo.h>
+
+int
+__feclearexcept (int excepts)
+{
+ fenv_t temp;
+
+ /* Mask out unsupported bits/exceptions. */
+ excepts &= FE_ALL_EXCEPT;
+
+ /* Bah, we have to clear selected exceptions. Since there is no
+ `fldsw' instruction we have to do it the hard way. */
+ __asm__ ("fnstenv %0" : "=m" (*&temp));
+
+ /* Clear the relevant bits. */
+ temp.__status_word &= excepts ^ FE_ALL_EXCEPT;
+
+ /* Put the new data in effect. */
+ __asm__ ("fldenv %0" : : "m" (*&temp));
+
+ /* If the CPU supports SSE, we clear the MXCSR as well. */
+ if (HAS_CPU_FEATURE (SSE))
+ {
+ unsigned int xnew_exc;
+
+ /* Get the current MXCSR. */
+ __asm__ ("stmxcsr %0" : "=m" (*&xnew_exc));
+
+ /* Clear the relevant bits. */
+ xnew_exc &= ~excepts;
+
+ /* Put the new data in effect. */
+ __asm__ ("ldmxcsr %0" : : "m" (*&xnew_exc));
+ }
+
+ /* Success. */
+ return 0;
+}
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__feclearexcept, __old_feclearexcept)
+compat_symbol (libm, __old_feclearexcept, feclearexcept, GLIBC_2_1);
+#endif
+
+libm_hidden_ver (__feclearexcept, feclearexcept)
+versioned_symbol (libm, __feclearexcept, feclearexcept, GLIBC_2_2);
diff --git a/REORG.TODO/sysdeps/i386/fpu/fedisblxcpt.c b/REORG.TODO/sysdeps/i386/fpu/fedisblxcpt.c
new file mode 100644
index 0000000000..f8db665425
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/fedisblxcpt.c
@@ -0,0 +1,54 @@
+/* Disable floating-point exceptions.
+ Copyright (C) 1999-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@suse.de>, 1999.
+
+ 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 <fenv.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+#include <dl-procinfo.h>
+
+int
+fedisableexcept (int excepts)
+{
+ unsigned short int new_exc, old_exc;
+
+ /* Get the current control word. */
+ __asm__ ("fstcw %0" : "=m" (*&new_exc));
+
+ old_exc = (~new_exc) & FE_ALL_EXCEPT;
+
+ excepts &= FE_ALL_EXCEPT;
+
+ new_exc |= excepts;
+ __asm__ ("fldcw %0" : : "m" (*&new_exc));
+
+ /* If the CPU supports SSE we set the MXCSR as well. */
+ if (HAS_CPU_FEATURE (SSE))
+ {
+ unsigned int xnew_exc;
+
+ /* Get the current control word. */
+ __asm__ ("stmxcsr %0" : "=m" (*&xnew_exc));
+
+ xnew_exc |= excepts << 7;
+
+ __asm__ ("ldmxcsr %0" : : "m" (*&xnew_exc));
+ }
+
+ return old_exc;
+}
diff --git a/REORG.TODO/sysdeps/i386/fpu/feenablxcpt.c b/REORG.TODO/sysdeps/i386/fpu/feenablxcpt.c
new file mode 100644
index 0000000000..f1c42d7c27
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/feenablxcpt.c
@@ -0,0 +1,54 @@
+/* Enable floating-point exceptions.
+ Copyright (C) 1999-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@suse.de>, 1999.
+
+ 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 <fenv.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+#include <dl-procinfo.h>
+
+int
+feenableexcept (int excepts)
+{
+ unsigned short int new_exc;
+ unsigned short int old_exc;
+
+ /* Get the current control word. */
+ __asm__ ("fstcw %0" : "=m" (*&new_exc));
+
+ excepts &= FE_ALL_EXCEPT;
+ old_exc = (~new_exc) & FE_ALL_EXCEPT;
+
+ new_exc &= ~excepts;
+ __asm__ ("fldcw %0" : : "m" (*&new_exc));
+
+ /* If the CPU supports SSE we set the MXCSR as well. */
+ if (HAS_CPU_FEATURE (SSE))
+ {
+ unsigned int xnew_exc;
+
+ /* Get the current control word. */
+ __asm__ ("stmxcsr %0" : "=m" (*&xnew_exc));
+
+ xnew_exc &= ~(excepts << 7);
+
+ __asm__ ("ldmxcsr %0" : : "m" (*&xnew_exc));
+ }
+
+ return old_exc;
+}
diff --git a/REORG.TODO/sysdeps/i386/fpu/fegetenv.c b/REORG.TODO/sysdeps/i386/fpu/fegetenv.c
new file mode 100644
index 0000000000..983f6af25e
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/fegetenv.c
@@ -0,0 +1,49 @@
+/* Store current floating-point environment.
+ Copyright (C) 1997-2017 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 <fenv.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+#include <dl-procinfo.h>
+
+int
+__fegetenv (fenv_t *envp)
+{
+ __asm__ ("fnstenv %0" : "=m" (*envp));
+ /* And load it right back since the processor changes the mask.
+ Intel thought this opcode to be used in interrupt handlers which
+ would block all exceptions. */
+ __asm__ ("fldenv %0" : : "m" (*envp));
+
+ if (HAS_CPU_FEATURE (SSE))
+ __asm__ ("stmxcsr %0" : "=m" (envp->__eip));
+
+ /* Success. */
+ return 0;
+}
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__fegetenv, __old_fegetenv)
+compat_symbol (libm, __old_fegetenv, fegetenv, GLIBC_2_1);
+#endif
+
+libm_hidden_def (__fegetenv)
+libm_hidden_ver (__fegetenv, fegetenv)
+versioned_symbol (libm, __fegetenv, fegetenv, GLIBC_2_2);
diff --git a/REORG.TODO/sysdeps/i386/fpu/fegetexcept.c b/REORG.TODO/sysdeps/i386/fpu/fegetexcept.c
new file mode 100644
index 0000000000..dc87b7a470
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/fegetexcept.c
@@ -0,0 +1,31 @@
+/* Get enabled floating-point exceptions.
+ Copyright (C) 1999-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@suse.de>, 1999.
+
+ 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 <fenv.h>
+
+int
+fegetexcept (void)
+{
+ unsigned short int exc;
+
+ /* Get the current control word. */
+ __asm__ ("fstcw %0" : "=m" (*&exc));
+
+ return (~exc) & FE_ALL_EXCEPT;
+}
diff --git a/REORG.TODO/sysdeps/i386/fpu/fegetmode.c b/REORG.TODO/sysdeps/i386/fpu/fegetmode.c
new file mode 100644
index 0000000000..abbce3075f
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/fegetmode.c
@@ -0,0 +1,32 @@
+/* Store current floating-point control modes. i386 version.
+ Copyright (C) 2016-2017 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <fenv.h>
+#include <fpu_control.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+#include <dl-procinfo.h>
+
+int
+fegetmode (femode_t *modep)
+{
+ _FPU_GETCW (modep->__control_word);
+ if (HAS_CPU_FEATURE (SSE))
+ __asm__ ("stmxcsr %0" : "=m" (modep->__mxcsr));
+ return 0;
+}
diff --git a/REORG.TODO/sysdeps/i386/fpu/fegetround.c b/REORG.TODO/sysdeps/i386/fpu/fegetround.c
new file mode 100644
index 0000000000..8ce8b859d8
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/fegetround.c
@@ -0,0 +1,33 @@
+/* Return current rounding direction.
+ Copyright (C) 1997-2017 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 <fenv.h>
+
+int
+__fegetround (void)
+{
+ int cw;
+
+ __asm__ ("fnstcw %0" : "=m" (*&cw));
+
+ return cw & 0xc00;
+}
+libm_hidden_def (__fegetround)
+weak_alias (__fegetround, fegetround)
+libm_hidden_weak (fegetround)
diff --git a/REORG.TODO/sysdeps/i386/fpu/feholdexcpt.c b/REORG.TODO/sysdeps/i386/fpu/feholdexcpt.c
new file mode 100644
index 0000000000..d327358913
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/feholdexcpt.c
@@ -0,0 +1,50 @@
+/* Store current floating-point environment and clear exceptions.
+ Copyright (C) 1997-2017 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 <fenv.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+#include <dl-procinfo.h>
+
+int
+__feholdexcept (fenv_t *envp)
+{
+ /* 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 (HAS_CPU_FEATURE (SSE))
+ {
+ unsigned int xwork;
+
+ /* Get the current control word. */
+ __asm__ ("stmxcsr %0" : "=m" (envp->__eip));
+
+ /* Set all exceptions to non-stop and clear them. */
+ xwork = (envp->__eip | 0x1f80) & ~0x3f;
+
+ __asm__ ("ldmxcsr %0" : : "m" (*&xwork));
+ }
+
+ return 0;
+}
+libm_hidden_def (__feholdexcept)
+weak_alias (__feholdexcept, feholdexcept)
+libm_hidden_weak (feholdexcept)
diff --git a/REORG.TODO/sysdeps/i386/fpu/fenv_private.h b/REORG.TODO/sysdeps/i386/fpu/fenv_private.h
new file mode 100644
index 0000000000..e20e1f1662
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/fenv_private.h
@@ -0,0 +1,501 @@
+#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_fesetround_sse (int r)
+{
+ unsigned int mxcsr;
+ asm (STMXCSR " %0" : "=m" (*&mxcsr));
+ mxcsr = (mxcsr & ~0x6000) | (r << 3);
+ asm volatile (LDMXCSR " %0" : : "m" (*&mxcsr));
+}
+
+static __always_inline void
+libc_fesetround_387 (int r)
+{
+ fpu_control_t cw;
+ _FPU_GETCW (cw);
+ cw = (cw & ~0xc00) | r;
+ _FPU_SETCW (cw);
+}
+
+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 (__glibc_unlikely (~(old_mxcsr >> 7) & cur_ex))
+ __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_fesetroundf libc_fesetround_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_fesetroundf libc_fesetround_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_fesetround libc_fesetround_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_fesetround libc_fesetround_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_fesetroundl libc_fesetround_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
+
+/* We have support for rounding mode context. */
+#define HAVE_RM_CTX 1
+
+static __always_inline void
+libc_feholdexcept_setround_sse_ctx (struct rm_ctx *ctx, int r)
+{
+ unsigned int mxcsr, new_mxcsr;
+ asm (STMXCSR " %0" : "=m" (*&mxcsr));
+ new_mxcsr = ((mxcsr | 0x1f80) & ~0x603f) | (r << 3);
+
+ ctx->env.__mxcsr = mxcsr;
+ if (__glibc_unlikely (mxcsr != new_mxcsr))
+ {
+ asm volatile (LDMXCSR " %0" : : "m" (*&new_mxcsr));
+ ctx->updated_status = true;
+ }
+ else
+ ctx->updated_status = false;
+}
+
+/* Unconditional since we want to overwrite any exceptions that occurred in the
+ context. This is also why all fehold* functions unconditionally write into
+ ctx->env. */
+static __always_inline void
+libc_fesetenv_sse_ctx (struct rm_ctx *ctx)
+{
+ libc_fesetenv_sse (&ctx->env);
+}
+
+static __always_inline void
+libc_feupdateenv_sse_ctx (struct rm_ctx *ctx)
+{
+ if (__glibc_unlikely (ctx->updated_status))
+ libc_feupdateenv_test_sse (&ctx->env, 0);
+}
+
+static __always_inline void
+libc_feholdexcept_setround_387_prec_ctx (struct rm_ctx *ctx, int r)
+{
+ libc_feholdexcept_387 (&ctx->env);
+
+ fpu_control_t cw = ctx->env.__control_word;
+ fpu_control_t old_cw = cw;
+ cw &= ~(_FPU_RC_ZERO | _FPU_EXTENDED);
+ cw |= r | 0x3f;
+
+ if (__glibc_unlikely (old_cw != cw))
+ {
+ _FPU_SETCW (cw);
+ ctx->updated_status = true;
+ }
+ else
+ ctx->updated_status = false;
+}
+
+static __always_inline void
+libc_feholdexcept_setround_387_ctx (struct rm_ctx *ctx, int r)
+{
+ libc_feholdexcept_setround_387_prec_ctx (ctx, r | _FPU_EXTENDED);
+}
+
+static __always_inline void
+libc_feholdexcept_setround_387_53bit_ctx (struct rm_ctx *ctx, int r)
+{
+ libc_feholdexcept_setround_387_prec_ctx (ctx, r | _FPU_DOUBLE);
+}
+
+static __always_inline void
+libc_feholdsetround_387_prec_ctx (struct rm_ctx *ctx, int r)
+{
+ fpu_control_t cw, new_cw;
+
+ _FPU_GETCW (cw);
+ new_cw = cw;
+ new_cw &= ~(_FPU_RC_ZERO | _FPU_EXTENDED);
+ new_cw |= r;
+
+ ctx->env.__control_word = cw;
+ if (__glibc_unlikely (new_cw != cw))
+ {
+ _FPU_SETCW (new_cw);
+ ctx->updated_status = true;
+ }
+ else
+ ctx->updated_status = false;
+}
+
+static __always_inline void
+libc_feholdsetround_387_ctx (struct rm_ctx *ctx, int r)
+{
+ libc_feholdsetround_387_prec_ctx (ctx, r | _FPU_EXTENDED);
+}
+
+static __always_inline void
+libc_feholdsetround_387_53bit_ctx (struct rm_ctx *ctx, int r)
+{
+ libc_feholdsetround_387_prec_ctx (ctx, r | _FPU_DOUBLE);
+}
+
+static __always_inline void
+libc_feholdsetround_sse_ctx (struct rm_ctx *ctx, int r)
+{
+ unsigned int mxcsr, new_mxcsr;
+
+ asm (STMXCSR " %0" : "=m" (*&mxcsr));
+ new_mxcsr = (mxcsr & ~0x6000) | (r << 3);
+
+ ctx->env.__mxcsr = mxcsr;
+ if (__glibc_unlikely (new_mxcsr != mxcsr))
+ {
+ asm volatile (LDMXCSR " %0" : : "m" (*&new_mxcsr));
+ ctx->updated_status = true;
+ }
+ else
+ ctx->updated_status = false;
+}
+
+static __always_inline void
+libc_feresetround_sse_ctx (struct rm_ctx *ctx)
+{
+ if (__glibc_unlikely (ctx->updated_status))
+ libc_feresetround_sse (&ctx->env);
+}
+
+static __always_inline void
+libc_feresetround_387_ctx (struct rm_ctx *ctx)
+{
+ if (__glibc_unlikely (ctx->updated_status))
+ _FPU_SETCW (ctx->env.__control_word);
+}
+
+static __always_inline void
+libc_feupdateenv_387_ctx (struct rm_ctx *ctx)
+{
+ if (__glibc_unlikely (ctx->updated_status))
+ libc_feupdateenv_test_387 (&ctx->env, 0);
+}
+
+#ifdef __SSE_MATH__
+# define libc_feholdexcept_setroundf_ctx libc_feholdexcept_setround_sse_ctx
+# define libc_fesetenvf_ctx libc_fesetenv_sse_ctx
+# define libc_feupdateenvf_ctx libc_feupdateenv_sse_ctx
+# define libc_feholdsetroundf_ctx libc_feholdsetround_sse_ctx
+# define libc_feresetroundf_ctx libc_feresetround_sse_ctx
+#else
+# define libc_feholdexcept_setroundf_ctx libc_feholdexcept_setround_387_ctx
+# define libc_feupdateenvf_ctx libc_feupdateenv_387_ctx
+# define libc_feholdsetroundf_ctx libc_feholdsetround_387_ctx
+# define libc_feresetroundf_ctx libc_feresetround_387_ctx
+#endif /* __SSE_MATH__ */
+
+#ifdef __SSE2_MATH__
+# define libc_feholdexcept_setround_ctx libc_feholdexcept_setround_sse_ctx
+# define libc_fesetenv_ctx libc_fesetenv_sse_ctx
+# define libc_feupdateenv_ctx libc_feupdateenv_sse_ctx
+# define libc_feholdsetround_ctx libc_feholdsetround_sse_ctx
+# define libc_feresetround_ctx libc_feresetround_sse_ctx
+#else
+# define libc_feholdexcept_setround_ctx libc_feholdexcept_setround_387_ctx
+# define libc_feupdateenv_ctx libc_feupdateenv_387_ctx
+# define libc_feholdsetround_ctx libc_feholdsetround_387_ctx
+# define libc_feresetround_ctx libc_feresetround_387_ctx
+#endif /* __SSE2_MATH__ */
+
+#define libc_feholdexcept_setroundl_ctx libc_feholdexcept_setround_387_ctx
+#define libc_feupdateenvl_ctx libc_feupdateenv_387_ctx
+#define libc_feholdsetroundl_ctx libc_feholdsetround_387_ctx
+#define libc_feresetroundl_ctx libc_feresetround_387_ctx
+
+#ifndef __SSE2_MATH__
+# define libc_feholdsetround_53bit_ctx libc_feholdsetround_387_53bit_ctx
+# define libc_feresetround_53bit_ctx libc_feresetround_387_ctx
+#endif
+
+#undef __mxcsr
+
+#endif /* FENV_PRIVATE_H */
diff --git a/REORG.TODO/sysdeps/i386/fpu/fesetenv.c b/REORG.TODO/sysdeps/i386/fpu/fesetenv.c
new file mode 100644
index 0000000000..a338e5d555
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/fesetenv.c
@@ -0,0 +1,131 @@
+/* Install given floating-point environment.
+ Copyright (C) 1997-2017 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 <fenv.h>
+#include <fpu_control.h>
+#include <assert.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+#include <dl-procinfo.h>
+
+
+/* All exceptions, including the x86-specific "denormal operand"
+ exception. */
+#define FE_ALL_EXCEPT_X86 (FE_ALL_EXCEPT | __FE_DENORM)
+
+
+int
+__fesetenv (const fenv_t *envp)
+{
+ fenv_t temp;
+
+ /* The memory block used by fstenv/fldenv has a size of 28 bytes. */
+ assert (sizeof (fenv_t) == 28);
+
+ /* Install the environment specified by ENVP. But there are a few
+ values which we do not want to come from the saved environment.
+ Therefore, we get the current environment and replace the values
+ we want to use from the environment specified by the parameter. */
+ __asm__ ("fnstenv %0" : "=m" (*&temp));
+
+ if (envp == FE_DFL_ENV)
+ {
+ temp.__control_word |= FE_ALL_EXCEPT_X86;
+ temp.__control_word &= ~FE_TOWARDZERO;
+ temp.__control_word |= _FPU_EXTENDED;
+ temp.__status_word &= ~FE_ALL_EXCEPT_X86;
+ }
+ else if (envp == FE_NOMASK_ENV)
+ {
+ temp.__control_word &= ~(FE_ALL_EXCEPT | FE_TOWARDZERO);
+ /* Keep the "denormal operand" exception masked. */
+ temp.__control_word |= __FE_DENORM;
+ temp.__control_word |= _FPU_EXTENDED;
+ temp.__status_word &= ~FE_ALL_EXCEPT_X86;
+ }
+ else
+ {
+ temp.__control_word &= ~(FE_ALL_EXCEPT_X86
+ | FE_TOWARDZERO
+ | _FPU_EXTENDED);
+ temp.__control_word |= (envp->__control_word
+ & (FE_ALL_EXCEPT_X86
+ | FE_TOWARDZERO
+ | _FPU_EXTENDED));
+ temp.__status_word &= ~FE_ALL_EXCEPT_X86;
+ temp.__status_word |= envp->__status_word & FE_ALL_EXCEPT_X86;
+ }
+ temp.__eip = 0;
+ temp.__cs_selector = 0;
+ temp.__opcode = 0;
+ temp.__data_offset = 0;
+ temp.__data_selector = 0;
+
+ __asm__ ("fldenv %0" : : "m" (temp));
+
+ if (HAS_CPU_FEATURE (SSE))
+ {
+ unsigned int mxcsr;
+ __asm__ ("stmxcsr %0" : "=m" (mxcsr));
+
+ if (envp == FE_DFL_ENV)
+ {
+ /* Clear SSE exceptions. */
+ mxcsr &= ~FE_ALL_EXCEPT_X86;
+ /* Set mask for SSE MXCSR. */
+ mxcsr |= (FE_ALL_EXCEPT_X86 << 7);
+ /* Set rounding to FE_TONEAREST. */
+ mxcsr &= ~0x6000;
+ mxcsr |= (FE_TONEAREST << 3);
+ /* Clear the FZ and DAZ bits. */
+ mxcsr &= ~0x8040;
+ }
+ else if (envp == FE_NOMASK_ENV)
+ {
+ /* Clear SSE exceptions. */
+ mxcsr &= ~FE_ALL_EXCEPT_X86;
+ /* Do not mask exceptions. */
+ mxcsr &= ~(FE_ALL_EXCEPT << 7);
+ /* Keep the "denormal operand" exception masked. */
+ mxcsr |= (__FE_DENORM << 7);
+ /* Set rounding to FE_TONEAREST. */
+ mxcsr &= ~0x6000;
+ mxcsr |= (FE_TONEAREST << 3);
+ /* Clear the FZ and DAZ bits. */
+ mxcsr &= ~0x8040;
+ }
+ else
+ mxcsr = envp->__eip;
+
+ __asm__ ("ldmxcsr %0" : : "m" (mxcsr));
+ }
+
+ /* Success. */
+ return 0;
+}
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__fesetenv, __old_fesetenv)
+compat_symbol (libm, __old_fesetenv, fesetenv, GLIBC_2_1);
+#endif
+
+libm_hidden_def (__fesetenv)
+libm_hidden_ver (__fesetenv, fesetenv)
+versioned_symbol (libm, __fesetenv, fesetenv, GLIBC_2_2);
diff --git a/REORG.TODO/sysdeps/i386/fpu/fesetexcept.c b/REORG.TODO/sysdeps/i386/fpu/fesetexcept.c
new file mode 100644
index 0000000000..adfcf17ba6
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/fesetexcept.c
@@ -0,0 +1,31 @@
+/* Set given exception flags. i386 version.
+ Copyright (C) 2016-2017 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <fenv.h>
+
+int
+fesetexcept (int excepts)
+{
+ fenv_t temp;
+
+ __asm__ ("fnstenv %0" : "=m" (*&temp));
+ temp.__status_word |= excepts & FE_ALL_EXCEPT;
+ __asm__ ("fldenv %0" : : "m" (*&temp));
+
+ return 0;
+}
diff --git a/REORG.TODO/sysdeps/i386/fpu/fesetmode.c b/REORG.TODO/sysdeps/i386/fpu/fesetmode.c
new file mode 100644
index 0000000000..bd9f74cd97
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/fesetmode.c
@@ -0,0 +1,54 @@
+/* Install given floating-point control modes. i386 version.
+ Copyright (C) 2016-2017 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <fenv.h>
+#include <fpu_control.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+#include <dl-procinfo.h>
+
+/* All exceptions, including the x86-specific "denormal operand"
+ exception. */
+#define FE_ALL_EXCEPT_X86 (FE_ALL_EXCEPT | __FE_DENORM)
+
+int
+fesetmode (const femode_t *modep)
+{
+ fpu_control_t cw;
+ if (modep == FE_DFL_MODE)
+ cw = _FPU_DEFAULT;
+ else
+ cw = modep->__control_word;
+ _FPU_SETCW (cw);
+ if (HAS_CPU_FEATURE (SSE))
+ {
+ unsigned int mxcsr;
+ __asm__ ("stmxcsr %0" : "=m" (mxcsr));
+ /* Preserve SSE exception flags but restore other state in
+ MXCSR. */
+ mxcsr &= FE_ALL_EXCEPT_X86;
+ if (modep == FE_DFL_MODE)
+ /* Default MXCSR state has all bits zero except for those
+ masking exceptions. */
+ mxcsr |= FE_ALL_EXCEPT_X86 << 7;
+ else
+ mxcsr |= modep->__mxcsr & ~FE_ALL_EXCEPT_X86;
+ __asm__ ("ldmxcsr %0" : : "m" (mxcsr));
+ }
+ return 0;
+}
diff --git a/REORG.TODO/sysdeps/i386/fpu/fesetround.c b/REORG.TODO/sysdeps/i386/fpu/fesetround.c
new file mode 100644
index 0000000000..a3fa6235c0
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/fesetround.c
@@ -0,0 +1,54 @@
+/* Set current rounding direction.
+ Copyright (C) 1997-2017 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 <fenv.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+#include <dl-procinfo.h>
+
+int
+__fesetround (int round)
+{
+ unsigned short int cw;
+
+ if ((round & ~0xc00) != 0)
+ /* ROUND is no valid rounding mode. */
+ return 1;
+
+ __asm__ ("fnstcw %0" : "=m" (*&cw));
+ cw &= ~0xc00;
+ cw |= round;
+ __asm__ ("fldcw %0" : : "m" (*&cw));
+
+ /* If the CPU supports SSE we set the MXCSR as well. */
+ if (HAS_CPU_FEATURE (SSE))
+ {
+ unsigned int xcw;
+
+ __asm__ ("stmxcsr %0" : "=m" (*&xcw));
+ xcw &= ~0x6000;
+ xcw |= round << 3;
+ __asm__ ("ldmxcsr %0" : : "m" (*&xcw));
+ }
+
+ return 0;
+}
+libm_hidden_def (__fesetround)
+weak_alias (__fesetround, fesetround)
+libm_hidden_weak (fesetround)
diff --git a/REORG.TODO/sysdeps/i386/fpu/feupdateenv.c b/REORG.TODO/sysdeps/i386/fpu/feupdateenv.c
new file mode 100644
index 0000000000..b610289cd0
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/feupdateenv.c
@@ -0,0 +1,60 @@
+/* Install given floating-point environment and raise exceptions.
+ Copyright (C) 1997-2017 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 <fenv.h>
+#include <unistd.h>
+#include <dl-procinfo.h>
+#include <ldsodefs.h>
+
+int
+__feupdateenv (const fenv_t *envp)
+{
+ fexcept_t temp;
+ unsigned int xtemp = 0;
+
+ /* Save current exceptions. */
+ __asm__ ("fnstsw %0" : "=m" (*&temp));
+
+ /* If the CPU supports SSE we test the MXCSR as well. */
+ if (HAS_CPU_FEATURE (SSE))
+ __asm__ ("stmxcsr %0" : "=m" (*&xtemp));
+
+ temp = (temp | xtemp) & FE_ALL_EXCEPT;
+
+ /* Install new environment. */
+ __fesetenv (envp);
+
+ /* Raise the saved exception. Incidently for us the implementation
+ defined format of the values in objects of type fexcept_t is the
+ same as the ones specified using the FE_* constants. */
+ __feraiseexcept ((int) temp);
+
+ /* Success. */
+ return 0;
+}
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__feupdateenv, __old_feupdateenv)
+compat_symbol (libm, __old_feupdateenv, feupdateenv, GLIBC_2_1);
+#endif
+
+libm_hidden_def (__feupdateenv)
+libm_hidden_ver (__feupdateenv, feupdateenv)
+versioned_symbol (libm, __feupdateenv, feupdateenv, GLIBC_2_2);
diff --git a/REORG.TODO/sysdeps/i386/fpu/fgetexcptflg.c b/REORG.TODO/sysdeps/i386/fpu/fgetexcptflg.c
new file mode 100644
index 0000000000..954e5f69d8
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/fgetexcptflg.c
@@ -0,0 +1,57 @@
+/* Store current representation for exceptions.
+ Copyright (C) 1997-2017 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 <fenv.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+#include <dl-procinfo.h>
+
+
+int
+__fegetexceptflag (fexcept_t *flagp, int excepts)
+{
+ fexcept_t temp;
+
+ /* Get the current exceptions. */
+ __asm__ ("fnstsw %0" : "=m" (*&temp));
+
+ *flagp = temp & excepts & FE_ALL_EXCEPT;
+
+ /* If the CPU supports SSE, we clear the MXCSR as well. */
+ if (HAS_CPU_FEATURE (SSE))
+ {
+ unsigned int sse_exc;
+
+ /* Get the current MXCSR. */
+ __asm__ ("stmxcsr %0" : "=m" (*&sse_exc));
+
+ *flagp |= sse_exc & excepts & FE_ALL_EXCEPT;
+ }
+
+ /* Success. */
+ return 0;
+}
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__fegetexceptflag, __old_fegetexceptflag)
+compat_symbol (libm, __old_fegetexceptflag, fegetexceptflag, GLIBC_2_1);
+#endif
+
+versioned_symbol (libm, __fegetexceptflag, fegetexceptflag, GLIBC_2_2);
diff --git a/REORG.TODO/sysdeps/i386/fpu/fraiseexcpt.c b/REORG.TODO/sysdeps/i386/fpu/fraiseexcpt.c
new file mode 100644
index 0000000000..913d7b912c
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/fraiseexcpt.c
@@ -0,0 +1,124 @@
+/* Raise given exceptions.
+ Copyright (C) 1997-2017 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 <fenv.h>
+#include <math.h>
+
+int
+__feraiseexcept (int excepts)
+{
+ /* Raise exceptions represented by EXPECTS. But we must raise only
+ one signal at a time. It is important that if the overflow/underflow
+ exception and the inexact exception are given at the same time,
+ the overflow/underflow exception follows the inexact exception. */
+
+ /* First: invalid exception. */
+ if ((FE_INVALID & excepts) != 0)
+ {
+ /* One example of an invalid operation is 0.0 / 0.0. */
+ double d;
+ __asm__ __volatile__ ("fldz; fdiv %%st, %%st(0); fwait" : "=t" (d));
+ (void) &d;
+ }
+
+ /* Next: division by zero. */
+ if ((FE_DIVBYZERO & excepts) != 0)
+ {
+ double d;
+ __asm__ __volatile__ ("fldz; fld1; fdivp %%st, %%st(1); fwait"
+ : "=t" (d));
+ (void) &d;
+ }
+
+ /* Next: overflow. */
+ if ((FE_OVERFLOW & excepts) != 0)
+ {
+ /* There is no way to raise only the overflow flag. Do it the
+ hard way. */
+ fenv_t temp;
+
+ /* Bah, we have to clear selected exceptions. Since there is no
+ `fldsw' instruction we have to do it the hard way. */
+ __asm__ __volatile__ ("fnstenv %0" : "=m" (*&temp));
+
+ /* Set the relevant bits. */
+ temp.__status_word |= FE_OVERFLOW;
+
+ /* Put the new data in effect. */
+ __asm__ __volatile__ ("fldenv %0" : : "m" (*&temp));
+
+ /* And raise the exception. */
+ __asm__ __volatile__ ("fwait");
+ }
+
+ /* Next: underflow. */
+ if ((FE_UNDERFLOW & excepts) != 0)
+ {
+ /* There is no way to raise only the underflow flag. Do it the
+ hard way. */
+ fenv_t temp;
+
+ /* Bah, we have to clear selected exceptions. Since there is no
+ `fldsw' instruction we have to do it the hard way. */
+ __asm__ __volatile__ ("fnstenv %0" : "=m" (*&temp));
+
+ /* Set the relevant bits. */
+ temp.__status_word |= FE_UNDERFLOW;
+
+ /* Put the new data in effect. */
+ __asm__ __volatile__ ("fldenv %0" : : "m" (*&temp));
+
+ /* And raise the exception. */
+ __asm__ __volatile__ ("fwait");
+ }
+
+ /* Last: inexact. */
+ if ((FE_INEXACT & excepts) != 0)
+ {
+ /* There is no way to raise only the inexact flag. Do it the
+ hard way. */
+ fenv_t temp;
+
+ /* Bah, we have to clear selected exceptions. Since there is no
+ `fldsw' instruction we have to do it the hard way. */
+ __asm__ __volatile__ ("fnstenv %0" : "=m" (*&temp));
+
+ /* Set the relevant bits. */
+ temp.__status_word |= FE_INEXACT;
+
+ /* Put the new data in effect. */
+ __asm__ __volatile__ ("fldenv %0" : : "m" (*&temp));
+
+ /* And raise the exception. */
+ __asm__ __volatile__ ("fwait");
+ }
+
+ /* Success. */
+ return 0;
+}
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__feraiseexcept, __old_feraiseexcept)
+compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1);
+#endif
+
+libm_hidden_def (__feraiseexcept)
+libm_hidden_ver (__feraiseexcept, feraiseexcept)
+versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2);
diff --git a/REORG.TODO/sysdeps/i386/fpu/fsetexcptflg.c b/REORG.TODO/sysdeps/i386/fpu/fsetexcptflg.c
new file mode 100644
index 0000000000..efa64aaefd
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/fsetexcptflg.c
@@ -0,0 +1,69 @@
+/* Set floating-point environment exception handling.
+ Copyright (C) 1997-2017 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 <fenv.h>
+#include <math.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+#include <dl-procinfo.h>
+
+int
+__fesetexceptflag (const fexcept_t *flagp, int excepts)
+{
+ fenv_t temp;
+
+ /* Get the current environment. We have to do this since we cannot
+ separately set the status word. */
+ __asm__ ("fnstenv %0" : "=m" (*&temp));
+
+ temp.__status_word &= ~(excepts & FE_ALL_EXCEPT);
+ temp.__status_word |= *flagp & excepts & FE_ALL_EXCEPT;
+
+ /* Store the new status word (along with the rest of the environment.
+ Possibly new exceptions are set but they won't get executed unless
+ the next floating-point instruction. */
+ __asm__ ("fldenv %0" : : "m" (*&temp));
+
+ /* If the CPU supports SSE, we set the MXCSR as well. */
+ if (HAS_CPU_FEATURE (SSE))
+ {
+ unsigned int xnew_exc;
+
+ /* Get the current MXCSR. */
+ __asm__ ("stmxcsr %0" : "=m" (*&xnew_exc));
+
+ /* Set the relevant bits. */
+ xnew_exc &= ~(excepts & FE_ALL_EXCEPT);
+ xnew_exc |= *flagp & excepts & FE_ALL_EXCEPT;
+
+ /* Put the new data in effect. */
+ __asm__ ("ldmxcsr %0" : : "m" (*&xnew_exc));
+ }
+
+ /* Success. */
+ return 0;
+}
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__fesetexceptflag, __old_fesetexceptflag)
+compat_symbol (libm, __old_fesetexceptflag, fesetexceptflag, GLIBC_2_1);
+#endif
+
+versioned_symbol (libm, __fesetexceptflag, fesetexceptflag, GLIBC_2_2);
diff --git a/REORG.TODO/sysdeps/i386/fpu/ftestexcept.c b/REORG.TODO/sysdeps/i386/fpu/ftestexcept.c
new file mode 100644
index 0000000000..f523f9e709
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/ftestexcept.c
@@ -0,0 +1,40 @@
+/* Test exception in current environment.
+ Copyright (C) 1997-2017 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 <fenv.h>
+#include <unistd.h>
+#include <dl-procinfo.h>
+#include <ldsodefs.h>
+
+int
+fetestexcept (int excepts)
+{
+ short temp;
+ int xtemp = 0;
+
+ /* Get current exceptions. */
+ __asm__ ("fnstsw %0" : "=a" (temp));
+
+ /* If the CPU supports SSE we test the MXCSR as well. */
+ if (HAS_CPU_FEATURE (SSE))
+ __asm__ ("stmxcsr %0" : "=m" (*&xtemp));
+
+ return (temp | xtemp) & excepts & FE_ALL_EXCEPT;
+}
+libm_hidden_def (fetestexcept)
diff --git a/REORG.TODO/sysdeps/i386/fpu/halfulp.c b/REORG.TODO/sysdeps/i386/fpu/halfulp.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/halfulp.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/REORG.TODO/sysdeps/i386/fpu/i386-math-asm.h b/REORG.TODO/sysdeps/i386/fpu/i386-math-asm.h
new file mode 100644
index 0000000000..6ffc8e6f64
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/i386-math-asm.h
@@ -0,0 +1,340 @@
+/* Helper macros for x86 libm functions.
+ Copyright (C) 2015-2017 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _I386_MATH_ASM_H
+#define _I386_MATH_ASM_H 1
+
+/* Remove excess range and precision by storing a value on the stack
+ and loading it back. */
+#define FLT_NARROW_EVAL \
+ subl $4, %esp; \
+ cfi_adjust_cfa_offset (4); \
+ fstps (%esp); \
+ flds (%esp); \
+ addl $4, %esp; \
+ cfi_adjust_cfa_offset (-4);
+#define DBL_NARROW_EVAL \
+ subl $8, %esp; \
+ cfi_adjust_cfa_offset (8); \
+ fstpl (%esp); \
+ fldl (%esp); \
+ addl $8, %esp; \
+ cfi_adjust_cfa_offset (-8);
+
+/* Define constants for the minimum value of a floating-point
+ type. */
+#define DEFINE_FLT_MIN \
+ .section .rodata.cst4,"aM",@progbits,4; \
+ .p2align 2; \
+ .type flt_min,@object; \
+flt_min: \
+ .byte 0, 0, 0x80, 0; \
+ .size flt_min, .-flt_min;
+#define DEFINE_DBL_MIN \
+ .section .rodata.cst8,"aM",@progbits,8; \
+ .p2align 3; \
+ .type dbl_min,@object; \
+dbl_min: \
+ .byte 0, 0, 0, 0, 0, 0, 0x10, 0; \
+ .size dbl_min, .-dbl_min;
+#define DEFINE_LDBL_MIN \
+ .section .rodata.cst16,"aM",@progbits,16; \
+ .p2align 4; \
+ .type ldbl_min,@object; \
+ldbl_min: \
+ .byte 0, 0, 0, 0, 0, 0, 0, 0x80, 0x1, 0; \
+ .byte 0, 0, 0, 0, 0, 0; \
+ .size ldbl_min, .-ldbl_min;
+
+/* Remove excess range and precision by storing a value on the stack
+ and loading it back. The value is given to be nonnegative or NaN;
+ if it is subnormal, also force an underflow exception. The
+ relevant constant for the minimum of the type must have been
+ defined, the MO macro must have been defined for access to memory
+ operands, and, if PIC, the PIC register must have been loaded. */
+#define FLT_NARROW_EVAL_UFLOW_NONNEG_NAN \
+ subl $4, %esp; \
+ cfi_adjust_cfa_offset (4); \
+ flds MO(flt_min); \
+ fld %st(1); \
+ fucompp; \
+ fnstsw; \
+ sahf; \
+ jnc 6424f; \
+ fld %st(0); \
+ fmul %st(0); \
+ fstps (%esp); \
+6424: fstps (%esp); \
+ flds (%esp); \
+ addl $4, %esp; \
+ cfi_adjust_cfa_offset (-4);
+#define DBL_NARROW_EVAL_UFLOW_NONNEG_NAN \
+ subl $8, %esp; \
+ cfi_adjust_cfa_offset (8); \
+ fldl MO(dbl_min); \
+ fld %st(1); \
+ fucompp; \
+ fnstsw; \
+ sahf; \
+ jnc 6453f; \
+ fld %st(0); \
+ fmul %st(0); \
+ fstpl (%esp); \
+6453: fstpl (%esp); \
+ fldl (%esp); \
+ addl $8, %esp; \
+ cfi_adjust_cfa_offset (-8);
+
+/* Likewise, but the argument is not a NaN (so fcom instructions,
+ which support memory operands, can be used). */
+#define FLT_NARROW_EVAL_UFLOW_NONNEG \
+ subl $4, %esp; \
+ cfi_adjust_cfa_offset (4); \
+ fcoms MO(flt_min); \
+ fnstsw; \
+ sahf; \
+ jnc 6424f; \
+ fld %st(0); \
+ fmul %st(0); \
+ fstps (%esp); \
+6424: fstps (%esp); \
+ flds (%esp); \
+ addl $4, %esp; \
+ cfi_adjust_cfa_offset (-4);
+#define DBL_NARROW_EVAL_UFLOW_NONNEG \
+ subl $8, %esp; \
+ cfi_adjust_cfa_offset (8); \
+ fcoml MO(dbl_min); \
+ fnstsw; \
+ sahf; \
+ jnc 6453f; \
+ fld %st(0); \
+ fmul %st(0); \
+ fstpl (%esp); \
+6453: fstpl (%esp); \
+ fldl (%esp); \
+ addl $8, %esp; \
+ cfi_adjust_cfa_offset (-8);
+
+/* Likewise, but the non-NaN argument may be negative. */
+#define FLT_NARROW_EVAL_UFLOW_NONNAN \
+ subl $4, %esp; \
+ cfi_adjust_cfa_offset (4); \
+ fld %st(0); \
+ fabs; \
+ fcomps MO(flt_min); \
+ fnstsw; \
+ sahf; \
+ jnc 6424f; \
+ fld %st(0); \
+ fmul %st(0); \
+ fstps (%esp); \
+6424: fstps (%esp); \
+ flds (%esp); \
+ addl $4, %esp; \
+ cfi_adjust_cfa_offset (-4);
+#define DBL_NARROW_EVAL_UFLOW_NONNAN \
+ subl $8, %esp; \
+ cfi_adjust_cfa_offset (8); \
+ fld %st(0); \
+ fabs; \
+ fcompl MO(dbl_min); \
+ fnstsw; \
+ sahf; \
+ jnc 6453f; \
+ fld %st(0); \
+ fmul %st(0); \
+ fstpl (%esp); \
+6453: fstpl (%esp); \
+ fldl (%esp); \
+ addl $8, %esp; \
+ cfi_adjust_cfa_offset (-8);
+
+/* Force an underflow exception if the given value is subnormal. The
+ relevant constant for the minimum of the type must have been
+ defined, the MO macro must have been defined for access to memory
+ operands, and, if PIC, the PIC register must have been loaded. */
+#define FLT_CHECK_FORCE_UFLOW \
+ flds MO(flt_min); \
+ fld %st(1); \
+ fabs; \
+ fucompp; \
+ fnstsw; \
+ sahf; \
+ jnc 6424f; \
+ subl $4, %esp; \
+ cfi_adjust_cfa_offset (4); \
+ fld %st(0); \
+ fmul %st(0); \
+ fstps (%esp); \
+ addl $4, %esp; \
+ cfi_adjust_cfa_offset (-4); \
+6424:
+#define DBL_CHECK_FORCE_UFLOW \
+ fldl MO(dbl_min); \
+ fld %st(1); \
+ fabs; \
+ fucompp; \
+ fnstsw; \
+ sahf; \
+ jnc 6453f; \
+ subl $8, %esp; \
+ cfi_adjust_cfa_offset (8); \
+ fld %st(0); \
+ fmul %st(0); \
+ fstpl (%esp); \
+ addl $8, %esp; \
+ cfi_adjust_cfa_offset (-8); \
+6453:
+
+/* Likewise, but also remove excess range and precision if the value
+ is subnormal. */
+#define FLT_CHECK_FORCE_UFLOW_NARROW \
+ flds MO(flt_min); \
+ fld %st(1); \
+ fabs; \
+ fucompp; \
+ fnstsw; \
+ sahf; \
+ jnc 6424f; \
+ subl $4, %esp; \
+ cfi_adjust_cfa_offset (4); \
+ fld %st(0); \
+ fmul %st(0); \
+ fstps (%esp); \
+ fstps (%esp); \
+ flds (%esp); \
+ addl $4, %esp; \
+ cfi_adjust_cfa_offset (-4); \
+6424:
+#define DBL_CHECK_FORCE_UFLOW_NARROW \
+ fldl MO(dbl_min); \
+ fld %st(1); \
+ fabs; \
+ fucompp; \
+ fnstsw; \
+ sahf; \
+ jnc 6453f; \
+ subl $8, %esp; \
+ cfi_adjust_cfa_offset (8); \
+ fld %st(0); \
+ fmul %st(0); \
+ fstpl (%esp); \
+ fstpl (%esp); \
+ fldl (%esp); \
+ addl $8, %esp; \
+ cfi_adjust_cfa_offset (-8); \
+6453:
+
+/* Likewise, but the argument is nonnegative or NaN. */
+#define LDBL_CHECK_FORCE_UFLOW_NONNEG_NAN \
+ fldt MO(ldbl_min); \
+ fld %st(1); \
+ fucompp; \
+ fnstsw; \
+ sahf; \
+ jnc 6464f; \
+ fld %st(0); \
+ fmul %st(0); \
+ fstp %st(0); \
+6464:
+
+/* Likewise, but the argument is not a NaN. */
+#define FLT_CHECK_FORCE_UFLOW_NONNAN \
+ fld %st(0); \
+ fabs; \
+ fcomps MO(flt_min); \
+ fnstsw; \
+ sahf; \
+ jnc 6424f; \
+ subl $4, %esp; \
+ cfi_adjust_cfa_offset (4); \
+ fld %st(0); \
+ fmul %st(0); \
+ fstps (%esp); \
+ addl $4, %esp; \
+ cfi_adjust_cfa_offset (-4); \
+6424:
+#define DBL_CHECK_FORCE_UFLOW_NONNAN \
+ fld %st(0); \
+ fabs; \
+ fcompl MO(dbl_min); \
+ fnstsw; \
+ sahf; \
+ jnc 6453f; \
+ subl $8, %esp; \
+ cfi_adjust_cfa_offset (8); \
+ fld %st(0); \
+ fmul %st(0); \
+ fstpl (%esp); \
+ addl $8, %esp; \
+ cfi_adjust_cfa_offset (-8); \
+6453:
+#define LDBL_CHECK_FORCE_UFLOW_NONNAN \
+ fldt MO(ldbl_min); \
+ fld %st(1); \
+ fabs; \
+ fcompp; \
+ fnstsw; \
+ sahf; \
+ jnc 6464f; \
+ fld %st(0); \
+ fmul %st(0); \
+ fstp %st(0); \
+6464:
+
+/* Likewise, but the argument is nonnegative and not a NaN. */
+#define FLT_CHECK_FORCE_UFLOW_NONNEG \
+ fcoms MO(flt_min); \
+ fnstsw; \
+ sahf; \
+ jnc 6424f; \
+ subl $4, %esp; \
+ cfi_adjust_cfa_offset (4); \
+ fld %st(0); \
+ fmul %st(0); \
+ fstps (%esp); \
+ addl $4, %esp; \
+ cfi_adjust_cfa_offset (-4); \
+6424:
+#define DBL_CHECK_FORCE_UFLOW_NONNEG \
+ fcoml MO(dbl_min); \
+ fnstsw; \
+ sahf; \
+ jnc 6453f; \
+ subl $8, %esp; \
+ cfi_adjust_cfa_offset (8); \
+ fld %st(0); \
+ fmul %st(0); \
+ fstpl (%esp); \
+ addl $8, %esp; \
+ cfi_adjust_cfa_offset (-8); \
+6453:
+#define LDBL_CHECK_FORCE_UFLOW_NONNEG \
+ fldt MO(ldbl_min); \
+ fld %st(1); \
+ fcompp; \
+ fnstsw; \
+ sahf; \
+ jnc 6464f; \
+ fld %st(0); \
+ fmul %st(0); \
+ fstp %st(0); \
+6464:
+
+#endif /* i386-math-asm.h. */
diff --git a/REORG.TODO/sysdeps/i386/fpu/libm-test-ulps b/REORG.TODO/sysdeps/i386/fpu/libm-test-ulps
new file mode 100644
index 0000000000..0fc50907ad
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/libm-test-ulps
@@ -0,0 +1,2202 @@
+# Begin of automatic generation
+
+# Maximal error of functions:
+Function: "acos":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "acos_downward":
+ildouble: 2
+ldouble: 2
+
+Function: "acos_towardzero":
+ildouble: 2
+ldouble: 2
+
+Function: "acos_upward":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+
+Function: "acosh":
+double: 1
+idouble: 1
+ildouble: 4
+ldouble: 2
+
+Function: "acosh_downward":
+double: 1
+idouble: 1
+ildouble: 6
+ldouble: 4
+
+Function: "acosh_towardzero":
+double: 1
+idouble: 1
+ildouble: 6
+ldouble: 4
+
+Function: "acosh_upward":
+double: 1
+idouble: 1
+ildouble: 4
+ldouble: 3
+
+Function: "asin":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "asin_downward":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+
+Function: "asin_towardzero":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "asin_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "asinh":
+double: 1
+idouble: 1
+ildouble: 3
+ldouble: 3
+
+Function: "asinh_downward":
+double: 1
+float: 1
+idouble: 1
+ildouble: 5
+ldouble: 5
+
+Function: "asinh_towardzero":
+double: 1
+float: 1
+idouble: 1
+ildouble: 4
+ldouble: 4
+
+Function: "asinh_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 5
+ldouble: 5
+
+Function: "atan":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "atan2":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "atan2_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "atan2_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "atan2_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "atan_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "atan_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "atan_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "atanh":
+double: 1
+idouble: 1
+ildouble: 3
+ldouble: 3
+
+Function: "atanh_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 4
+
+Function: "atanh_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 5
+ldouble: 3
+
+Function: "atanh_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 5
+ldouble: 5
+
+Function: "cabs":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "cabs_downward":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "cabs_towardzero":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "cabs_upward":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cacos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "cacos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "cacos_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "cacos_downward":
+double: 5
+float: 3
+idouble: 5
+ifloat: 3
+ildouble: 6
+ldouble: 6
+
+Function: Real part of "cacos_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "cacos_towardzero":
+double: 4
+float: 3
+idouble: 4
+ifloat: 3
+ildouble: 5
+ldouble: 5
+
+Function: Real part of "cacos_upward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "cacos_upward":
+double: 7
+float: 7
+idouble: 7
+ifloat: 7
+ildouble: 7
+ldouble: 7
+
+Function: Real part of "cacosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "cacosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cacosh_downward":
+double: 4
+float: 3
+idouble: 4
+ifloat: 3
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "cacosh_downward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "cacosh_towardzero":
+double: 4
+float: 3
+idouble: 4
+ifloat: 3
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "cacosh_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "cacosh_upward":
+double: 4
+float: 4
+idouble: 4
+ifloat: 4
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "cacosh_upward":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: "carg":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "carg_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "carg_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "carg_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "casin":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "casin":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "casin_downward":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: Imaginary part of "casin_downward":
+double: 5
+float: 3
+idouble: 5
+ifloat: 3
+ildouble: 6
+ldouble: 6
+
+Function: Real part of "casin_towardzero":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Imaginary part of "casin_towardzero":
+double: 4
+float: 3
+idouble: 4
+ifloat: 3
+ildouble: 5
+ldouble: 5
+
+Function: Real part of "casin_upward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "casin_upward":
+double: 7
+float: 7
+idouble: 7
+ifloat: 7
+ildouble: 7
+ldouble: 7
+
+Function: Real part of "casinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "casinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "casinh_downward":
+double: 5
+float: 3
+idouble: 5
+ifloat: 3
+ildouble: 6
+ldouble: 6
+
+Function: Imaginary part of "casinh_downward":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "casinh_towardzero":
+double: 4
+float: 3
+idouble: 4
+ifloat: 3
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "casinh_towardzero":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "casinh_upward":
+double: 7
+float: 7
+idouble: 7
+ifloat: 7
+ildouble: 7
+ldouble: 7
+
+Function: Imaginary part of "casinh_upward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "catan":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "catan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "catan_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "catan_downward":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: Real part of "catan_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "catan_towardzero":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: Real part of "catan_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "catan_upward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "catanh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "catanh":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "catanh_downward":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: Imaginary part of "catanh_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "catanh_towardzero":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: Imaginary part of "catanh_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "catanh_upward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 4
+ldouble: 4
+
+Function: Imaginary part of "catanh_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "cbrt":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: "cbrt_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: "cbrt_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: "cbrt_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: Real part of "ccos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ccos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ccos_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Imaginary part of "ccos_downward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "ccos_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Imaginary part of "ccos_towardzero":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "ccos_upward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "ccos_upward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "ccosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ccosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ccosh_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Imaginary part of "ccosh_downward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "ccosh_towardzero":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: Imaginary part of "ccosh_towardzero":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "ccosh_upward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "ccosh_upward":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+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: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cexp_downward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: Imaginary part of "cexp_downward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "cexp_towardzero":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: Imaginary part of "cexp_towardzero":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "cexp_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "cexp_upward":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "clog":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Imaginary part of "clog":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "clog10":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 4
+ldouble: 4
+
+Function: Imaginary part of "clog10":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "clog10_downward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 8
+ldouble: 8
+
+Function: Imaginary part of "clog10_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "clog10_towardzero":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 8
+ldouble: 8
+
+Function: Imaginary part of "clog10_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "clog10_upward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 7
+ldouble: 7
+
+Function: Imaginary part of "clog10_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "clog_downward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "clog_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "clog_towardzero":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "clog_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "clog_upward":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 4
+ldouble: 4
+
+Function: Imaginary part of "clog_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "cos":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "cos_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: "cos_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: "cos_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: "cosh":
+double: 1
+float: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+
+Function: "cosh_downward":
+double: 2
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 3
+
+Function: "cosh_towardzero":
+double: 2
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: "cosh_upward":
+double: 4
+float: 2
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 3
+
+Function: Real part of "cpow":
+double: 2
+float: 5
+idouble: 2
+ifloat: 5
+ildouble: 3
+ldouble: 3
+
+Function: Imaginary part of "cpow":
+float: 2
+ifloat: 2
+ildouble: 4
+ldouble: 4
+
+Function: Real part of "cpow_downward":
+double: 5
+float: 8
+idouble: 5
+ifloat: 8
+ildouble: 7
+ldouble: 7
+
+Function: Imaginary part of "cpow_downward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "cpow_towardzero":
+double: 5
+float: 8
+idouble: 5
+ifloat: 8
+ildouble: 7
+ldouble: 7
+
+Function: Imaginary part of "cpow_towardzero":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cpow_upward":
+double: 4
+float: 1
+idouble: 4
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "cpow_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "csin":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csin":
+float: 1
+ifloat: 1
+
+Function: Real part of "csin_downward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 3
+ldouble: 3
+
+Function: Imaginary part of "csin_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "csin_towardzero":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 3
+ldouble: 3
+
+Function: Imaginary part of "csin_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "csin_upward":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "csin_upward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "csinh":
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "csinh_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Imaginary part of "csinh_downward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "csinh_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Imaginary part of "csinh_towardzero":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "csinh_upward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "csinh_upward":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "csqrt":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "csqrt":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "csqrt_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "csqrt_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: Real part of "csqrt_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: Imaginary part of "csqrt_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: Real part of "csqrt_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "csqrt_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 4
+ldouble: 4
+
+Function: Real part of "ctan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "ctan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ctan_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "ctan_downward":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: Real part of "ctan_towardzero":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "ctan_towardzero":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 4
+ldouble: 4
+
+Function: Real part of "ctan_upward":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: Imaginary part of "ctan_upward":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "ctanh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ctanh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "ctanh_downward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 4
+ldouble: 4
+
+Function: Imaginary part of "ctanh_downward":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: Real part of "ctanh_towardzero":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 4
+ldouble: 4
+
+Function: Imaginary part of "ctanh_towardzero":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: Real part of "ctanh_upward":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: Imaginary part of "ctanh_upward":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: "erf":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "erf_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "erf_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "erf_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "erfc":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: "erfc_downward":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 4
+ldouble: 4
+
+Function: "erfc_towardzero":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 4
+ldouble: 4
+
+Function: "erfc_upward":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 5
+ldouble: 5
+
+Function: "exp":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "exp10":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "exp10_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: "exp10_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: "exp10_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: "exp2":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "exp2_downward":
+ildouble: 1
+ldouble: 1
+
+Function: "exp2_towardzero":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "exp2_upward":
+ildouble: 1
+ldouble: 1
+
+Function: "exp_downward":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "exp_towardzero":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+
+Function: "exp_upward":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "expm1":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+
+Function: "expm1_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: "expm1_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: "expm1_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: "gamma":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 4
+ldouble: 4
+
+Function: "gamma_downward":
+double: 4
+float: 4
+idouble: 4
+ifloat: 4
+ildouble: 7
+ldouble: 7
+
+Function: "gamma_towardzero":
+double: 4
+float: 2
+idouble: 4
+ifloat: 2
+ildouble: 7
+ldouble: 7
+
+Function: "gamma_upward":
+double: 3
+float: 4
+idouble: 3
+ifloat: 4
+ildouble: 5
+ldouble: 5
+
+Function: "hypot":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "hypot_downward":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "hypot_towardzero":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "hypot_upward":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "j0":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: "j0_downward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 4
+ldouble: 4
+
+Function: "j0_towardzero":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 5
+ldouble: 5
+
+Function: "j0_upward":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+ildouble: 4
+ldouble: 4
+
+Function: "j1":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "j1_downward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 4
+ldouble: 4
+
+Function: "j1_towardzero":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: "j1_upward":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 3
+ldouble: 3
+
+Function: "jn":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 4
+ldouble: 4
+
+Function: "jn_downward":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 4
+ldouble: 4
+
+Function: "jn_towardzero":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 5
+ldouble: 5
+
+Function: "jn_upward":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 5
+ldouble: 5
+
+Function: "lgamma":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 4
+ldouble: 4
+
+Function: "lgamma_downward":
+double: 4
+float: 4
+idouble: 4
+ifloat: 4
+ildouble: 7
+ldouble: 7
+
+Function: "lgamma_towardzero":
+double: 4
+float: 2
+idouble: 4
+ifloat: 2
+ildouble: 7
+ldouble: 7
+
+Function: "lgamma_upward":
+double: 3
+float: 4
+idouble: 3
+ifloat: 4
+ildouble: 5
+ldouble: 5
+
+Function: "log":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log10":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log10_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: "log10_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: "log10_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log1p":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+
+Function: "log1p_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: "log1p_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 4
+ldouble: 4
+
+Function: "log1p_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: "log2":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log2_downward":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log2_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log2_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log_downward":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+
+Function: "log_towardzero":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+
+Function: "log_upward":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "pow":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "pow10":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "pow10_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: "pow10_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: "pow10_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: "pow_downward":
+double: 1
+idouble: 1
+ildouble: 4
+ldouble: 4
+
+Function: "pow_towardzero":
+double: 1
+idouble: 1
+ildouble: 4
+ldouble: 4
+
+Function: "pow_upward":
+double: 1
+idouble: 1
+ildouble: 4
+ldouble: 4
+
+Function: "sin":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "sin_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: "sin_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: "sin_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: "sincos":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "sincos_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: "sincos_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: "sincos_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: "sinh":
+double: 1
+ildouble: 2
+ldouble: 2
+
+Function: "sinh_downward":
+double: 2
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 4
+ldouble: 5
+
+Function: "sinh_towardzero":
+double: 2
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 4
+
+Function: "sinh_upward":
+double: 4
+float: 2
+idouble: 1
+ifloat: 1
+ildouble: 4
+ldouble: 5
+
+Function: "tan":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: "tan_downward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: "tan_towardzero":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: "tan_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: "tanh":
+double: 1
+idouble: 1
+ildouble: 3
+ldouble: 3
+
+Function: "tanh_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 7
+ldouble: 4
+
+Function: "tanh_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 3
+ldouble: 3
+
+Function: "tanh_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 5
+ldouble: 4
+
+Function: "tgamma":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 5
+ldouble: 5
+
+Function: "tgamma_downward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 5
+ldouble: 5
+
+Function: "tgamma_towardzero":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 5
+ldouble: 5
+
+Function: "tgamma_upward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 5
+ldouble: 5
+
+Function: "y0":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "y0_downward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 5
+ldouble: 5
+
+Function: "y0_towardzero":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 5
+ldouble: 5
+
+Function: "y0_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: "y1":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: "y1_downward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 7
+ldouble: 7
+
+Function: "y1_towardzero":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 5
+ldouble: 5
+
+Function: "y1_upward":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 7
+ldouble: 7
+
+Function: "yn":
+double: 2
+float: 3
+idouble: 2
+ifloat: 3
+ildouble: 4
+ldouble: 4
+
+Function: "yn_downward":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 5
+ldouble: 5
+
+Function: "yn_towardzero":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 5
+ldouble: 5
+
+Function: "yn_upward":
+double: 3
+float: 3
+idouble: 3
+ifloat: 3
+ildouble: 4
+ldouble: 4
+
+# end of automatic generation
diff --git a/REORG.TODO/sysdeps/i386/fpu/libm-test-ulps-name b/REORG.TODO/sysdeps/i386/fpu/libm-test-ulps-name
new file mode 100644
index 0000000000..54ca0d8295
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/libm-test-ulps-name
@@ -0,0 +1 @@
+ix86
diff --git a/REORG.TODO/sysdeps/i386/fpu/math-tests.h b/REORG.TODO/sysdeps/i386/fpu/math-tests.h
new file mode 100644
index 0000000000..26d0633dc0
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/math-tests.h
@@ -0,0 +1,27 @@
+/* Configuration for math tests. 32-bit x86 version.
+ Copyright (C) 2013-2017 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
+ <http://www.gnu.org/licenses/>. */
+
+/* On 32-bit x86, versions of GCC up to at least 4.8 are happy to use FPU load
+ instructions for sNaN values, and loading a float or double sNaN value will
+ already raise an INVALID exception as well as turn the sNaN into a qNaN,
+ rendering certain tests infeasible in this scenario.
+ <http://gcc.gnu.org/PR56831>. */
+#define SNAN_TESTS_float 0
+#define SNAN_TESTS_double 0
+
+#include_next <math-tests.h>
diff --git a/REORG.TODO/sysdeps/i386/fpu/math_private.h b/REORG.TODO/sysdeps/i386/fpu/math_private.h
new file mode 100644
index 0000000000..485214391f
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/math_private.h
@@ -0,0 +1,7 @@
+#ifndef I386_MATH_PRIVATE_H
+#define I386_MATH_PRIVATE_H 1
+
+#include "fenv_private.h"
+#include_next <math_private.h>
+
+#endif
diff --git a/REORG.TODO/sysdeps/i386/fpu/mpatan.c b/REORG.TODO/sysdeps/i386/fpu/mpatan.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/mpatan.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/REORG.TODO/sysdeps/i386/fpu/mpatan2.c b/REORG.TODO/sysdeps/i386/fpu/mpatan2.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/mpatan2.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/REORG.TODO/sysdeps/i386/fpu/mpexp.c b/REORG.TODO/sysdeps/i386/fpu/mpexp.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/mpexp.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/REORG.TODO/sysdeps/i386/fpu/mplog.c b/REORG.TODO/sysdeps/i386/fpu/mplog.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/mplog.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/REORG.TODO/sysdeps/i386/fpu/mpsqrt.c b/REORG.TODO/sysdeps/i386/fpu/mpsqrt.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/mpsqrt.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_asinh.S b/REORG.TODO/sysdeps/i386/fpu/s_asinh.S
new file mode 100644
index 0000000000..1a60f7de2c
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_asinh.S
@@ -0,0 +1,139 @@
+/* ix87 specific implementation of arcsinh.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ 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>
+
+ .section .rodata
+
+ .align ALIGNARG(4)
+ .type huge,@object
+huge: .double 1e+300
+ ASM_SIZE_DIRECTIVE(huge)
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ .type limit,@object
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+ .text
+ENTRY(__asinh)
+ movl 8(%esp), %ecx
+ movl $0x7fffffff, %eax
+ andl %ecx, %eax
+ andl $0x80000000, %ecx
+ movl %eax, %edx
+ orl $0x800fffff, %edx
+ incl %edx
+ jz 7f // x in ħInf or NaN
+ xorl %ecx, 8(%esp)
+ fldl 4(%esp) // |x|
+ cmpl $0x3e300000, %eax
+ jb 2f // |x| < 2^-28
+ fldln2 // log(2) : |x|
+ cmpl $0x41b00000, %eax
+ fxch // |x| : log(2)
+ ja 3f // |x| > 2^28
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ cmpl $0x40000000, %eax
+ ja 5f // |x| > 2
+
+ // 2^-28 <= |x| <= 2 => y = sign(x)*log1p(|x|+|x|^2/(1+sqrt(1+|x|^2)))
+ fld %st // |x| : |x| : log(2)
+ fmul %st(1) // |x|^2 : |x| : log(2)
+ fld %st // |x|^2 : |x|^2 : |x| : log(2)
+ faddl MO(one) // 1+|x|^2 : |x|^2 : |x| : log(2)
+ fsqrt // sqrt(1+|x|^2) : |x|^2 : |x| : log(2)
+ faddl MO(one) // 1+sqrt(1+|x|^2) : |x|^2 : |x| : log(2)
+ fdivrp // |x|^2/(1+sqrt(1+|x|^2)) : |x| : log(2)
+ faddp // |x|+|x|^2/(1+sqrt(1+|x|^2)) : log(2)
+ fcoml MO(limit)
+ fnstsw
+ sahf
+ ja 6f
+ fyl2xp1
+ jecxz 4f
+ fchs
+4: ret
+
+7: fldl 4(%esp)
+ ret
+
+6: faddl MO(one)
+ fyl2x
+ jecxz 4f
+ fchs
+4: ret
+
+ // |x| < 2^-28 => y = x (inexact iff |x| != 0.0)
+ .align ALIGNARG(4)
+2:
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ jecxz 4f
+ fchs // x
+4: fld %st // x : x
+ faddl MO(huge) // huge+x : x
+ fstp %st(0) // x
+ cmpl $0x00100000, %eax
+ jae 8f
+ subl $8, %esp
+ cfi_adjust_cfa_offset (8)
+ fld %st(0)
+ fmul %st(0)
+ fstpl (%esp)
+ addl $8, %esp
+ cfi_adjust_cfa_offset (-8)
+8: ret
+
+ // |x| > 2^28 => y = sign(x) * (log(|x|) + log(2))
+ .align ALIGNARG(4)
+3: fyl2x // log(|x|)
+ fldln2 // log(2) : log(|x|)
+ faddp // log(|x|)+log(2)
+ jecxz 4f
+ fchs
+4: ret
+
+ // |x| > 2 => y = sign(x) * log(2*|x| + 1/(|x|+sqrt(x*x+1)))
+ .align ALIGNARG(4)
+5: fld %st // |x| : |x| : log(2)
+ fadd %st, %st(1) // |x| : 2*|x| : log(2)
+ fld %st // |x| : |x| : 2*|x| : log(2)
+ fmul %st(1) // |x|^2 : |x| : 2*|x| : log(2)
+ faddl MO(one) // 1+|x|^2 : |x| : 2*|x| : log(2)
+ fsqrt // sqrt(1+|x|^2) : |x| : 2*|x| : log(2)
+ faddp // |x|+sqrt(1+|x|^2) : 2*|x| : log(2)
+ fdivrl MO(one) // 1/(|x|+sqrt(1+|x|^2)) : 2*|x| : log(2)
+ faddp // 2*|x|+1/(|x|+sqrt(1+|x|^2)) : log(2)
+ fyl2x // log(2*|x|+1/(|x|+sqrt(1+|x|^2)))
+ jecxz 4f
+ fchs
+4: ret
+END(__asinh)
+weak_alias (__asinh, asinh)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_asinhf.S b/REORG.TODO/sysdeps/i386/fpu/s_asinhf.S
new file mode 100644
index 0000000000..12bcfef934
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_asinhf.S
@@ -0,0 +1,139 @@
+/* ix87 specific implementation of arcsinh.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ 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>
+
+ .section .rodata
+
+ .align ALIGNARG(4)
+ .type huge,@object
+huge: .double 1e+36
+ ASM_SIZE_DIRECTIVE(huge)
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ .type limit,@object
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+ .text
+ENTRY(__asinhf)
+ movl 4(%esp), %ecx
+ movl $0x7fffffff, %eax
+ andl %ecx, %eax
+ andl $0x80000000, %ecx
+ movl %eax, %edx
+ orl $0x807fffff, %edx
+ incl %edx
+ jz 7f // x in ħInf or NaN
+ xorl %ecx, 4(%esp)
+ flds 4(%esp) // |x|
+ cmpl $0x38000000, %eax
+ jb 2f // |x| < 2^-14
+ fldln2 // log(2) : |x|
+ cmpl $0x47000000, %eax
+ fxch // |x| : log(2)
+ ja 3f // |x| > 2^14
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ cmpl $0x40000000, %eax
+ ja 5f // |x| > 2
+
+ // 2^-14 <= |x| <= 2 => y = sign(x)*log1p(|x|+|x|^2/(1+sqrt(1+|x|^2)))
+ fld %st // |x| : |x| : log(2)
+ fmul %st(1) // |x|^2 : |x| : log(2)
+ fld %st // |x|^2 : |x|^2 : |x| : log(2)
+ faddl MO(one) // 1+|x|^2 : |x|^2 : |x| : log(2)
+ fsqrt // sqrt(1+|x|^2) : |x|^2 : |x| : log(2)
+ faddl MO(one) // 1+sqrt(1+|x|^2) : |x|^2 : |x| : log(2)
+ fdivrp // |x|^2/(1+sqrt(1+|x|^2)) : |x| : log(2)
+ faddp // |x|+|x|^2/(1+sqrt(1+|x|^2)) : log(2)
+ fcoml MO(limit)
+ fnstsw
+ sahf
+ ja 6f
+ fyl2xp1
+ jecxz 4f
+ fchs
+4: ret
+
+7: flds 4(%esp)
+ ret
+
+6: faddl MO(one)
+ fyl2x
+ jecxz 4f
+ fchs
+4: ret
+
+ // |x| < 2^-14 => y = x (inexact iff |x| != 0.0)
+ .align ALIGNARG(4)
+2:
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ jecxz 4f
+ fchs // x
+4: fld %st // x : x
+ faddl MO(huge) // huge+x : x
+ fstp %st(0) // x
+ cmpl $0x00800000, %eax
+ jae 8f
+ subl $4, %esp
+ cfi_adjust_cfa_offset (4)
+ fld %st(0)
+ fmul %st(0)
+ fstps (%esp)
+ addl $4, %esp
+ cfi_adjust_cfa_offset (-4)
+8: ret
+
+ // |x| > 2^14 => y = sign(x) * (log(|x|) + log(2))
+ .align ALIGNARG(4)
+3: fyl2x // log(|x|)
+ fldln2 // log(2) : log(|x|)
+ faddp // log(|x|)+log(2)
+ jecxz 4f
+ fchs
+4: ret
+
+ // |x| > 2 => y = sign(x) * log(2*|x| + 1/(|x|+sqrt(x*x+1)))
+ .align ALIGNARG(4)
+5: fld %st // |x| : |x| : log(2)
+ fadd %st, %st(1) // |x| : 2*|x| : log(2)
+ fld %st // |x| : |x| : 2*|x| : log(2)
+ fmul %st(1) // |x|^2 : |x| : 2*|x| : log(2)
+ faddl MO(one) // 1+|x|^2 : |x| : 2*|x| : log(2)
+ fsqrt // sqrt(1+|x|^2) : |x| : 2*|x| : log(2)
+ faddp // |x|+sqrt(1+|x|^2) : 2*|x| : log(2)
+ fdivrl MO(one) // 1/(|x|+sqrt(1+|x|^2)) : 2*|x| : log(2)
+ faddp // 2*|x|+1/(|x|+sqrt(1+|x|^2)) : log(2)
+ fyl2x // log(2*|x|+1/(|x|+sqrt(1+|x|^2)))
+ jecxz 4f
+ fchs
+4: ret
+END(__asinhf)
+weak_alias (__asinhf, asinhf)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_asinhl.S b/REORG.TODO/sysdeps/i386/fpu/s_asinhl.S
new file mode 100644
index 0000000000..f31a267e78
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_asinhl.S
@@ -0,0 +1,144 @@
+/* ix87 specific implementation of arcsinh.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ 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>
+
+ .section .rodata
+
+ .align ALIGNARG(4)
+ .type huge,@object
+huge: .tfloat 1e+4930
+ ASM_SIZE_DIRECTIVE(huge)
+ .align ALIGNARG(4)
+ /* Please note that we use double value for 1.0. This number
+ has an exact representation and so we don't get accuracy
+ problems. The advantage is that the code is simpler. */
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ /* It is not important that this constant is precise. It is only
+ a value which is known to be on the safe side for using the
+ fyl2xp1 instruction. */
+ .type limit,@object
+limit: .double 0.29
+ ASM_SIZE_DIRECTIVE(limit)
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+ .text
+ENTRY(__asinhl)
+ movl 12(%esp), %ecx
+ movl $0x7fff, %eax
+ andl %ecx, %eax
+ andl $0x8000, %ecx
+ movl %eax, %edx
+ orl $0xffff8000, %edx
+ incl %edx
+ jz 7f // x in ħInf or NaN
+ xorl %ecx, 12(%esp)
+ fldt 4(%esp) // |x|
+ cmpl $0x3fde, %eax
+ jb 2f // |x| < 2^-34
+ fldln2 // log(2) : |x|
+ cmpl $0x4020, %eax
+ fxch // |x| : log(2)
+ ja 3f // |x| > 2^34
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ cmpl $0x4000, %eax
+ ja 5f // |x| > 2
+
+ // 2^-34 <= |x| <= 2 => y = sign(x)*log1p(|x|+|x|^2/(1+sqrt(1+|x|^2)))
+ fld %st // |x| : |x| : log(2)
+ fmul %st(1) // |x|^2 : |x| : log(2)
+ fld %st // |x|^2 : |x|^2 : |x| : log(2)
+ faddl MO(one) // 1+|x|^2 : |x|^2 : |x| : log(2)
+ fsqrt // sqrt(1+|x|^2) : |x|^2 : |x| : log(2)
+ faddl MO(one) // 1+sqrt(1+|x|^2) : |x|^2 : |x| : log(2)
+ fdivrp // |x|^2/(1+sqrt(1+|x|^2)) : |x| : log(2)
+ faddp // |x|+|x|^2/(1+sqrt(1+|x|^2)) : log(2)
+ fcoml MO(limit)
+ fnstsw
+ sahf
+ ja 6f
+ fyl2xp1
+ jecxz 4f
+ fchs
+4: ret
+
+7: fldt 4(%esp)
+ fadd %st
+ ret
+
+6: faddl MO(one)
+ fyl2x
+ jecxz 4f
+ fchs
+4: ret
+
+ // |x| < 2^-34 => y = x (inexact iff |x| != 0.0)
+ .align ALIGNARG(4)
+2:
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ jecxz 4f
+ fchs // x
+4: fld %st // x : x
+ fldt MO(huge) // huge : x : x
+ faddp // huge+x : x
+ fstp %st(0) // x
+ cmpl $0x0001, %eax
+ jae 8f
+ fld %st(0)
+ fmul %st(0)
+ fstp %st(0)
+8: ret
+
+ // |x| > 2^34 => y = sign(x) * (log(|x|) + log(2))
+ .align ALIGNARG(4)
+3: fyl2x // log(|x|)
+ fldln2 // log(2) : log(|x|)
+ faddp // log(|x|)+log(2)
+ jecxz 4f
+ fchs
+4: ret
+
+ // |x| > 2 => y = sign(x) * log(2*|x| + 1/(|x|+sqrt(x*x+1)))
+ .align ALIGNARG(4)
+5: fld %st // |x| : |x| : log(2)
+ fadd %st, %st(1) // |x| : 2*|x| : log(2)
+ fld %st // |x| : |x| : 2*|x| : log(2)
+ fmul %st(1) // |x|^2 : |x| : 2*|x| : log(2)
+ faddl MO(one) // 1+|x|^2 : |x| : 2*|x| : log(2)
+ fsqrt // sqrt(1+|x|^2) : |x| : 2*|x| : log(2)
+ faddp // |x|+sqrt(1+|x|^2) : 2*|x| : log(2)
+ fdivrl MO(one) // 1/(|x|+sqrt(1+|x|^2)) : 2*|x| : log(2)
+ faddp // 2*|x|+1/(|x|+sqrt(1+|x|^2)) : log(2)
+ fyl2x // log(2*|x|+1/(|x|+sqrt(1+|x|^2)))
+ jecxz 4f
+ fchs
+4: ret
+END(__asinhl)
+weak_alias (__asinhl, asinhl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_atan.S b/REORG.TODO/sysdeps/i386/fpu/s_atan.S
new file mode 100644
index 0000000000..644de78feb
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_atan.S
@@ -0,0 +1,30 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+RCSID("$NetBSD: s_atan.S,v 1.4 1995/05/08 23:50:41 jtc Exp $")
+
+DEFINE_DBL_MIN
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%ecx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+ENTRY(__atan)
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ fldl 4(%esp)
+ fld1
+ fpatan
+ DBL_CHECK_FORCE_UFLOW
+ ret
+END (__atan)
+weak_alias (__atan, atan)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_atanf.S b/REORG.TODO/sysdeps/i386/fpu/s_atanf.S
new file mode 100644
index 0000000000..0589c1135e
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_atanf.S
@@ -0,0 +1,30 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+RCSID("$NetBSD: s_atanf.S,v 1.3 1995/05/08 23:51:33 jtc Exp $")
+
+DEFINE_FLT_MIN
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%ecx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+ENTRY(__atanf)
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ flds 4(%esp)
+ fld1
+ fpatan
+ FLT_CHECK_FORCE_UFLOW
+ ret
+END (__atanf)
+weak_alias (__atanf, atanf)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_atanl.c b/REORG.TODO/sysdeps/i386/fpu/s_atanl.c
new file mode 100644
index 0000000000..b7dba88aad
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_atanl.c
@@ -0,0 +1,22 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <math_private.h>
+
+long double
+__atanl (long double x)
+{
+ long double res;
+
+ asm ("fld1\n"
+ "fpatan"
+ : "=t" (res) : "0" (x));
+
+ return res;
+}
+
+weak_alias (__atanl, atanl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_cbrt.S b/REORG.TODO/sysdeps/i386/fpu/s_cbrt.S
new file mode 100644
index 0000000000..7f01659eae
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_cbrt.S
@@ -0,0 +1,200 @@
+/* Compute cubic root of double value.
+ Copyright (C) 1997-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Dirk Alboth <dirka@uni-paderborn.de> and
+ 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>
+
+ .section .rodata
+
+ .align ALIGNARG(4)
+ .type f7,@object
+f7: .double -0.145263899385486377
+ ASM_SIZE_DIRECTIVE(f7)
+ .type f6,@object
+f6: .double 0.784932344976639262
+ ASM_SIZE_DIRECTIVE(f6)
+ .type f5,@object
+f5: .double -1.83469277483613086
+ ASM_SIZE_DIRECTIVE(f5)
+ .type f4,@object
+f4: .double 2.44693122563534430
+ ASM_SIZE_DIRECTIVE(f4)
+ .type f3,@object
+f3: .double -2.11499494167371287
+ ASM_SIZE_DIRECTIVE(f3)
+ .type f2,@object
+f2: .double 1.50819193781584896
+ ASM_SIZE_DIRECTIVE(f2)
+ .type f1,@object
+f1: .double 0.354895765043919860
+ ASM_SIZE_DIRECTIVE(f1)
+
+#define CBRT2 1.2599210498948731648
+#define ONE_CBRT2 0.793700525984099737355196796584
+#define SQR_CBRT2 1.5874010519681994748
+#define ONE_SQR_CBRT2 0.629960524947436582364439673883
+
+ .type factor,@object
+factor: .double ONE_SQR_CBRT2
+ .double ONE_CBRT2
+ .double 1.0
+ .double CBRT2
+ .double SQR_CBRT2
+ ASM_SIZE_DIRECTIVE(factor)
+
+ .type two54,@object
+two54: .byte 0, 0, 0, 0, 0, 0, 0x50, 0x43
+ ASM_SIZE_DIRECTIVE(two54)
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%ebx)
+#define MOX(op,x) op##@GOTOFF(%ebx,x,1)
+#else
+#define MO(op) op
+#define MOX(op,x) op(x)
+#endif
+
+ .text
+ENTRY(__cbrt)
+ movl 4(%esp), %ecx
+ movl 8(%esp), %eax
+ movl %eax, %edx
+ andl $0x7fffffff, %eax
+ orl %eax, %ecx
+ jz 1f
+ xorl %ecx, %ecx
+ cmpl $0x7ff00000, %eax
+ jae 1f
+
+#ifdef PIC
+ pushl %ebx
+ cfi_adjust_cfa_offset (4)
+ cfi_rel_offset (ebx, 0)
+ LOAD_PIC_REG (bx)
+#endif
+
+ cmpl $0x00100000, %eax
+ jae 2f
+
+#ifdef PIC
+ fldl 8(%esp)
+#else
+ fldl 4(%esp)
+#endif
+ fmull MO(two54)
+ movl $-54, %ecx
+#ifdef PIC
+ fstpl 8(%esp)
+ movl 12(%esp), %eax
+#else
+ fstpl 4(%esp)
+ movl 8(%esp), %eax
+#endif
+ movl %eax, %edx
+ andl $0x7fffffff, %eax
+
+2: shrl $20, %eax
+ andl $0x800fffff, %edx
+ subl $1022, %eax
+ orl $0x3fe00000, %edx
+ addl %eax, %ecx
+#ifdef PIC
+ movl %edx, 12(%esp)
+
+ fldl 8(%esp) /* xm */
+#else
+ movl %edx, 8(%esp)
+
+ fldl 4(%esp) /* xm */
+#endif
+ fabs
+
+ /* The following code has two tracks:
+ a) compute the normalized cbrt value
+ b) compute xe/3 and xe%3
+ The right track computes the value for b) and this is done
+ in an optimized way by avoiding division.
+
+ But why two tracks at all? Very easy: efficiency. Some FP
+ instruction can overlap with a certain amount of integer (and
+ FP) instructions. So we get (except for the imull) all
+ instructions for free. */
+
+ fld %st(0) /* xm : xm */
+
+ fmull MO(f7) /* f7*xm : xm */
+ movl $1431655766, %eax
+ faddl MO(f6) /* f6+f7*xm : xm */
+ imull %ecx
+ fmul %st(1) /* (f6+f7*xm)*xm : xm */
+ movl %ecx, %eax
+ faddl MO(f5) /* f5+(f6+f7*xm)*xm : xm */
+ sarl $31, %eax
+ fmul %st(1) /* (f5+(f6+f7*xm)*xm)*xm : xm */
+ subl %eax, %edx
+ faddl MO(f4) /* f4+(f5+(f6+f7*xm)*xm)*xm : xm */
+ fmul %st(1) /* (f4+(f5+(f6+f7*xm)*xm)*xm)*xm : xm */
+ faddl MO(f3) /* f3+(f4+(f5+(f6+f7*xm)*xm)*xm)*xm : xm */
+ fmul %st(1) /* (f3+(f4+(f5+(f6+f7*xm)*xm)*xm)*xm)*xm : xm */
+ faddl MO(f2) /* f2+(f3+(f4+(f5+(f6+f7*xm)*xm)*xm)*xm)*xm : xm */
+ fmul %st(1) /* (f2+(f3+(f4+(f5+(f6+f7*xm)*xm)*xm)*xm)*xm)*xm : xm */
+ faddl MO(f1) /* u:=f1+(f2+(f3+(f4+(f5+(f6+f7*xm)*xm)*xm)*xm)*xm)*xm : xm */
+
+ fld %st /* u : u : xm */
+ fmul %st(1) /* u*u : u : xm */
+ fld %st(2) /* xm : u*u : u : xm */
+ fadd %st /* 2*xm : u*u : u : xm */
+ fxch %st(1) /* u*u : 2*xm : u : xm */
+ fmul %st(2) /* t2:=u*u*u : 2*xm : u : xm */
+ movl %edx, %eax
+ fadd %st, %st(1) /* t2 : t2+2*xm : u : xm */
+ leal (%edx,%edx,2),%edx
+ fadd %st(0) /* 2*t2 : t2+2*xm : u : xm */
+ subl %edx, %ecx
+ faddp %st, %st(3) /* t2+2*xm : u : 2*t2+xm */
+ shll $3, %ecx
+ fmulp /* u*(t2+2*xm) : 2*t2+xm */
+ fdivp %st, %st(1) /* u*(t2+2*xm)/(2*t2+xm) */
+ fmull MOX(16+factor,%ecx) /* u*(t2+2*xm)/(2*t2+xm)*FACT */
+ pushl %eax
+ cfi_adjust_cfa_offset (4)
+ fildl (%esp) /* xe/3 : u*(t2+2*xm)/(2*t2+xm)*FACT */
+ fxch /* u*(t2+2*xm)/(2*t2+xm)*FACT : xe/3 */
+ fscale /* u*(t2+2*xm)/(2*t2+xm)*FACT*2^xe/3 */
+ popl %edx
+ cfi_adjust_cfa_offset (-4)
+#ifdef PIC
+ movl 12(%esp), %eax
+ popl %ebx
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (ebx)
+#else
+ movl 8(%esp), %eax
+#endif
+ testl %eax, %eax
+ fstp %st(1)
+ jns 4f
+ fchs
+4: ret
+
+ /* Return the argument. */
+1: fldl 4(%esp)
+ ret
+END(__cbrt)
+weak_alias (__cbrt, cbrt)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_cbrtf.S b/REORG.TODO/sysdeps/i386/fpu/s_cbrtf.S
new file mode 100644
index 0000000000..645d24372d
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_cbrtf.S
@@ -0,0 +1,177 @@
+/* Compute cubic root of float value.
+ Copyright (C) 1997-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Dirk Alboth <dirka@uni-paderborn.de> and
+ 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>
+
+ .section .rodata
+
+ .align ALIGNARG(4)
+ .type f3,@object
+f3: .double 0.191502161678719066
+ ASM_SIZE_DIRECTIVE(f3)
+ .type f2,@object
+f2: .double 0.697570460207922770
+ ASM_SIZE_DIRECTIVE(f2)
+ .type f1,@object
+f1: .double 0.492659620528969547
+ ASM_SIZE_DIRECTIVE(f1)
+
+#define CBRT2 1.2599210498948731648
+#define ONE_CBRT2 0.793700525984099737355196796584
+#define SQR_CBRT2 1.5874010519681994748
+#define ONE_SQR_CBRT2 0.629960524947436582364439673883
+
+ .type factor,@object
+ .align ALIGNARG(4)
+factor: .double ONE_SQR_CBRT2
+ .double ONE_CBRT2
+ .double 1.0
+ .double CBRT2
+ .double SQR_CBRT2
+ ASM_SIZE_DIRECTIVE(factor)
+
+ .type two25,@object
+two25: .byte 0, 0, 0, 0x4c
+ ASM_SIZE_DIRECTIVE(two25)
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%ebx)
+#define MOX(op,x) op##@GOTOFF(%ebx,x,1)
+#else
+#define MO(op) op
+#define MOX(op,x) op(x)
+#endif
+
+ .text
+ENTRY(__cbrtf)
+ movl 4(%esp), %eax
+ xorl %ecx, %ecx
+ movl %eax, %edx
+ andl $0x7fffffff, %eax
+ jz 1f
+ cmpl $0x7f800000, %eax
+ jae 1f
+
+#ifdef PIC
+ pushl %ebx
+ cfi_adjust_cfa_offset (4)
+ cfi_rel_offset (ebx, 0)
+ LOAD_PIC_REG (bx)
+#endif
+
+ cmpl $0x00800000, %eax
+ jae 2f
+
+#ifdef PIC
+ flds 8(%esp)
+#else
+ flds 4(%esp)
+#endif
+ fmuls MO(two25)
+ movl $-25, %ecx
+#ifdef PIC
+ fstps 8(%esp)
+ movl 8(%esp), %eax
+#else
+ fstps 4(%esp)
+ movl 4(%esp), %eax
+#endif
+ movl %eax, %edx
+ andl $0x7fffffff, %eax
+
+2: shrl $23, %eax
+ andl $0x807fffff, %edx
+ subl $126, %eax
+ orl $0x3f000000, %edx
+ addl %eax, %ecx
+#ifdef PIC
+ movl %edx, 8(%esp)
+
+ flds 8(%esp) /* xm */
+#else
+ movl %edx, 4(%esp)
+
+ flds 4(%esp) /* xm */
+#endif
+ fabs
+
+ /* The following code has two tracks:
+ a) compute the normalized cbrt value
+ b) compute xe/3 and xe%3
+ The right track computes the value for b) and this is done
+ in an optimized way by avoiding division.
+
+ But why two tracks at all? Very easy: efficiency. Some FP
+ instruction can overlap with a certain amount of integer (and
+ FP) instructions. So we get (except for the imull) all
+ instructions for free. */
+
+ fld %st(0) /* xm : xm */
+ fmull MO(f3) /* f3*xm : xm */
+ movl $1431655766, %eax
+ fsubrl MO(f2) /* f2-f3*xm : xm */
+ imull %ecx
+ fmul %st(1) /* (f2-f3*xm)*xm : xm */
+ movl %ecx, %eax
+ faddl MO(f1) /* u:=f1+(f2-f3*xm)*xm : xm */
+ sarl $31, %eax
+ fld %st /* u : u : xm */
+ subl %eax, %edx
+ fmul %st(1) /* u*u : u : xm */
+ fld %st(2) /* xm : u*u : u : xm */
+ fadd %st /* 2*xm : u*u : u : xm */
+ fxch %st(1) /* u*u : 2*xm : u : xm */
+ fmul %st(2) /* t2:=u*u*u : 2*xm : u : xm */
+ movl %edx, %eax
+ fadd %st, %st(1) /* t2 : t2+2*xm : u : xm */
+ leal (%edx,%edx,2),%edx
+ fadd %st(0) /* 2*t2 : t2+2*xm : u : xm */
+ subl %edx, %ecx
+ faddp %st, %st(3) /* t2+2*xm : u : 2*t2+xm */
+ shll $3, %ecx
+ fmulp /* u*(t2+2*xm) : 2*t2+xm */
+ fdivp %st, %st(1) /* u*(t2+2*xm)/(2*t2+xm) */
+ fmull MOX(16+factor,%ecx) /* u*(t2+2*xm)/(2*t2+xm)*FACT */
+ pushl %eax
+ cfi_adjust_cfa_offset (4)
+ fildl (%esp) /* xe/3 : u*(t2+2*xm)/(2*t2+xm)*FACT */
+ fxch /* u*(t2+2*xm)/(2*t2+xm)*FACT : xe/3 */
+ fscale /* u*(t2+2*xm)/(2*t2+xm)*FACT*2^xe/3 */
+ popl %edx
+ cfi_adjust_cfa_offset (-4)
+#ifdef PIC
+ movl 8(%esp), %eax
+ popl %ebx
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (ebx)
+#else
+ movl 4(%esp), %eax
+#endif
+ testl %eax, %eax
+ fstp %st(1)
+ jns 4f
+ fchs
+4: ret
+
+ /* Return the argument. */
+1: flds 4(%esp)
+ ret
+END(__cbrtf)
+weak_alias (__cbrtf, cbrtf)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_cbrtl.S b/REORG.TODO/sysdeps/i386/fpu/s_cbrtl.S
new file mode 100644
index 0000000000..e4a72d29c6
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_cbrtl.S
@@ -0,0 +1,229 @@
+/* Compute cubic root of long double value.
+ Copyright (C) 1997-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Dirk Alboth <dirka@uni-paderborn.de> and
+ 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>
+
+ .section .rodata
+
+ .align ALIGNARG(4)
+ .type f8,@object
+f8: .tfloat 0.161617097923756032
+ ASM_SIZE_DIRECTIVE(f8)
+ .align ALIGNARG(4)
+ .type f7,@object
+f7: .tfloat -0.988553671195413709
+ ASM_SIZE_DIRECTIVE(f7)
+ .align ALIGNARG(4)
+ .type f6,@object
+f6: .tfloat 2.65298938441952296
+ ASM_SIZE_DIRECTIVE(f6)
+ .align ALIGNARG(4)
+ .type f5,@object
+f5: .tfloat -4.11151425200350531
+ ASM_SIZE_DIRECTIVE(f5)
+ .align ALIGNARG(4)
+ .type f4,@object
+f4: .tfloat 4.09559907378707839
+ ASM_SIZE_DIRECTIVE(f4)
+ .align ALIGNARG(4)
+ .type f3,@object
+f3: .tfloat -2.82414939754975962
+ ASM_SIZE_DIRECTIVE(f3)
+ .align ALIGNARG(4)
+ .type f2,@object
+f2: .tfloat 1.67595307700780102
+ ASM_SIZE_DIRECTIVE(f2)
+ .align ALIGNARG(4)
+ .type f1,@object
+f1: .tfloat 0.338058687610520237
+ ASM_SIZE_DIRECTIVE(f1)
+
+#define CBRT2 1.2599210498948731648
+#define ONE_CBRT2 0.793700525984099737355196796584
+#define SQR_CBRT2 1.5874010519681994748
+#define ONE_SQR_CBRT2 0.629960524947436582364439673883
+
+ /* We make the entries in the following table all 16 bytes
+ wide to avoid having to implement a multiplication by 10. */
+ .type factor,@object
+ .align ALIGNARG(4)
+factor: .tfloat ONE_SQR_CBRT2
+ .byte 0, 0, 0, 0, 0, 0
+ .tfloat ONE_CBRT2
+ .byte 0, 0, 0, 0, 0, 0
+ .tfloat 1.0
+ .byte 0, 0, 0, 0, 0, 0
+ .tfloat CBRT2
+ .byte 0, 0, 0, 0, 0, 0
+ .tfloat SQR_CBRT2
+ ASM_SIZE_DIRECTIVE(factor)
+
+ .type two64,@object
+ .align ALIGNARG(4)
+two64: .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x43
+ ASM_SIZE_DIRECTIVE(two64)
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%ebx)
+#define MOX(op,x) op##@GOTOFF(%ebx,x,1)
+#else
+#define MO(op) op
+#define MOX(op,x) op(x)
+#endif
+
+ .text
+ENTRY(__cbrtl)
+ movl 4(%esp), %ecx
+ movl 12(%esp), %eax
+ orl 8(%esp), %ecx
+ movl %eax, %edx
+ andl $0x7fff, %eax
+ orl %eax, %ecx
+ jz 1f
+ xorl %ecx, %ecx
+ cmpl $0x7fff, %eax
+ je 1f
+
+#ifdef PIC
+ pushl %ebx
+ cfi_adjust_cfa_offset (4)
+ cfi_rel_offset (ebx, 0)
+ LOAD_PIC_REG (bx)
+#endif
+
+ cmpl $0, %eax
+ jne 2f
+
+#ifdef PIC
+ fldt 8(%esp)
+#else
+ fldt 4(%esp)
+#endif
+ fmull MO(two64)
+ movl $-64, %ecx
+#ifdef PIC
+ fstpt 8(%esp)
+ movl 16(%esp), %eax
+#else
+ fstpt 4(%esp)
+ movl 12(%esp), %eax
+#endif
+ movl %eax, %edx
+ andl $0x7fff, %eax
+
+2: andl $0x8000, %edx
+ subl $16382, %eax
+ orl $0x3ffe, %edx
+ addl %eax, %ecx
+#ifdef PIC
+ movl %edx, 16(%esp)
+
+ fldt 8(%esp) /* xm */
+#else
+ movl %edx, 12(%esp)
+
+ fldt 4(%esp) /* xm */
+#endif
+ fabs
+
+ /* The following code has two tracks:
+ a) compute the normalized cbrt value
+ b) compute xe/3 and xe%3
+ The right track computes the value for b) and this is done
+ in an optimized way by avoiding division.
+
+ But why two tracks at all? Very easy: efficiency. Some FP
+ instruction can overlap with a certain amount of integer (and
+ FP) instructions. So we get (except for the imull) all
+ instructions for free. */
+
+ fldt MO(f8) /* f8 : xm */
+ fmul %st(1) /* f8*xm : xm */
+
+ fldt MO(f7)
+ faddp /* f7+f8*xm : xm */
+ fmul %st(1) /* (f7+f8*xm)*xm : xm */
+ movl $1431655766, %eax
+ fldt MO(f6)
+ faddp /* f6+(f7+f8*xm)*xm : xm */
+ imull %ecx
+ fmul %st(1) /* (f6+(f7+f8*xm)*xm)*xm : xm */
+ movl %ecx, %eax
+ fldt MO(f5)
+ faddp /* f5+(f6+(f7+f8*xm)*xm)*xm : xm */
+ sarl $31, %eax
+ fmul %st(1) /* (f5+(f6+(f7+f8*xm)*xm)*xm)*xm : xm */
+ subl %eax, %edx
+ fldt MO(f4)
+ faddp /* f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm : xm */
+ fmul %st(1) /* (f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm)*xm : xm */
+ fldt MO(f3)
+ faddp /* f3+(f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm)*xm : xm */
+ fmul %st(1) /* (f3+(f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm)*xm)*xm : xm */
+ fldt MO(f2)
+ faddp /* f2+(f3+(f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm)*xm)*xm : xm */
+ fmul %st(1) /* (f2+(f3+(f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm)*xm)*xm)*xm : xm */
+ fldt MO(f1)
+ faddp /* u:=f1+(f2+(f3+(f4+(f5+(f6+(f7+f8*xm)*xm)*xm)*xm)*xm)*xm)*xm : xm */
+
+ fld %st /* u : u : xm */
+ fmul %st(1) /* u*u : u : xm */
+ fld %st(2) /* xm : u*u : u : xm */
+ fadd %st /* 2*xm : u*u : u : xm */
+ fxch %st(1) /* u*u : 2*xm : u : xm */
+ fmul %st(2) /* t2:=u*u*u : 2*xm : u : xm */
+ movl %edx, %eax
+ fadd %st, %st(1) /* t2 : t2+2*xm : u : xm */
+ leal (%edx,%edx,2),%edx
+ fadd %st(0) /* 2*t2 : t2+2*xm : u : xm */
+ subl %edx, %ecx
+ faddp %st, %st(3) /* t2+2*xm : u : 2*t2+xm */
+ shll $4, %ecx
+ fmulp /* u*(t2+2*xm) : 2*t2+xm */
+ fdivp %st, %st(1) /* u*(t2+2*xm)/(2*t2+xm) */
+ fldt MOX(32+factor,%ecx)
+ fmulp /* u*(t2+2*xm)/(2*t2+xm)*FACT */
+ pushl %eax
+ cfi_adjust_cfa_offset (4)
+ fildl (%esp) /* xe/3 : u*(t2+2*xm)/(2*t2+xm)*FACT */
+ fxch /* u*(t2+2*xm)/(2*t2+xm)*FACT : xe/3 */
+ fscale /* u*(t2+2*xm)/(2*t2+xm)*FACT*2^xe/3 */
+ popl %edx
+ cfi_adjust_cfa_offset (-4)
+#ifdef PIC
+ movl 16(%esp), %eax
+ popl %ebx
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (ebx)
+#else
+ movl 12(%esp), %eax
+#endif
+ testl $0x8000, %eax
+ fstp %st(1)
+ jz 4f
+ fchs
+4: ret
+
+ /* Return the argument. */
+1: fldt 4(%esp)
+ fadd %st
+ ret
+END(__cbrtl)
+weak_alias (__cbrtl, cbrtl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_ceil.S b/REORG.TODO/sysdeps/i386/fpu/s_ceil.S
new file mode 100644
index 0000000000..1226bb2f87
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_ceil.S
@@ -0,0 +1,34 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_ceil.S,v 1.4 1995/05/08 23:52:13 jtc Exp $")
+
+ENTRY(__ceil)
+ fldl 4(%esp)
+ subl $32,%esp
+ cfi_adjust_cfa_offset (32)
+
+ fnstenv 4(%esp) /* store fpu environment */
+
+ /* We use here %edx although only the low 1 bits are defined.
+ But none of the operations should care and they are faster
+ than the 16 bit operations. */
+ movl $0x0800,%edx /* round towards +oo */
+ orl 4(%esp),%edx
+ andl $0xfbff,%edx
+ movl %edx,(%esp)
+ fldcw (%esp) /* load modified control word */
+
+ frndint /* round */
+
+ fldenv 4(%esp) /* restore original environment */
+
+ addl $32,%esp
+ cfi_adjust_cfa_offset (-32)
+ ret
+END (__ceil)
+weak_alias (__ceil, ceil)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_ceilf.S b/REORG.TODO/sysdeps/i386/fpu/s_ceilf.S
new file mode 100644
index 0000000000..d345c0973b
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_ceilf.S
@@ -0,0 +1,34 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_ceilf.S,v 1.3 1995/05/08 23:52:44 jtc Exp $")
+
+ENTRY(__ceilf)
+ flds 4(%esp)
+ subl $32,%esp
+ cfi_adjust_cfa_offset (32)
+
+ fnstenv 4(%esp) /* store fpu environment */
+
+ /* We use here %edx although only the low 1 bits are defined.
+ But none of the operations should care and they are faster
+ than the 16 bit operations. */
+ movl $0x0800,%edx /* round towards +oo */
+ orl 4(%esp),%edx
+ andl $0xfbff,%edx
+ movl %edx,(%esp)
+ fldcw (%esp) /* load modified control word */
+
+ frndint /* round */
+
+ fldenv 4(%esp) /* restore original environment */
+
+ addl $32,%esp
+ cfi_adjust_cfa_offset (-32)
+ ret
+END (__ceilf)
+weak_alias (__ceilf, ceilf)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_ceill.S b/REORG.TODO/sysdeps/i386/fpu/s_ceill.S
new file mode 100644
index 0000000000..7c08f43b24
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_ceill.S
@@ -0,0 +1,40 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__ceill)
+ fldt 4(%esp)
+ subl $32,%esp
+ cfi_adjust_cfa_offset (32)
+
+ fnstenv 4(%esp) /* store fpu environment */
+
+ /* We use here %edx although only the low 1 bits are defined.
+ But none of the operations should care and they are faster
+ than the 16 bit operations. */
+ movl $0x0800,%edx /* round towards +oo */
+ orl 4(%esp),%edx
+ andl $0xfbff,%edx
+ movl %edx,(%esp)
+ fldcw (%esp) /* load modified control word */
+
+ frndint /* round */
+
+ /* Preserve "invalid" exceptions from sNaN input. */
+ fnstsw
+ andl $0x1, %eax
+ orl %eax, 8(%esp)
+
+ fldenv 4(%esp) /* restore original environment */
+
+ addl $32,%esp
+ cfi_adjust_cfa_offset (-32)
+ ret
+END (__ceill)
+weak_alias (__ceill, ceill)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_copysign.S b/REORG.TODO/sysdeps/i386/fpu/s_copysign.S
new file mode 100644
index 0000000000..2520a94427
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_copysign.S
@@ -0,0 +1,20 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_copysign.S,v 1.4 1995/05/08 23:53:02 jtc Exp $")
+
+ENTRY(__copysign)
+ movl 16(%esp),%edx
+ movl 8(%esp),%eax
+ andl $0x80000000,%edx
+ andl $0x7fffffff,%eax
+ orl %edx,%eax
+ movl %eax,8(%esp)
+ fldl 4(%esp)
+ ret
+END (__copysign)
+weak_alias (__copysign, copysign)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_copysignf.S b/REORG.TODO/sysdeps/i386/fpu/s_copysignf.S
new file mode 100644
index 0000000000..57b1a6f119
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_copysignf.S
@@ -0,0 +1,20 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_copysignf.S,v 1.3 1995/05/08 23:53:25 jtc Exp $")
+
+ENTRY(__copysignf)
+ movl 8(%esp),%edx
+ movl 4(%esp),%eax
+ andl $0x80000000,%edx
+ andl $0x7fffffff,%eax
+ orl %edx,%eax
+ movl %eax,4(%esp)
+ flds 4(%esp)
+ ret
+END (__copysignf)
+weak_alias (__copysignf, copysignf)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_copysignl.S b/REORG.TODO/sysdeps/i386/fpu/s_copysignl.S
new file mode 100644
index 0000000000..2163e7b014
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_copysignl.S
@@ -0,0 +1,21 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__copysignl)
+ movl 24(%esp),%edx
+ movl 12(%esp),%eax
+ andl $0x8000,%edx
+ andl $0x7fff,%eax
+ orl %edx,%eax
+ movl %eax,12(%esp)
+ fldt 4(%esp)
+ ret
+END (__copysignl)
+weak_alias (__copysignl, copysignl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_expm1.S b/REORG.TODO/sysdeps/i386/fpu/s_expm1.S
new file mode 100644
index 0000000000..59fded2d5a
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_expm1.S
@@ -0,0 +1,113 @@
+/* ix87 specific implementation of exp(x)-1.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+ Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>.
+ Corrections by H.J. Lu (hjl@gnu.ai.mit.edu), 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/>. */
+
+ /* Using: e^x - 1 = 2^(x * log2(e)) - 1 */
+
+#include <sysdep.h>
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+ .section .rodata
+
+ .align ALIGNARG(4)
+ .type minus1,@object
+minus1: .double -1.0
+ ASM_SIZE_DIRECTIVE(minus1)
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ .type l2e,@object
+l2e: .tfloat 1.442695040888963407359924681002
+ ASM_SIZE_DIRECTIVE(l2e)
+
+DEFINE_DBL_MIN
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+ .text
+ENTRY(__expm1)
+ movzwl 4+6(%esp), %eax
+ xorb $0x80, %ah // invert sign bit (now 1 is "positive")
+ cmpl $0xc086, %eax // is num >= 704?
+ jae HIDDEN_JUMPTARGET (__exp)
+
+ fldl 4(%esp) // x
+ fxam // Is NaN, +-Inf or +-0?
+ xorb $0x80, %ah
+ cmpl $0xc043, %eax // is num <= -38.0?
+ fstsw %ax
+ movb $0x45, %ch
+ jb 4f
+
+ // Below -38.0 (may be -NaN or -Inf).
+ andb %ah, %ch
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ cmpb $0x01, %ch
+ je 5f // If -NaN, jump.
+ jmp 2f // -large, possibly -Inf.
+
+4: // In range -38.0 to 704.0 (may be +-0 but not NaN or +-Inf).
+ andb %ah, %ch
+ cmpb $0x40, %ch
+ je 3f // If +-0, jump.
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+
+5: fldt MO(l2e) // log2(e) : x
+ fmulp // log2(e)*x
+ fld %st // log2(e)*x : log2(e)*x
+ // Set round-to-nearest temporarily.
+ subl $8, %esp
+ cfi_adjust_cfa_offset (8)
+ fstcw 4(%esp)
+ movl $0xf3ff, %ecx
+ andl 4(%esp), %ecx
+ movl %ecx, (%esp)
+ fldcw (%esp)
+ frndint // int(log2(e)*x) : log2(e)*x
+ fldcw 4(%esp)
+ addl $8, %esp
+ cfi_adjust_cfa_offset (-8)
+ fsubr %st, %st(1) // int(log2(e)*x) : fract(log2(e)*x)
+ fxch // fract(log2(e)*x) : int(log2(e)*x)
+ f2xm1 // 2^fract(log2(e)*x)-1 : int(log2(e)*x)
+ fscale // 2^(log2(e)*x)-2^int(log2(e)*x) : int(log2(e)*x)
+ fxch // int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+ fldl MO(one) // 1 : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+ fscale // 2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+ fsubrl MO(one) // 1-2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+ fstp %st(1) // 1-2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+ fsubrp %st, %st(1) // 2^(log2(e)*x)
+ DBL_CHECK_FORCE_UFLOW
+ ret
+
+2: fstp %st
+ fldl MO(minus1) // Set result to -1.0.
+3: ret
+END(__expm1)
+weak_alias (__expm1, expm1)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_expm1f.S b/REORG.TODO/sysdeps/i386/fpu/s_expm1f.S
new file mode 100644
index 0000000000..4f0b2e7832
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_expm1f.S
@@ -0,0 +1,113 @@
+/* ix87 specific implementation of exp(x)-1.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+ Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>.
+ Corrections by H.J. Lu (hjl@gnu.ai.mit.edu), 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/>. */
+
+ /* Using: e^x - 1 = 2^(x * log2(e)) - 1 */
+
+#include <sysdep.h>
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+ .section .rodata
+
+ .align ALIGNARG(4)
+ .type minus1,@object
+minus1: .double -1.0
+ ASM_SIZE_DIRECTIVE(minus1)
+ .type one,@object
+one: .double 1.0
+ ASM_SIZE_DIRECTIVE(one)
+ .type l2e,@object
+l2e: .tfloat 1.442695040888963407359924681002
+ ASM_SIZE_DIRECTIVE(l2e)
+
+DEFINE_FLT_MIN
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+ .text
+ENTRY(__expm1f)
+ movzwl 4+2(%esp), %eax
+ xorb $0x80, %ah // invert sign bit (now 1 is "positive")
+ cmpl $0xc2b1, %eax // is num >= 88.5?
+ jae HIDDEN_JUMPTARGET (__expf)
+
+ flds 4(%esp) // x
+ fxam // Is NaN, +-Inf or +-0?
+ xorb $0x80, %ah
+ cmpl $0xc190, %eax // is num <= -18.0?
+ fstsw %ax
+ movb $0x45, %ch
+ jb 4f
+
+ // Below -18.0 (may be -NaN or -Inf).
+ andb %ah, %ch
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ cmpb $0x01, %ch
+ je 5f // If -NaN, jump.
+ jmp 2f // -large, possibly -Inf.
+
+4: // In range -18.0 to 88.5 (may be +-0 but not NaN or +-Inf).
+ andb %ah, %ch
+ cmpb $0x40, %ch
+ je 3f // If +-0, jump.
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+
+5: fldt MO(l2e) // log2(e) : x
+ fmulp // log2(e)*x
+ fld %st // log2(e)*x : log2(e)*x
+ // Set round-to-nearest temporarily.
+ subl $8, %esp
+ cfi_adjust_cfa_offset (8)
+ fstcw 4(%esp)
+ movl $0xf3ff, %ecx
+ andl 4(%esp), %ecx
+ movl %ecx, (%esp)
+ fldcw (%esp)
+ frndint // int(log2(e)*x) : log2(e)*x
+ fldcw 4(%esp)
+ addl $8, %esp
+ cfi_adjust_cfa_offset (-8)
+ fsubr %st, %st(1) // int(log2(e)*x) : fract(log2(e)*x)
+ fxch // fract(log2(e)*x) : int(log2(e)*x)
+ f2xm1 // 2^fract(log2(e)*x)-1 : int(log2(e)*x)
+ fscale // 2^(log2(e)*x)-2^int(log2(e)*x) : int(log2(e)*x)
+ fxch // int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+ fldl MO(one) // 1 : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+ fscale // 2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+ fsubrl MO(one) // 1-2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+ fstp %st(1) // 1-2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+ fsubrp %st, %st(1) // 2^(log2(e)*x)
+ FLT_CHECK_FORCE_UFLOW
+ ret
+
+2: fstp %st
+ fldl MO(minus1) // Set result to -1.0.
+3: ret
+END(__expm1f)
+weak_alias (__expm1f, expm1f)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_expm1l.S b/REORG.TODO/sysdeps/i386/fpu/s_expm1l.S
new file mode 100644
index 0000000000..7fbd99b0db
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_expm1l.S
@@ -0,0 +1,2 @@
+#define USE_AS_EXPM1L
+#include <e_expl.S>
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_fabs.S b/REORG.TODO/sysdeps/i386/fpu/s_fabs.S
new file mode 100644
index 0000000000..23ae9dccb9
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_fabs.S
@@ -0,0 +1,9 @@
+#include <sysdep.h>
+
+ .text
+ENTRY(__fabs)
+ fldl 4(%esp)
+ fabs
+ ret
+END(__fabs)
+weak_alias (__fabs, fabs)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_fabsf.S b/REORG.TODO/sysdeps/i386/fpu/s_fabsf.S
new file mode 100644
index 0000000000..c0407a8839
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_fabsf.S
@@ -0,0 +1,9 @@
+#include <sysdep.h>
+
+ .text
+ENTRY(__fabsf)
+ flds 4(%esp)
+ fabs
+ ret
+END(__fabsf)
+weak_alias (__fabsf, fabsf)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_fabsl.S b/REORG.TODO/sysdeps/i386/fpu/s_fabsl.S
new file mode 100644
index 0000000000..a12a3e050b
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_fabsl.S
@@ -0,0 +1,9 @@
+#include <sysdep.h>
+
+ .text
+ENTRY(__fabsl)
+ fldt 4(%esp)
+ fabs
+ ret
+END(__fabsl)
+weak_alias (__fabsl, fabsl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_fdim.c b/REORG.TODO/sysdeps/i386/fpu/s_fdim.c
new file mode 100644
index 0000000000..6243c62998
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_fdim.c
@@ -0,0 +1,50 @@
+/* Return positive difference between arguments. i386 version.
+ Copyright (C) 1997-2017 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <fpu_control.h>
+#include <math.h>
+#include <math_private.h>
+
+double
+__fdim (double x, double y)
+{
+ if (islessequal (x, y))
+ return 0.0;
+
+ /* To avoid double rounding, set double precision for the
+ subtraction. math_narrow_eval is still needed to eliminate
+ excess range in the case of overflow. If the result of the
+ subtraction is in the subnormal range for double, it is exact, so
+ no issues of double rounding for subnormals arise. */
+ fpu_control_t cw, cw_double;
+ _FPU_GETCW (cw);
+ cw_double = (cw & ~_FPU_EXTENDED) | _FPU_DOUBLE;
+ _FPU_SETCW (cw_double);
+ double r = math_narrow_eval (x - y);
+ _FPU_SETCW (cw);
+ if (isinf (r) && !isinf (x) && !isinf (y))
+ __set_errno (ERANGE);
+
+ return r;
+}
+weak_alias (__fdim, fdim)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__fdim, __fdiml)
+weak_alias (__fdim, fdiml)
+#endif
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_finite.S b/REORG.TODO/sysdeps/i386/fpu/s_finite.S
new file mode 100644
index 0000000000..1ae4aed451
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_finite.S
@@ -0,0 +1,17 @@
+/*
+ * Written by Joe Keane <jgk@jgk.org>.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(__finite)
+ movl 8(%esp),%eax
+ movl $0xFFEFFFFF,%ecx
+ subl %eax,%ecx
+ xorl %ecx,%eax
+ shrl $31, %eax
+ ret
+END (__finite)
+weak_alias (__finite, finite)
+hidden_def (__finite)
+
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_finitef.S b/REORG.TODO/sysdeps/i386/fpu/s_finitef.S
new file mode 100644
index 0000000000..69e72facff
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_finitef.S
@@ -0,0 +1,16 @@
+/*
+ * Written by Joe Keane <jgk@jgk.org>.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(__finitef)
+ movl 4(%esp),%eax
+ movl $0xFF7FFFFF,%ecx
+ subl %eax,%ecx
+ xorl %ecx,%eax
+ shrl $31,%eax
+ ret
+END (__finitef)
+weak_alias (__finitef, finitef)
+hidden_def (__finitef)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_finitel.S b/REORG.TODO/sysdeps/i386/fpu/s_finitel.S
new file mode 100644
index 0000000000..cce90e18fc
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_finitel.S
@@ -0,0 +1,15 @@
+/*
+ * Written by Joe Keane <jgk@jgk.org>.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(__finitel)
+ movl 12(%esp),%eax
+ orl $0xffff8000, %eax
+ incl %eax
+ shrl $31, %eax
+ ret
+END (__finitel)
+weak_alias (__finitel, finitel)
+hidden_def (__finitel)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_floor.S b/REORG.TODO/sysdeps/i386/fpu/s_floor.S
new file mode 100644
index 0000000000..ed837dae40
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_floor.S
@@ -0,0 +1,34 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_floor.S,v 1.4 1995/05/09 00:01:59 jtc Exp $")
+
+ENTRY(__floor)
+ fldl 4(%esp)
+ subl $32,%esp
+ cfi_adjust_cfa_offset (32)
+
+ fnstenv 4(%esp) /* store fpu environment */
+
+ /* We use here %edx although only the low 1 bits are defined.
+ But none of the operations should care and they are faster
+ than the 16 bit operations. */
+ movl $0x400,%edx /* round towards -oo */
+ orl 4(%esp),%edx
+ andl $0xf7ff,%edx
+ movl %edx,(%esp)
+ fldcw (%esp) /* load modified control word */
+
+ frndint /* round */
+
+ fldenv 4(%esp) /* restore original environment */
+
+ addl $32,%esp
+ cfi_adjust_cfa_offset (-32)
+ ret
+END (__floor)
+weak_alias (__floor, floor)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_floorf.S b/REORG.TODO/sysdeps/i386/fpu/s_floorf.S
new file mode 100644
index 0000000000..84b6f7ed99
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_floorf.S
@@ -0,0 +1,34 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_floorf.S,v 1.3 1995/05/09 00:04:32 jtc Exp $")
+
+ENTRY(__floorf)
+ flds 4(%esp)
+ subl $32,%esp
+ cfi_adjust_cfa_offset (32)
+
+ fnstenv 4(%esp) /* store fpu environment */
+
+ /* We use here %edx although only the low 1 bits are defined.
+ But none of the operations should care and they are faster
+ than the 16 bit operations. */
+ movl $0x400,%edx /* round towards -oo */
+ orl 4(%esp),%edx
+ andl $0xf7ff,%edx
+ movl %edx,(%esp)
+ fldcw (%esp) /* load modified control word */
+
+ frndint /* round */
+
+ fldenv 4(%esp) /* restore original environment */
+
+ addl $32,%esp
+ cfi_adjust_cfa_offset (-32)
+ ret
+END (__floorf)
+weak_alias (__floorf, floorf)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_floorl.S b/REORG.TODO/sysdeps/i386/fpu/s_floorl.S
new file mode 100644
index 0000000000..dc74a0c446
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_floorl.S
@@ -0,0 +1,40 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__floorl)
+ fldt 4(%esp)
+ subl $32,%esp
+ cfi_adjust_cfa_offset (32)
+
+ fnstenv 4(%esp) /* store fpu environment */
+
+ /* We use here %edx although only the low 1 bits are defined.
+ But none of the operations should care and they are faster
+ than the 16 bit operations. */
+ movl $0x400,%edx /* round towards -oo */
+ orl 4(%esp),%edx
+ andl $0xf7ff,%edx
+ movl %edx,(%esp)
+ fldcw (%esp) /* load modified control word */
+
+ frndint /* round */
+
+ /* Preserve "invalid" exceptions from sNaN input. */
+ fnstsw
+ andl $0x1, %eax
+ orl %eax, 8(%esp)
+
+ fldenv 4(%esp) /* restore original environment */
+
+ addl $32,%esp
+ cfi_adjust_cfa_offset (-32)
+ ret
+END (__floorl)
+weak_alias (__floorl, floorl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_fmax.S b/REORG.TODO/sysdeps/i386/fpu/s_fmax.S
new file mode 100644
index 0000000000..218dcef421
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_fmax.S
@@ -0,0 +1,43 @@
+/* Compute maximum of two numbers, regarding NaN as missing argument.
+ Copyright (C) 1997-2017 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>
+
+ .text
+ENTRY(__fmax)
+ fldl 12(%esp) // y
+ fxam
+ fnstsw
+ fldl 4(%esp) // y : x
+
+ andb $0x45, %ah
+ cmpb $0x01, %ah
+ je 1f // y == NaN
+
+ fucom %st(1)
+ fnstsw
+ sahf
+ jnc 1f
+
+ fxch %st(1)
+1: fstp %st(1)
+
+ ret
+END(__fmax)
+weak_alias (__fmax, fmax)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_fmaxf.S b/REORG.TODO/sysdeps/i386/fpu/s_fmaxf.S
new file mode 100644
index 0000000000..b7a00cefeb
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_fmaxf.S
@@ -0,0 +1,43 @@
+/* Compute maximum of two numbers, regarding NaN as missing argument.
+ Copyright (C) 1997-2017 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>
+
+ .text
+ENTRY(__fmaxf)
+ flds 8(%esp) // y
+ fxam
+ fnstsw
+ flds 4(%esp) // y : x
+
+ andb $0x45, %ah
+ cmpb $0x01, %ah
+ je 1f // y == NaN
+
+ fucom %st(1)
+ fnstsw
+ sahf
+ jnc 1f
+
+ fxch %st(1)
+1: fstp %st(1)
+
+ ret
+END(__fmaxf)
+weak_alias (__fmaxf, fmaxf)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_fmaxl.S b/REORG.TODO/sysdeps/i386/fpu/s_fmaxl.S
new file mode 100644
index 0000000000..68162921db
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_fmaxl.S
@@ -0,0 +1,71 @@
+/* Compute maximum of two numbers, regarding NaN as missing argument.
+ Copyright (C) 1997-2017 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>
+
+ .text
+ENTRY(__fmaxl)
+ fldt 16(%esp) // y
+ fxam
+ fnstsw
+ fldt 4(%esp) // y : x
+
+ andb $0x45, %ah
+ cmpb $0x01, %ah
+ je 2f // y == NaN
+
+ fxam
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x01, %ah
+ je 3f // x == NaN
+
+ fucom %st(1)
+ fnstsw
+ sahf
+ jnc 1f
+
+ fxch %st(1)
+1: fstp %st(1)
+
+ ret
+
+2: // st(1) is a NaN; st(0) may or may not be.
+ fxam
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x01, %ah
+ je 4f
+ // st(1) is a NaN; st(0) is not. Test if st(1) is signaling.
+ testb $0x40, 23(%esp)
+ jz 4f
+ fstp %st(1)
+ ret
+
+3: // st(0) is a NaN; st(1) is not. Test if st(0) is signaling.
+ testb $0x40, 11(%esp)
+ jz 4f
+ fstp %st(0)
+ ret
+
+4: // Both arguments are NaNs, or one is a signaling NaN.
+ faddp
+ ret
+END(__fmaxl)
+weak_alias (__fmaxl, fmaxl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_fmin.S b/REORG.TODO/sysdeps/i386/fpu/s_fmin.S
new file mode 100644
index 0000000000..a5bb0e06dd
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_fmin.S
@@ -0,0 +1,43 @@
+/* Compute minimum of two numbers, regarding NaN as missing argument.
+ Copyright (C) 1997-2017 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>
+
+ .text
+ENTRY(__fmin)
+ fldl 4(%esp) // x
+ fldl 12(%esp) // x : y
+
+ fxam
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x01, %ah
+ je 1f // y == NaN
+
+ fucom %st(1)
+ fnstsw
+ sahf
+ jc 2f
+
+1: fxch %st(1)
+2: fstp %st(1)
+
+ ret
+END(__fmin)
+weak_alias (__fmin, fmin)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_fminf.S b/REORG.TODO/sysdeps/i386/fpu/s_fminf.S
new file mode 100644
index 0000000000..fba4a41120
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_fminf.S
@@ -0,0 +1,43 @@
+/* Compute minimum of two numbers, regarding NaN as missing argument.
+ Copyright (C) 1997-2017 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>
+
+ .text
+ENTRY(__fminf)
+ flds 4(%esp) // x
+ flds 8(%esp) // x : y
+
+ fxam
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x01, %ah
+ je 1f // y == NaN
+
+ fucom %st(1)
+ fnstsw
+ sahf
+ jc 2f
+
+1: fxch %st(1)
+2: fstp %st(1)
+
+ ret
+END(__fminf)
+weak_alias (__fminf, fminf)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_fminl.S b/REORG.TODO/sysdeps/i386/fpu/s_fminl.S
new file mode 100644
index 0000000000..12ef21fda9
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_fminl.S
@@ -0,0 +1,71 @@
+/* Compute minimum of two numbers, regarding NaN as missing argument.
+ Copyright (C) 1997-2017 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>
+
+ .text
+ENTRY(__fminl)
+ fldt 16(%esp) // y
+ fxam
+ fnstsw
+ fldt 4(%esp) // y : x
+
+ andb $0x45, %ah
+ cmpb $0x01, %ah
+ je 2f // y == NaN
+
+ fxam
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x01, %ah
+ je 3f // x == NaN
+
+ fucom %st(1)
+ fnstsw
+ sahf
+ jc 1f
+
+ fxch %st(1)
+1: fstp %st(1)
+
+ ret
+
+2: // st(1) is a NaN; st(0) may or may not be.
+ fxam
+ fnstsw
+ andb $0x45, %ah
+ cmpb $0x01, %ah
+ je 4f
+ // st(1) is a NaN; st(0) is not. Test if st(1) is signaling.
+ testb $0x40, 23(%esp)
+ jz 4f
+ fstp %st(1)
+ ret
+
+3: // st(0) is a NaN; st(1) is not. Test if st(0) is signaling.
+ testb $0x40, 11(%esp)
+ jz 4f
+ fstp %st(0)
+ ret
+
+4: // Both arguments are NaNs, or one is a signaling NaN.
+ faddp
+ ret
+END(__fminl)
+weak_alias (__fminl, fminl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_fpclassifyl.c b/REORG.TODO/sysdeps/i386/fpu/s_fpclassifyl.c
new file mode 100644
index 0000000000..ce19fd0035
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_fpclassifyl.c
@@ -0,0 +1,42 @@
+/* Return classification value corresponding to argument.
+ Copyright (C) 1997-2017 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 <math.h>
+
+#include <math_private.h>
+
+
+int
+__fpclassifyl (long double x)
+{
+ u_int32_t ex, hx, lx;
+ int retval = FP_NORMAL;
+
+ GET_LDOUBLE_WORDS (ex, hx, lx, x);
+ ex &= 0x7fff;
+ if ((ex | lx | hx) == 0)
+ retval = FP_ZERO;
+ else if (ex == 0 && (hx & 0x80000000) == 0)
+ retval = FP_SUBNORMAL;
+ else if (ex == 0x7fff)
+ retval = ((hx & 0x7fffffff) | lx) != 0 ? FP_NAN : FP_INFINITE;
+
+ return retval;
+}
+libm_hidden_def (__fpclassifyl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_frexp.S b/REORG.TODO/sysdeps/i386/fpu/s_frexp.S
new file mode 100644
index 0000000000..104f733bf6
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_frexp.S
@@ -0,0 +1,83 @@
+/* ix87 specific frexp implementation for double.
+ Copyright (C) 1997-2017 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>
+
+ .section .rodata
+
+ .align ALIGNARG(4)
+ .type two54,@object
+two54: .byte 0, 0, 0, 0, 0, 0, 0x50, 0x43
+ ASM_SIZE_DIRECTIVE(two54)
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+#define PARMS 4 /* no space for saved regs */
+#define VAL0 PARMS
+#define VAL1 VAL0+4
+#define EXPP VAL1+4
+
+ .text
+ENTRY (__frexp)
+
+ movl VAL0(%esp), %ecx
+ movl VAL1(%esp), %eax
+ movl %eax, %edx
+ andl $0x7fffffff, %eax
+ orl %eax, %ecx
+ jz 1f
+ xorl %ecx, %ecx
+ cmpl $0x7ff00000, %eax
+ jae 1f
+
+ cmpl $0x00100000, %eax
+ jae 2f
+
+ fldl VAL0(%esp)
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ fmull MO(two54)
+ movl $-54, %ecx
+ fstpl VAL0(%esp)
+ fwait
+ movl VAL1(%esp), %eax
+ movl %eax, %edx
+ andl $0x7fffffff, %eax
+
+2: shrl $20, %eax
+ andl $0x800fffff, %edx
+ subl $1022, %eax
+ orl $0x3fe00000, %edx
+ addl %eax, %ecx
+ movl %edx, VAL1(%esp)
+
+ /* Store %ecx in the variable pointed to by the second argument,
+ get the factor from the stack and return. */
+1: movl EXPP(%esp), %eax
+ fldl VAL0(%esp)
+ movl %ecx, (%eax)
+
+ ret
+END (__frexp)
+weak_alias (__frexp, frexp)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_frexpf.S b/REORG.TODO/sysdeps/i386/fpu/s_frexpf.S
new file mode 100644
index 0000000000..f21c39ec4b
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_frexpf.S
@@ -0,0 +1,80 @@
+/* ix87 specific frexp implementation for float.
+ Copyright (C) 1997-2017 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>
+
+ .section .rodata
+
+ .align ALIGNARG(4)
+ .type two25,@object
+two25: .byte 0, 0, 0, 0x4c
+ ASM_SIZE_DIRECTIVE(two25)
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+#define PARMS 4 /* no space for saved regs */
+#define VAL PARMS
+#define EXPP VAL+4
+
+ .text
+ENTRY (__frexpf)
+
+ movl VAL(%esp), %eax
+ xorl %ecx, %ecx
+ movl %eax, %edx
+ andl $0x7fffffff, %eax
+ jz 1f
+ cmpl $0x7f800000, %eax
+ jae 1f
+
+ cmpl $0x00800000, %eax
+ jae 2f
+
+ flds VAL(%esp)
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+ fmuls MO(two25)
+ movl $-25, %ecx
+ fstps VAL(%esp)
+ fwait
+ movl VAL(%esp), %eax
+ movl %eax, %edx
+ andl $0x7fffffff, %eax
+
+2: shrl $23, %eax
+ andl $0x807fffff, %edx
+ subl $126, %eax
+ orl $0x3f000000, %edx
+ addl %eax, %ecx
+ movl %edx, VAL(%esp)
+
+ /* Store %ecx in the variable pointed to by the second argument,
+ get the factor from the stack and return. */
+1: movl EXPP(%esp), %eax
+ flds VAL(%esp)
+ movl %ecx, (%eax)
+
+ ret
+END (__frexpf)
+weak_alias (__frexpf, frexpf)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_frexpl.S b/REORG.TODO/sysdeps/i386/fpu/s_frexpl.S
new file mode 100644
index 0000000000..04f28888d2
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_frexpl.S
@@ -0,0 +1,92 @@
+/* ix87 specific frexp implementation for long double.
+ Copyright (C) 1997-2017 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>
+
+ .section .rodata
+
+ .align ALIGNARG(4)
+ .type two64,@object
+two64: .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x43
+ ASM_SIZE_DIRECTIVE(two64)
+
+#ifdef PIC
+#define MO(op) op##@GOTOFF(%edx)
+#else
+#define MO(op) op
+#endif
+
+#define PARMS 4 /* no space for saved regs */
+#define VAL0 PARMS
+#define VAL1 VAL0+4
+#define VAL2 VAL1+4
+#define EXPP VAL2+4
+
+ .text
+ENTRY (__frexpl)
+
+ movl VAL0(%esp), %ecx
+ movl VAL2(%esp), %eax
+ orl VAL1(%esp), %ecx
+ movl %eax, %edx
+ andl $0x7fff, %eax
+ orl %eax, %ecx
+ jz 1f
+ xorl %ecx, %ecx
+ cmpl $0x7fff, %eax
+ je 3f
+
+ cmpl $0, %eax
+ jne 2f
+
+ fldt VAL0(%esp)
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+
+ fmull MO(two64) /* It's not necessary to use a 80bit factor */
+ movl $-64, %ecx
+ fstpt VAL0(%esp)
+ fwait
+ movl VAL2(%esp), %eax
+ movl %eax, %edx
+ andl $0x7fff, %eax
+
+2: andl $0x8000, %edx
+ subl $16382, %eax
+ orl $0x3ffe, %edx
+ addl %eax, %ecx
+ movl %edx, VAL2(%esp)
+
+ /* Store %ecx in the variable pointed to by the second argument,
+ get the factor from the stack and return. */
+1: movl EXPP(%esp), %eax
+ fldt VAL0(%esp)
+ movl %ecx, (%eax)
+
+ ret
+
+ /* Infinity or NaN; ensure signaling NaNs are quieted. */
+3: movl EXPP(%esp), %eax
+ fldt VAL0(%esp)
+ fadd %st
+ movl %ecx, (%eax)
+ ret
+END (__frexpl)
+weak_alias (__frexpl, frexpl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_isinfl.c b/REORG.TODO/sysdeps/i386/fpu/s_isinfl.c
new file mode 100644
index 0000000000..cdd77183fa
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_isinfl.c
@@ -0,0 +1,32 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Change for long double by Ulrich Drepper <drepper@cygnus.com>.
+ * Intel i387 specific version.
+ * Public domain.
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * isinfl(x) returns 1 if x is inf, -1 if x is -inf, else 0;
+ * no branching!
+ */
+
+#include <math.h>
+#include <math_private.h>
+
+int __isinfl(long double x)
+{
+ int32_t se,hx,lx;
+ GET_LDOUBLE_WORDS(se,hx,lx,x);
+ /* This additional ^ 0x80000000 is necessary because in Intel's
+ internal representation of the implicit one is explicit. */
+ lx |= (hx ^ 0x80000000) | ((se & 0x7fff) ^ 0x7fff);
+ lx |= -lx;
+ se &= 0x8000;
+ return ~(lx >> 31) & (1 - (se >> 14));
+}
+hidden_def (__isinfl)
+weak_alias (__isinfl, isinfl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_isnanl.c b/REORG.TODO/sysdeps/i386/fpu/s_isnanl.c
new file mode 100644
index 0000000000..816396d8fb
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_isnanl.c
@@ -0,0 +1,43 @@
+/* s_isnanl.c -- long double version for i387 of s_isnan.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * isnanl(x) returns 1 is x is nan, else 0;
+ * no branching!
+ */
+
+#include <math.h>
+#include <math_private.h>
+
+int __isnanl(long double x)
+{
+ int32_t se,hx,lx;
+ GET_LDOUBLE_WORDS(se,hx,lx,x);
+ se = (se & 0x7fff) << 1;
+ /* The additional & 0x7fffffff is required because Intel's
+ extended format has the normally implicit 1 explicit
+ present. Sigh! */
+ lx |= hx & 0x7fffffff;
+ se |= (u_int32_t)(lx|(-lx))>>31;
+ se = 0xfffe - se;
+ return (int)((u_int32_t)(se))>>16;
+}
+hidden_def (__isnanl)
+weak_alias (__isnanl, isnanl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_llrint.S b/REORG.TODO/sysdeps/i386/fpu/s_llrint.S
new file mode 100644
index 0000000000..a597183aab
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_llrint.S
@@ -0,0 +1,36 @@
+/* Round argument to nearest integral value according to current rounding
+ direction.
+ Copyright (C) 1997-2017 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>
+
+ .text
+ENTRY(__llrint)
+ fldl 4(%esp)
+ subl $8, %esp
+ cfi_adjust_cfa_offset (8)
+ fistpll (%esp)
+ fwait
+ popl %eax
+ cfi_adjust_cfa_offset (-4)
+ popl %edx
+ cfi_adjust_cfa_offset (-4)
+ ret
+END(__llrint)
+weak_alias (__llrint, llrint)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_llrintf.S b/REORG.TODO/sysdeps/i386/fpu/s_llrintf.S
new file mode 100644
index 0000000000..a4b574eccb
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_llrintf.S
@@ -0,0 +1,36 @@
+/* Round argument to nearest integral value according to current rounding
+ direction.
+ Copyright (C) 1997-2017 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>
+
+ .text
+ENTRY(__llrintf)
+ flds 4(%esp)
+ subl $8, %esp
+ cfi_adjust_cfa_offset (8)
+ fistpll (%esp)
+ fwait
+ popl %eax
+ cfi_adjust_cfa_offset (-4)
+ popl %edx
+ cfi_adjust_cfa_offset (-4)
+ ret
+END(__llrintf)
+weak_alias (__llrintf, llrintf)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_llrintl.S b/REORG.TODO/sysdeps/i386/fpu/s_llrintl.S
new file mode 100644
index 0000000000..7b48c02ef4
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_llrintl.S
@@ -0,0 +1,36 @@
+/* Round argument to nearest integral value according to current rounding
+ direction.
+ Copyright (C) 1997-2017 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>
+
+ .text
+ENTRY(__llrintl)
+ fldt 4(%esp)
+ subl $8, %esp
+ cfi_adjust_cfa_offset (8)
+ fistpll (%esp)
+ fwait
+ popl %eax
+ cfi_adjust_cfa_offset (-4)
+ popl %edx
+ cfi_adjust_cfa_offset (-4)
+ ret
+END(__llrintl)
+weak_alias (__llrintl, llrintl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_log1p.S b/REORG.TODO/sysdeps/i386/fpu/s_log1p.S
new file mode 100644
index 0000000000..7978e76095
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_log1p.S
@@ -0,0 +1,67 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $")
+
+ .section .rodata
+
+ .align ALIGNARG(4)
+ /* The fyl2xp1 can only be used for values in
+ -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2
+ 0.29 is a safe value.
+ */
+limit: .double 0.29
+one: .double 1.0
+
+DEFINE_DBL_MIN
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%edx)
+#else
+# define MO(op) op
+#endif
+
+/*
+ * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
+ * otherwise fyl2x with the needed extra computation.
+ */
+ .text
+ENTRY(__log1p)
+ fldln2
+
+ fldl 4(%esp)
+
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+
+ fxam
+ fnstsw
+ fld %st
+ sahf
+ jc 3f // in case x is NaN or ħInf
+4: fabs
+ fcompl MO(limit)
+ fnstsw
+ sahf
+ jc 2f
+
+ faddl MO(one)
+ fyl2x
+ ret
+
+2: fyl2xp1
+ DBL_CHECK_FORCE_UFLOW_NONNAN
+ ret
+
+3: jp 4b // in case x is ħInf
+ fstp %st(1)
+ fstp %st(1)
+ ret
+
+END (__log1p)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_log1pf.S b/REORG.TODO/sysdeps/i386/fpu/s_log1pf.S
new file mode 100644
index 0000000000..acaa299d94
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_log1pf.S
@@ -0,0 +1,67 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+RCSID("$NetBSD: s_log1pf.S,v 1.4 1995/05/09 00:13:05 jtc Exp $")
+
+ .section .rodata
+
+ .align ALIGNARG(4)
+ /* The fyl2xp1 can only be used for values in
+ -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2
+ 0.29 is a safe value.
+ */
+limit: .float 0.29
+one: .float 1.0
+
+DEFINE_FLT_MIN
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%edx)
+#else
+# define MO(op) op
+#endif
+
+/*
+ * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
+ * otherwise fyl2x with the needed extra computation.
+ */
+ .text
+ENTRY(__log1pf)
+ fldln2
+
+ flds 4(%esp)
+
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+
+ fxam
+ fnstsw
+ fld %st
+ sahf
+ jc 3f // in case x is NaN or ħInf
+4: fabs
+ fcomps MO(limit)
+ fnstsw
+ sahf
+ jc 2f
+
+ fadds MO(one)
+ fyl2x
+ ret
+
+2: fyl2xp1
+ FLT_CHECK_FORCE_UFLOW_NONNAN
+ ret
+
+3: jp 4b // in case x is ħInf
+ fstp %st(1)
+ fstp %st(1)
+ ret
+
+END (__log1pf)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_log1pl.S b/REORG.TODO/sysdeps/i386/fpu/s_log1pl.S
new file mode 100644
index 0000000000..0fd05cbdb3
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_log1pl.S
@@ -0,0 +1,76 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $")
+
+ .section .rodata
+
+ .align ALIGNARG(4)
+ /* The fyl2xp1 can only be used for values in
+ -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2
+ 0.29 is a safe value.
+ */
+limit: .tfloat 0.29
+ /* Please note: we use a double value here. Since 1.0 has
+ an exact representation this does not effect the accuracy
+ but it helps to optimize the code. */
+one: .double 1.0
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%edx)
+#else
+# define MO(op) op
+#endif
+
+/*
+ * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
+ * otherwise fyl2x with the needed extra computation.
+ */
+ .text
+ENTRY(__log1pl)
+ fldln2
+
+ fldt 4(%esp)
+
+#ifdef PIC
+ LOAD_PIC_REG (dx)
+#endif
+
+ fxam
+ fnstsw
+ fld %st
+ sahf
+ jc 3f // in case x is NaN or ħInf
+4:
+ fabs
+ fldt MO(limit)
+ fcompp
+ fnstsw
+ sahf
+ jnc 2f
+
+ movzwl 4+8(%esp), %eax
+ xorb $0x80, %ah
+ cmpl $0xc040, %eax
+ jae 5f
+
+ faddl MO(one)
+5: fyl2x
+ ret
+
+2: fyl2xp1
+ ret
+
+3: jp 4b // in case x is ħInf
+ fstp %st(1)
+ fstp %st(1)
+ fadd %st(0)
+ ret
+
+END (__log1pl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_logb.S b/REORG.TODO/sysdeps/i386/fpu/s_logb.S
new file mode 100644
index 0000000000..f78c091c8a
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_logb.S
@@ -0,0 +1,16 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_logb.S,v 1.4 1995/05/09 00:14:30 jtc Exp $")
+
+ENTRY(__logb)
+ fldl 4(%esp)
+ fxtract
+ fstp %st
+ ret
+END (__logb)
+weak_alias (__logb, logb)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_logbf.S b/REORG.TODO/sysdeps/i386/fpu/s_logbf.S
new file mode 100644
index 0000000000..91eb3d2925
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_logbf.S
@@ -0,0 +1,16 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_logbf.S,v 1.3 1995/05/09 00:15:12 jtc Exp $")
+
+ENTRY(__logbf)
+ flds 4(%esp)
+ fxtract
+ fstp %st
+ ret
+END (__logbf)
+weak_alias (__logbf, logbf)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_logbl.c b/REORG.TODO/sysdeps/i386/fpu/s_logbl.c
new file mode 100644
index 0000000000..391e2db489
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_logbl.c
@@ -0,0 +1,19 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
+ * Public domain.
+ */
+
+#include <math_private.h>
+
+long double
+__logbl (long double x)
+{
+ long double res;
+
+ asm ("fxtract\n"
+ "fstp %%st" : "=t" (res) : "0" (x));
+ return res;
+}
+
+weak_alias (__logbl, logbl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_lrint.S b/REORG.TODO/sysdeps/i386/fpu/s_lrint.S
new file mode 100644
index 0000000000..79a374b399
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_lrint.S
@@ -0,0 +1,34 @@
+/* Round argument to nearest integral value according to current rounding
+ direction.
+ Copyright (C) 1997-2017 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>
+
+ .text
+ENTRY(__lrint)
+ fldl 4(%esp)
+ subl $4, %esp
+ cfi_adjust_cfa_offset (4)
+ fistpl (%esp)
+ fwait
+ popl %eax
+ cfi_adjust_cfa_offset (-4)
+ ret
+END(__lrint)
+weak_alias (__lrint, lrint)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_lrintf.S b/REORG.TODO/sysdeps/i386/fpu/s_lrintf.S
new file mode 100644
index 0000000000..fc6e68e073
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_lrintf.S
@@ -0,0 +1,34 @@
+/* Round argument to nearest integral value according to current rounding
+ direction.
+ Copyright (C) 1997-2017 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>
+
+ .text
+ENTRY(__lrintf)
+ flds 4(%esp)
+ subl $4, %esp
+ cfi_adjust_cfa_offset (4)
+ fistpl (%esp)
+ fwait
+ popl %eax
+ cfi_adjust_cfa_offset (-4)
+ ret
+END(__lrintf)
+weak_alias (__lrintf, lrintf)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_lrintl.S b/REORG.TODO/sysdeps/i386/fpu/s_lrintl.S
new file mode 100644
index 0000000000..ba6dbdf44c
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_lrintl.S
@@ -0,0 +1,34 @@
+/* Round argument to nearest integral value according to current rounding
+ direction.
+ Copyright (C) 1997-2017 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>
+
+ .text
+ENTRY(__lrintl)
+ fldt 4(%esp)
+ subl $4, %esp
+ cfi_adjust_cfa_offset (4)
+ fistpl (%esp)
+ fwait
+ popl %eax
+ cfi_adjust_cfa_offset (-4)
+ ret
+END(__lrintl)
+weak_alias (__lrintl, lrintl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_nearbyint.S b/REORG.TODO/sysdeps/i386/fpu/s_nearbyint.S
new file mode 100644
index 0000000000..f7b79b6ff2
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_nearbyint.S
@@ -0,0 +1,20 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+/* Adapted for use as nearbyint by Ulrich Drepper <drepper@cygnus.com>. */
+
+#include <machine/asm.h>
+
+ENTRY(__nearbyint)
+ fldl 4(%esp)
+ subl $32, %esp
+ cfi_adjust_cfa_offset (32)
+ fnstenv 4(%esp)
+ frndint
+ fldenv 4(%esp)
+ addl $32, %esp
+ cfi_adjust_cfa_offset (-32)
+ ret
+END (__nearbyint)
+weak_alias (__nearbyint, nearbyint)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_nearbyintf.S b/REORG.TODO/sysdeps/i386/fpu/s_nearbyintf.S
new file mode 100644
index 0000000000..92df2f87b3
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_nearbyintf.S
@@ -0,0 +1,20 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+/* Adapted for use as nearbyint by Ulrich Drepper <drepper@cygnus.com>. */
+
+#include <machine/asm.h>
+
+ENTRY(__nearbyintf)
+ flds 4(%esp)
+ subl $32, %esp
+ cfi_adjust_cfa_offset (32)
+ fnstenv 4(%esp)
+ frndint
+ fldenv 4(%esp)
+ addl $32, %esp
+ cfi_adjust_cfa_offset (-32)
+ ret
+END (__nearbyintf)
+weak_alias (__nearbyintf, nearbyintf)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_nearbyintl.S b/REORG.TODO/sysdeps/i386/fpu/s_nearbyintl.S
new file mode 100644
index 0000000000..3b7d1e2436
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_nearbyintl.S
@@ -0,0 +1,23 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+/* Adapted for use as nearbyint by Ulrich Drepper <drepper@cygnus.com>. */
+
+#include <machine/asm.h>
+
+ENTRY(__nearbyintl)
+ fldt 4(%esp)
+ subl $32, %esp
+ cfi_adjust_cfa_offset (32)
+ fnstenv 4(%esp)
+ frndint
+ fnstsw
+ andl $0x1, %eax
+ orl %eax, 8(%esp)
+ fldenv 4(%esp)
+ addl $32, %esp
+ cfi_adjust_cfa_offset (-32)
+ ret
+END (__nearbyintl)
+weak_alias (__nearbyintl, nearbyintl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_nextafterl.c b/REORG.TODO/sysdeps/i386/fpu/s_nextafterl.c
new file mode 100644
index 0000000000..600ad7a8d3
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_nextafterl.c
@@ -0,0 +1,125 @@
+/* s_nextafterl.c -- long double version of s_nextafter.c.
+ * Special version for i387.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* IEEE functions
+ * nextafterl(x,y)
+ * return the next machine floating-point number of x in the
+ * direction toward y.
+ * Special cases:
+ */
+
+#include <errno.h>
+#include <math.h>
+#include <math_private.h>
+
+long double __nextafterl(long double x, long double y)
+{
+ u_int32_t hx,hy,ix,iy;
+ u_int32_t lx,ly;
+ int32_t esx,esy;
+
+ GET_LDOUBLE_WORDS(esx,hx,lx,x);
+ GET_LDOUBLE_WORDS(esy,hy,ly,y);
+ ix = esx&0x7fff; /* |x| */
+ iy = esy&0x7fff; /* |y| */
+
+ /* Intel's extended format has the normally implicit 1 explicit
+ present. Sigh! */
+ if(((ix==0x7fff)&&(((hx&0x7fffffff)|lx)!=0)) || /* x is nan */
+ ((iy==0x7fff)&&(((hy&0x7fffffff)|ly)!=0))) /* y is nan */
+ return x+y;
+ if(x==y) return y; /* x=y, return y */
+ if((ix|hx|lx)==0) { /* x == 0 */
+ long double u;
+ SET_LDOUBLE_WORDS(x,esy&0x8000,0,1);/* return +-minsubnormal */
+ u = math_opt_barrier (x);
+ u = u * u;
+ math_force_eval (u); /* raise underflow flag */
+ return x;
+ }
+ if(esx>=0) { /* x > 0 */
+ if(esx>esy||((esx==esy) && (hx>hy||((hx==hy)&&(lx>ly))))) {
+ /* x > y, x -= ulp */
+ if(lx==0) {
+ if (hx <= 0x80000000) {
+ if (esx == 0) {
+ --hx;
+ } else {
+ esx -= 1;
+ hx = hx - 1;
+ if (esx > 0)
+ hx |= 0x80000000;
+ }
+ } else
+ hx -= 1;
+ }
+ lx -= 1;
+ } else { /* x < y, x += ulp */
+ lx += 1;
+ if(lx==0) {
+ hx += 1;
+ if (hx==0 || (esx == 0 && hx == 0x80000000)) {
+ esx += 1;
+ hx |= 0x80000000;
+ }
+ }
+ }
+ } else { /* x < 0 */
+ if(esy>=0||(esx>esy||((esx==esy)&&(hx>hy||((hx==hy)&&(lx>ly)))))){
+ /* x < y, x -= ulp */
+ if(lx==0) {
+ if (hx <= 0x80000000 && esx != 0xffff8000) {
+ esx -= 1;
+ hx = hx - 1;
+ if ((esx&0x7fff) > 0)
+ hx |= 0x80000000;
+ } else
+ hx -= 1;
+ }
+ lx -= 1;
+ } else { /* x > y, x += ulp */
+ lx += 1;
+ if(lx==0) {
+ hx += 1;
+ if (hx==0 || (esx == 0xffff8000 && hx == 0x80000000)) {
+ esx += 1;
+ hx |= 0x80000000;
+ }
+ }
+ }
+ }
+ esy = esx&0x7fff;
+ if(esy==0x7fff) {
+ long double u = x + x; /* overflow */
+ math_force_eval (u);
+ __set_errno (ERANGE);
+ }
+ if(esy==0) {
+ long double u = x*x; /* underflow */
+ math_force_eval (u); /* raise underflow flag */
+ __set_errno (ERANGE);
+ }
+ SET_LDOUBLE_WORDS(x,esx,hx,lx);
+ return x;
+}
+weak_alias (__nextafterl, nextafterl)
+strong_alias (__nextafterl, __nexttowardl)
+weak_alias (__nextafterl, nexttowardl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_nexttoward.c b/REORG.TODO/sysdeps/i386/fpu/s_nexttoward.c
new file mode 100644
index 0000000000..0b47044760
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_nexttoward.c
@@ -0,0 +1,93 @@
+/* s_nexttoward.c
+ * Special i387 version
+ * Conversion from s_nextafter.c by Ulrich Drepper, Cygnus Support,
+ * drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* IEEE functions
+ * nexttoward(x,y)
+ * return the next machine floating-point number of x in the
+ * direction toward y.
+ * Special cases:
+ */
+
+#include <errno.h>
+#include <math.h>
+#include <math_private.h>
+#include <float.h>
+
+double __nexttoward(double x, long double y)
+{
+ int32_t hx,ix,iy;
+ u_int32_t lx,hy,ly,esy;
+
+ EXTRACT_WORDS(hx,lx,x);
+ GET_LDOUBLE_WORDS(esy,hy,ly,y);
+ ix = hx&0x7fffffff; /* |x| */
+ iy = esy&0x7fff; /* |y| */
+
+ /* Intel's extended format has the normally implicit 1 explicit
+ present. Sigh! */
+ if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */
+ ((iy>=0x7fff)&&((hy&0x7fffffff)|ly)!=0)) /* y is nan */
+ return x+y;
+ if((long double) x==y) return y; /* x=y, return y */
+ if((ix|lx)==0) { /* x == 0 */
+ double u;
+ INSERT_WORDS(x,(esy&0x8000)<<16,1); /* return +-minsub */
+ u = math_opt_barrier (x);
+ u = u * u;
+ math_force_eval (u); /* raise underflow flag */
+ return x;
+ }
+ if(hx>=0) { /* x > 0 */
+ if (x > y) { /* x -= ulp */
+ if(lx==0) hx -= 1;
+ lx -= 1;
+ } else { /* x < y, x += ulp */
+ lx += 1;
+ if(lx==0) hx += 1;
+ }
+ } else { /* x < 0 */
+ if (x < y) { /* x -= ulp */
+ if(lx==0) hx -= 1;
+ lx -= 1;
+ } else { /* x > y, x += ulp */
+ lx += 1;
+ if(lx==0) hx += 1;
+ }
+ }
+ hy = hx&0x7ff00000;
+ if(hy>=0x7ff00000) {
+ double u = x+x; /* overflow */
+ math_force_eval (u);
+ __set_errno (ERANGE);
+ }
+ if(hy<0x00100000) {
+ double u = x*x; /* underflow */
+ math_force_eval (u); /* raise underflow flag */
+ __set_errno (ERANGE);
+ }
+ INSERT_WORDS(x,hx,lx);
+ return x;
+}
+weak_alias (__nexttoward, nexttoward)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__nexttoward, __nexttowardl)
+weak_alias (__nexttoward, nexttowardl)
+#endif
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_nexttowardf.c b/REORG.TODO/sysdeps/i386/fpu/s_nexttowardf.c
new file mode 100644
index 0000000000..e1156d1e4f
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_nexttowardf.c
@@ -0,0 +1,77 @@
+/* s_nexttowardf.c -- float version of s_nextafter.c.
+ * Special i387 version.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+#include <errno.h>
+#include <math.h>
+#include <math_private.h>
+#include <float.h>
+
+float __nexttowardf(float x, long double y)
+{
+ int32_t hx,ix,iy;
+ u_int32_t hy,ly,esy;
+
+ GET_FLOAT_WORD(hx,x);
+ GET_LDOUBLE_WORDS(esy,hy,ly,y);
+ ix = hx&0x7fffffff; /* |x| */
+ iy = esy&0x7fff; /* |y| */
+
+ /* Intel's extended format has the normally implicit 1 explicit
+ present. Sigh! */
+ if((ix>0x7f800000) || /* x is nan */
+ (iy>=0x7fff&&(((hy&0x7fffffff)|ly)!=0))) /* y is nan */
+ return x+y;
+ if((long double) x==y) return y; /* x=y, return y */
+ if(ix==0) { /* x == 0 */
+ float u;
+ SET_FLOAT_WORD(x,((esy&0x8000)<<16)|1);/* return +-minsub*/
+ u = math_opt_barrier (x);
+ u = u * u;
+ math_force_eval (u); /* raise underflow flag */
+ return x;
+ }
+ if(hx>=0) { /* x > 0 */
+ if(x > y) { /* x -= ulp */
+ hx -= 1;
+ } else { /* x < y, x += ulp */
+ hx += 1;
+ }
+ } else { /* x < 0 */
+ if(x < y) { /* x -= ulp */
+ hx -= 1;
+ } else { /* x > y, x += ulp */
+ hx += 1;
+ }
+ }
+ hy = hx&0x7f800000;
+ if(hy>=0x7f800000) {
+ float u = x+x; /* overflow */
+ math_force_eval (u);
+ __set_errno (ERANGE);
+ }
+ if(hy<0x00800000) {
+ float u = x*x; /* underflow */
+ math_force_eval (u); /* raise underflow flag */
+ __set_errno (ERANGE);
+ }
+ SET_FLOAT_WORD(x,hx);
+ return x;
+}
+weak_alias (__nexttowardf, nexttowardf)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_remquo.S b/REORG.TODO/sysdeps/i386/fpu/s_remquo.S
new file mode 100644
index 0000000000..341285db30
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_remquo.S
@@ -0,0 +1,45 @@
+/*
+ * Written by Ulrich Drepper <drepper@cygnus.com>.
+ * Based on e_remainder by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+#define PARMS 4 /* no space for saved regs */
+#define DVDND PARMS
+#define DVSOR DVDND+8
+#define QUOP DVSOR+8
+
+ .text
+ENTRY (__remquo)
+
+ fldl DVSOR(%esp)
+ fldl DVDND(%esp)
+1: fprem1
+ fstsw %ax
+ sahf
+ jp 1b
+ fstp %st(1)
+ /* Compute the congruent of the quotient. */
+ movl %eax, %ecx
+ shrl $8, %eax
+ shrl $12, %ecx
+ andl $4, %ecx
+ andl $3, %eax
+ orl %eax, %ecx
+ leal (%ecx,%ecx,2),%ecx
+ movl $0xef2a60, %eax
+ shrl %cl, %eax
+ andl $7, %eax
+ movl QUOP(%esp), %ecx
+ movl DVDND+4(%esp), %edx
+ xorl DVSOR+4(%esp), %edx
+ testl $0x80000000, %edx
+ jz 1f
+ negl %eax
+1: movl %eax, (%ecx)
+
+ ret
+END (__remquo)
+weak_alias (__remquo, remquo)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_remquof.S b/REORG.TODO/sysdeps/i386/fpu/s_remquof.S
new file mode 100644
index 0000000000..62063f068f
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_remquof.S
@@ -0,0 +1,45 @@
+/*
+ * Written by Ulrich Drepper <drepper@cygnus.com>.
+ * Based on e_remainder by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+#define PARMS 4 /* no space for saved regs */
+#define DVDND PARMS
+#define DVSOR DVDND+4
+#define QUOP DVSOR+4
+
+ .text
+ENTRY (__remquof)
+
+ flds DVSOR(%esp)
+ flds DVDND(%esp)
+1: fprem1
+ fstsw %ax
+ sahf
+ jp 1b
+ fstp %st(1)
+ /* Compute the congruent of the quotient. */
+ movl %eax, %ecx
+ shrl $8, %eax
+ shrl $12, %ecx
+ andl $4, %ecx
+ andl $3, %eax
+ orl %eax, %ecx
+ leal (%ecx,%ecx,2),%ecx
+ movl $0xef2a60, %eax
+ shrl %cl, %eax
+ andl $7, %eax
+ movl QUOP(%esp), %ecx
+ movl DVDND(%esp), %edx
+ xorl DVSOR(%esp), %edx
+ testl $0x80000000, %edx
+ jz 1f
+ negl %eax
+1: movl %eax, (%ecx)
+
+ ret
+END (__remquof)
+weak_alias (__remquof, remquof)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_remquol.S b/REORG.TODO/sysdeps/i386/fpu/s_remquol.S
new file mode 100644
index 0000000000..f3d84fc7c2
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_remquol.S
@@ -0,0 +1,45 @@
+/*
+ * Written by Ulrich Drepper <drepper@cygnus.com>.
+ * Based on e_remainder by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+#define PARMS 4 /* no space for saved regs */
+#define DVDND PARMS
+#define DVSOR DVDND+12
+#define QUOP DVSOR+12
+
+ .text
+ENTRY (__remquol)
+
+ fldt DVSOR(%esp)
+ fldt DVDND(%esp)
+1: fprem1
+ fstsw %ax
+ sahf
+ jp 1b
+ fstp %st(1)
+ /* Compute the congruent of the quotient. */
+ movl %eax, %ecx
+ shrl $8, %eax
+ shrl $12, %ecx
+ andl $4, %ecx
+ andl $3, %eax
+ orl %eax, %ecx
+ leal (%ecx,%ecx,2),%ecx
+ movl $0xef2a60, %eax
+ shrl %cl, %eax
+ andl $7, %eax
+ movl QUOP(%esp), %ecx
+ movl DVDND+8(%esp), %edx
+ xorl DVSOR+8(%esp), %edx
+ testl $0x8000, %edx
+ jz 1f
+ negl %eax
+1: movl %eax, (%ecx)
+
+ ret
+END (__remquol)
+weak_alias (__remquol, remquol)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_rint.S b/REORG.TODO/sysdeps/i386/fpu/s_rint.S
new file mode 100644
index 0000000000..be36c5f0ca
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_rint.S
@@ -0,0 +1,15 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_rint.S,v 1.4 1995/05/09 00:16:08 jtc Exp $")
+
+ENTRY(__rint)
+ fldl 4(%esp)
+ frndint
+ ret
+END (__rint)
+weak_alias (__rint, rint)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_rintf.S b/REORG.TODO/sysdeps/i386/fpu/s_rintf.S
new file mode 100644
index 0000000000..2b358c1cf1
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_rintf.S
@@ -0,0 +1,15 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_rintf.S,v 1.3 1995/05/09 00:17:22 jtc Exp $")
+
+ENTRY(__rintf)
+ flds 4(%esp)
+ frndint
+ ret
+END (__rintf)
+weak_alias (__rintf, rintf)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_rintl.c b/REORG.TODO/sysdeps/i386/fpu/s_rintl.c
new file mode 100644
index 0000000000..66af9cb675
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_rintl.c
@@ -0,0 +1,18 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
+ * Public domain.
+ */
+
+#include <math_private.h>
+
+long double
+__rintl (long double x)
+{
+ long double res;
+
+ asm ("frndint" : "=t" (res) : "0" (x));
+ return res;
+}
+
+weak_alias (__rintl, rintl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_scalbln.c b/REORG.TODO/sysdeps/i386/fpu/s_scalbln.c
new file mode 100644
index 0000000000..1009713fbc
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_scalbln.c
@@ -0,0 +1,2 @@
+/* Nothing to do. This function is the same as scalbn. So we define an
+ alias. */
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_scalblnf.c b/REORG.TODO/sysdeps/i386/fpu/s_scalblnf.c
new file mode 100644
index 0000000000..5e558c3540
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_scalblnf.c
@@ -0,0 +1,2 @@
+/* Nothing to do. This function is the same as scalbnf. So we define an
+ alias. */
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_scalblnl.c b/REORG.TODO/sysdeps/i386/fpu/s_scalblnl.c
new file mode 100644
index 0000000000..cda2ec11c8
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_scalblnl.c
@@ -0,0 +1,2 @@
+/* Nothing to do. This function is the same as scalbnl. So we define an
+ alias. */
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_scalbn.S b/REORG.TODO/sysdeps/i386/fpu/s_scalbn.S
new file mode 100644
index 0000000000..4e90903115
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_scalbn.S
@@ -0,0 +1,24 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+RCSID("$NetBSD: s_scalbn.S,v 1.4 1995/05/09 00:19:06 jtc Exp $")
+
+ENTRY(__scalbn)
+ fildl 12(%esp)
+ fldl 4(%esp)
+ fscale
+ fstp %st(1)
+ DBL_NARROW_EVAL
+ ret
+END (__scalbn)
+strong_alias (__scalbn, __scalbln)
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_20)
+compat_symbol (libc, __scalbn, scalbln, GLIBC_2_1);
+#endif
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_scalbnf.S b/REORG.TODO/sysdeps/i386/fpu/s_scalbnf.S
new file mode 100644
index 0000000000..f8353c4c75
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_scalbnf.S
@@ -0,0 +1,24 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+#include <i386-math-asm.h>
+
+RCSID("$NetBSD: s_scalbnf.S,v 1.3 1995/05/09 00:19:59 jtc Exp $")
+
+ENTRY(__scalbnf)
+ fildl 8(%esp)
+ flds 4(%esp)
+ fscale
+ fstp %st(1)
+ FLT_NARROW_EVAL
+ ret
+END (__scalbnf)
+strong_alias (__scalbnf, __scalblnf)
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_20)
+compat_symbol (libc, __scalbnf, scalblnf, GLIBC_2_1);
+#endif
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_scalbnl.S b/REORG.TODO/sysdeps/i386/fpu/s_scalbnl.S
new file mode 100644
index 0000000000..839b5ff353
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_scalbnl.S
@@ -0,0 +1,23 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__scalbnl)
+ fildl 16(%esp)
+ fldt 4(%esp)
+ fscale
+ fstp %st(1)
+ ret
+END (__scalbnl)
+strong_alias (__scalbnl, __scalblnl)
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_20)
+compat_symbol (libc, __scalbnl, scalblnl, GLIBC_2_1);
+#endif
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_significand.S b/REORG.TODO/sysdeps/i386/fpu/s_significand.S
new file mode 100644
index 0000000000..4859b7ed71
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_significand.S
@@ -0,0 +1,16 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_significand.S,v 1.4 1995/05/09 00:21:47 jtc Exp $")
+
+ENTRY(__significand)
+ fldl 4(%esp)
+ fxtract
+ fstp %st(1)
+ ret
+END (__significand)
+weak_alias (__significand, significand)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_significandf.S b/REORG.TODO/sysdeps/i386/fpu/s_significandf.S
new file mode 100644
index 0000000000..3a2de97759
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_significandf.S
@@ -0,0 +1,16 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_significandf.S,v 1.3 1995/05/09 00:24:07 jtc Exp $")
+
+ENTRY(__significandf)
+ flds 4(%esp)
+ fxtract
+ fstp %st(1)
+ ret
+END (__significandf)
+weak_alias (__significandf, significandf)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_significandl.c b/REORG.TODO/sysdeps/i386/fpu/s_significandl.c
new file mode 100644
index 0000000000..b8cb093502
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_significandl.c
@@ -0,0 +1,19 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
+ * Public domain.
+ */
+
+#include <math_private.h>
+
+long double
+__significandl (long double x)
+{
+ long double res;
+
+ asm ("fxtract\n"
+ "fstp %%st(1)" : "=t" (res) : "0" (x));
+ return res;
+}
+
+weak_alias (__significandl, significandl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_trunc.S b/REORG.TODO/sysdeps/i386/fpu/s_trunc.S
new file mode 100644
index 0000000000..e9a850b877
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_trunc.S
@@ -0,0 +1,37 @@
+/* Truncate double value.
+ Copyright (C) 1997-2017 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>
+
+ENTRY(__trunc)
+ fldl 4(%esp)
+ subl $32, %esp
+ cfi_adjust_cfa_offset (32)
+ fnstenv 4(%esp)
+ movl $0xc00, %edx
+ orl 4(%esp), %edx
+ movl %edx, (%esp)
+ fldcw (%esp)
+ frndint
+ fldenv 4(%esp)
+ addl $32, %esp
+ cfi_adjust_cfa_offset (-32)
+ ret
+END(__trunc)
+weak_alias (__trunc, trunc)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_truncf.S b/REORG.TODO/sysdeps/i386/fpu/s_truncf.S
new file mode 100644
index 0000000000..a93f5b9a2e
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_truncf.S
@@ -0,0 +1,37 @@
+/* Truncate float value.
+ Copyright (C) 1997-2017 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>
+
+ENTRY(__truncf)
+ flds 4(%esp)
+ subl $32, %esp
+ cfi_adjust_cfa_offset (32)
+ fnstenv 4(%esp)
+ movl $0xc00, %edx
+ orl 4(%esp), %edx
+ movl %edx, (%esp)
+ fldcw (%esp)
+ frndint
+ fldenv 4(%esp)
+ addl $32, %esp
+ cfi_adjust_cfa_offset (-32)
+ ret
+END(__truncf)
+weak_alias (__truncf, truncf)
diff --git a/REORG.TODO/sysdeps/i386/fpu/s_truncl.S b/REORG.TODO/sysdeps/i386/fpu/s_truncl.S
new file mode 100644
index 0000000000..a884123612
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/s_truncl.S
@@ -0,0 +1,40 @@
+/* Truncate long double value.
+ Copyright (C) 1997-2017 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>
+
+ENTRY(__truncl)
+ fldt 4(%esp)
+ subl $32, %esp
+ cfi_adjust_cfa_offset (32)
+ fnstenv 4(%esp)
+ movl $0xc00, %edx
+ orl 4(%esp), %edx
+ movl %edx, (%esp)
+ fldcw (%esp)
+ frndint
+ fnstsw
+ andl $0x1, %eax
+ orl %eax, 8(%esp)
+ fldenv 4(%esp)
+ addl $32, %esp
+ cfi_adjust_cfa_offset (-32)
+ ret
+END(__truncl)
+weak_alias (__truncl, truncl)
diff --git a/REORG.TODO/sysdeps/i386/fpu/slowexp.c b/REORG.TODO/sysdeps/i386/fpu/slowexp.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/slowexp.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/REORG.TODO/sysdeps/i386/fpu/slowpow.c b/REORG.TODO/sysdeps/i386/fpu/slowpow.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/slowpow.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/REORG.TODO/sysdeps/i386/fpu/t_exp.c b/REORG.TODO/sysdeps/i386/fpu/t_exp.c
new file mode 100644
index 0000000000..fd37963b05
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/t_exp.c
@@ -0,0 +1 @@
+/* Empty. Not needed. */
diff --git a/REORG.TODO/sysdeps/i386/fpu/w_sqrt_compat.c b/REORG.TODO/sysdeps/i386/fpu/w_sqrt_compat.c
new file mode 100644
index 0000000000..ddd36d0964
--- /dev/null
+++ b/REORG.TODO/sysdeps/i386/fpu/w_sqrt_compat.c
@@ -0,0 +1,8 @@
+/* The inline __ieee754_sqrt is not correctly rounding; it's OK for
+ most internal uses in glibc, but not for sqrt itself. */
+#define __ieee754_sqrt __avoid_ieee754_sqrt
+#include <math.h>
+#include <math_private.h>
+#undef __ieee754_sqrt
+extern double __ieee754_sqrt (double);
+#include <math/w_sqrt_compat.c>