[PATCHv2, testsuite] Enable some existing __float128 tests for powerpc

Bill Schmidt wschmidt@linux.vnet.ibm.com
Thu Jun 30 17:38:00 GMT 2016


Hi,

My previous patch added to the specific target list for the tests, and
Joseph suggested it would be better to use an effective target check.
This version does this.  To avoid a name clash with Joseph's pending
patch, the effective target names include __float128 rather than
float128.  I discovered that most of the tests work even for -m32 on
big-endian, except those that depend on int128 support, so I've loosened
the 64-bit restriction.

I used the term "runnable" rather than the more common "hw_available"
for the dg-run tests, to avoid a point of potential confusion.
__float128_hw_available for PowerPC implies hardware support for the
individual instructions, but we want to run these tests even when those
are not present.  However, we need VSX hardware support because of ABI
restrictions for __float128.

Tested on powerpc64[le]-unknown-linux-gnu.  Is this ok for trunk, and
eventual backport to gcc-6-branch?

Thanks,
Bill


2016-06-30  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	* gcc.dg/const-float128-ped.c: Require __float128 effective
	target, and specify additional options for powerpc*-*-*.
	* gcc.dg/const-float128.c: Likewise.
	* gcc.dg/torture/float128-cmp-invalid.c: Require
	__float128_runnable effective target, and specify additional
	options for powerpc*-*-*.
	* gcc.dg/torture/float128-div-underflow.c: Likewise.
	* gcc.dg/torture/float128-exact-underflow.c: Require
	__float128_runnable_gnu effective target, and specify additional
	options for powerpc*-*-*.
	* gcc.dg/torture/float128-extend-nan.c: Require
	__float128_runnable effective target, and specify additional
	options for powerpc*-*-*.
	* gcc.dg/torture/float128-nan.c: Likewise.
	* gcc.dg/torture/fp-int-convert-float128-timode-2.c: Likewise.
	* gcc.dg/torture/fp-int-convert-float128-timode-3.c: Likewise.
	* gcc.dg/torture/fp-int-convert-float128-timode.c: Likewise.
	* lib/target-supports.exp (check_effective_target___float128):
	New.
	(check_effective_target___float128_runnable): New.
	(check_effective_target___float128_runnable_gnu): New.


Index: gcc/testsuite/gcc.dg/const-float128-ped.c
===================================================================
--- gcc/testsuite/gcc.dg/const-float128-ped.c	(revision 237802)
+++ gcc/testsuite/gcc.dg/const-float128-ped.c	(working copy)
@@ -1,5 +1,7 @@
 /* Test 'q' suffix with -pedantic on __float128 type constants.  */
-/* { dg-do compile { target ia64-*-* i?86-*-* x86_64-*-* } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target __float128 } */
 /* { dg-options "-pedantic" } */
+/* { dg-additional-options "-mfloat128 -mvsx" { target powerpc*-*-* } } */
 
 __float128 a = 123.456789q; /* { dg-warning "non-standard suffix on floating constant" } */
Index: gcc/testsuite/gcc.dg/const-float128.c
===================================================================
--- gcc/testsuite/gcc.dg/const-float128.c	(revision 237802)
+++ gcc/testsuite/gcc.dg/const-float128.c	(working copy)
@@ -1,6 +1,8 @@
 /* Test 'q' and 'Q' suffixes on __float128 type constants.  */
-/* { dg-do compile { target ia64-*-* i?86-*-* x86_64-*-* } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target __float128 } */
 /* { dg-options "" } */
+/* { dg-additional-options "-mfloat128 -mvsx" { target powerpc*-*-* } } */
 
 __float128 a = 123.456789q;
 __float128 b = 123.456789Q;
Index: gcc/testsuite/gcc.dg/torture/float128-cmp-invalid.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/float128-cmp-invalid.c	(revision 237802)
+++ gcc/testsuite/gcc.dg/torture/float128-cmp-invalid.c	(working copy)
@@ -1,7 +1,9 @@
 /* Test for "invalid" exceptions from __float128 comparisons.  */
-/* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */
+/* { dg-do run } */
 /* { dg-options "" } */
+/* { dg-require-effective-target __float128_runnable } */
 /* { dg-require-effective-target fenv_exceptions } */
+/* { dg-additional-options "-mfloat128 -mvsx" { target powerpc*-*-* } } */
 
 #include <fenv.h>
 #include <stdlib.h>
Index: gcc/testsuite/gcc.dg/torture/float128-div-underflow.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/float128-div-underflow.c	(revision 237802)
+++ gcc/testsuite/gcc.dg/torture/float128-div-underflow.c	(working copy)
@@ -1,7 +1,9 @@
 /* Test for spurious underflow from __float128 division.  */
-/* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */
+/* { dg-do run } */
 /* { dg-options "" } */
+/* { dg-require-effective-target __float128_runnable } */
 /* { dg-require-effective-target fenv_exceptions } */
+/* { dg-additional-options "-mfloat128 -mvsx" { target powerpc*-*-* } } */
 
 #include <fenv.h>
 #include <stdlib.h>
Index: gcc/testsuite/gcc.dg/torture/float128-exact-underflow.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/float128-exact-underflow.c	(revision 237802)
+++ gcc/testsuite/gcc.dg/torture/float128-exact-underflow.c	(working copy)
@@ -2,9 +2,11 @@
    exception if trapping is enabled, but does not raise the flag
    otherwise.  */
 
-/* { dg-do run { target i?86-*-*gnu* x86_64-*-*gnu* ia64-*-*gnu* } } */
+/* { dg-do run }
 /* { dg-options "-D_GNU_SOURCE" } */
+/* { dg-require-effective-target __float128_runnable_gnu } */
 /* { dg-require-effective-target fenv_exceptions } */
+/* { dg-additional-options "-mfloat128 -mvsx" { target powerpc*-*-* } } */
 
 #include <fenv.h>
 #include <setjmp.h>
Index: gcc/testsuite/gcc.dg/torture/float128-extend-nan.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/float128-extend-nan.c	(revision 237802)
+++ gcc/testsuite/gcc.dg/torture/float128-extend-nan.c	(working copy)
@@ -1,7 +1,9 @@
 /* Test extensions to __float128 quiet signaling NaNs.  */
-/* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */
+/* { dg-do run } */
 /* { dg-options "-fsignaling-nans" } */
+/* { dg-require-effective-target __float128_runnable } */
 /* { dg-require-effective-target fenv_exceptions } */
+/* { dg-additional-options "-mfloat128 -mvsx" { target powerpc*-*-* } } */
 
 #include <fenv.h>
 #include <float.h>
Index: gcc/testsuite/gcc.dg/torture/float128-nan.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/float128-nan.c	(revision 237802)
+++ gcc/testsuite/gcc.dg/torture/float128-nan.c	(working copy)
@@ -1,7 +1,9 @@
 /* Test __float128 NaN generation.  */
-/* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */
+/* { dg-do run } */
 /* { dg-require-effective-target fenv_exceptions } */
+/* { dg-require-effective-target __float128_runnable } */
 /* { dg-options "" } */
+/* { dg-additional-options "-mfloat128 -mvsx" { target powerpc*-*-* } } */
 
 #include <fenv.h>
 #include <stdbool.h>
Index: gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode-2.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode-2.c	(revision 237802)
+++ gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode-2.c	(working copy)
@@ -1,9 +1,11 @@
 /* Test floating-point conversions.  __float128 type with TImode: bug
    53317.  */
 /* Origin: Joseph Myers <joseph@codesourcery.com> */
-/* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */
+/* { dg-do run } */
+/* { dg-require-effective-target __float128_runnable } */
 /* { dg-require-effective-target int128 } */
 /* { dg-options "" } */
+/* { dg-additional-options "-mfloat128 -mvsx" { target powerpc*-*-* } } */
 
 extern void abort (void);
 extern void exit (int);
Index: gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode-3.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode-3.c	(revision 237802)
+++ gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode-3.c	(working copy)
@@ -1,8 +1,10 @@
 /* Test for correct rounding of conversions from __int128 to
    __float128.  */
-/* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */
+/* { dg-do run } */
+/* { dg-require-effective-target __float128_runnable } */
 /* { dg-require-effective-target int128 } */
 /* { dg-options "-frounding-math" } */
+/* { dg-additional-options "-mfloat128 -mvsx" { target powerpc*-*-* } } */
 
 #include <fenv.h>
 #include <stdlib.h>
Index: gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode.c	(revision 237802)
+++ gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode.c	(working copy)
@@ -1,7 +1,9 @@
 /* Test floating-point conversions.  __float128 type with TImode.  */
 /* Origin: Joseph Myers <joseph@codesourcery.com> */
-/* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */
+/* { dg-do run } */
+/* { dg-require-effective-target __float128_runnable } */
 /* { dg-options "" } */
+/* { dg-additional-options "-mfloat128 -mvsx" { target powerpc*-*-* } } */
 
 #include "fp-int-convert.h"
 
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	(revision 237802)
+++ gcc/testsuite/lib/target-supports.exp	(working copy)
@@ -2370,6 +2370,60 @@ proc check_effective_target_has_q_floating_suffix
 	float dummy = 1.0q;
     } "$opts"]
 }
+
+# Return 1 if the target supports __float128,
+# 0 otherwise.
+
+proc check_effective_target___float128 { } {
+    if { [istarget powerpc*-*-*] } {
+	return [check_ppc_float128_sw_available]
+    }
+    if { [istarget ia64-*-*]
+	 || [istarget i?86-*-*]
+	 || [istarget x86_64-*-*] } {
+	return 1
+    }
+    return 0
+}
+
+# Return 1 if the target supports __float128 at run time,
+# 0 otherwise.
+
+proc check_effective_target___float128_runnable { } {
+    if { [istarget powerpc*-*-*] } {
+	if { [check_ppc_float128_sw_available]
+	     && [check_vsx_hw_available] } {
+	    return 1
+	}
+	return 0
+    }
+    if { [istarget ia64-*-*]
+	 || [istarget i?86-*-*]
+	 || [istarget x86_64-*-*] } {
+	return 1
+    }
+    return 0
+}
+
+# Return 1 if the *-*-*gnu* target supports __float128 at run time,
+# 0 otherwise.
+
+proc check_effective_target___float128_runnable_gnu { } {
+    if { [istarget powerpc*-*-*gnu*] } {
+	if { [check_ppc_float128_sw_available]
+	     && [check_vsx_hw_available] } {
+	    return 1
+	}
+	return 0
+    }
+    if { [istarget ia64-*-*gnu*]
+	 || [istarget i?86-*-*gnu*]
+	 || [istarget x86_64-*-*gnu*] } {
+	return 1
+    }
+    return 0
+}
+
 # Return 1 if the target supports compiling fixed-point,
 # 0 otherwise.
 




More information about the Gcc-patches mailing list