diff mbox series

[1/3] PowerPC: Add long double target-supports.

Message ID 20201121053352.GC17995@ibm-toto.the-meissners.org
State New
Headers show
Series Updated PowerPC tests for long double | expand

Commit Message

Michael Meissner Nov. 21, 2020, 5:33 a.m. UTC
PowerPC: Add long double target-supports.

This patch adds 3 target supports to test what type of PowerPC long double is
used by the test:

   1)	Long double uses the IBM 128-bit extended double format;
   2)	Long double uses the IEEE 128-bit format; (and)
   3)	Long double uses the 64-bit format.

I have tested this patch and the following two patches in this series with
compilers with the 3 different long double types.  I verified that the two
tests being modified both are labeled as UNSUPPORTED if long double is not IBM
128-bit, and if long double is IBM 128-bit, the tests pass.

Can I check this into the master branch?  I think this patch should also be
back ported to the earlier branches.

gcc/testsuite/
2020-11-21  Michael Meissner  <meissner@linux.ibm.com>

	* lib/target-supports.exp (check_ppc_long_double_ibm): New
	function.
	(check_ppc_long_double_ieee): New function.
	(check_ppc_long_double_64bit): New function.
	(is-effective-target): Add ppc_long_double_ibm,
	ppc_long_double_ieee, and ppc_long_double_64bit.
---
 gcc/testsuite/lib/target-supports.exp | 56 +++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

Comments

Segher Boessenkool Nov. 23, 2020, 8:28 p.m. UTC | #1
Hi!

On Sat, Nov 21, 2020 at 12:33:52AM -0500, Michael Meissner wrote:
> +# See if the target is a powerpc with the long double format that uses the IBM
> +# extended double format.

"Return 1 if the target is PowerPC, and long double is IBM extended double."

> @@ -7939,6 +7992,9 @@ 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_long_double_ieee" { set selected [check_ppc_long_double_ieee] }
> +	  "ppc_long_double_64bit" { set selected [check_ppc_long_double_64bit] }
>  	  "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] }

Why this?  It just defines aliases to the exact same name?


Segher
Michael Meissner Nov. 24, 2020, 9:44 p.m. UTC | #2
On Mon, Nov 23, 2020 at 02:28:57PM -0600, Segher Boessenkool wrote:
> Hi!
> 
> On Sat, Nov 21, 2020 at 12:33:52AM -0500, Michael Meissner wrote:
> > +# See if the target is a powerpc with the long double format that uses the IBM
> > +# extended double format.
> 
> "Return 1 if the target is PowerPC, and long double is IBM extended double."
> 
> > @@ -7939,6 +7992,9 @@ 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_long_double_ieee" { set selected [check_ppc_long_double_ieee] }
> > +	  "ppc_long_double_64bit" { set selected [check_ppc_long_double_64bit] }
> >  	  "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] }
> 
> Why this?  It just defines aliases to the exact same name?

If you remove those lines you get the failure from the default case:

	  default          { error "unknown effective target keyword `$arg'" }
Segher Boessenkool Nov. 24, 2020, 11:49 p.m. UTC | #3
On Tue, Nov 24, 2020 at 04:44:19PM -0500, Michael Meissner wrote:
> On Mon, Nov 23, 2020 at 02:28:57PM -0600, Segher Boessenkool wrote:
> > On Sat, Nov 21, 2020 at 12:33:52AM -0500, Michael Meissner wrote:
> > > +# See if the target is a powerpc with the long double format that uses the IBM
> > > +# extended double format.
> > 
> > "Return 1 if the target is PowerPC, and long double is IBM extended double."
> > 
> > > @@ -7939,6 +7992,9 @@ 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_long_double_ieee" { set selected [check_ppc_long_double_ieee] }
> > > +	  "ppc_long_double_64bit" { set selected [check_ppc_long_double_64bit] }
> > >  	  "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] }
> > 
> > Why this?  It just defines aliases to the exact same name?
> 
> If you remove those lines you get the failure from the default case:
> 
> 	  default          { error "unknown effective target keyword `$arg'" }

So name the functions check_effective_target_ppc_long_double_ibm etc.?
Then it is all handled by the generic code, and yes you can use these
same names in the testcases.


Segher
diff mbox series

Patch

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 22acda2a74f..adcb789d136 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2336,6 +2336,59 @@  proc check_effective_target_ppc_ieee128_ok { } {
     }]
 }
 
+# See if the target is a powerpc with the long double format that 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()
+	    {
+	      #if !defined(_ARCH_PPC) || !defined(__LONG_DOUBLE_IBM128__)
+		return 1;
+	      #else
+		return 0;
+	      #endif
+	    }
+	}
+    }]
+}
+
+# See if the target is a powerpc with the long double format that uses the IEEE
+# 128-bit format.
+
+proc check_ppc_long_double_ieee { } {
+    return [check_cached_effective_target ppc_long_double_ieee {
+	check_runtime_nocache ppc_long_double_ieee {
+	    int main()
+	    {
+	      #if !defined(_ARCH_PPC) || !defined(__LONG_DOUBLE_IEEE128__)
+		return 1;
+	      #else
+		return 0;
+	      #endif
+	    }
+	}
+    }]
+}
+
+# See if the target is a powerpc with the long double format that is 64-bit.
+
+proc check_ppc_long_double_64bit { } {
+    return [check_cached_effective_target ppc_long_double_64bit {
+	check_runtime_nocache ppc_long_double_64bit {
+	    int main()
+	    {
+	      #ifndef _ARCH_PPC
+		return 1;
+	      #else
+		return sizeof (long double) != 64;
+	      #endif
+	    }
+	}
+    }]
+}
+
 # Return 1 if the target supports executing VSX instructions, 0
 # otherwise.  Cache the result.
 
@@ -7939,6 +7992,9 @@  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_long_double_ieee" { set selected [check_ppc_long_double_ieee] }
+	  "ppc_long_double_64bit" { set selected [check_ppc_long_double_64bit] }
 	  "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] }