aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/hppa/fpu
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-10-15 06:50:42 +0000
committerUlrich Drepper <drepper@redhat.com>2000-10-15 06:50:42 +0000
commitb15cb495054a40644197395fb6a94daa4b0e81cb (patch)
tree085712cd0a7f5e68dc291c49c6adfb9c3675dcee /sysdeps/hppa/fpu
parent42be70d43174c6a6e80fbd25276d4eb04c6e5adf (diff)
downloadglibc-b15cb495054a40644197395fb6a94daa4b0e81cb.tar
glibc-b15cb495054a40644197395fb6a94daa4b0e81cb.tar.gz
glibc-b15cb495054a40644197395fb6a94daa4b0e81cb.tar.bz2
glibc-b15cb495054a40644197395fb6a94daa4b0e81cb.zip
Update.
2000-10-14 Ulrich Drepper <drepper@redhat.com> * math/libm-test.inc (frexp_test): Add L suffix also to parameters. (hypot_test): Likewise. * sysdeps/generic/printf_fphex.c: Compute width of decimal point string correctly. Handle padding correctly. * sysdeps/ia64/fpu/printf_fphex.c: Use sizeof in _itowa parameters correctly. * sysdeps/ieee754/ldbl-128/printf_fphex.c: Likewise. * sysdeps/ieee754/ldbl-96/printf_fphex.c: Likewise. 2000-10-12 Alan Modra <alan@linuxcare.com.au> * FAQ.in: Add --start-group and --end-group. 2000-10-12 Alan Modra <alan@linuxcare.com.au> * malloc/memusage.c: Conditionalize stack usage calculation on stack direction. 2000-10-12 Alan Modra <alan@linuxcare.com.au> * config.h.in: Add ASM_LINE_SEP. * configure.in: Add test for comment and line separators. * include/libc-symbols.h: Define and use ASM_LINE_SEP, and add tabs to placate some hppa assemblers. * sysdeps/hppa/sysdep.h: Likewise. * sysdeps/gnu/siglist.c: Insert \n and \t into inline asm. * sysdeps/unix/sysv/linux/errlist.c: Likewise. 2000-10-12 David Huggins-Daines <dhd@linuxcare.com> * sysdeps/unix/sysv/linux/Makefile: Include <bits/initspin> in $(sysdep_headers). * sysdeps/unix/sysv/linux/bits/initspin.h: Dummy version for non-threaded platforms. 2000-10-12 David Huggins-Daines <dhd@linuxcare.com> * configure.in: Add definitions for hppa. * elf/elf.h: Add PLABEL32 relocation for hppa ELF32, comments for IPLT and EPLT relocations. * shlib-versions: Version symbol definitions for hppa-linux. * sysdeps/unix/sysv/linux/configure.in: Define $arch_minimum_kernel for hppa. 2000-10-12 David Huggins-Daines <dhd@linuxcare.com> * sysdeps/hppa/Makefile: New file. * sysdeps/hppa/Versions: New file. * sysdeps/hppa/setjmp.S: New file. * sysdeps/hppa/__longjmp.S: New file. * sysdeps/hppa/bits/setjmp.h: New file. * sysdeps/hppa/frame.h: New file. * sysdeps/hppa/add_n.s: Don't use %r19 (linkage table pointer). * sysdeps/hppa/sub_n.s: Likewise. * sysdeps/hppa/lshift.s: Likewise. * sysdeps/hppa/rshift.s: Likewise. * sysdeps/hppa/udiv_qrnnd.s: Likewise. * sysdeps/hppa/hppa1.1/addmul_1.s: Likewise. * sysdeps/hppa/hppa1.1/submul_1.s: Likewise. * sysdeps/hppa/hppa1.1/mul_1.s: Likewise. * sysdeps/hppa/hppa1.1/udiv_qrnnd.s: Likewise. * sysdeps/hppa/dl-machine.h: New file. * sysdeps/hppa/dl-fptr.c: New file (note that this is almost identical to the IA-64 one). * sysdeps/hppa/dl-lookupcfg.h: Likewise. * sysdeps/hppa/dl-symaddr.c: Likewise. * sysdeps/hppa/elf/initfini.c: New file. * sysdeps/hppa/elf/start.S: New file. * sysdeps/hppa/fpu/bits/fenv.h: New file. * sysdeps/hppa/fpu/fclrexcpt.c: New file. * sysdeps/hppa/fpu/fedisblxcpt.c: New file. * sysdeps/hppa/fpu/feenablxcpt.c: New file. * sysdeps/hppa/fpu/fegetenv.c: New file. * sysdeps/hppa/fpu/fegetexcept.c: New file. * sysdeps/hppa/fpu/fegetround.c: New file. * sysdeps/hppa/fpu/feholdexcpt.c: New file. * sysdeps/hppa/fpu/fesetenv.c: New file. * sysdeps/hppa/fpu/fesetround.c: New file. * sysdeps/hppa/fpu/feupdateenv.c: New file. * sysdeps/hppa/fpu/fegetexcptflg.c: New file. * sysdeps/hppa/fpu/fraiseexcpt.c: New file. * sysdeps/hppa/fpu/fsetexcptflg.c: New file. * sysdeps/hppa/fpu/ftestexcept.c: New file. * sysdeps/unix/sysv/linux/hppa/Makefile: New file. * sysdeps/unix/sysv/linux/hppa/Versions: New file. * sysdeps/unix/sysv/linux/hppa/syscalls.list: New file. * sysdeps/unix/sysv/linux/hppa/sysdep.c: New file. * sysdeps/unix/sysv/linux/hppa/sysdep.h: New file. * sysdeps/unix/sysv/linux/hppa/bits/fcntl.h: New file. * sysdeps/unix/sysv/linux/hppa/bits/ioctls.h: New file. * sysdeps/unix/sysv/linux/hppa/bits/mman.h: New file. * sysdeps/unix/sysv/linux/hppa/bits/sigaction.h: New file. * sysdeps/unix/sysv/linux/hppa/bits/signum.h: New file. * sysdeps/unix/sysv/linux/hppa/brk.c: New file. * sysdeps/unix/sysv/linux/hppa/clone.S: New file. * sysdeps/unix/sysv/linux/hppa/socket.S: New file. * sysdeps/unix/sysv/linux/hppa/syscall.S: New file. * sysdeps/unix/sysv/linux/hppa/setrlimit.c: New file. * sysdeps/unix/sysv/linux/hppa/getrlimit.c: New file. * sysdeps/unix/sysv/linux/hppa/getrlimit64.c: New file. * sysdeps/unix/sysv/linux/hppa/kernel_sigaction.h: New file. * sysdeps/unix/sysv/linux/hppa/kernel_stat.h: New file. * sysdeps/unix/sysv/linux/hppa/mmap.c: New file. * sysdeps/unix/sysv/linux/hppa/profil-counter.h: New file. * sysdeps/unix/sysv/linux/hppa/procfs.h: New file. * sysdeps/unix/sysv/linux/hppa/ucontext.h: New file. * sysdeps/unix/sysv/linux/hppa/umount.c: New file. 2000-10-12 Alan Modra <alan@linuxcare.com.au> * sysdeps/hppa/hppa1.1/Implies: New file. * sysdeps/hppa/memusage.h: New file.
Diffstat (limited to 'sysdeps/hppa/fpu')
-rw-r--r--sysdeps/hppa/fpu/bits/fenv.h78
-rw-r--r--sysdeps/hppa/fpu/fclrexcpt.c37
-rw-r--r--sysdeps/hppa/fpu/fedisblxcpt.c37
-rw-r--r--sysdeps/hppa/fpu/feenablxcpt.c37
-rw-r--r--sysdeps/hppa/fpu/fegetenv.c33
-rw-r--r--sysdeps/hppa/fpu/fegetexcept.c32
-rw-r--r--sysdeps/hppa/fpu/fegetround.c32
-rw-r--r--sysdeps/hppa/fpu/feholdexcpt.c60
-rw-r--r--sysdeps/hppa/fpu/fesetenv.c70
-rw-r--r--sysdeps/hppa/fpu/fesetround.c39
-rw-r--r--sysdeps/hppa/fpu/feupdateenv.c40
-rw-r--r--sysdeps/hppa/fpu/fgetexcptflg.c36
-rw-r--r--sysdeps/hppa/fpu/fraiseexcpt.c89
-rw-r--r--sysdeps/hppa/fpu/fsetexcptflg.c41
-rw-r--r--sysdeps/hppa/fpu/ftestexcept.c32
15 files changed, 693 insertions, 0 deletions
diff --git a/sysdeps/hppa/fpu/bits/fenv.h b/sysdeps/hppa/fpu/bits/fenv.h
new file mode 100644
index 0000000000..7d25b9947c
--- /dev/null
+++ b/sysdeps/hppa/fpu/bits/fenv.h
@@ -0,0 +1,78 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _FENV_H
+# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+#endif
+
+/* Define bits representing the exception. We use the values of the
+ appropriate enable bits in the FPU status word (which,
+ coincidentally, are the same as the flag bits, but shifted right by
+ 27 bits). */
+enum
+{
+ FE_INVALID = 1<<4, /* V */
+#define FE_INVALID FE_INVALID
+ FE_DIVBYZERO = 1<<3, /* Z */
+#define FE_DIVBYZERO FE_DIVBYZERO
+ FE_OVERFLOW = 1<<2, /* O */
+#define FE_OVERFLOW FE_OVERFLOW
+ FE_UNDERFLOW = 1<<1, /* U */
+#define FE_UNDERFLOW FE_UNDERFLOW
+ FE_INEXACT = 1<<0, /* I */
+#define FE_INEXACT FE_INEXACT
+};
+
+#define FE_ALL_EXCEPT \
+ (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
+
+/* The PA-RISC FPU supports all of the four defined rounding modes.
+ We use the values of the RM field in the floating point status
+ register for the appropriate macros. */
+enum
+ {
+ FE_TONEAREST = 0 << 9,
+#define FE_TONEAREST FE_TONEAREST
+ FE_TOWARDZERO = 1 << 9,
+#define FE_TOWARDZERO FE_TOWARDZERO
+ FE_UPWARD = 2 << 9,
+#define FE_UPWARD FE_UPWARD
+ FE_DOWNWARD = 3 << 9,
+#define FE_DOWNWARD FE_DOWNWARD
+ };
+
+/* Type representing exception flags. */
+typedef unsigned int fexcept_t;
+
+/* Type representing floating-point environment. This structure
+ corresponds to the layout of the status and exception words in the
+ register file. */
+typedef struct
+{
+ unsigned int __status_word;
+ unsigned int __exception[7];
+} fenv_t;
+
+/* If the default argument is used we use this value. */
+#define FE_DFL_ENV ((fenv_t *) -1)
+
+#ifdef __USE_GNU
+/* Floating-point environment where none of the exceptions are masked. */
+# define FE_NOMASK_ENV ((fenv_t *) -2)
+#endif
diff --git a/sysdeps/hppa/fpu/fclrexcpt.c b/sysdeps/hppa/fpu/fclrexcpt.c
new file mode 100644
index 0000000000..4c64027310
--- /dev/null
+++ b/sysdeps/hppa/fpu/fclrexcpt.c
@@ -0,0 +1,37 @@
+/* Clear given exceptions in current floating-point environment.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+feclearexcept (int excepts)
+{
+ unsigned int sw[2];
+
+ /* Get the current status word. */
+ __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
+
+ /* Clear all the relevant bits. */
+ sw[0] &= ~(excepts & FE_ALL_EXCEPT);
+ __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw));
+
+ /* Success. */
+ return 0;
+}
diff --git a/sysdeps/hppa/fpu/fedisblxcpt.c b/sysdeps/hppa/fpu/fedisblxcpt.c
new file mode 100644
index 0000000000..95c362a263
--- /dev/null
+++ b/sysdeps/hppa/fpu/fedisblxcpt.c
@@ -0,0 +1,37 @@
+/* Disable floating-point exceptions.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+fedisableexcept (int excepts)
+{
+ unsigned int sw[2], old_exc;
+
+ /* Get the current status word. */
+ __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
+
+ old_exc = sw[0] & FE_ALL_EXCEPT;
+
+ sw[0] &= ~(excepts & FE_ALL_EXCEPT);
+ __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw));
+
+ return old_exc;
+}
diff --git a/sysdeps/hppa/fpu/feenablxcpt.c b/sysdeps/hppa/fpu/feenablxcpt.c
new file mode 100644
index 0000000000..ac46722767
--- /dev/null
+++ b/sysdeps/hppa/fpu/feenablxcpt.c
@@ -0,0 +1,37 @@
+/* Enable floating-point exceptions.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+feenableexcept (int excepts)
+{
+ unsigned int sw[2], old_exc;
+
+ /* Get the current status word. */
+ __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
+
+ old_exc = sw[0] & FE_ALL_EXCEPT;
+
+ sw[0] |= (excepts & FE_ALL_EXCEPT);
+ __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw));
+
+ return old_exc;
+}
diff --git a/sysdeps/hppa/fpu/fegetenv.c b/sysdeps/hppa/fpu/fegetenv.c
new file mode 100644
index 0000000000..0fe9773bb7
--- /dev/null
+++ b/sysdeps/hppa/fpu/fegetenv.c
@@ -0,0 +1,33 @@
+/* Store current floating-point environment.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+fegetenv (fenv_t *envp)
+{
+ __asm__ (
+ "fstd %%fr0,0(%2)\n"
+ "fstd,ma %%fr1,8(%2)\n"
+ "fstd,ma %%fr2,8(%2)\n"
+ "fstd %%fr3,0(%2)\n"
+ : "=m" (*envp), "=r" (envp) : "1" (envp));
+ return 0;
+}
diff --git a/sysdeps/hppa/fpu/fegetexcept.c b/sysdeps/hppa/fpu/fegetexcept.c
new file mode 100644
index 0000000000..6bf3f6446e
--- /dev/null
+++ b/sysdeps/hppa/fpu/fegetexcept.c
@@ -0,0 +1,32 @@
+/* Get enabled floating-point exceptions.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+fegetexcept (void)
+{
+ unsigned int sw[2];
+
+ /* Get the current status word. */
+ __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
+
+ return sw[0] & FE_ALL_EXCEPT;
+}
diff --git a/sysdeps/hppa/fpu/fegetround.c b/sysdeps/hppa/fpu/fegetround.c
new file mode 100644
index 0000000000..6e07f8654f
--- /dev/null
+++ b/sysdeps/hppa/fpu/fegetround.c
@@ -0,0 +1,32 @@
+/* Return current rounding direction.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+fegetround (void)
+{
+ unsigned int sw[2];
+
+ /* Get the current status word. */
+ __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
+
+ return sw[0] & FE_DOWNWARD;
+}
diff --git a/sysdeps/hppa/fpu/feholdexcpt.c b/sysdeps/hppa/fpu/feholdexcpt.c
new file mode 100644
index 0000000000..10621786eb
--- /dev/null
+++ b/sysdeps/hppa/fpu/feholdexcpt.c
@@ -0,0 +1,60 @@
+/* Store current floating-point environment and clear exceptions.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+#include <string.h>
+
+int
+feholdexcept (fenv_t *envp)
+{
+ fenv_t clear;
+
+ /* Store the environment. */
+ {
+ fenv_t * _regs = envp;
+ __asm__ (
+ "fstd %%fr0,0(%2)\n"
+ "fstd,ma %%fr1,8(%2)\n"
+ "fstd,ma %%fr2,8(%2)\n"
+ "fstd %%fr3,0(%2)\n"
+ : "=m" (*_regs), "=r" (_regs) : "1" (_regs));
+ memcpy (&clear, envp, sizeof (clear));
+ }
+
+ /* Now clear all exceptions. */
+ clear.__status_word &= ~(FE_ALL_EXCEPT << 27);
+ memset (clear.__exception, 0, sizeof (clear.__exception));
+
+ /* And set all exceptions to non-stop. */
+ clear.__status_word &= ~FE_ALL_EXCEPT;
+
+ /* Load the new environment. */
+ {
+ fenv_t * _regs = &clear + 1;
+ __asm__ (
+ "fldd,mb -8(%2),%%fr3\n"
+ "fldd,mb -8(%2),%%fr2\n"
+ "fldd,mb -8(%2),%%fr1\n"
+ "fldd -8(%2),%%fr0\n"
+ : "=m" (*_regs), "=r" (_regs) : "1" (_regs));
+ }
+
+ return 0;
+}
diff --git a/sysdeps/hppa/fpu/fesetenv.c b/sysdeps/hppa/fpu/fesetenv.c
new file mode 100644
index 0000000000..4bfbefdd9b
--- /dev/null
+++ b/sysdeps/hppa/fpu/fesetenv.c
@@ -0,0 +1,70 @@
+/* Install given floating-point environment.
+ Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+ Based on the m68k version by
+ Andreas Schwab <schwab@suse.de>
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+fesetenv (const fenv_t *envp)
+{
+ fenv_t temp;
+
+ /* Install the environment specified by ENVP. But there are a few
+ values which we do not want to come from the saved environment.
+ Therefore, we get the current environment and replace the values
+ we want to use from the environment specified by the parameter. */
+ {
+ fenv_t * _regs = &temp;
+ __asm__ (
+ "fstd %%fr0,0(%2)\n"
+ "fstd,ma %%fr1,8(%2)\n"
+ "fstd,ma %%fr2,8(%2)\n"
+ "fstd %%fr3,0(%2)\n"
+ : "=m" (*_regs), "=r" (_regs) : "1" (_regs));
+ }
+
+ temp.__status_word &= ~(FE_ALL_EXCEPT
+ | (FE_ALL_EXCEPT << 27)
+ | FE_DOWNWARD);
+ if (envp == FE_DFL_ENV)
+ ;
+ else if (envp == FE_NOMASK_ENV)
+ temp.__status_word |= FE_ALL_EXCEPT;
+ else
+ temp.__status_word |= (envp->__status_word
+ & (FE_ALL_EXCEPT
+ | FE_DOWNWARD
+ | (FE_ALL_EXCEPT << 27)));
+
+ /* Load the new environment. */
+ {
+ fenv_t * _regs = &temp + 1;
+ __asm__ (
+ "fldd,mb -8(%2),%%fr3\n"
+ "fldd,mb -8(%2),%%fr2\n"
+ "fldd,mb -8(%2),%%fr1\n"
+ "fldd -8(%2),%%fr0\n"
+ : "=m" (*_regs), "=r" (_regs) : "1" (_regs));
+ }
+
+ /* Success. */
+ return 0;
+}
diff --git a/sysdeps/hppa/fpu/fesetround.c b/sysdeps/hppa/fpu/fesetround.c
new file mode 100644
index 0000000000..0d5858f263
--- /dev/null
+++ b/sysdeps/hppa/fpu/fesetround.c
@@ -0,0 +1,39 @@
+/* Set current rounding direction.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+fesetround (int round)
+{
+ unsigned int sw[2];
+
+ if (round & ~FE_DOWNWARD)
+ /* ROUND is not a valid rounding mode. */
+ return 1;
+
+ /* Get the current status word. */
+ __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
+ sw[0] &= ~FE_UPWARD;
+ sw[0] |= round;
+ __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw));
+
+ return 0;
+}
diff --git a/sysdeps/hppa/fpu/feupdateenv.c b/sysdeps/hppa/fpu/feupdateenv.c
new file mode 100644
index 0000000000..7e2d715e25
--- /dev/null
+++ b/sysdeps/hppa/fpu/feupdateenv.c
@@ -0,0 +1,40 @@
+/* Install given floating-point environment and raise exceptions.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+feupdateenv (const fenv_t *envp)
+{
+ unsigned int sw[2];
+
+ /* Get the current exception status. */
+ __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
+ sw[0] &= (FE_ALL_EXCEPT << 27);
+
+ /* Install new environment. */
+ fesetenv (envp);
+
+ /* Raise the saved exception. */
+ feraiseexcept (sw[0] >> 27);
+
+ /* Success. */
+ return 0;
+}
diff --git a/sysdeps/hppa/fpu/fgetexcptflg.c b/sysdeps/hppa/fpu/fgetexcptflg.c
new file mode 100644
index 0000000000..800b1f4014
--- /dev/null
+++ b/sysdeps/hppa/fpu/fgetexcptflg.c
@@ -0,0 +1,36 @@
+/* Store current representation for exceptions.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+fegetexceptflag (fexcept_t *flagp, int excepts)
+{
+ unsigned int sw[2];
+
+ /* Get the current status word. */
+ __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
+
+ *flagp = (sw[0] >> 27) & excepts & FE_ALL_EXCEPT;
+
+ /* Success. */
+ return 0;
+}
+
diff --git a/sysdeps/hppa/fpu/fraiseexcpt.c b/sysdeps/hppa/fpu/fraiseexcpt.c
new file mode 100644
index 0000000000..7feeb9946f
--- /dev/null
+++ b/sysdeps/hppa/fpu/fraiseexcpt.c
@@ -0,0 +1,89 @@
+/* Raise given exceptions.
+ Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+#include <math.h>
+
+int
+feraiseexcept (int excepts)
+{
+ /* Raise exceptions represented by EXCEPTS. But we must raise only one
+ signal at a time. It is important that if the overflow/underflow
+ exception and the divide by zero exception are given at the same
+ time, the overflow/underflow exception follows the divide by zero
+ exception. */
+
+ /* We do these bits in assembly to be certain GCC doesn't optimize
+ away something important, and so we can force delayed traps to
+ occur. */
+
+ /* FIXME: These all need verification! */
+
+ /* First: invalid exception. */
+ if (excepts & FE_INVALID)
+ {
+ /* One example of a invalid operation is 0 * Infinity. */
+ double d = HUGE_VAL;
+ __asm__ __volatile__ ("fmpy,dbl %1,%%fr0,%0\n\t"
+ /* FIXME: is this a proper trap barrier? */
+ "fcpy,dbl %%fr0,%%fr0" : "=f" (d) : "0" (d));
+ }
+
+ /* Next: division by zero. */
+ if (excepts & FE_DIVBYZERO)
+ {
+ double d = 1.0;
+ __asm__ __volatile__ ("fdiv,dbl %1,%%fr0,%0\n\t"
+ "fcpy,dbl %%fr0,%%fr0" : "=f" (d) : "0" (d));
+ }
+
+ /* Next: overflow. */
+ /* FIXME: Compare with IA-64 - do we have the same problem? */
+ if (excepts & FE_OVERFLOW)
+ {
+ double d = DBL_MAX;
+
+ __asm__ __volatile__ ("fmpy,dbl %1,%1,%0\n\t"
+ "fcpy,dbl %%fr0,%%fr0" : "=f" (d) : "0" (d));
+ }
+
+ /* Next: underflow. */
+ if (excepts & FE_UNDERFLOW)
+ {
+ double d = DBL_MIN;
+ double e = 69.69;
+
+ __asm__ __volatile__ ("fdiv,dbl %1,%2,%0\n\t"
+ "fcpy,dbl %%fr0,%%fr0" : "=f" (d) : "0" (d), "f" (e));
+ }
+
+ /* Last: inexact. */
+ if (excepts & FE_INEXACT)
+ {
+ double d = 1.0;
+ double e = M_PI;
+
+ __asm__ __volatile__ ("fdiv,dbl %1,%2,%0\n\t"
+ "fcpy,dbl %%fr0,%%fr0" : "=f" (d) : "0" (d), "f" (e));
+ }
+
+ /* Success. */
+ return 0;
+}
diff --git a/sysdeps/hppa/fpu/fsetexcptflg.c b/sysdeps/hppa/fpu/fsetexcptflg.c
new file mode 100644
index 0000000000..2e369ea721
--- /dev/null
+++ b/sysdeps/hppa/fpu/fsetexcptflg.c
@@ -0,0 +1,41 @@
+/* Set floating-point environment exception handling.
+ Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+#include <math.h>
+
+int
+fesetexceptflag (const fexcept_t *flagp, int excepts)
+{
+ unsigned int sw[2];
+
+ /* Get the current status word. */
+ __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
+
+ /* Install the new exception flags bits. */
+ sw[0] &= ~(excepts & (FE_ALL_EXCEPT >> 27));
+ sw[0] |= (*flagp & excepts & FE_ALL_EXCEPT) << 27;
+
+ /* Store the new status word. */
+ __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw));
+
+ /* Success. */
+ return 0;
+}
diff --git a/sysdeps/hppa/fpu/ftestexcept.c b/sysdeps/hppa/fpu/ftestexcept.c
new file mode 100644
index 0000000000..15d149193f
--- /dev/null
+++ b/sysdeps/hppa/fpu/ftestexcept.c
@@ -0,0 +1,32 @@
+/* Test exception in current environment.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+fetestexcept (int excepts)
+{
+ unsigned int sw[2];
+
+ /* Get the current status word. */
+ __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
+
+ return (sw[0] >> 27) & excepts & FE_ALL_EXCEPT;
+}