Sun Mar 3 08:43:44 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
authorroland <roland>
Tue, 5 Mar 1996 19:09:12 +0000 (19:09 +0000)
committerroland <roland>
Tue, 5 Mar 1996 19:09:12 +0000 (19:09 +0000)
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.

42 files changed:
sysdeps/libm-i387/e_acos.S [new file with mode: 0644]
sysdeps/libm-i387/e_asin.S [new file with mode: 0644]
sysdeps/libm-i387/e_atan2.S [new file with mode: 0644]
sysdeps/libm-i387/e_atan2f.S [new file with mode: 0644]
sysdeps/libm-i387/e_exp.S [new file with mode: 0644]
sysdeps/libm-i387/e_fmod.S [new file with mode: 0644]
sysdeps/libm-i387/e_log.S [new file with mode: 0644]
sysdeps/libm-i387/e_log10.S [new file with mode: 0644]
sysdeps/libm-i387/e_remainder.S [new file with mode: 0644]
sysdeps/libm-i387/e_remainderf.S [new file with mode: 0644]
sysdeps/libm-i387/e_scalb.S [new file with mode: 0644]
sysdeps/libm-i387/e_sqrt.S [new file with mode: 0644]
sysdeps/libm-i387/e_sqrtf.S [new file with mode: 0644]
sysdeps/libm-i387/s_atan.S [new file with mode: 0644]
sysdeps/libm-i387/s_atanf.S [new file with mode: 0644]
sysdeps/libm-i387/s_ceil.S [new file with mode: 0644]
sysdeps/libm-i387/s_ceilf.S [new file with mode: 0644]
sysdeps/libm-i387/s_copysign.S [new file with mode: 0644]
sysdeps/libm-i387/s_copysignf.S [new file with mode: 0644]
sysdeps/libm-i387/s_cos.S [new file with mode: 0644]
sysdeps/libm-i387/s_cosf.S [new file with mode: 0644]
sysdeps/libm-i387/s_finite.S [new file with mode: 0644]
sysdeps/libm-i387/s_finitef.S [new file with mode: 0644]
sysdeps/libm-i387/s_floor.S [new file with mode: 0644]
sysdeps/libm-i387/s_floorf.S [new file with mode: 0644]
sysdeps/libm-i387/s_ilogb.S [new file with mode: 0644]
sysdeps/libm-i387/s_ilogbf.S [new file with mode: 0644]
sysdeps/libm-i387/s_log1p.S [new file with mode: 0644]
sysdeps/libm-i387/s_log1pf.S [new file with mode: 0644]
sysdeps/libm-i387/s_logb.S [new file with mode: 0644]
sysdeps/libm-i387/s_logbf.S [new file with mode: 0644]
sysdeps/libm-i387/s_rint.S [new file with mode: 0644]
sysdeps/libm-i387/s_rintf.S [new file with mode: 0644]
sysdeps/libm-i387/s_scalbn.S [new file with mode: 0644]
sysdeps/libm-i387/s_scalbnf.S [new file with mode: 0644]
sysdeps/libm-i387/s_significand.S [new file with mode: 0644]
sysdeps/libm-i387/s_significandf.S [new file with mode: 0644]
sysdeps/libm-i387/s_sin.S [new file with mode: 0644]
sysdeps/libm-i387/s_sinf.S [new file with mode: 0644]
sysdeps/libm-i387/s_tan.S [new file with mode: 0644]
sysdeps/libm-i387/s_tanf.S [new file with mode: 0644]
sysdeps/libm-ieee754/w_sqrtf.c [new file with mode: 0644]

diff --git a/sysdeps/libm-i387/e_acos.S b/sysdeps/libm-i387/e_acos.S
new file mode 100644 (file)
index 0000000..6ec7785
--- /dev/null
@@ -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 (file)
index 0000000..dfcd7bc
--- /dev/null
@@ -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 (file)
index 0000000..da2e119
--- /dev/null
@@ -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 (file)
index 0000000..21fc0d9
--- /dev/null
@@ -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 (file)
index 0000000..8c41ce0
--- /dev/null
@@ -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 (file)
index 0000000..c02df44
--- /dev/null
@@ -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 (file)
index 0000000..98d569e
--- /dev/null
@@ -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 (file)
index 0000000..612344b
--- /dev/null
@@ -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 (file)
index 0000000..d14f2e8
--- /dev/null
@@ -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 (file)
index 0000000..ed578ea
--- /dev/null
@@ -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 (file)
index 0000000..7d95f8e
--- /dev/null
@@ -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 (file)
index 0000000..34fe9b7
--- /dev/null
@@ -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 (file)
index 0000000..d20c4c1
--- /dev/null
@@ -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 (file)
index 0000000..4dcd54f
--- /dev/null
@@ -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 (file)
index 0000000..d00593d
--- /dev/null
@@ -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 (file)
index 0000000..2fd813d
--- /dev/null
@@ -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 (file)
index 0000000..6458b45
--- /dev/null
@@ -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 (file)
index 0000000..0de3aff
--- /dev/null
@@ -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 (file)
index 0000000..a55cd37
--- /dev/null
@@ -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 (file)
index 0000000..0ccf8bc
--- /dev/null
@@ -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 (file)
index 0000000..a200e04
--- /dev/null
@@ -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 (file)
index 0000000..a65aa6a
--- /dev/null
@@ -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 (file)
index 0000000..f842d46
--- /dev/null
@@ -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 (file)
index 0000000..33d5dbc
--- /dev/null
@@ -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 (file)
index 0000000..dd290fa
--- /dev/null
@@ -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 (file)
index 0000000..f11ed58
--- /dev/null
@@ -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 (file)
index 0000000..5a61d28
--- /dev/null
@@ -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 (file)
index 0000000..c4aee4a
--- /dev/null
@@ -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 (file)
index 0000000..e268550
--- /dev/null
@@ -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 (file)
index 0000000..4f071e0
--- /dev/null
@@ -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 (file)
index 0000000..ecdd0ae
--- /dev/null
@@ -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 (file)
index 0000000..2f09a47
--- /dev/null
@@ -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 (file)
index 0000000..de64d79
--- /dev/null
@@ -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 (file)
index 0000000..99ecac6
--- /dev/null
@@ -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 (file)
index 0000000..0203e91
--- /dev/null
@@ -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 (file)
index 0000000..09f3a0a
--- /dev/null
@@ -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 (file)
index 0000000..b678bc5
--- /dev/null
@@ -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 (file)
index 0000000..7928495
--- /dev/null
@@ -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 (file)
index 0000000..03a42cb
--- /dev/null
@@ -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 (file)
index 0000000..9474c8c
--- /dev/null
@@ -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 (file)
index 0000000..3296434
--- /dev/null
@@ -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)
diff --git a/sysdeps/libm-ieee754/w_sqrtf.c b/sysdeps/libm-ieee754/w_sqrtf.c
new file mode 100644 (file)
index 0000000..f5ccc73
--- /dev/null
@@ -0,0 +1,47 @@
+/* w_sqrtf.c -- float version of w_sqrt.c.
+ * 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: w_sqrtf.c,v 1.3 1995/05/10 20:49:59 jtc Exp $";
+#endif
+
+/* 
+ * wrapper sqrtf(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+       float __sqrtf(float x)          /* wrapper sqrtf */
+#else
+       float sqrt(x)                   /* wrapper sqrtf */
+       float x;
+#endif
+{
+#ifdef _IEEE_LIBM
+       return __ieee754_sqrtf(x);
+#else
+       float z;
+       z = __ieee754_sqrtf(x);
+       if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
+       if(x<(float)0.0) {
+           /* sqrtf(negative) */
+           return (float)__kernel_standard((double)x,(double)x,126);
+       } else
+           return z;
+#endif
+}
+weak_alias (__sqrtf, sqrtf)