PowerPC: Restrict long double test to use IBM long double.

I posted this patch previously as a set of 3 testsuite patches.  I have
separated them into separate patches.  This patch marks the convert-bfp-11.c
patch as needing IBM extended double.  If you look at the code, it is
specifically designed around testing the limits of the IBM 128-bit extended
double representation.  I added a new target-supports that says the test
requires IBM extended long double, and changed the test to require this
effective test.  Can I check this into the master branch?

gcc/testsuite/
2020-11-15  Michael Meissner  <meiss...@linux.ibm.com>

        * c-c++-common/dfp/convert-bfp-11.c: Require IBM 128-bit long
        double.
        * lib/target-supports.exp (check_ppc_long_double_ibm): New
        function.
        (is-effective-target): Add ppc_long_double_ibm.
---
 .../c-c++-common/dfp/convert-bfp-11.c         |  1 +
 gcc/testsuite/lib/target-supports.exp         | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c 
b/gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c
index 95c433d2c24..87f6716afb3 100644
--- a/gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c
+++ b/gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c
@@ -1,4 +1,5 @@
 /* { dg-skip-if "" { ! "powerpc*-*-linux*" } } */
+/* { dg-require-effective-target ppc_long_double_ibm } */
 
 /* Test decimal float conversions to and from IBM 128-bit long double. 
    Checks are skipped at runtime if long double is not 128 bits.
diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index ceee78c26a9..dc1100ba96c 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2336,6 +2336,24 @@ proc check_effective_target_ppc_ieee128_ok { } {
     }]
 }
 
+# Return 1 if the target is a powerpc with the long double format uses the IBM
+# extended double format.
+
+proc check_ppc_long_double_ibm { } {
+    return [check_cached_effective_target ppc_long_double_ibm {
+       check_runtime_nocache ppc_long_double_ibm {
+           int main()
+           {
+             #ifndef __LONG_DOUBLE_IBM128__
+               return 1;
+             #else
+               return 0;
+             #endif
+           }
+       }
+    }]
+}
+
 # Return 1 if the target supports executing VSX instructions, 0
 # otherwise.  Cache the result.
 
@@ -7939,6 +7957,7 @@ proc is-effective-target { arg } {
          "power10_hw"     { set selected [check_power10_hw_available] }
          "ppc_float128_sw" { set selected [check_ppc_float128_sw_available] }
          "ppc_float128_hw" { set selected [check_ppc_float128_hw_available] }
+         "ppc_long_double_ibm" { set selected [check_ppc_long_double_ibm] }
          "ppc_recip_hw"   { set selected [check_ppc_recip_hw_available] }
          "ppc_cpu_supports_hw" { set selected 
[check_ppc_cpu_supports_hw_available] }
          "ppc_mma_hw"     { set selected [check_ppc_mma_hw_available] }
-- 
2.22.0


-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meiss...@linux.ibm.com, phone: +1 (978) 899-4797

Reply via email to