summaryrefslogtreecommitdiff
path: root/sysdeps/i386/fpu
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/i386/fpu')
-rw-r--r--sysdeps/i386/fpu/bits/mathinline.h4
-rw-r--r--sysdeps/i386/fpu/e_fmod.S2
-rw-r--r--sysdeps/i386/fpu/e_fmodf.S2
-rw-r--r--sysdeps/i386/fpu/e_fmodl.c2
-rw-r--r--sysdeps/i386/fpu/e_log.S11
-rw-r--r--sysdeps/i386/fpu/e_logf.S11
-rw-r--r--sysdeps/i386/fpu/e_logl.S11
-rw-r--r--sysdeps/i386/fpu/e_pow.S18
-rw-r--r--sysdeps/i386/fpu/e_powf.S18
-rw-r--r--sysdeps/i386/fpu/e_powl.S18
10 files changed, 65 insertions, 32 deletions
diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/i386/fpu/bits/mathinline.h
index 28547d44b8..a0f630e240 100644
--- a/sysdeps/i386/fpu/bits/mathinline.h
+++ b/sysdeps/i386/fpu/bits/mathinline.h
@@ -1,5 +1,5 @@
/* Inline math functions for i387.
- Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2006
+ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2003,2004,2006,2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@math.ualberta.ca>, 1995.
@@ -26,7 +26,7 @@
#ifdef __cplusplus
# define __MATH_INLINE __inline
#else
-# define __MATH_INLINE extern __inline
+# define __MATH_INLINE __extern_inline
#endif
diff --git a/sysdeps/i386/fpu/e_fmod.S b/sysdeps/i386/fpu/e_fmod.S
index e801286a9b..4cf6e92054 100644
--- a/sysdeps/i386/fpu/e_fmod.S
+++ b/sysdeps/i386/fpu/e_fmod.S
@@ -10,7 +10,7 @@ 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: fprem1
+1: fprem
fstsw %ax
sahf
jp 1b
diff --git a/sysdeps/i386/fpu/e_fmodf.S b/sysdeps/i386/fpu/e_fmodf.S
index 1850af098e..bbce40976d 100644
--- a/sysdeps/i386/fpu/e_fmodf.S
+++ b/sysdeps/i386/fpu/e_fmodf.S
@@ -11,7 +11,7 @@ RCSID("$NetBSD: $")
ENTRY(__ieee754_fmodf)
flds 8(%esp)
flds 4(%esp)
-1: fprem1
+1: fprem
fstsw %ax
sahf
jp 1b
diff --git a/sysdeps/i386/fpu/e_fmodl.c b/sysdeps/i386/fpu/e_fmodl.c
index 97a06d0016..c7c9a60456 100644
--- a/sysdeps/i386/fpu/e_fmodl.c
+++ b/sysdeps/i386/fpu/e_fmodl.c
@@ -12,7 +12,7 @@ __ieee754_fmodl (long double x, long double y)
{
long double res;
- asm ("1:\tfprem1\n"
+ asm ("1:\tfprem\n"
"fstsw %%ax\n"
"sahf\n"
"jp 1b\n"
diff --git a/sysdeps/i386/fpu/e_log.S b/sysdeps/i386/fpu/e_log.S
index 5604e638f5..ce55b72292 100644
--- a/sysdeps/i386/fpu/e_log.S
+++ b/sysdeps/i386/fpu/e_log.S
@@ -36,11 +36,15 @@ limit: .double 0.29
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)
- fsubl MO(one) // x-1 : 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)
@@ -54,4 +58,9 @@ ENTRY(__ieee754_log)
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)
diff --git a/sysdeps/i386/fpu/e_logf.S b/sysdeps/i386/fpu/e_logf.S
index 128bb2754c..cd4538b594 100644
--- a/sysdeps/i386/fpu/e_logf.S
+++ b/sysdeps/i386/fpu/e_logf.S
@@ -37,11 +37,15 @@ limit: .double 0.29
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)
- fsubl MO(one) // x-1 : 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)
@@ -55,4 +59,9 @@ ENTRY(__ieee754_logf)
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)
diff --git a/sysdeps/i386/fpu/e_logl.S b/sysdeps/i386/fpu/e_logl.S
index 5023d3012f..551dcf1e46 100644
--- a/sysdeps/i386/fpu/e_logl.S
+++ b/sysdeps/i386/fpu/e_logl.S
@@ -37,11 +37,15 @@ limit: .double 0.29
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)
- fsubl MO(one) // x-1 : 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)
@@ -55,4 +59,9 @@ ENTRY(__ieee754_logl)
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_logl)
diff --git a/sysdeps/i386/fpu/e_pow.S b/sysdeps/i386/fpu/e_pow.S
index c554ca4ecb..792f926902 100644
--- a/sysdeps/i386/fpu/e_pow.S
+++ b/sysdeps/i386/fpu/e_pow.S
@@ -1,5 +1,5 @@
/* ix87 specific implementation of pow function.
- Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005
+ Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -161,10 +161,11 @@ ENTRY(__ieee754_pow)
2: /* y is a real number. */
fxch // x : y
fldl MO(one) // 1.0 : x : y
- fld %st(1) // x : 1.0 : x : y
- fsub %st(1) // x-1 : 1.0 : x : y
- fabs // |x-1| : 1.0 : x : y
- fcompl MO(limit) // 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
@@ -197,9 +198,10 @@ ENTRY(__ieee754_pow)
// y == ħinf
.align ALIGNARG(4)
12: fstp %st(0) // pop y
- fldl 4(%esp) // x
- fabs
- fcompl MO(one) // < 1, == 1, or > 1
+ 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
diff --git a/sysdeps/i386/fpu/e_powf.S b/sysdeps/i386/fpu/e_powf.S
index c835b978b9..c91545418d 100644
--- a/sysdeps/i386/fpu/e_powf.S
+++ b/sysdeps/i386/fpu/e_powf.S
@@ -1,5 +1,5 @@
/* ix87 specific implementation of pow function.
- Copyright (C) 1996, 1997, 1999, 2001, 2004, 2005
+ Copyright (C) 1996, 1997, 1999, 2001, 2004, 2005, 2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -155,10 +155,11 @@ ENTRY(__ieee754_powf)
2: /* y is a real number. */
fxch // x : y
fldl MO(one) // 1.0 : x : y
- fld %st(1) // x : 1.0 : x : y
- fsub %st(1) // x-1 : 1.0 : x : y
- fabs // |x-1| : 1.0 : x : y
- fcompl MO(limit) // 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
@@ -191,9 +192,10 @@ ENTRY(__ieee754_powf)
// y == ħinf
.align ALIGNARG(4)
12: fstp %st(0) // pop y
- flds 4(%esp) // x
- fabs
- fcompl MO(one) // < 1, == 1, or > 1
+ 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
diff --git a/sysdeps/i386/fpu/e_powl.S b/sysdeps/i386/fpu/e_powl.S
index 74f422816a..6215496207 100644
--- a/sysdeps/i386/fpu/e_powl.S
+++ b/sysdeps/i386/fpu/e_powl.S
@@ -1,5 +1,5 @@
/* ix87 specific implementation of pow function.
- Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005
+ Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -161,10 +161,11 @@ ENTRY(__ieee754_powl)
2: /* y is a real number. */
fxch // x : y
fldl MO(one) // 1.0 : x : y
- fld %st(1) // x : 1.0 : x : y
- fsub %st(1) // x-1 : 1.0 : x : y
- fabs // |x-1| : 1.0 : x : y
- fcompl MO(limit) // 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
@@ -210,9 +211,10 @@ ENTRY(__ieee754_powl)
// y == ħinf
.align ALIGNARG(4)
12: fstp %st(0) // pop y
- fldt 4(%esp) // x
- fabs
- fcompl MO(one) // < 1, == 1, or > 1
+ 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