aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/libm-i387
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-03-05 21:41:30 +0000
committerRoland McGrath <roland@gnu.org>1996-03-05 21:41:30 +0000
commitf7eac6eb504f4baf13dbb4d26717942df050ebe6 (patch)
tree95ff129c06c7f6f246a5e2bfa489ba6382659d19 /sysdeps/libm-i387
parent1521668f2afae1dc2ef5d7ffaeb84353b36874dd (diff)
downloadglibc-f7eac6eb504f4baf13dbb4d26717942df050ebe6.zip
glibc-f7eac6eb504f4baf13dbb4d26717942df050ebe6.tar.gz
glibc-f7eac6eb504f4baf13dbb4d26717942df050ebe6.tar.bz2
Mon Mar 4 20:54:40 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makeconfig ($(common-objpfx)config.make): Depend on config.h.in. Mon Mar 4 17:35:09 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> * hurd/catch-signal.c (hurd_safe_memmove): New function. (hurd_safe_copyin, hurd_safe_copyout): New functions. * hurd/hurd/sigpreempt.h: Declare them. Sun Mar 3 08:43:44 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> Replace math code with fdlibm from Sun as modified for netbsd by JT Conklin and Ian Taylor, including x86 FPU support. * sysdeps/libm-ieee754, sysdeps/libm-i387: New directories. * math/math_private.h: New file. * sysdeps/i386/fpu/Implies: New file. * sysdeps/ieee754/Implies: New file. * math/machine/asm.h, math/machine/endian.h: New files. * math/Makefile, math/math.h: Rewritten. * mathcalls.h, math/mathcalls.h: New file, broken out of math.h. * math/finite.c: File removed. * sysdeps/generic/Makefile [$(subdir)=math]: Frobnication removed. * math/test-math.c: Include errno.h and string.h. * sysdeps/unix/bsd/dirstream.h: File removed. * sysdeps/unix/bsd/readdir.c: File removed.
Diffstat (limited to 'sysdeps/libm-i387')
-rw-r--r--sysdeps/libm-i387/e_acos.S20
-rw-r--r--sysdeps/libm-i387/e_asin.S19
-rw-r--r--sysdeps/libm-i387/e_atan2.S14
-rw-r--r--sysdeps/libm-i387/e_atan2f.S14
-rw-r--r--sysdeps/libm-i387/e_exp.S23
-rw-r--r--sysdeps/libm-i387/e_fmod.S18
-rw-r--r--sysdeps/libm-i387/e_log.S14
-rw-r--r--sysdeps/libm-i387/e_log10.S14
-rw-r--r--sysdeps/libm-i387/e_remainder.S18
-rw-r--r--sysdeps/libm-i387/e_remainderf.S18
-rw-r--r--sysdeps/libm-i387/e_scalb.S14
-rw-r--r--sysdeps/libm-i387/e_sqrt.S13
-rw-r--r--sysdeps/libm-i387/e_sqrtf.S13
-rw-r--r--sysdeps/libm-i387/s_atan.S15
-rw-r--r--sysdeps/libm-i387/s_atanf.S15
-rw-r--r--sysdeps/libm-i387/s_ceil.S29
-rw-r--r--sysdeps/libm-i387/s_ceilf.S29
-rw-r--r--sysdeps/libm-i387/s_copysign.S19
-rw-r--r--sysdeps/libm-i387/s_copysignf.S19
-rw-r--r--sysdeps/libm-i387/s_cos.S27
-rw-r--r--sysdeps/libm-i387/s_cosf.S15
-rw-r--r--sysdeps/libm-i387/s_finite.S17
-rw-r--r--sysdeps/libm-i387/s_finitef.S17
-rw-r--r--sysdeps/libm-i387/s_floor.S29
-rw-r--r--sysdeps/libm-i387/s_floorf.S29
-rw-r--r--sysdeps/libm-i387/s_ilogb.S24
-rw-r--r--sysdeps/libm-i387/s_ilogbf.S24
-rw-r--r--sysdeps/libm-i387/s_log1p.S23
-rw-r--r--sysdeps/libm-i387/s_log1pf.S23
-rw-r--r--sysdeps/libm-i387/s_logb.S15
-rw-r--r--sysdeps/libm-i387/s_logbf.S15
-rw-r--r--sysdeps/libm-i387/s_rint.S14
-rw-r--r--sysdeps/libm-i387/s_rintf.S14
-rw-r--r--sysdeps/libm-i387/s_scalbn.S15
-rw-r--r--sysdeps/libm-i387/s_scalbnf.S15
-rw-r--r--sysdeps/libm-i387/s_significand.S15
-rw-r--r--sysdeps/libm-i387/s_significandf.S15
-rw-r--r--sysdeps/libm-i387/s_sin.S27
-rw-r--r--sysdeps/libm-i387/s_sinf.S15
-rw-r--r--sysdeps/libm-i387/s_tan.S29
-rw-r--r--sysdeps/libm-i387/s_tanf.S16
41 files changed, 771 insertions, 0 deletions
diff --git a/sysdeps/libm-i387/e_acos.S b/sysdeps/libm-i387/e_acos.S
new file mode 100644
index 0000000..6ec7785
--- /dev/null
+++ b/sysdeps/libm-i387/e_acos.S
@@ -0,0 +1,20 @@
+/*
+ * 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^2) / x) */
+ENTRY(__ieee754_acos)
+ fldl 4(%esp) /* x */
+ fst %st(1)
+ fmul %st(0) /* x^2 */
+ fld1
+ fsubp /* 1 - x^2 */
+ fsqrt /* sqrt (1 - x^2) */
+ fxch %st(1)
+ fpatan
+ ret
diff --git a/sysdeps/libm-i387/e_asin.S b/sysdeps/libm-i387/e_asin.S
new file mode 100644
index 0000000..dfcd7bc
--- /dev/null
+++ b/sysdeps/libm-i387/e_asin.S
@@ -0,0 +1,19 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: e_asin.S,v 1.4 1995/05/08 23:45:40 jtc Exp $")
+
+/* asin = atan (x / sqrt(1 - x^2)) */
+ENTRY(__ieee754_asin)
+ fldl 4(%esp) /* x */
+ fst %st(1)
+ fmul %st(0) /* x^2 */
+ fld1
+ fsubp /* 1 - x^2 */
+ fsqrt /* sqrt (1 - x^2) */
+ fpatan
+ ret
diff --git a/sysdeps/libm-i387/e_atan2.S b/sysdeps/libm-i387/e_atan2.S
new file mode 100644
index 0000000..da2e119
--- /dev/null
+++ b/sysdeps/libm-i387/e_atan2.S
@@ -0,0 +1,14 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: e_atan2.S,v 1.4 1995/05/08 23:46:28 jtc Exp $")
+
+ENTRY(__ieee754_atan2)
+ fldl 4(%esp)
+ fldl 12(%esp)
+ fpatan
+ ret
diff --git a/sysdeps/libm-i387/e_atan2f.S b/sysdeps/libm-i387/e_atan2f.S
new file mode 100644
index 0000000..21fc0d9
--- /dev/null
+++ b/sysdeps/libm-i387/e_atan2f.S
@@ -0,0 +1,14 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: e_atan2f.S,v 1.1 1995/05/08 23:35:10 jtc Exp $")
+
+ENTRY(__ieee754_atan2f)
+ flds 4(%esp)
+ flds 8(%esp)
+ fpatan
+ ret
diff --git a/sysdeps/libm-i387/e_exp.S b/sysdeps/libm-i387/e_exp.S
new file mode 100644
index 0000000..8c41ce0
--- /dev/null
+++ b/sysdeps/libm-i387/e_exp.S
@@ -0,0 +1,23 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: e_exp.S,v 1.4 1995/05/08 23:47:04 jtc Exp $")
+
+/* e^x = 2^(x * log2(e)) */
+ENTRY(__ieee754_exp)
+ fldl 4(%esp)
+ fldl2e
+ fmulp /* x * log2(e) */
+ fstl %st(1)
+ frndint /* int(x * log2(e)) */
+ fstl %st(2)
+ fsubrp /* fract(x * log2(e)) */
+ f2xm1 /* 2^(fract(x * log2(e))) - 1 */
+ fld1
+ faddp /* 2^(fract(x * log2(e))) */
+ fscale /* e^x */
+ ret
diff --git a/sysdeps/libm-i387/e_fmod.S b/sysdeps/libm-i387/e_fmod.S
new file mode 100644
index 0000000..c02df44
--- /dev/null
+++ b/sysdeps/libm-i387/e_fmod.S
@@ -0,0 +1,18 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: e_fmod.S,v 1.4 1995/05/08 23:47:56 jtc Exp $")
+
+ENTRY(__ieee754_fmod)
+ fldl 12(%esp)
+ fldl 4(%esp)
+1: fprem
+ fstsw %ax
+ sahf
+ jp 1b
+ fstpl %st(1)
+ ret
diff --git a/sysdeps/libm-i387/e_log.S b/sysdeps/libm-i387/e_log.S
new file mode 100644
index 0000000..98d569e
--- /dev/null
+++ b/sysdeps/libm-i387/e_log.S
@@ -0,0 +1,14 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: e_log.S,v 1.4 1995/05/08 23:48:39 jtc Exp $")
+
+ENTRY(__ieee754_log)
+ fldln2
+ fldl 4(%esp)
+ fyl2x
+ ret
diff --git a/sysdeps/libm-i387/e_log10.S b/sysdeps/libm-i387/e_log10.S
new file mode 100644
index 0000000..612344b
--- /dev/null
+++ b/sysdeps/libm-i387/e_log10.S
@@ -0,0 +1,14 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: e_log10.S,v 1.4 1995/05/08 23:49:24 jtc Exp $")
+
+ENTRY(__ieee754_log10)
+ fldlg2
+ fldl 4(%esp)
+ fyl2x
+ ret
diff --git a/sysdeps/libm-i387/e_remainder.S b/sysdeps/libm-i387/e_remainder.S
new file mode 100644
index 0000000..d14f2e8
--- /dev/null
+++ b/sysdeps/libm-i387/e_remainder.S
@@ -0,0 +1,18 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: e_remainder.S,v 1.4 1995/05/08 23:49:37 jtc Exp $")
+
+ENTRY(__ieee754_remainder)
+ fldl 12(%esp)
+ fldl 4(%esp)
+1: fprem1
+ fstsw %ax
+ sahf
+ jp 1b
+ fstpl %st(1)
+ ret
diff --git a/sysdeps/libm-i387/e_remainderf.S b/sysdeps/libm-i387/e_remainderf.S
new file mode 100644
index 0000000..ed578ea
--- /dev/null
+++ b/sysdeps/libm-i387/e_remainderf.S
@@ -0,0 +1,18 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: e_remainderf.S,v 1.2 1995/05/08 23:49:47 jtc Exp $")
+
+ENTRY(__ieee754_remainderf)
+ flds 8(%esp)
+ flds 4(%esp)
+1: fprem1
+ fstsw %ax
+ sahf
+ jp 1b
+ fstpl %st(1)
+ ret
diff --git a/sysdeps/libm-i387/e_scalb.S b/sysdeps/libm-i387/e_scalb.S
new file mode 100644
index 0000000..7d95f8e
--- /dev/null
+++ b/sysdeps/libm-i387/e_scalb.S
@@ -0,0 +1,14 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: e_scalb.S,v 1.4 1995/05/08 23:49:52 jtc Exp $")
+
+ENTRY(__ieee754_scalb)
+ fldl 12(%esp)
+ fldl 4(%esp)
+ fscale
+ ret
diff --git a/sysdeps/libm-i387/e_sqrt.S b/sysdeps/libm-i387/e_sqrt.S
new file mode 100644
index 0000000..34fe9b7
--- /dev/null
+++ b/sysdeps/libm-i387/e_sqrt.S
@@ -0,0 +1,13 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: e_sqrt.S,v 1.4 1995/05/08 23:49:57 jtc Exp $")
+
+ENTRY(__ieee754_sqrt)
+ fldl 4(%esp)
+ fsqrt
+ ret
diff --git a/sysdeps/libm-i387/e_sqrtf.S b/sysdeps/libm-i387/e_sqrtf.S
new file mode 100644
index 0000000..d20c4c1
--- /dev/null
+++ b/sysdeps/libm-i387/e_sqrtf.S
@@ -0,0 +1,13 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: e_sqrtf.S,v 1.2 1995/05/08 23:50:14 jtc Exp $")
+
+ENTRY(__ieee754_sqrtf)
+ flds 4(%esp)
+ fsqrt
+ ret
diff --git a/sysdeps/libm-i387/s_atan.S b/sysdeps/libm-i387/s_atan.S
new file mode 100644
index 0000000..4dcd54f
--- /dev/null
+++ b/sysdeps/libm-i387/s_atan.S
@@ -0,0 +1,15 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_atan.S,v 1.4 1995/05/08 23:50:41 jtc Exp $")
+
+ENTRY(__atan)
+ fldl 4(%esp)
+ fld1
+ fpatan
+ ret
+weak_alias (__atan, atan)
diff --git a/sysdeps/libm-i387/s_atanf.S b/sysdeps/libm-i387/s_atanf.S
new file mode 100644
index 0000000..d00593d
--- /dev/null
+++ b/sysdeps/libm-i387/s_atanf.S
@@ -0,0 +1,15 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_atanf.S,v 1.3 1995/05/08 23:51:33 jtc Exp $")
+
+ENTRY(__atanf)
+ flds 4(%esp)
+ fld1
+ fpatan
+ ret
+weak_alias (__atanf, atanf)
diff --git a/sysdeps/libm-i387/s_ceil.S b/sysdeps/libm-i387/s_ceil.S
new file mode 100644
index 0000000..2fd813d
--- /dev/null
+++ b/sysdeps/libm-i387/s_ceil.S
@@ -0,0 +1,29 @@
+/*
+ * 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)
+ pushl %ebp
+ movl %esp,%ebp
+ subl $8,%esp
+
+ fstcw -12(%ebp) /* store fpu control word */
+ movw -12(%ebp),%dx
+ orw $0x0800,%dx /* round towards +oo */
+ andw $0xfbff,%dx
+ movw %dx,-16(%ebp)
+ fldcw -16(%ebp) /* load modfied control word */
+
+ fldl 8(%ebp); /* round */
+ frndint
+
+ fldcw -12(%ebp) /* restore original control word */
+
+ leave
+ ret
+weak_alias (__ceil, ceil)
diff --git a/sysdeps/libm-i387/s_ceilf.S b/sysdeps/libm-i387/s_ceilf.S
new file mode 100644
index 0000000..6458b45
--- /dev/null
+++ b/sysdeps/libm-i387/s_ceilf.S
@@ -0,0 +1,29 @@
+/*
+ * 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)
+ pushl %ebp
+ movl %esp,%ebp
+ subl $8,%esp
+
+ fstcw -12(%ebp) /* store fpu control word */
+ movw -12(%ebp),%dx
+ orw $0x0800,%dx /* round towards +oo */
+ andw $0xfbff,%dx
+ movw %dx,-16(%ebp)
+ fldcw -16(%ebp) /* load modfied control word */
+
+ flds 8(%ebp); /* round */
+ frndint
+
+ fldcw -12(%ebp) /* restore original control word */
+
+ leave
+ ret
+weak_alias (__ceilf, ceilf)
diff --git a/sysdeps/libm-i387/s_copysign.S b/sysdeps/libm-i387/s_copysign.S
new file mode 100644
index 0000000..0de3aff
--- /dev/null
+++ b/sysdeps/libm-i387/s_copysign.S
@@ -0,0 +1,19 @@
+/*
+ * 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
+ andl $0x80000000,%edx
+ movl 8(%esp),%eax
+ andl $0x7fffffff,%eax
+ orl %edx,%eax
+ movl %eax,8(%esp)
+ fldl 4(%esp)
+ ret
+weak_alias (__copysign, copysign)
diff --git a/sysdeps/libm-i387/s_copysignf.S b/sysdeps/libm-i387/s_copysignf.S
new file mode 100644
index 0000000..a55cd37
--- /dev/null
+++ b/sysdeps/libm-i387/s_copysignf.S
@@ -0,0 +1,19 @@
+/*
+ * 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
+ andl $0x80000000,%edx
+ movl 4(%esp),%eax
+ andl $0x7fffffff,%eax
+ orl %edx,%eax
+ movl %eax,4(%esp)
+ flds 4(%esp)
+ ret
+weak_alias (__copysignf, copysignf)
diff --git a/sysdeps/libm-i387/s_cos.S b/sysdeps/libm-i387/s_cos.S
new file mode 100644
index 0000000..0ccf8bc
--- /dev/null
+++ b/sysdeps/libm-i387/s_cos.S
@@ -0,0 +1,27 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_cos.S,v 1.5 1995/05/08 23:54:00 jtc Exp $")
+
+ENTRY(__cos)
+ fldl 4(%esp)
+ fcos
+ fnstsw %ax
+ andw $0x400,%ax
+ jnz 1f
+ ret
+1: fldpi
+ fadd %st(0)
+ fxch %st(1)
+2: fprem1
+ fnstsw %ax
+ andw $0x400,%ax
+ jnz 2b
+ fstp %st(1)
+ fcos
+ ret
+weak_alias (__cos, cos)
diff --git a/sysdeps/libm-i387/s_cosf.S b/sysdeps/libm-i387/s_cosf.S
new file mode 100644
index 0000000..a200e04
--- /dev/null
+++ b/sysdeps/libm-i387/s_cosf.S
@@ -0,0 +1,15 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_cosf.S,v 1.3 1995/05/08 23:55:16 jtc Exp $")
+
+/* A float's domain isn't large enough to require argument reduction. */
+ENTRY(__cosf)
+ flds 4(%esp)
+ fcos
+ ret
+weak_alias (__cosf, cosf)
diff --git a/sysdeps/libm-i387/s_finite.S b/sysdeps/libm-i387/s_finite.S
new file mode 100644
index 0000000..a65aa6a
--- /dev/null
+++ b/sysdeps/libm-i387/s_finite.S
@@ -0,0 +1,17 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_finite.S,v 1.4 1995/05/08 23:57:41 jtc Exp $")
+
+ENTRY(__finite)
+ movl 8(%esp),%eax
+ andl $0x7ff00000, %eax
+ cmpl $0x7ff00000, %eax
+ setnel %al
+ andl $0x000000ff, %eax
+ ret
+weak_alias (__finite, finite)
diff --git a/sysdeps/libm-i387/s_finitef.S b/sysdeps/libm-i387/s_finitef.S
new file mode 100644
index 0000000..f842d46
--- /dev/null
+++ b/sysdeps/libm-i387/s_finitef.S
@@ -0,0 +1,17 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_finitef.S,v 1.3 1995/05/09 00:00:02 jtc Exp $")
+
+ENTRY(__finitef)
+ movl 4(%esp),%eax
+ andl $0x7ff00000, %eax
+ cmpl $0x7ff00000, %eax
+ setnel %al
+ andl $0x000000ff, %eax
+ ret
+weak_alias (__finitef, finitef)
diff --git a/sysdeps/libm-i387/s_floor.S b/sysdeps/libm-i387/s_floor.S
new file mode 100644
index 0000000..33d5dbc
--- /dev/null
+++ b/sysdeps/libm-i387/s_floor.S
@@ -0,0 +1,29 @@
+/*
+ * 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)
+ pushl %ebp
+ movl %esp,%ebp
+ subl $8,%esp
+
+ fstcw -12(%ebp) /* store fpu control word */
+ movw -12(%ebp),%dx
+ orw $0x0400,%dx /* round towards -oo */
+ andw $0xf7ff,%dx
+ movw %dx,-16(%ebp)
+ fldcw -16(%ebp) /* load modfied control word */
+
+ fldl 8(%ebp); /* round */
+ frndint
+
+ fldcw -12(%ebp) /* restore original control word */
+
+ leave
+ ret
+weak_alias (__floor, floor)
diff --git a/sysdeps/libm-i387/s_floorf.S b/sysdeps/libm-i387/s_floorf.S
new file mode 100644
index 0000000..dd290fa
--- /dev/null
+++ b/sysdeps/libm-i387/s_floorf.S
@@ -0,0 +1,29 @@
+/*
+ * 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)
+ pushl %ebp
+ movl %esp,%ebp
+ subl $8,%esp
+
+ fstcw -12(%ebp) /* store fpu control word */
+ movw -12(%ebp),%dx
+ orw $0x0400,%dx /* round towards -oo */
+ andw $0xf7ff,%dx
+ movw %dx,-16(%ebp)
+ fldcw -16(%ebp) /* load modfied control word */
+
+ flds 8(%ebp); /* round */
+ frndint
+
+ fldcw -12(%ebp) /* restore original control word */
+
+ leave
+ ret
+weak_alias (__floorf, floorf)
diff --git a/sysdeps/libm-i387/s_ilogb.S b/sysdeps/libm-i387/s_ilogb.S
new file mode 100644
index 0000000..f11ed58
--- /dev/null
+++ b/sysdeps/libm-i387/s_ilogb.S
@@ -0,0 +1,24 @@
+/*
+ * 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(__ilogb)
+ pushl %ebp
+ movl %esp,%ebp
+ subl $4,%esp
+
+ fldl 8(%ebp)
+ fxtract
+ fstpl %st
+
+ fistpl -4(%ebp)
+ movl -4(%ebp),%eax
+
+ leave
+ ret
+weak_alias (__ilogb, ilogb)
diff --git a/sysdeps/libm-i387/s_ilogbf.S b/sysdeps/libm-i387/s_ilogbf.S
new file mode 100644
index 0000000..5a61d28
--- /dev/null
+++ b/sysdeps/libm-i387/s_ilogbf.S
@@ -0,0 +1,24 @@
+/*
+ * 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(__ilogbf)
+ pushl %ebp
+ movl %esp,%ebp
+ subl $4,%esp
+
+ flds 8(%ebp)
+ fxtract
+ fstpl %st
+
+ fistpl -4(%ebp)
+ movl -4(%ebp),%eax
+
+ leave
+ ret
+weak_alias (__ilogbf, ilogbf)
diff --git a/sysdeps/libm-i387/s_log1p.S b/sysdeps/libm-i387/s_log1p.S
new file mode 100644
index 0000000..c4aee4a
--- /dev/null
+++ b/sysdeps/libm-i387/s_log1p.S
@@ -0,0 +1,23 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $")
+
+/*
+ * Since the fyl2xp1 instruction has such a limited range:
+ * -(1 - (sqrt(2) / 2)) <= x <= sqrt(2) - 1
+ * it's not worth trying to use it.
+ */
+
+ENTRY(__log1p)
+ fldln2
+ fldl 4(%esp)
+ fld1
+ faddp
+ fyl2x
+ ret
+weak_alias (__log1p, log1p)
diff --git a/sysdeps/libm-i387/s_log1pf.S b/sysdeps/libm-i387/s_log1pf.S
new file mode 100644
index 0000000..e268550
--- /dev/null
+++ b/sysdeps/libm-i387/s_log1pf.S
@@ -0,0 +1,23 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_log1pf.S,v 1.4 1995/05/09 00:13:05 jtc Exp $")
+
+/*
+ * Since the fyl2xp1 instruction has such a limited range:
+ * -(1 - (sqrt(2) / 2)) <= x <= sqrt(2) - 1
+ * it's not worth trying to use it.
+ */
+
+ENTRY(__log1pf)
+ fldln2
+ flds 4(%esp)
+ fld1
+ faddp
+ fyl2x
+ ret
+weak_alias (__log1pf, log1pf)
diff --git a/sysdeps/libm-i387/s_logb.S b/sysdeps/libm-i387/s_logb.S
new file mode 100644
index 0000000..4f071e0
--- /dev/null
+++ b/sysdeps/libm-i387/s_logb.S
@@ -0,0 +1,15 @@
+/*
+ * 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
+ fstpl %st
+ ret
+weak_alias (__logb, logb)
diff --git a/sysdeps/libm-i387/s_logbf.S b/sysdeps/libm-i387/s_logbf.S
new file mode 100644
index 0000000..ecdd0ae
--- /dev/null
+++ b/sysdeps/libm-i387/s_logbf.S
@@ -0,0 +1,15 @@
+/*
+ * 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
+ fstpl %st
+ ret
+weak_alias (__logbf, logbf)
diff --git a/sysdeps/libm-i387/s_rint.S b/sysdeps/libm-i387/s_rint.S
new file mode 100644
index 0000000..2f09a47
--- /dev/null
+++ b/sysdeps/libm-i387/s_rint.S
@@ -0,0 +1,14 @@
+/*
+ * 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
+weak_alias (__rint, rint)
diff --git a/sysdeps/libm-i387/s_rintf.S b/sysdeps/libm-i387/s_rintf.S
new file mode 100644
index 0000000..de64d79
--- /dev/null
+++ b/sysdeps/libm-i387/s_rintf.S
@@ -0,0 +1,14 @@
+/*
+ * 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
+weak_alias (__rintf, rintf)
diff --git a/sysdeps/libm-i387/s_scalbn.S b/sysdeps/libm-i387/s_scalbn.S
new file mode 100644
index 0000000..99ecac6
--- /dev/null
+++ b/sysdeps/libm-i387/s_scalbn.S
@@ -0,0 +1,15 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/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
+ ret
+weak_alias (__scalbn, scalbn)
diff --git a/sysdeps/libm-i387/s_scalbnf.S b/sysdeps/libm-i387/s_scalbnf.S
new file mode 100644
index 0000000..0203e91
--- /dev/null
+++ b/sysdeps/libm-i387/s_scalbnf.S
@@ -0,0 +1,15 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/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
+ ret
+weak_alias (__scalbnf, scalbnf)
diff --git a/sysdeps/libm-i387/s_significand.S b/sysdeps/libm-i387/s_significand.S
new file mode 100644
index 0000000..09f3a0a
--- /dev/null
+++ b/sysdeps/libm-i387/s_significand.S
@@ -0,0 +1,15 @@
+/*
+ * 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
+ fstpl %st(1)
+ ret
+weak_alias (__significand, significand)
diff --git a/sysdeps/libm-i387/s_significandf.S b/sysdeps/libm-i387/s_significandf.S
new file mode 100644
index 0000000..b678bc5
--- /dev/null
+++ b/sysdeps/libm-i387/s_significandf.S
@@ -0,0 +1,15 @@
+/*
+ * 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
+ fstpl %st(1)
+ ret
+weak_alias (__significandf, significandf)
diff --git a/sysdeps/libm-i387/s_sin.S b/sysdeps/libm-i387/s_sin.S
new file mode 100644
index 0000000..7928495
--- /dev/null
+++ b/sysdeps/libm-i387/s_sin.S
@@ -0,0 +1,27 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_sin.S,v 1.5 1995/05/09 00:25:54 jtc Exp $")
+
+ENTRY(__sin)
+ fldl 4(%esp)
+ fsin
+ fnstsw %ax
+ andw $0x400,%ax
+ jnz 1f
+ ret
+1: fldpi
+ fadd %st(0)
+ fxch %st(1)
+2: fprem1
+ fnstsw %ax
+ andw $0x400,%ax
+ jnz 2b
+ fstp %st(1)
+ fsin
+ ret
+weak_alias (__sin, sin)
diff --git a/sysdeps/libm-i387/s_sinf.S b/sysdeps/libm-i387/s_sinf.S
new file mode 100644
index 0000000..03a42cb
--- /dev/null
+++ b/sysdeps/libm-i387/s_sinf.S
@@ -0,0 +1,15 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_sinf.S,v 1.3 1995/05/09 00:27:53 jtc Exp $")
+
+/* A float's domain isn't large enough to require argument reduction. */
+ENTRY(__sinf)
+ flds 4(%esp)
+ fsin
+ ret
+weak_alias (__sinf, sinf)
diff --git a/sysdeps/libm-i387/s_tan.S b/sysdeps/libm-i387/s_tan.S
new file mode 100644
index 0000000..9474c8c
--- /dev/null
+++ b/sysdeps/libm-i387/s_tan.S
@@ -0,0 +1,29 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_tan.S,v 1.5 1995/05/09 00:30:00 jtc Exp $")
+
+ENTRY(__tan)
+ fldl 4(%esp)
+ fptan
+ fnstsw %ax
+ andw $0x400,%ax
+ jnz 1f
+ fstp %st(0)
+ ret
+1: fldpi
+ fadd %st(0)
+ fxch %st(1)
+2: fprem1
+ fstsw %ax
+ andw $0x400,%ax
+ jnz 2b
+ fstp %st(1)
+ fptan
+ fstp %st(0)
+ ret
+weak_alias (__tan, tan)
diff --git a/sysdeps/libm-i387/s_tanf.S b/sysdeps/libm-i387/s_tanf.S
new file mode 100644
index 0000000..3296434
--- /dev/null
+++ b/sysdeps/libm-i387/s_tanf.S
@@ -0,0 +1,16 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_tanf.S,v 1.3 1995/05/09 00:31:09 jtc Exp $")
+
+/* A float's domain isn't large enough to require argument reduction. */
+ENTRY(__tanf)
+ flds 4(%esp)
+ fptan
+ fstp %st(0)
+ ret
+weak_alias (__tanf, tanf)