]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libgfortran/config/fpu-glibc.h
Update copyright years.
[thirdparty/gcc.git] / libgfortran / config / fpu-glibc.h
index 9abdfd95ee3bd62fd6f245e035b7a8b8e09bdf47..ff5f2f2b1a83f0443bbf57e5a6197757abdd45a7 100644 (file)
@@ -1,5 +1,5 @@
 /* FPU-related code for systems with GNU libc.
-   Copyright (C) 2005-2019 Free Software Foundation, Inc.
+   Copyright (C) 2005-2024 Free Software Foundation, Inc.
    Contributed by Francois-Xavier Coudert <coudert@clipper.ens.fr>
 
 This file is part of the GNU Fortran runtime library (libgfortran).
@@ -129,41 +129,7 @@ get_fpu_trap_exceptions (void)
 int
 support_fpu_trap (int flag)
 {
-  int exceptions = 0;
-  int old;
-
-  if (!support_fpu_flag (flag))
-    return 0;
-
-#ifdef FE_INVALID
-  if (flag & GFC_FPE_INVALID) exceptions |= FE_INVALID;
-#endif
-
-#ifdef FE_DIVBYZERO
-  if (flag & GFC_FPE_ZERO) exceptions |= FE_DIVBYZERO;
-#endif
-
-#ifdef FE_OVERFLOW
-  if (flag & GFC_FPE_OVERFLOW) exceptions |= FE_OVERFLOW;
-#endif
-
-#ifdef FE_UNDERFLOW
-  if (flag & GFC_FPE_UNDERFLOW) exceptions |= FE_UNDERFLOW;
-#endif
-
-#ifdef FE_DENORMAL
-  if (flag & GFC_FPE_DENORMAL) exceptions |= FE_DENORMAL;
-#endif
-
-#ifdef FE_INEXACT
-  if (flag & GFC_FPE_INEXACT) exceptions |= FE_INEXACT;
-#endif
-
-  old = feenableexcept (exceptions);
-  if (old == -1)
-    return 0;
-  fedisableexcept (exceptions & ~old);
-  return 1;
+  return support_fpu_flag (flag);
 }
 
 
@@ -376,6 +342,11 @@ get_fpu_rounding_mode (void)
        return GFC_FPE_TOWARDZERO;
 #endif
 
+#ifdef FE_TONEARESTFROMZERO
+      case FE_TONEARESTFROMZERO:
+       return GFC_FPE_AWAY;
+#endif
+
       default:
        return 0; /* Should be unreachable.  */
     }
@@ -413,6 +384,12 @@ set_fpu_rounding_mode (int mode)
        break;
 #endif
 
+#ifdef FE_TONEARESTFROMZERO
+      case GFC_FPE_AWAY:
+       rnd_mode = FE_TONEARESTFROMZERO;
+       break;
+#endif
+
       default:
        return; /* Should be unreachable.  */
     }
@@ -454,6 +431,13 @@ support_fpu_rounding_mode (int mode)
        return 0;
 #endif
 
+      case GFC_FPE_AWAY:
+#ifdef FE_TONEARESTFROMZERO
+       return 1;
+#else
+       return 0;
+#endif
+
       default:
        return 0; /* Should be unreachable.  */
     }