Denormal behaviour is well defined for IEEE128 long doubles, so don't
XFAIL some gfortran tests on ppc64le when configured with the IEEE128
long double ABI.

gcc/testsuite/ChangeLog:

        PR testsuite/118127
        * lib/target-supports.exp
        (check_effective_target_ppc_not_well_defined_denormals): New
        procedure.
        * gfortran.dg/default_format_2.f90: xfail for
        ppc_not_well_defined_denormals.
        * gfortran.dg/default_format_denormal_2.f90: Likewise.
        * gfortran.dg/large_real_kind_form_io_2.f90: Likewise.

Signed-off-by: Siddhesh Poyarekar <siddh...@gotplt.org>
---
Change from v4:
- PASS only for IEEE128 instead of XFAILing only for IBM128.

 gcc/testsuite/gfortran.dg/default_format_2.f90     |  2 +-
 .../gfortran.dg/default_format_denormal_2.f90      |  2 +-
 .../gfortran.dg/large_real_kind_form_io_2.f90      |  2 +-
 gcc/testsuite/lib/target-supports.exp              | 14 ++++++++++++++
 4 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/gfortran.dg/default_format_2.f90 
b/gcc/testsuite/gfortran.dg/default_format_2.f90
index 5ad7b3a6429..c2100cb8710 100644
--- a/gcc/testsuite/gfortran.dg/default_format_2.f90
+++ b/gcc/testsuite/gfortran.dg/default_format_2.f90
@@ -1,4 +1,4 @@
-! { dg-do run { xfail powerpc*-apple-darwin* powerpc*-*-linux* } }
+! { dg-do run { xfail ppc_not_well_defined_denormals } }
 ! { dg-require-effective-target fortran_large_real }
 ! Test XFAILed on these platforms because the system's printf() lacks
 ! proper support for denormalized long doubles. See PR24685
diff --git a/gcc/testsuite/gfortran.dg/default_format_denormal_2.f90 
b/gcc/testsuite/gfortran.dg/default_format_denormal_2.f90
index e9ccf5e8f61..addfe0860d6 100644
--- a/gcc/testsuite/gfortran.dg/default_format_denormal_2.f90
+++ b/gcc/testsuite/gfortran.dg/default_format_denormal_2.f90
@@ -1,4 +1,4 @@
-! { dg-do run { xfail powerpc*-*-* } }
+! { dg-do run { xfail ppc_not_well_defined_denormals } }
 ! { dg-require-effective-target fortran_large_real }
 ! Test XFAILed on this platform because the system's printf() lacks
 ! proper support for denormalized long doubles. See PR24685
diff --git a/gcc/testsuite/gfortran.dg/large_real_kind_form_io_2.f90 
b/gcc/testsuite/gfortran.dg/large_real_kind_form_io_2.f90
index 34b8aec462c..eb0632b615a 100644
--- a/gcc/testsuite/gfortran.dg/large_real_kind_form_io_2.f90
+++ b/gcc/testsuite/gfortran.dg/large_real_kind_form_io_2.f90
@@ -1,4 +1,4 @@
-! { dg-do run { xfail powerpc*-apple-darwin* powerpc*-*-linux* } }
+! { dg-do run { xfail ppc_not_well_defined_denormals } }
 ! Test XFAILed on these platforms because the system's printf() lacks
 ! proper support for denormalized long doubles. See PR24685
 ! { dg-require-effective-target fortran_large_real }
diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index 9ad1e1965bb..62efbf557cb 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1854,6 +1854,20 @@ proc check_effective_target_fortran_integer_16 { } {
     }]
 }
 
+# Check if the PPC target defaults to the IBM long double format.
+
+proc check_effective_target_ppc_not_well_defined_denormals { } {
+    if { ![istarget powerpc*-*-*] } {
+      return 0
+    }
+
+    return [check_no_compiler_messages ppc_not_well_defined_denormals assembly 
{
+      #if defined(__LONG_DOUBLE_IEEE128__)
+      #error "__LONG_DOUBLE_IEEE128__ defined, denormals are well defined"
+      #endif
+    }]
+}
+
 # Return 1 if we can statically link libgfortran, 0 otherwise.
 #
 # When the target name changes, replace the cached result.
-- 
2.47.1

Reply via email to