summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2006-08-23 22:25:57 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2006-08-23 22:25:57 +0000
commit970ebe57ef4ef40026beadbad4a48c87aab8dffd (patch)
tree50599ce5e7078a8c11bf50f09daf75057fff70ce
parentdcae595f76824c4f08be274a0b8a121005bde66a (diff)
* sysdeps/generic/e_exp2l.c: Update from mainline glibc.
* sysdeps/mips/mips64/n32/Implies: Add mips/mips64/soft-fp. * sysdeps/mips/mips64/n64/Implies: Likewise. * sysdeps/mips/mips64/soft-fp/Makefile: New. * sysdeps/mips/mips64/soft-fp/e_sqrtl.c: New. * sysdeps/mips/mips64/soft-fp/sfp-machine.h: Include <fenv.h> and <fpu_control.h>. Use hardware exception and rounding mode settings. * soft-fp/quad.h (_FP_UNION_Q): Use _FP_W_TYPE for frac bit-fields. git-svn-id: svn://svn.eglibc.org/branches/eglibc-2_3@64 7b3dc134-2b1b-0410-93df-9e9f96275f8d
-rw-r--r--libc/ChangeLog.eglibc13
-rw-r--r--libc/soft-fp/quad.h8
-rw-r--r--libc/sysdeps/generic/e_exp2l.c12
-rw-r--r--libc/sysdeps/mips/mips64/n32/Implies1
-rw-r--r--libc/sysdeps/mips/mips64/n64/Implies1
-rw-r--r--libc/sysdeps/mips/mips64/soft-fp/Makefile3
-rw-r--r--libc/sysdeps/mips/mips64/soft-fp/e_sqrtl.c39
-rw-r--r--libc/sysdeps/mips/mips64/soft-fp/sfp-machine.h37
8 files changed, 97 insertions, 17 deletions
diff --git a/libc/ChangeLog.eglibc b/libc/ChangeLog.eglibc
index bd3bf01d3..f453813b7 100644
--- a/libc/ChangeLog.eglibc
+++ b/libc/ChangeLog.eglibc
@@ -1,5 +1,18 @@
2006-08-23 Joseph Myers <joseph@codesourcery.com>
+ * sysdeps/generic/e_exp2l.c: Update from mainline glibc.
+ * sysdeps/mips/mips64/n32/Implies: Add mips/mips64/soft-fp.
+ * sysdeps/mips/mips64/n64/Implies: Likewise.
+ * sysdeps/mips/mips64/soft-fp/Makefile: New.
+ * sysdeps/mips/mips64/soft-fp/e_sqrtl.c: New.
+ * sysdeps/mips/mips64/soft-fp/sfp-machine.h: Include <fenv.h> and
+ <fpu_control.h>. Use hardware exception and rounding mode
+ settings.
+ * soft-fp/quad.h (_FP_UNION_Q): Use _FP_W_TYPE for frac
+ bit-fields.
+
+2006-08-23 Joseph Myers <joseph@codesourcery.com>
+
* sysdeps/unix/sysv/linux/mips/bits/resource.h (RLIM_INFINITY,
RLIM64_INFINITY): Define appropriately for N64. Use unsigned
types.
diff --git a/libc/soft-fp/quad.h b/libc/soft-fp/quad.h
index 33ee4d4b2..cf60e2037 100644
--- a/libc/soft-fp/quad.h
+++ b/libc/soft-fp/quad.h
@@ -137,11 +137,11 @@ union _FP_UNION_Q
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned sign : 1;
unsigned exp : _FP_EXPBITS_Q;
- unsigned long frac1 : _FP_FRACBITS_Q-(_FP_IMPLBIT_Q != 0)-_FP_W_TYPE_SIZE;
- unsigned long frac0 : _FP_W_TYPE_SIZE;
+ _FP_W_TYPE frac1 : _FP_FRACBITS_Q-(_FP_IMPLBIT_Q != 0)-_FP_W_TYPE_SIZE;
+ _FP_W_TYPE frac0 : _FP_W_TYPE_SIZE;
#else
- unsigned long frac0 : _FP_W_TYPE_SIZE;
- unsigned long frac1 : _FP_FRACBITS_Q-(_FP_IMPLBIT_Q != 0)-_FP_W_TYPE_SIZE;
+ _FP_W_TYPE frac0 : _FP_W_TYPE_SIZE;
+ _FP_W_TYPE frac1 : _FP_FRACBITS_Q-(_FP_IMPLBIT_Q != 0)-_FP_W_TYPE_SIZE;
unsigned exp : _FP_EXPBITS_Q;
unsigned sign : 1;
#endif
diff --git a/libc/sysdeps/generic/e_exp2l.c b/libc/sysdeps/generic/e_exp2l.c
index 64ef6d3d5..7e598d8d2 100644
--- a/libc/sysdeps/generic/e_exp2l.c
+++ b/libc/sysdeps/generic/e_exp2l.c
@@ -1,14 +1,10 @@
#include <math.h>
-#include <stdio.h>
-#include <errno.h>
+#include "math_private.h"
long double
__ieee754_exp2l (long double x)
{
- fputs ("__ieee754_exp2l not implemented\n", stderr);
- __set_errno (ENOSYS);
- return 0.0;
+ /* This is a very stupid and inprecise implementation. It'll get
+ replaced sometime (soon?). */
+ return __ieee754_expl (M_LN2l * x);
}
-
-stub_warning (exp2l)
-#include <stub-tag.h>
diff --git a/libc/sysdeps/mips/mips64/n32/Implies b/libc/sysdeps/mips/mips64/n32/Implies
index a7cb280ec..bed8f14c3 100644
--- a/libc/sysdeps/mips/mips64/n32/Implies
+++ b/libc/sysdeps/mips/mips64/n32/Implies
@@ -1,4 +1,5 @@
ieee754/ldbl-128
+mips/mips64/soft-fp
mips/mips64
mips
wordsize-32
diff --git a/libc/sysdeps/mips/mips64/n64/Implies b/libc/sysdeps/mips/mips64/n64/Implies
index e50778678..214b85c77 100644
--- a/libc/sysdeps/mips/mips64/n64/Implies
+++ b/libc/sysdeps/mips/mips64/n64/Implies
@@ -1,4 +1,5 @@
ieee754/ldbl-128
+mips/mips64/soft-fp
mips/mips64
mips
wordsize-64
diff --git a/libc/sysdeps/mips/mips64/soft-fp/Makefile b/libc/sysdeps/mips/mips64/soft-fp/Makefile
new file mode 100644
index 000000000..ada13e8b7
--- /dev/null
+++ b/libc/sysdeps/mips/mips64/soft-fp/Makefile
@@ -0,0 +1,3 @@
+ifeq ($(subdir),math)
+CPPFLAGS += -I../soft-fp
+endif
diff --git a/libc/sysdeps/mips/mips64/soft-fp/e_sqrtl.c b/libc/sysdeps/mips/mips64/soft-fp/e_sqrtl.c
new file mode 100644
index 000000000..81fd58ae1
--- /dev/null
+++ b/libc/sysdeps/mips/mips64/soft-fp/e_sqrtl.c
@@ -0,0 +1,39 @@
+/* long double square root in software floating-point emulation.
+ Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com) and
+ Jakub Jelinek (jj@ultra.linux.cz).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdlib.h>
+#include <soft-fp.h>
+#include <quad.h>
+
+long double
+__ieee754_sqrtl (const long double a)
+{
+ FP_DECL_EX;
+ FP_DECL_Q(A); FP_DECL_Q(C);
+ long double c;
+
+ FP_INIT_ROUNDMODE;
+ FP_UNPACK_Q(A, a);
+ FP_SQRT_Q(C, A);
+ FP_PACK_Q(c, C);
+ FP_HANDLE_EXCEPTIONS;
+ return c;
+}
diff --git a/libc/sysdeps/mips/mips64/soft-fp/sfp-machine.h b/libc/sysdeps/mips/mips64/soft-fp/sfp-machine.h
index 309a14a5f..9c1ee3b2a 100644
--- a/libc/sysdeps/mips/mips64/soft-fp/sfp-machine.h
+++ b/libc/sysdeps/mips/mips64/soft-fp/sfp-machine.h
@@ -1,3 +1,6 @@
+#include <fenv.h>
+#include <fpu_control.h>
+
#define _FP_W_TYPE_SIZE 64
#define _FP_W_TYPE unsigned long long
#define _FP_WS_TYPE signed long long
@@ -40,8 +43,32 @@
R##_c = FP_CLS_NAN; \
} while (0)
-#define FP_EX_INVALID (1 << 4)
-#define FP_EX_DIVZERO (1 << 3)
-#define FP_EX_OVERFLOW (1 << 2)
-#define FP_EX_UNDERFLOW (1 << 1)
-#define FP_EX_INEXACT (1 << 0)
+#define _FP_DECL_EX fpu_control_t _fcw
+
+#define FP_ROUNDMODE (_fcw & 0x3)
+
+#define FP_RND_NEAREST FE_TONEAREST
+#define FP_RND_ZERO FE_TOWARDZERO
+#define FP_RND_PINF FE_UPWARD
+#define FP_RND_MINF FE_DOWNWARD
+
+#define FP_EX_INVALID FE_INVALID
+#define FP_EX_OVERFLOW FE_OVERFLOW
+#define FP_EX_UNDERFLOW FE_UNDERFLOW
+#define FP_EX_DIVZERO FE_DIVBYZERO
+#define FP_EX_INEXACT FE_INEXACT
+
+#ifdef __mips_hard_float
+#define FP_INIT_ROUNDMODE \
+do { \
+ _FPU_GETCW (_fcw); \
+} while (0)
+
+#define FP_HANDLE_EXCEPTIONS \
+do { \
+ if (__builtin_expect (_fex, 0)) \
+ _FPU_SETCW (_fcw | _fex | (_fex << 10)); \
+} while (0)
+#else
+#define FP_INIT_ROUNDMODE _fcw = FP_RND_NEAREST
+#endif