summaryrefslogtreecommitdiff
path: root/sysdeps/m68k/fpu
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/m68k/fpu')
-rw-r--r--sysdeps/m68k/fpu/bits/fenv.h87
-rw-r--r--sysdeps/m68k/fpu/fclrexcpt.c2
-rw-r--r--sysdeps/m68k/fpu/fedisblxcpt.c2
-rw-r--r--sysdeps/m68k/fpu/feenablxcpt.c2
-rw-r--r--sysdeps/m68k/fpu/fegetenv.c2
-rw-r--r--sysdeps/m68k/fpu/fegetexcept.c2
-rw-r--r--sysdeps/m68k/fpu/fegetmode.c27
-rw-r--r--sysdeps/m68k/fpu/fegetround.c2
-rw-r--r--sysdeps/m68k/fpu/feholdexcpt.c2
-rw-r--r--sysdeps/m68k/fpu/fesetenv.c2
-rw-r--r--sysdeps/m68k/fpu/fesetexcept.c31
-rw-r--r--sysdeps/m68k/fpu/fesetmode.c32
-rw-r--r--sysdeps/m68k/fpu/fesetround.c2
-rw-r--r--sysdeps/m68k/fpu/feupdateenv.c2
-rw-r--r--sysdeps/m68k/fpu/fgetexcptflg.c2
-rw-r--r--sysdeps/m68k/fpu/fsetexcptflg.c2
-rw-r--r--sysdeps/m68k/fpu/ftestexcept.c2
17 files changed, 103 insertions, 100 deletions
diff --git a/sysdeps/m68k/fpu/bits/fenv.h b/sysdeps/m68k/fpu/bits/fenv.h
deleted file mode 100644
index 2228861624..0000000000
--- a/sysdeps/m68k/fpu/bits/fenv.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- 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, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _FENV_H
-# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
-#endif
-
-
-/* Define bits representing the exception. We use the bit positions of
- the appropriate bits in the FPSR Accrued Exception Byte. */
-enum
- {
- FE_INEXACT =
-#define FE_INEXACT (1 << 3)
- FE_INEXACT,
- FE_DIVBYZERO =
-#define FE_DIVBYZERO (1 << 4)
- FE_DIVBYZERO,
- FE_UNDERFLOW =
-#define FE_UNDERFLOW (1 << 5)
- FE_UNDERFLOW,
- FE_OVERFLOW =
-#define FE_OVERFLOW (1 << 6)
- FE_OVERFLOW,
- FE_INVALID =
-#define FE_INVALID (1 << 7)
- FE_INVALID
- };
-
-#define FE_ALL_EXCEPT \
- (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
-
-/* The m68k FPU supports all of the four defined rounding modes. We use
- the bit positions in the FPCR Mode Control Byte as the values for the
- appropriate macros. */
-enum
- {
- FE_TONEAREST =
-#define FE_TONEAREST 0
- FE_TONEAREST,
- FE_TOWARDZERO =
-#define FE_TOWARDZERO (1 << 4)
- FE_TOWARDZERO,
- FE_DOWNWARD =
-#define FE_DOWNWARD (2 << 4)
- FE_DOWNWARD,
- FE_UPWARD =
-#define FE_UPWARD (3 << 4)
- FE_UPWARD
- };
-
-
-/* Type representing exception flags. */
-typedef unsigned int fexcept_t;
-
-
-/* Type representing floating-point environment. This structure
- corresponds to the layout of the block written by `fmovem'. */
-typedef struct
- {
- unsigned int __control_register;
- unsigned int __status_register;
- unsigned int __instruction_address;
- }
-fenv_t;
-
-/* If the default argument is used we use this value. */
-#define FE_DFL_ENV ((const fenv_t *) -1)
-
-#ifdef __USE_GNU
-/* Floating-point environment where none of the exceptions are masked. */
-# define FE_NOMASK_ENV ((const fenv_t *) -2)
-#endif
diff --git a/sysdeps/m68k/fpu/fclrexcpt.c b/sysdeps/m68k/fpu/fclrexcpt.c
index 7248cbbf82..b3bf9b760b 100644
--- a/sysdeps/m68k/fpu/fclrexcpt.c
+++ b/sysdeps/m68k/fpu/fclrexcpt.c
@@ -1,5 +1,5 @@
/* Clear given exceptions in current floating-point environment.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
diff --git a/sysdeps/m68k/fpu/fedisblxcpt.c b/sysdeps/m68k/fpu/fedisblxcpt.c
index 19d1668820..0e62cd47c2 100644
--- a/sysdeps/m68k/fpu/fedisblxcpt.c
+++ b/sysdeps/m68k/fpu/fedisblxcpt.c
@@ -1,5 +1,5 @@
/* Disable floating-point exceptions.
- Copyright (C) 2000-2016 Free Software Foundation, Inc.
+ Copyright (C) 2000-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@suse.de>, 2000.
diff --git a/sysdeps/m68k/fpu/feenablxcpt.c b/sysdeps/m68k/fpu/feenablxcpt.c
index cdb395d962..a67c4ac6fd 100644
--- a/sysdeps/m68k/fpu/feenablxcpt.c
+++ b/sysdeps/m68k/fpu/feenablxcpt.c
@@ -1,5 +1,5 @@
/* Enable floating-point exceptions.
- Copyright (C) 2000-2016 Free Software Foundation, Inc.
+ Copyright (C) 2000-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@suse.de>, 2000.
diff --git a/sysdeps/m68k/fpu/fegetenv.c b/sysdeps/m68k/fpu/fegetenv.c
index 04ee8ebbd2..4f5774191e 100644
--- a/sysdeps/m68k/fpu/fegetenv.c
+++ b/sysdeps/m68k/fpu/fegetenv.c
@@ -1,5 +1,5 @@
/* Store current floating-point environment.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
diff --git a/sysdeps/m68k/fpu/fegetexcept.c b/sysdeps/m68k/fpu/fegetexcept.c
index 65a1c1b32a..2167fb689d 100644
--- a/sysdeps/m68k/fpu/fegetexcept.c
+++ b/sysdeps/m68k/fpu/fegetexcept.c
@@ -1,5 +1,5 @@
/* Get enabled floating-point exceptions.
- Copyright (C) 2000-2016 Free Software Foundation, Inc.
+ Copyright (C) 2000-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@suse.de>, 2000.
diff --git a/sysdeps/m68k/fpu/fegetmode.c b/sysdeps/m68k/fpu/fegetmode.c
new file mode 100644
index 0000000000..fb5a4cdba9
--- /dev/null
+++ b/sysdeps/m68k/fpu/fegetmode.c
@@ -0,0 +1,27 @@
+/* Store current floating-point control modes. M68K version.
+ Copyright (C) 2016-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+int
+fegetmode (femode_t *modep)
+{
+ _FPU_GETCW (*modep);
+ return 0;
+}
diff --git a/sysdeps/m68k/fpu/fegetround.c b/sysdeps/m68k/fpu/fegetround.c
index 724246f016..5dd18b2ba7 100644
--- a/sysdeps/m68k/fpu/fegetround.c
+++ b/sysdeps/m68k/fpu/fegetround.c
@@ -1,5 +1,5 @@
/* Return current rounding direction.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
diff --git a/sysdeps/m68k/fpu/feholdexcpt.c b/sysdeps/m68k/fpu/feholdexcpt.c
index ff00e2f9b7..b47724a2e0 100644
--- a/sysdeps/m68k/fpu/feholdexcpt.c
+++ b/sysdeps/m68k/fpu/feholdexcpt.c
@@ -1,5 +1,5 @@
/* Store current floating-point environment and clear exceptions.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
diff --git a/sysdeps/m68k/fpu/fesetenv.c b/sysdeps/m68k/fpu/fesetenv.c
index 59189906a3..ab7b3e25ce 100644
--- a/sysdeps/m68k/fpu/fesetenv.c
+++ b/sysdeps/m68k/fpu/fesetenv.c
@@ -1,5 +1,5 @@
/* Install given floating-point environment.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
diff --git a/sysdeps/m68k/fpu/fesetexcept.c b/sysdeps/m68k/fpu/fesetexcept.c
new file mode 100644
index 0000000000..0906e526be
--- /dev/null
+++ b/sysdeps/m68k/fpu/fesetexcept.c
@@ -0,0 +1,31 @@
+/* Set given exception flags. M68K version.
+ Copyright (C) 2016-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <fenv.h>
+
+int
+fesetexcept (int excepts)
+{
+ fexcept_t fpsr;
+
+ __asm__ ("fmove%.l %/fpsr,%0" : "=dm" (fpsr));
+ fpsr |= excepts & FE_ALL_EXCEPT;
+ __asm__ __volatile__ ("fmove%.l %0,%/fpsr" : : "dm" (fpsr));
+
+ return 0;
+}
diff --git a/sysdeps/m68k/fpu/fesetmode.c b/sysdeps/m68k/fpu/fesetmode.c
new file mode 100644
index 0000000000..3569fd08ca
--- /dev/null
+++ b/sysdeps/m68k/fpu/fesetmode.c
@@ -0,0 +1,32 @@
+/* Install given floating-point control modes. M68K version.
+ Copyright (C) 2016-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+int
+fesetmode (const femode_t *modep)
+{
+ femode_t mode;
+ if (modep == FE_DFL_MODE)
+ mode = _FPU_DEFAULT;
+ else
+ mode = *modep;
+ _FPU_SETCW (mode);
+ return 0;
+}
diff --git a/sysdeps/m68k/fpu/fesetround.c b/sysdeps/m68k/fpu/fesetround.c
index a1ea0d074e..e2b0c4a98a 100644
--- a/sysdeps/m68k/fpu/fesetround.c
+++ b/sysdeps/m68k/fpu/fesetround.c
@@ -1,5 +1,5 @@
/* Set current rounding direction.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
diff --git a/sysdeps/m68k/fpu/feupdateenv.c b/sysdeps/m68k/fpu/feupdateenv.c
index 077f6ad3aa..ee351a2f86 100644
--- a/sysdeps/m68k/fpu/feupdateenv.c
+++ b/sysdeps/m68k/fpu/feupdateenv.c
@@ -1,5 +1,5 @@
/* Install given floating-point environment and raise exceptions.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
diff --git a/sysdeps/m68k/fpu/fgetexcptflg.c b/sysdeps/m68k/fpu/fgetexcptflg.c
index 0783381466..87c29a3b89 100644
--- a/sysdeps/m68k/fpu/fgetexcptflg.c
+++ b/sysdeps/m68k/fpu/fgetexcptflg.c
@@ -1,5 +1,5 @@
/* Store current representation for exceptions.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
diff --git a/sysdeps/m68k/fpu/fsetexcptflg.c b/sysdeps/m68k/fpu/fsetexcptflg.c
index f51a129c92..1f2a5e4104 100644
--- a/sysdeps/m68k/fpu/fsetexcptflg.c
+++ b/sysdeps/m68k/fpu/fsetexcptflg.c
@@ -1,5 +1,5 @@
/* Set floating-point environment exception handling.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
diff --git a/sysdeps/m68k/fpu/ftestexcept.c b/sysdeps/m68k/fpu/ftestexcept.c
index e61f0cb0cb..cb7f063873 100644
--- a/sysdeps/m68k/fpu/ftestexcept.c
+++ b/sysdeps/m68k/fpu/ftestexcept.c
@@ -1,5 +1,5 @@
/* Test exception in current environment.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>