aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-02-18 09:02:38 +0000
committerUlrich Drepper <drepper@redhat.com>2001-02-18 09:02:38 +0000
commit6571c5709af6e58e3b9a571fc6289be375a1ffe3 (patch)
tree132bbb604a697ea20c92a59631e9bcdbad5d3e81
parent4ebacc5a6284e211976e14e016d1cf90ee2f3837 (diff)
downloadglibc-6571c5709af6e58e3b9a571fc6289be375a1ffe3.tar
glibc-6571c5709af6e58e3b9a571fc6289be375a1ffe3.tar.gz
glibc-6571c5709af6e58e3b9a571fc6289be375a1ffe3.tar.bz2
glibc-6571c5709af6e58e3b9a571fc6289be375a1ffe3.zip
Update.
2001-02-18 Ulrich Drepper <drepper@redhat.com> * math/libm-test.inc (pow_test): Correct expected results for x == +-1. * sysdeps/i386/fpu/e_pow.S: Handle x == +-1 correctly. * sysdeps/i386/fpu/e_powf.S: Likewise. * sysdeps/i386/fpu/e_powl.S: Likewise. * sysdeps/i386/fpu/bits/mathinline.h: Remove pow inline code. * sysdeps/generic/e_exp2l.c: ...this. New file. * sysdeps/i386/fpu/e_exp2.S: ...this. New file. * sysdeps/i386/fpu/e_exp2f.S: ...this. New file. * sysdeps/i386/fpu/e_exp2l.S: ...this. New file. * sysdeps/ieee754/flt-32/e_exp2f.c: ...this. New file. * sysdeps/ieee754/dbl-64/e_exp2.c: ...this. New file. * sysdeps/m68k/fpu/e_exp2.c: ...this. New file. * sysdeps/m68k/fpu/e_exp2f.c: ...this. New file. * sysdeps/m68k/fpu/e_exp2l.c: ...this. New file.
-rw-r--r--ChangeLog27
-rw-r--r--math/libm-test.inc10
-rw-r--r--sysdeps/i386/fpu/bits/mathinline.h52
-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
6 files changed, 66 insertions, 77 deletions
diff --git a/ChangeLog b/ChangeLog
index 4892c83b7a..69474405ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,25 +1,34 @@
+2001-02-18 Ulrich Drepper <drepper@redhat.com>
+
+ * math/libm-test.inc (pow_test): Correct expected results for x == +-1.
+ * sysdeps/i386/fpu/e_pow.S: Handle x == +-1 correctly.
+ * sysdeps/i386/fpu/e_powf.S: Likewise.
+ * sysdeps/i386/fpu/e_powl.S: Likewise.
+
+ * sysdeps/i386/fpu/bits/mathinline.h: Remove pow inline code.
+
2001-02-17 Ulrich Drepper <drepper@redhat.com>
* math/Makefile (libm-calls): It's e_exp2 not s_exp2.
* sysdeps/generic/s_exp2l.c: Renamed to...
- * sysdeps/generic/s_exp2l.c: ...this. New file.
+ * sysdeps/generic/e_exp2l.c: ...this. New file.
* sysdeps/i386/fpu/s_exp2.S: Renamed to...
- * sysdeps/i386/fpu/s_exp2.S: ...this. New file.
+ * sysdeps/i386/fpu/e_exp2.S: ...this. New file.
* sysdeps/i386/fpu/s_exp2f.S: Renamed to...
- * sysdeps/i386/fpu/s_exp2f.S: ...this. New file.
+ * sysdeps/i386/fpu/e_exp2f.S: ...this. New file.
* sysdeps/i386/fpu/s_exp2l.S: Renamed to...
- * sysdeps/i386/fpu/s_exp2l.S: ...this. New file.
+ * sysdeps/i386/fpu/e_exp2l.S: ...this. New file.
* sysdeps/ieee754/flt-32/s_exp2f.c: Renamed to...
- * sysdeps/ieee754/flt-32/s_exp2f.c: ...this. New file.
+ * sysdeps/ieee754/flt-32/e_exp2f.c: ...this. New file.
* sysdeps/ieee754/dbl-64/s_exp2.c: Renamed to...
- * sysdeps/ieee754/dbl-64/s_exp2.c: ...this. New file.
+ * sysdeps/ieee754/dbl-64/e_exp2.c: ...this. New file.
* sysdeps/m68k/fpu/s_exp2.c: Renamed to...
- * sysdeps/m68k/fpu/s_exp2.c: ...this. New file.
+ * sysdeps/m68k/fpu/e_exp2.c: ...this. New file.
* sysdeps/m68k/fpu/s_exp2f.c: Renamed to...
- * sysdeps/m68k/fpu/s_exp2f.c: ...this. New file.
+ * sysdeps/m68k/fpu/e_exp2f.c: ...this. New file.
* sysdeps/m68k/fpu/s_exp2l.c: Renamed to...
- * sysdeps/m68k/fpu/s_exp2l.c: ...this. New file.
+ * sysdeps/m68k/fpu/e_exp2l.c: ...this. New file.
2001-02-17 Andreas Jaeger <aj@suse.de>
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 867efcd493..3928f412f8 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -3468,7 +3468,7 @@ pow_test (void)
TEST_ff_f (pow, nan_value, nan_value, nan_value);
TEST_ff_f (pow, 0, nan_value, nan_value);
- TEST_ff_f (pow, 1, nan_value, nan_value);
+ TEST_ff_f (pow, 1, nan_value, 1);
TEST_ff_f (pow, -1, nan_value, nan_value);
TEST_ff_f (pow, nan_value, 1, nan_value);
TEST_ff_f (pow, nan_value, -1, nan_value);
@@ -3476,10 +3476,10 @@ pow_test (void)
/* pow (x, NaN) == NaN. */
TEST_ff_f (pow, 3.0, nan_value, nan_value);
- TEST_ff_f (pow, 1, plus_infty, nan_value, INVALID_EXCEPTION);
- TEST_ff_f (pow, -1, plus_infty, nan_value, INVALID_EXCEPTION);
- TEST_ff_f (pow, 1, minus_infty, nan_value, INVALID_EXCEPTION);
- TEST_ff_f (pow, -1, minus_infty, nan_value, INVALID_EXCEPTION);
+ TEST_ff_f (pow, 1, plus_infty, 1);
+ TEST_ff_f (pow, -1, plus_infty, 1);
+ TEST_ff_f (pow, 1, minus_infty, 1);
+ TEST_ff_f (pow, -1, minus_infty, 1);
TEST_ff_f (pow, -0.1L, 1.1L, nan_value, INVALID_EXCEPTION);
TEST_ff_f (pow, -0.1L, -1.1L, nan_value, INVALID_EXCEPTION);
diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/i386/fpu/bits/mathinline.h
index e79713dfd5..3539231376 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,96,97,98,99,2000 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@math.ualberta.ca>, 1995.
@@ -413,56 +413,6 @@ __inline_mathcodeNP (tan, __x, \
("fptan" \
: "=t" (__value2), "=u" (__value) : "0" (__x)); \
return __value)
-
-
-__inline_mathcodeNP2 (pow, __x, __y, \
- register long double __value; \
- register long double __exponent; \
- __extension__ long long int __p = (long long int) __y; \
- if (__x == 0.0) \
- { \
- if (__y > 0.0) \
- return __y == (double) __p && (__p & 1) != 0 ? __x : 0.0; \
- else if (__y < 0.0) \
- return (__y == (double) __p && (-__p & 1) != 0 \
- ? 1.0 / __x : 1.0 / fabs (__x)); \
- } \
- if (__y == (double) __p) \
- { \
- long double __r = 1.0; \
- if (__p == 0) \
- return 1.0; \
- if (__p < 0) \
- { \
- __p = -__p; \
- __x = 1.0 / __x; \
- } \
- while (1) \
- { \
- if (__p & 1) \
- __r *= __x; \
- __p >>= 1; \
- if (__p == 0) \
- return __r; \
- __x *= __x; \
- } \
- /* NOTREACHED */ \
- } \
- __asm __volatile__ \
- ("fyl2x" : "=t" (__value) : "0" (__x), "u" (1.0) : "st(1)"); \
- __asm __volatile__ \
- ("fmul %%st(1) # y * log2(x)\n\t" \
- "fst %%st(1)\n\t" \
- "frndint # int(y * log2(x))\n\t" \
- "fxch\n\t" \
- "fsub %%st(1) # fract(y * log2(x))\n\t" \
- "f2xm1 # 2^(fract(y * log2(x))) - 1\n\t" \
- : "=t" (__value), "=u" (__exponent) : "0" (__y), "1" (__value)); \
- __value += 1.0; \
- __asm __volatile__ \
- ("fscale" \
- : "=t" (__value) : "0" (__value), "u" (__exponent)); \
- return __value)
#endif /* __FAST_MATH__ */
diff --git a/sysdeps/i386/fpu/e_pow.S b/sysdeps/i386/fpu/e_pow.S
index 75b39e4884..842faaba85 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 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -130,7 +130,18 @@ ENTRY(__ieee754_pow)
orl %edx, %ecx
jnz 6b
fstp %st(0) // ST*x
-30: ret
+ ret
+
+ /* y is ±NAN */
+30: fldl 4(%esp) // x : y
+ fldl MO(one) // 1.0 : x : y
+ fucomp %st(1) // x : y
+ fnstsw
+ sahf
+ je 31f
+ fxch // y : x
+31: fstp %st(1)
+ ret
.align ALIGNARG(4)
2: /* y is a real number. */
@@ -189,8 +200,7 @@ ENTRY(__ieee754_pow)
ret
.align ALIGNARG(4)
-14: fldl MO(infinity)
- fmull MO(zero) // raise invalid exception
+14: fldl MO(one)
ret
.align ALIGNARG(4)
diff --git a/sysdeps/i386/fpu/e_powf.S b/sysdeps/i386/fpu/e_powf.S
index c023c11e65..30f262e843 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 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -125,7 +125,18 @@ ENTRY(__ieee754_powf)
testl %edx, %edx
jnz 6b
fstp %st(0) // ST*x
-30: ret
+ ret
+
+ /* y is ±NAN */
+30: flds 4(%esp) // x : y
+ fldl MO(one) // 1.0 : x : y
+ fucomp %st(1) // x : y
+ fnstsw
+ sahf
+ je 31f
+ fxch // y : x
+31: fstp %st(1)
+ ret
.align ALIGNARG(4)
2: /* y is a real number. */
@@ -184,8 +195,7 @@ ENTRY(__ieee754_powf)
ret
.align ALIGNARG(4)
-14: fldl MO(infinity)
- fmull MO(zero) // raise invalid exception
+14: fldl MO(one)
ret
.align ALIGNARG(4)
diff --git a/sysdeps/i386/fpu/e_powl.S b/sysdeps/i386/fpu/e_powl.S
index 769be4c197..c6aa731423 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 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -130,7 +130,18 @@ ENTRY(__ieee754_powl)
orl %edx, %ecx
jnz 6b
fstp %st(0) // ST*x
-30: ret
+ ret
+
+ /* y is ±NAN */
+30: fldt 4(%esp) // x : y
+ fldl MO(one) // 1.0 : x : y
+ fucomp %st(1) // x : y
+ fnstsw
+ sahf
+ je 31f
+ fxch // y : x
+31: fstp %st(1)
+ ret
.align ALIGNARG(4)
2: /* y is a real number. */
@@ -189,8 +200,7 @@ ENTRY(__ieee754_powl)
ret
.align ALIGNARG(4)
-14: fldl MO(infinity)
- fmull MO(zero) // raise invalid exception
+14: fldl MO(one)
ret
.align ALIGNARG(4)