about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-03-17 04:04:21 +0000
committerUlrich Drepper <drepper@redhat.com>1997-03-17 04:04:21 +0000
commit87a5e8a7a45739d16aa4215bb038e8f5e76dc589 (patch)
tree7c3ada118ec5d1dff6c6dc9efee33b7ebdd9fba7
parenta2a3fc55fd2b5db4045c117e5508b3d1176bb066 (diff)
downloadglibc-87a5e8a7a45739d16aa4215bb038e8f5e76dc589.tar.gz
glibc-87a5e8a7a45739d16aa4215bb038e8f5e76dc589.tar.xz
glibc-87a5e8a7a45739d16aa4215bb038e8f5e76dc589.zip
Fix bug in FPU stack handling.
-rw-r--r--sysdeps/libm-i387/e_acos.S14
-rw-r--r--sysdeps/libm-i387/e_acosf.S2
-rw-r--r--sysdeps/libm-i387/e_acosl.S2
-rw-r--r--sysdeps/libm-i387/e_asin.S2
-rw-r--r--sysdeps/libm-i387/e_asinf.S2
-rw-r--r--sysdeps/libm-i387/e_asinl.S2
-rw-r--r--sysdeps/libm-i387/e_exp.S3
-rw-r--r--sysdeps/libm-i387/e_expf.S3
-rw-r--r--sysdeps/libm-i387/e_expl.S3
-rw-r--r--sysdeps/libm-i387/s_scalbn.S1
-rw-r--r--sysdeps/libm-i387/s_scalbnf.S1
-rw-r--r--sysdeps/libm-i387/s_scalbnl.S1
12 files changed, 21 insertions, 15 deletions
diff --git a/sysdeps/libm-i387/e_acos.S b/sysdeps/libm-i387/e_acos.S
index becae36d5e..b9d07b1091 100644
--- a/sysdeps/libm-i387/e_acos.S
+++ b/sysdeps/libm-i387/e_acos.S
@@ -10,12 +10,12 @@ 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
+	fld	%st			/* x : x */
+	fmul	%st(0)			/* x^2 : x */
+	fld1				/* 1 : x^2 : x */
+	fsubp				/* 1 - x^2 : x */
+	fsqrt				/* sqrt (1 - x^2) : x */
+	fxch	%st(1)			/* x : sqrt (1 - x^2) */
+	fpatan				/* atan (sqrt(1 - x^2) / x) */
 	ret
 END (__ieee754_acos)
diff --git a/sysdeps/libm-i387/e_acosf.S b/sysdeps/libm-i387/e_acosf.S
index 87ee2fb5bc..50b13fd1bd 100644
--- a/sysdeps/libm-i387/e_acosf.S
+++ b/sysdeps/libm-i387/e_acosf.S
@@ -11,7 +11,7 @@ RCSID("$NetBSD: $")
 /* acos = atan (sqrt(1 - x^2) / x) */
 ENTRY(__ieee754_acosf)
 	flds	4(%esp)			/* x */
-	fst	%st(1)
+	fld	%st
 	fmul	%st(0)			/* x^2 */
 	fld1
 	fsubp				/* 1 - x^2 */
diff --git a/sysdeps/libm-i387/e_acosl.S b/sysdeps/libm-i387/e_acosl.S
index e8f97485de..d69f056556 100644
--- a/sysdeps/libm-i387/e_acosl.S
+++ b/sysdeps/libm-i387/e_acosl.S
@@ -11,7 +11,7 @@
 /* acosl = atanl (sqrtl(1 - x^2) / x) */
 ENTRY(__ieee754_acosl)
 	fldt	4(%esp)			/* x */
-	fst	%st(1)
+	fld	%st
 	fmul	%st(0)			/* x^2 */
 	fld1
 	fsubp				/* 1 - x^2 */
diff --git a/sysdeps/libm-i387/e_asin.S b/sysdeps/libm-i387/e_asin.S
index 1202753d9b..945e308245 100644
--- a/sysdeps/libm-i387/e_asin.S
+++ b/sysdeps/libm-i387/e_asin.S
@@ -10,7 +10,7 @@ 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)
+	fld	%st
 	fmul	%st(0)			/* x^2 */
 	fld1
 	fsubp				/* 1 - x^2 */
diff --git a/sysdeps/libm-i387/e_asinf.S b/sysdeps/libm-i387/e_asinf.S
index d2159bac37..d450e9a740 100644
--- a/sysdeps/libm-i387/e_asinf.S
+++ b/sysdeps/libm-i387/e_asinf.S
@@ -11,7 +11,7 @@ RCSID("$NetBSD: $")
 /* asin = atan (x / sqrt(1 - x^2)) */
 ENTRY(__ieee754_asinf)
 	flds	4(%esp)			/* x */
-	fst	%st(1)
+	fld	%st
 	fmul	%st(0)			/* x^2 */
 	fld1
 	fsubp				/* 1 - x^2 */
diff --git a/sysdeps/libm-i387/e_asinl.S b/sysdeps/libm-i387/e_asinl.S
index ab421f3189..3919fbcf58 100644
--- a/sysdeps/libm-i387/e_asinl.S
+++ b/sysdeps/libm-i387/e_asinl.S
@@ -12,7 +12,7 @@ RCSID("$NetBSD: $")
 /* asinl = atanl (x / sqrtl(1 - x^2)) */
 ENTRY(__ieee754_asinl)
 	fldt	4(%esp)			/* x */
-	fst	%st(1)
+	fld	%st
 	fmul	%st(0)			/* x^2 */
 	fld1
 	fsubp				/* 1 - x^2 */
diff --git a/sysdeps/libm-i387/e_exp.S b/sysdeps/libm-i387/e_exp.S
index e76b9c63df..4a75fa1d1c 100644
--- a/sysdeps/libm-i387/e_exp.S
+++ b/sysdeps/libm-i387/e_exp.S
@@ -22,7 +22,7 @@ ENTRY(__ieee754_exp)
 	je	1f			/* Is +-Inf, jump.  */
 	fldl2e
 	fmulp				/* x * log2(e) */
-	fstl	%st(1)
+	fld	%st
 	frndint				/* int(x * log2(e)) */
 	fsubr	%st,%st(1)		/* fract(x * log2(e)) */
 	fxch
@@ -35,6 +35,7 @@ ENTRY(__ieee754_exp)
 
 1:	testl	$0x200, %eax		/* Test sign.  */
 	jz	2f			/* If positive, jump.  */
+	fstp	%st
 	fldz				/* Set result to 0.  */
 2:	ret
 END (__ieee754_exp)
diff --git a/sysdeps/libm-i387/e_expf.S b/sysdeps/libm-i387/e_expf.S
index 9a669cf8d4..5fd49b89fd 100644
--- a/sysdeps/libm-i387/e_expf.S
+++ b/sysdeps/libm-i387/e_expf.S
@@ -23,7 +23,7 @@ ENTRY(__ieee754_expf)
 	je	1f			/* Is +-Inf, jump.  */
 	fldl2e
 	fmulp				/* x * log2(e) */
-	fstl	%st(1)
+	fld	%st
 	frndint				/* int(x * log2(e)) */
 	fsubr	%st,%st(1)		/* fract(x * log2(e)) */
 	fxch
@@ -36,6 +36,7 @@ ENTRY(__ieee754_expf)
 
 1:	testl	$0x200, %eax		/* Test sign.  */
 	jz	2f			/* If positive, jump.  */
+	fstp	%st
 	fldz				/* Set result to 0.  */
 2:	ret
 END (__ieee754_expf)
diff --git a/sysdeps/libm-i387/e_expl.S b/sysdeps/libm-i387/e_expl.S
index e83d30640d..2bcdf58c58 100644
--- a/sysdeps/libm-i387/e_expl.S
+++ b/sysdeps/libm-i387/e_expl.S
@@ -24,7 +24,7 @@ ENTRY(__ieee754_expl)
 	je	1f			/* Is +-Inf, jump.  */
 	fldl2e
 	fmulp				/* x * log2(e) */
-	fstl	%st(1)
+	fld	%st
 	frndint				/* int(x * log2(e)) */
 	fsubr	%st,%st(1)		/* fract(x * log2(e)) */
 	fxch
@@ -37,6 +37,7 @@ ENTRY(__ieee754_expl)
 
 1:	testl	$0x200, %eax		/* Test sign.  */
 	jz	2f			/* If positive, jump.  */
+	fstp	%st
 	fldz				/* Set result to 0.  */
 2:	ret
 END (__ieee754_expl)
diff --git a/sysdeps/libm-i387/s_scalbn.S b/sysdeps/libm-i387/s_scalbn.S
index 3ec56d4523..709b7a47f5 100644
--- a/sysdeps/libm-i387/s_scalbn.S
+++ b/sysdeps/libm-i387/s_scalbn.S
@@ -11,6 +11,7 @@ ENTRY(__scalbn)
 	fildl	12(%esp)
 	fldl	4(%esp)
 	fscale
+	fstp	%st(1)
 	ret
 END (__scalbn)
 weak_alias (__scalbn, scalbn)
diff --git a/sysdeps/libm-i387/s_scalbnf.S b/sysdeps/libm-i387/s_scalbnf.S
index b1a1c46b6c..ce92113844 100644
--- a/sysdeps/libm-i387/s_scalbnf.S
+++ b/sysdeps/libm-i387/s_scalbnf.S
@@ -11,6 +11,7 @@ ENTRY(__scalbnf)
 	fildl	8(%esp)
 	flds	4(%esp)
 	fscale
+	fstp	%st(1)
 	ret
 END (__scalbnf)
 weak_alias (__scalbnf, scalbnf)
diff --git a/sysdeps/libm-i387/s_scalbnl.S b/sysdeps/libm-i387/s_scalbnl.S
index 0f3323803c..09e06457b8 100644
--- a/sysdeps/libm-i387/s_scalbnl.S
+++ b/sysdeps/libm-i387/s_scalbnl.S
@@ -12,6 +12,7 @@ ENTRY(__scalbnl)
 	fildl	16(%esp)
 	fldt	4(%esp)
 	fscale
+	fstp	%st(1)
 	ret
 END (__scalbnl)
 weak_alias (__scalbnl, scalbnl)