From: Ulrich Drepper Date: Mon, 17 Mar 1997 04:04:21 +0000 (+0000) Subject: Fix bug in FPU stack handling. X-Git-Tag: cvs/glibc-2_0_4~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87a5e8a7a45739d16aa4215bb038e8f5e76dc589;p=thirdparty%2Fglibc.git Fix bug in FPU stack handling. --- diff --git a/sysdeps/libm-i387/e_acos.S b/sysdeps/libm-i387/e_acos.S index becae36d5e9..b9d07b10917 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 87ee2fb5bcd..50b13fd1bd7 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 e8f97485dea..d69f0565568 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 1202753d9b1..945e308245b 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 d2159bac372..d450e9a740e 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 ab421f31890..3919fbcf58f 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 e76b9c63dfa..4a75fa1d1c3 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 9a669cf8d4d..5fd49b89fdc 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 e83d30640d5..2bcdf58c589 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 3ec56d45230..709b7a47f54 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 b1a1c46b6c9..ce921138449 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 0f3323803c4..09e06457b81 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)