]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
expr.c (external_spec_function): Add ieee_support_subnormal to list of IEEE inquiry...
authorSteven G. Kargl <kargl@gcc.gnu.org>
Sat, 29 Dec 2018 19:14:32 +0000 (19:14 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Sat, 29 Dec 2018 19:14:32 +0000 (19:14 +0000)
2018-12-29  Steven G. Kargl  <kargl@gcc.gnu.org>

* expr.c (external_spec_function): Add ieee_support_subnormal to list
of IEEE inquiry functions.

2018-12-29  Steven G. Kargl  <kargl@gcc.gnu.org>

* gfortran.map: Expose subnormal functions in dynamic library.
* ieee/ieee_arithmetic.F90: Add support for IEEE_SUBNORMAL,
IEEE_POSITIVE_SUBNORMAL, and IEEE_NEGATIVE_SUBNORMAL.
* ieee/ieee_helper.c: Ditto.
* ieee/ieee_features.F90:  Add IEEE_SUBNORMAL.

2018-12-29  Steven G. Kargl  <kargl@gcc.gnu.org>

* gfortran.dg/ieee/ieee_11.F90: New test.

From-SVN: r267468

gcc/fortran/ChangeLog
gcc/fortran/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/ieee/ieee_11.F90 [new file with mode: 0644]
libgfortran/ChangeLog
libgfortran/gfortran.map
libgfortran/ieee/ieee_arithmetic.F90
libgfortran/ieee/ieee_features.F90
libgfortran/ieee/ieee_helper.c

index e2600283363f523357ffa4639399c20c4dcaa5b7..30a7c0f3b0a412795fa89593cfaabb0801096de5 100644 (file)
@@ -1,3 +1,8 @@
+2018-12-29  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       * expr.c (external_spec_function): Add ieee_support_subnormal to list
+       of IEEE inquiry functions.
+
 2018-12-29  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        * cpp.c (gfc_cpp_init):  Add pre-defined macros for INTEGER(1)
index 638b38d141b7e149611e63ac01fedb02fb7e4382..aad1496689f19b91c2685df8037bd11803419153 100644 (file)
@@ -3068,6 +3068,7 @@ external_spec_function (gfc_expr *e)
          || !strcmp (f->name, "ieee_support_halting")
          || !strcmp (f->name, "ieee_support_datatype")
          || !strcmp (f->name, "ieee_support_denormal")
+         || !strcmp (f->name, "ieee_support_subnormal")
          || !strcmp (f->name, "ieee_support_divide")
          || !strcmp (f->name, "ieee_support_inf")
          || !strcmp (f->name, "ieee_support_io")
index cdfc940b45f7ab47a33a1f073473b2ee3a4096c2..5e9bd887c41741da3b3123a45e5bf17421e5a998 100644 (file)
@@ -1,3 +1,7 @@
+2018-12-29  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       * gfortran.dg/ieee/ieee_11.F90: New test.
+
 2018-12-29  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
 
        * gcc.target/msp430/critical-interrupt.c: New test.
diff --git a/gcc/testsuite/gfortran.dg/ieee/ieee_11.F90 b/gcc/testsuite/gfortran.dg/ieee/ieee_11.F90
new file mode 100644 (file)
index 0000000..9f62e70
--- /dev/null
@@ -0,0 +1,74 @@
+! { dg-do run }
+program foo
+
+   use ieee_arithmetic
+
+   implicit none
+
+   call test04
+   call test08
+   call test10
+   call test16
+
+   contains
+
+      subroutine test04
+         real(4) x, y 
+         if (ieee_support_subnormal(x)) then
+            x = ieee_value(x, ieee_positive_subnormal)
+            y = ieee_value(y, ieee_positive_denormal)
+            if (x /= y) stop 1
+            x = ieee_value(x, ieee_negative_subnormal)
+            y = ieee_value(y, ieee_negative_denormal)
+            if (x /= y) stop 2
+         end if
+      end subroutine test04
+
+      subroutine test08
+         real(8) x, y 
+         if (ieee_support_subnormal(x)) then
+            x = ieee_value(x, ieee_positive_subnormal)
+            y = ieee_value(y, ieee_positive_denormal)
+            if (x /= y) stop 1
+            x = ieee_value(x, ieee_negative_subnormal)
+            y = ieee_value(y, ieee_negative_denormal)
+            if (x /= y) stop 2
+         end if
+      end subroutine test08
+
+#ifdef __GFC_REAL_10__
+      subroutine test10
+         real(10) x, y 
+         if (ieee_support_subnormal(x)) then
+            x = ieee_value(x, ieee_positive_subnormal)
+            y = ieee_value(y, ieee_positive_denormal)
+            if (x /= y) stop 1
+            x = ieee_value(x, ieee_negative_subnormal)
+            y = ieee_value(y, ieee_negative_denormal)
+            if (x /= y) stop 2
+         end if
+      end subroutine test10
+#else
+      subroutine test10
+      end subroutine test10
+#endif
+
+#ifdef __GFC_REAL_16__
+      subroutine test16
+         real(16) x, y 
+         if (ieee_support_subnormal(x)) then
+            x = ieee_value(x, ieee_positive_subnormal)
+            y = ieee_value(y, ieee_positive_denormal)
+            if (x /= y) stop 1
+            x = ieee_value(x, ieee_negative_subnormal)
+            y = ieee_value(y, ieee_negative_denormal)
+            if (x /= y) stop 2
+         end if
+      end subroutine test16
+#else
+      subroutine test16
+      end subroutine test16
+#endif
+
+
+end program foo
index 6eace44944022e106289e5a61980c32293076074..ab0dd2115ffeedb578ee8eb2e08291eb5e580dfb 100644 (file)
@@ -1,3 +1,11 @@
+2018-12-29  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       * gfortran.map: Expose subnormal functions in dynamic library.
+       * ieee/ieee_arithmetic.F90: Add support for IEEE_SUBNORMAL,
+       IEEE_POSITIVE_SUBNORMAL, and IEEE_NEGATIVE_SUBNORMAL.
+       * ieee/ieee_helper.c: Ditto.
+       * ieee/ieee_features.F90:  Add IEEE_SUBNORMAL.
+
 2018-12-29  Steven G. Kargl  <kargl@gcc.gnu.org>
       
        PR fortran/88342
index 8dcb3295b20cc746c3510807ce98515554a3c567..ce4fe201b1e6aa7121b63c0c146a858a7ffd406e 100644 (file)
@@ -1573,4 +1573,9 @@ GFORTRAN_9 {
   _gfortran_sfindloc2_s1;
   _gfortran_sfindloc2_s4;
   _gfortran_st_wait_async;
+  __ieee_arithmetic_MOD_ieee_support_subnormal_10;
+  __ieee_arithmetic_MOD_ieee_support_subnormal_16;
+  __ieee_arithmetic_MOD_ieee_support_subnormal_4;
+  __ieee_arithmetic_MOD_ieee_support_subnormal_8;
+  __ieee_arithmetic_MOD_ieee_support_subnormal_noarg;
 };
index 1cda1c7458be9b900db02f62d58dced1b3208be7..ac6334cba70913eb75e2502a22cf287d439a37c4 100644 (file)
@@ -55,9 +55,11 @@ module IEEE_ARITHMETIC
     IEEE_NEGATIVE_INF      = IEEE_CLASS_TYPE(3), &
     IEEE_NEGATIVE_NORMAL   = IEEE_CLASS_TYPE(4), &
     IEEE_NEGATIVE_DENORMAL = IEEE_CLASS_TYPE(5), &
+    IEEE_NEGATIVE_SUBNORMAL= IEEE_CLASS_TYPE(5), &
     IEEE_NEGATIVE_ZERO     = IEEE_CLASS_TYPE(6), &
     IEEE_POSITIVE_ZERO     = IEEE_CLASS_TYPE(7), &
     IEEE_POSITIVE_DENORMAL = IEEE_CLASS_TYPE(8), &
+    IEEE_POSITIVE_SUBNORMAL= IEEE_CLASS_TYPE(8), &
     IEEE_POSITIVE_NORMAL   = IEEE_CLASS_TYPE(9), &
     IEEE_POSITIVE_INF      = IEEE_CLASS_TYPE(10)
 
@@ -795,6 +797,7 @@ REM_MACRO(4,4,4)
 
 SUPPORTGENERIC(IEEE_SUPPORT_DATATYPE)
 SUPPORTGENERIC(IEEE_SUPPORT_DENORMAL)
+SUPPORTGENERIC(IEEE_SUPPORT_SUBNORMAL)
 SUPPORTGENERIC(IEEE_SUPPORT_DIVIDE)
 SUPPORTGENERIC(IEEE_SUPPORT_INF)
 SUPPORTGENERIC(IEEE_SUPPORT_IO)
@@ -1359,7 +1362,7 @@ SUPPORTMACRO(IEEE_SUPPORT_DATATYPE,16,.true.)
 #endif
 SUPPORTMACRO_NOARG(IEEE_SUPPORT_DATATYPE,.true.)
 
-! IEEE_SUPPORT_DENORMAL
+! IEEE_SUPPORT_DENORMAL and IEEE_SUPPORT_SUBNORMAL
 
 SUPPORTMACRO(IEEE_SUPPORT_DENORMAL,4,.true.)
 SUPPORTMACRO(IEEE_SUPPORT_DENORMAL,8,.true.)
@@ -1371,6 +1374,16 @@ SUPPORTMACRO(IEEE_SUPPORT_DENORMAL,16,.true.)
 #endif
 SUPPORTMACRO_NOARG(IEEE_SUPPORT_DENORMAL,.true.)
 
+SUPPORTMACRO(IEEE_SUPPORT_SUBNORMAL,4,.true.)
+SUPPORTMACRO(IEEE_SUPPORT_SUBNORMAL,8,.true.)
+#ifdef HAVE_GFC_REAL_10
+SUPPORTMACRO(IEEE_SUPPORT_SUBNORMAL,10,.true.)
+#endif
+#ifdef HAVE_GFC_REAL_16
+SUPPORTMACRO(IEEE_SUPPORT_SUBNORMAL,16,.true.)
+#endif
+SUPPORTMACRO_NOARG(IEEE_SUPPORT_SUBNORMAL,.true.)
+
 ! IEEE_SUPPORT_DIVIDE
 
 SUPPORTMACRO(IEEE_SUPPORT_DIVIDE,4,.true.)
index d5aec3bca1e6b0ca9ad819c6e65b3d17503bc907..af8185e827769d70cfdc2cafc83bd10fb5690339 100644 (file)
@@ -36,6 +36,7 @@ module IEEE_FEATURES
   type(IEEE_FEATURES_TYPE), parameter, public :: &
     IEEE_DATATYPE       = IEEE_FEATURES_TYPE(0), &
     IEEE_DENORMAL       = IEEE_FEATURES_TYPE(1), &
+    IEEE_SUBNORMAL      = IEEE_FEATURES_TYPE(1), &
     IEEE_DIVIDE         = IEEE_FEATURES_TYPE(2), &
     IEEE_HALTING        = IEEE_FEATURES_TYPE(3), &
     IEEE_INEXACT_FLAG   = IEEE_FEATURES_TYPE(4), &
index 5071efa4f82b2a99ae2c17236fba649f5b3f9732..35231274a1a706ea36c9cad5324cd8126721032c 100644 (file)
@@ -50,7 +50,8 @@ internal_proto(ieee_class_helper_16);
 enum { IEEE_OTHER_VALUE = 0, IEEE_SIGNALING_NAN, IEEE_QUIET_NAN,
   IEEE_NEGATIVE_INF, IEEE_NEGATIVE_NORMAL, IEEE_NEGATIVE_DENORMAL,
   IEEE_NEGATIVE_ZERO, IEEE_POSITIVE_ZERO, IEEE_POSITIVE_DENORMAL,
-  IEEE_POSITIVE_NORMAL, IEEE_POSITIVE_INF };
+  IEEE_POSITIVE_NORMAL, IEEE_POSITIVE_INF, IEEE_SUBNORMAL,
+  IEEE_NEGATIVE_SUBNORMAL, IEEE_POSITIVE_SUBNORMAL };
 
 #define CLASSMACRO(TYPE) \
   int ieee_class_helper_ ## TYPE (GFC_REAL_ ## TYPE *value) \