public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PowerPC: Update __float128 and __ibm128 error messages.
@ 2020-10-22 22:11 Michael Meissner
  2020-10-27 14:15 ` will schmidt
  2020-10-27 23:27 ` Segher Boessenkool
  0 siblings, 2 replies; 6+ messages in thread
From: Michael Meissner @ 2020-10-22 22:11 UTC (permalink / raw)
  To: gcc-patches, Michael Meissner, Segher Boessenkool,
	David Edelsohn, Bill Schmidt, Peter Bergner, Jeff Law,
	Jonathan Wakely

PowerPC: Update __float128 and __ibm128 error messages.

I have split all of these patches into separate patches to hopefully get them
into the tree.

This patch attempts to make the error messages for intermixing IEEE 128-bit
floating point with IBM 128-bit extended double types to be clearer if the long
double type uses the IEEE 128-bit format.

I have tested this patch with bootstrap builds on a little endian power9 system
running Linux.  With the other patches, I have built two full bootstrap builds
using this patch and the patches after this patch.  One build used the current
default for long double (IBM extended double) and the other build switched the
default to IEEE 128-bit.  I used the Advance Toolchain AT 14.0 compiler as the
library used by this compiler.  There are no regressions between the tests.
There are 3 fortran benchmarks (ieee/large_2.f90, default_format_2.f90, and
default_format_denormal_2.f90) that now pass.

Can I install this into the trunk?

We have gotten some requests to back port these changes to GCC 10.x.  At the
moment, I am not planning to do the back port, but I may need to in the future.

gcc/
2020-10-22  Michael Meissner  <meissner@linux.ibm.com>

	* config/rs6000/rs6000.c (rs6000_invalid_binary_op): Update error
	messages about mixing IBM long double and IEEE 128-bit.

gcc/testsuite/
2020-10-22  Michael Meissner  <meissner@linux.ibm.com>

	* gcc.target/powerpc/bfp/scalar-extract-exp-4.c: Update failure
	messages.
	* gcc.target/powerpc/bfp/scalar-extract-sig-4.c: Update failure
	messages.
	* gcc.target/powerpc/bfp/scalar-test-data-class-11.c: Update
	failure messages.
	* gcc.target/powerpc/bfp/scalar-test-neg-5.c: Update failure
	messages.
	* gcc.target/powerpc/float128-mix-2.c: New test.
	* gcc.target/powerpc/float128-mix-3.c: New test.
	* gcc.target/powerpc/float128-mix.c: Update failure messages.
---
 gcc/config/rs6000/rs6000.c                    | 20 ++++---------------
 .../powerpc/bfp/scalar-extract-exp-4.c        |  4 +---
 .../powerpc/bfp/scalar-extract-sig-4.c        |  2 +-
 .../powerpc/bfp/scalar-test-data-class-11.c   |  2 +-
 .../powerpc/bfp/scalar-test-neg-5.c           |  2 +-
 .../gcc.target/powerpc/float128-mix-2.c       | 17 ++++++++++++++++
 .../gcc.target/powerpc/float128-mix-3.c       | 17 ++++++++++++++++
 .../gcc.target/powerpc/float128-mix.c         | 19 ++++++++++--------
 8 files changed, 53 insertions(+), 30 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/powerpc/float128-mix-2.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/float128-mix-3.c

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 8c2544ee88d..50039c0a53d 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -14386,22 +14386,10 @@ rs6000_invalid_binary_op (int op ATTRIBUTE_UNUSED,
 
   if (!TARGET_FLOAT128_CVT)
     {
-      if ((mode1 == KFmode && mode2 == IFmode)
-	  || (mode1 == IFmode && mode2 == KFmode))
-	return N_("__float128 and __ibm128 cannot be used in the same "
-		  "expression");
-
-      if (TARGET_IEEEQUAD
-	  && ((mode1 == IFmode && mode2 == TFmode)
-	      || (mode1 == TFmode && mode2 == IFmode)))
-	return N_("__ibm128 and long double cannot be used in the same "
-		  "expression");
-
-      if (!TARGET_IEEEQUAD
-	  && ((mode1 == KFmode && mode2 == TFmode)
-	      || (mode1 == TFmode && mode2 == KFmode)))
-	return N_("__float128 and long double cannot be used in the same "
-		  "expression");
+      if ((FLOAT128_IEEE_P (mode1) && FLOAT128_IBM_P (mode2))
+	  || (FLOAT128_IBM_P (mode1) && FLOAT128_IEEE_P (mode2)))
+	return N_("Invalid mixing of IEEE 128-bit and IBM 128-bit floating "
+		  "point types");
     }
 
   return NULL;
diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-4.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-4.c
index 850ff620490..2065a287bb3 100644
--- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-4.c
+++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-4.c
@@ -11,7 +11,5 @@ get_exponent (__ieee128 *p)
 {
   __ieee128 source = *p;
 
-  return __builtin_vec_scalar_extract_exp (source); /* { dg-error "'__builtin_vsx_scalar_extract_expq' requires" } */
+  return __builtin_vec_scalar_extract_exp (source); /* { dg-error "'__builtin_vsx_scalar_extract_exp.*' requires" } */
 }
-
-
diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-4.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-4.c
index 32a53c6fffd..37bc8332961 100644
--- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-4.c
+++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-4.c
@@ -11,5 +11,5 @@ get_significand (__ieee128 *p)
 {
   __ieee128 source = *p;
 
-  return __builtin_vec_scalar_extract_sig (source);	/* { dg-error "'__builtin_vsx_scalar_extract_sigq' requires" } */
+  return __builtin_vec_scalar_extract_sig (source);	/* { dg-error "'__builtin_vsx_scalar_extract_sig.*' requires" } */
 }
diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-11.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-11.c
index 7c6fca2b729..ec3118792c4 100644
--- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-11.c
+++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-11.c
@@ -10,5 +10,5 @@ test_data_class (__ieee128 *p)
 {
   __ieee128 source = *p;
 
-  return __builtin_vec_scalar_test_data_class (source, 3); /* { dg-error "'__builtin_vsx_scalar_test_data_class_qp' requires" } */
+  return __builtin_vec_scalar_test_data_class (source, 3); /* { dg-error "'__builtin_vsx_scalar_test_data_class_.*' requires" } */
 }
diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-5.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-5.c
index bab86040a7b..eb9cacf8c50 100644
--- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-5.c
+++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-5.c
@@ -10,5 +10,5 @@ test_neg (__ieee128 *p)
 {
   __ieee128 source = *p;
 
-  return __builtin_vec_scalar_test_neg_qp (source); /* { dg-error "'__builtin_vsx_scalar_test_neg_qp' requires" } */
+  return __builtin_vec_scalar_test_neg_qp (source); /* { dg-error "'__builtin_vsx_scalar_test_neg_.*' requires" } */
 }
diff --git a/gcc/testsuite/gcc.target/powerpc/float128-mix-2.c b/gcc/testsuite/gcc.target/powerpc/float128-mix-2.c
new file mode 100644
index 00000000000..b88102118a9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/float128-mix-2.c
@@ -0,0 +1,17 @@
+/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-require-effective-target ppc_float128_sw } */
+/* { dg-options "-O2 -mvsx -Wno-psabi -mabi=ieeelongdouble -mlong-double-128" } */
+
+/* Test to make sure that __float128 and long double do not generate errors if
+   long double uses the IEEE 128-bit format.  */
+__float128
+add (__float128 a, long double b)
+{
+  return a+b;
+}
+
+long double
+sub (long double a, __float128 b)
+{
+  return a-b;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/float128-mix-3.c b/gcc/testsuite/gcc.target/powerpc/float128-mix-3.c
new file mode 100644
index 00000000000..13fbe7fd08a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/float128-mix-3.c
@@ -0,0 +1,17 @@
+/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-require-effective-target ppc_float128_sw } */
+/* { dg-options "-O2 -mvsx" } */
+
+/* Test to make sure that __float128 and __ibm128 cannot be combined
+   together.  */
+__float128
+add (__float128 a, __ibm128 b)
+{
+  return a+b;	/* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
+}
+
+__ibm128
+sub (__ibm128 a, __float128 b)
+{
+  return a-b;	/* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/float128-mix.c b/gcc/testsuite/gcc.target/powerpc/float128-mix.c
index 71f840c9490..eb8e6ac27bc 100644
--- a/gcc/testsuite/gcc.target/powerpc/float128-mix.c
+++ b/gcc/testsuite/gcc.target/powerpc/float128-mix.c
@@ -1,15 +1,18 @@
 /* { dg-do compile { target { powerpc*-*-linux* } } } */
-/* { dg-require-effective-target powerpc_vsx_ok } */
-/* { dg-options "-O2 -mvsx" } */
+/* { dg-require-effective-target ppc_float128_sw } */
+/* { dg-options "-O2 -mvsx -Wno-psabi -mabi=ibmlongdouble -mlong-double-128" } */
 
-
-/* Test to make sure that __float128 and long double cannot be combined together.  */
-__float128 add (__float128 a, long double b)
+/* Test to make sure that __float128 and long double cannot be combined
+   together, when long double uses the IBM extended double format, and
+   __float128 uses the IEEE 128-bit format.  */
+__float128
+add (__float128 a, long double b)
 {
-  return a+b;	/* { dg-error "__float128 and long double cannot be used in the same expression" } */
+  return a+b;	/* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
 }
 
-__ibm128 sub (long double a, __float128 b)
+long double
+sub (long double a, __float128 b)
 {
-  return a-b;	/* { dg-error "__float128 and long double cannot be used in the same expression" } */
+  return a-b;	/* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
 }
-- 
2.22.0


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PowerPC: Update __float128 and __ibm128 error messages.
  2020-10-22 22:11 PowerPC: Update __float128 and __ibm128 error messages Michael Meissner
@ 2020-10-27 14:15 ` will schmidt
  2020-10-27 23:27 ` Segher Boessenkool
  1 sibling, 0 replies; 6+ messages in thread
From: will schmidt @ 2020-10-27 14:15 UTC (permalink / raw)
  To: Michael Meissner, gcc-patches, Segher Boessenkool,
	David Edelsohn, Bill Schmidt, Peter Bergner, Jeff Law,
	Jonathan Wakely

On Thu, 2020-10-22 at 18:11 -0400, Michael Meissner via Gcc-patches wrote:
> PowerPC: Update __float128 and __ibm128 error messages.
> 
> I have split all of these patches into separate patches to hopefully get them
> into the tree.
> 
> This patch attempts to make the error messages for intermixing IEEE 128-bit
> floating point with IBM 128-bit extended double types to be clearer if the long
> double type uses the IEEE 128-bit format.
> 
> I have tested this patch with bootstrap builds on a little endian power9 system
> running Linux.  With the other patches, I have built two full bootstrap builds
> using this patch and the patches after this patch.  One build used the current
> default for long double (IBM extended double) and the other build switched the
> default to IEEE 128-bit.  I used the Advance Toolchain AT 14.0 compiler as the
> library used by this compiler.  There are no regressions between the tests.
> There are 3 fortran benchmarks (ieee/large_2.f90, default_format_2.f90, and
> default_format_denormal_2.f90) that now pass.
> 
> Can I install this into the trunk?
> 
> We have gotten some requests to back port these changes to GCC 10.x.  At the
> moment, I am not planning to do the back port, but I may need to in the future.
> 
> gcc/
> 2020-10-22  Michael Meissner  <meissner@linux.ibm.com>
> 
> 	* config/rs6000/rs6000.c (rs6000_invalid_binary_op): Update error
> 	messages about mixing IBM long double and IEEE 128-bit.
> 
> gcc/testsuite/
> 2020-10-22  Michael Meissner  <meissner@linux.ibm.com>
> 
> 	* gcc.target/powerpc/bfp/scalar-extract-exp-4.c: Update failure
> 	messages.
> 	* gcc.target/powerpc/bfp/scalar-extract-sig-4.c: Update failure
> 	messages.
> 	* gcc.target/powerpc/bfp/scalar-test-data-class-11.c: Update
> 	failure messages.
> 	* gcc.target/powerpc/bfp/scalar-test-neg-5.c: Update failure
> 	messages.
> 	* gcc.target/powerpc/float128-mix-2.c: New test.
> 	* gcc.target/powerpc/float128-mix-3.c: New test.
> 	* gcc.target/powerpc/float128-mix.c: Update failure messages.
> ---
>  gcc/config/rs6000/rs6000.c                    | 20 ++++---------------
>  .../powerpc/bfp/scalar-extract-exp-4.c        |  4 +---
>  .../powerpc/bfp/scalar-extract-sig-4.c        |  2 +-
>  .../powerpc/bfp/scalar-test-data-class-11.c   |  2 +-
>  .../powerpc/bfp/scalar-test-neg-5.c           |  2 +-
>  .../gcc.target/powerpc/float128-mix-2.c       | 17 ++++++++++++++++
>  .../gcc.target/powerpc/float128-mix-3.c       | 17 ++++++++++++++++
>  .../gcc.target/powerpc/float128-mix.c         | 19 ++++++++++--------
>  8 files changed, 53 insertions(+), 30 deletions(-)
>  create mode 100644 gcc/testsuite/gcc.target/powerpc/float128-mix-2.c
>  create mode 100644 gcc/testsuite/gcc.target/powerpc/float128-mix-3.c
> 

ok

> diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
> index 8c2544ee88d..50039c0a53d 100644
> --- a/gcc/config/rs6000/rs6000.c
> +++ b/gcc/config/rs6000/rs6000.c
> @@ -14386,22 +14386,10 @@ rs6000_invalid_binary_op (int op ATTRIBUTE_UNUSED,
> 
>    if (!TARGET_FLOAT128_CVT)
>      {
> -      if ((mode1 == KFmode && mode2 == IFmode)
> -	  || (mode1 == IFmode && mode2 == KFmode))
> -	return N_("__float128 and __ibm128 cannot be used in the same "
> -		  "expression");
> -
> -      if (TARGET_IEEEQUAD
> -	  && ((mode1 == IFmode && mode2 == TFmode)
> -	      || (mode1 == TFmode && mode2 == IFmode)))
> -	return N_("__ibm128 and long double cannot be used in the same "
> -		  "expression");
> -
> -      if (!TARGET_IEEEQUAD
> -	  && ((mode1 == KFmode && mode2 == TFmode)
> -	      || (mode1 == TFmode && mode2 == KFmode)))
> -	return N_("__float128 and long double cannot be used in the same "
> -		  "expression");
> +      if ((FLOAT128_IEEE_P (mode1) && FLOAT128_IBM_P (mode2))
> +	  || (FLOAT128_IBM_P (mode1) && FLOAT128_IEEE_P (mode2)))
> +	return N_("Invalid mixing of IEEE 128-bit and IBM 128-bit floating "
> +		  "point types");

ok

>      }
> 
>    return NULL;
> diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-4.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-4.c
> index 850ff620490..2065a287bb3 100644
> --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-4.c
> +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-4.c
> @@ -11,7 +11,5 @@ get_exponent (__ieee128 *p)
>  {
>    __ieee128 source = *p;
> 
> -  return __builtin_vec_scalar_extract_exp (source); /* { dg-error "'__builtin_vsx_scalar_extract_expq' requires" } */
> +  return __builtin_vec_scalar_extract_exp (source); /* { dg-error "'__builtin_vsx_scalar_extract_exp.*' requires" } */
>  }
> -
> -
ok


> diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-4.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-4.c
> index 32a53c6fffd..37bc8332961 100644
> --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-4.c
> +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-4.c
> @@ -11,5 +11,5 @@ get_significand (__ieee128 *p)
>  {
>    __ieee128 source = *p;
> 
> -  return __builtin_vec_scalar_extract_sig (source);	/* { dg-error "'__builtin_vsx_scalar_extract_sigq' requires" } */
> +  return __builtin_vec_scalar_extract_sig (source);	/* { dg-error "'__builtin_vsx_scalar_extract_sig.*' requires" } */
>  }
ok

> diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-11.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-11.c
> index 7c6fca2b729..ec3118792c4 100644
> --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-11.c
> +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-11.c
> @@ -10,5 +10,5 @@ test_data_class (__ieee128 *p)
>  {
>    __ieee128 source = *p;
> 
> -  return __builtin_vec_scalar_test_data_class (source, 3); /* { dg-error "'__builtin_vsx_scalar_test_data_class_qp' requires" } */
> +  return __builtin_vec_scalar_test_data_class (source, 3); /* { dg-error "'__builtin_vsx_scalar_test_data_class_.*' requires" } */
>  }
> diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-5.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-5.c
> index bab86040a7b..eb9cacf8c50 100644
> --- a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-5.c
> +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-5.c
> @@ -10,5 +10,5 @@ test_neg (__ieee128 *p)
>  {
>    __ieee128 source = *p;
> 
> -  return __builtin_vec_scalar_test_neg_qp (source); /* { dg-error "'__builtin_vsx_scalar_test_neg_qp' requires" } */
> +  return __builtin_vec_scalar_test_neg_qp (source); /* { dg-error "'__builtin_vsx_scalar_test_neg_.*' requires" } */
>  }

ok

> diff --git a/gcc/testsuite/gcc.target/powerpc/float128-mix-2.c b/gcc/testsuite/gcc.target/powerpc/float128-mix-2.c
> new file mode 100644
> index 00000000000..b88102118a9
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/powerpc/float128-mix-2.c
> @@ -0,0 +1,17 @@
> +/* { dg-do compile { target { powerpc*-*-linux* } } } */
> +/* { dg-require-effective-target ppc_float128_sw } */
> +/* { dg-options "-O2 -mvsx -Wno-psabi -mabi=ieeelongdouble -mlong-double-128" } */
> +
> +/* Test to make sure that __float128 and long double do not generate errors if
> +   long double uses the IEEE 128-bit format.  */
> +__float128
> +add (__float128 a, long double b)
> +{
> +  return a+b;
> +}
> +
> +long double
> +sub (long double a, __float128 b)
> +{
> +  return a-b;
> +}
> diff --git a/gcc/testsuite/gcc.target/powerpc/float128-mix-3.c b/gcc/testsuite/gcc.target/powerpc/float128-mix-3.c
> new file mode 100644
> index 00000000000..13fbe7fd08a
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/powerpc/float128-mix-3.c
> @@ -0,0 +1,17 @@
> +/* { dg-do compile { target { powerpc*-*-linux* } } } */
> +/* { dg-require-effective-target ppc_float128_sw } */
> +/* { dg-options "-O2 -mvsx" } */
> +
> +/* Test to make sure that __float128 and __ibm128 cannot be combined
> +   together.  */
> +__float128
> +add (__float128 a, __ibm128 b)
> +{
> +  return a+b;	/* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
> +}
> +
> +__ibm128
> +sub (__ibm128 a, __float128 b)
> +{
> +  return a-b;	/* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
> +}

ok

> diff --git a/gcc/testsuite/gcc.target/powerpc/float128-mix.c b/gcc/testsuite/gcc.target/powerpc/float128-mix.c
> index 71f840c9490..eb8e6ac27bc 100644
> --- a/gcc/testsuite/gcc.target/powerpc/float128-mix.c
> +++ b/gcc/testsuite/gcc.target/powerpc/float128-mix.c
> @@ -1,15 +1,18 @@
>  /* { dg-do compile { target { powerpc*-*-linux* } } } */
> -/* { dg-require-effective-target powerpc_vsx_ok } */
> -/* { dg-options "-O2 -mvsx" } */
> +/* { dg-require-effective-target ppc_float128_sw } */
> +/* { dg-options "-O2 -mvsx -Wno-psabi -mabi=ibmlongdouble -mlong-double-128" } */
> 
> -
> -/* Test to make sure that __float128 and long double cannot be combined together.  */
> -__float128 add (__float128 a, long double b)
> +/* Test to make sure that __float128 and long double cannot be combined
> +   together, when long double uses the IBM extended double format, and
> +   __float128 uses the IEEE 128-bit format.  */
> +__float128
> +add (__float128 a, long double b)
>  {
> -  return a+b;	/* { dg-error "__float128 and long double cannot be used in the same expression" } */
> +  return a+b;	/* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
>  }
> 
> -__ibm128 sub (long double a, __float128 b)
> +long double
> +sub (long double a, __float128 b)
>  {
> -  return a-b;	/* { dg-error "__float128 and long double cannot be used in the same expression" } */
> +  return a-b;	/* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
>  }

ok.
All lgtm, 
thanks
-Will


> -- 
> 2.22.0
> 
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PowerPC: Update __float128 and __ibm128 error messages.
  2020-10-22 22:11 PowerPC: Update __float128 and __ibm128 error messages Michael Meissner
  2020-10-27 14:15 ` will schmidt
@ 2020-10-27 23:27 ` Segher Boessenkool
  2020-10-29 17:03   ` Michael Meissner
  1 sibling, 1 reply; 6+ messages in thread
From: Segher Boessenkool @ 2020-10-27 23:27 UTC (permalink / raw)
  To: Michael Meissner, gcc-patches, David Edelsohn, Bill Schmidt,
	Peter Bergner, Jeff Law, Jonathan Wakely

Hi!

On Thu, Oct 22, 2020 at 06:11:35PM -0400, Michael Meissner wrote:
> This patch attempts to make the error messages for intermixing IEEE 128-bit
> floating point with IBM 128-bit extended double types to be clearer if the long
> double type uses the IEEE 128-bit format.

> We have gotten some requests to back port these changes to GCC 10.x.  At the
> moment, I am not planning to do the back port, but I may need to in the future.

Ping the patches if/when that happens?

> +/* { dg-do compile { target { powerpc*-*-linux* } } } */

Use *-*-linux* instead?  (In all relevant tests.)

Is there any reason these tests should only run on Linux?  If not, it
should not restrict itself like this; and if so, you may want another
selsector (something ieee128 perhaps), or at the very least add a
comment why you do this.

>  /* { dg-do compile { target { powerpc*-*-linux* } } } */
> -/* { dg-require-effective-target powerpc_vsx_ok } */
> -/* { dg-options "-O2 -mvsx" } */
> +/* { dg-require-effective-target ppc_float128_sw } */

Removing powerpc_vsx_ok is wrong, you still use -mvsx.  That the only
current soft float QP stuff requires VSX is irrelevant.

Please fix those everywhere.  Okay for trunk with that.  Thanks!


Segher

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PowerPC: Update __float128 and __ibm128 error messages.
  2020-10-27 23:27 ` Segher Boessenkool
@ 2020-10-29 17:03   ` Michael Meissner
  2020-10-29 19:18     ` Segher Boessenkool
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Meissner @ 2020-10-29 17:03 UTC (permalink / raw)
  To: Segher Boessenkool
  Cc: Michael Meissner, gcc-patches, David Edelsohn, Bill Schmidt,
	Peter Bergner, Jeff Law, Jonathan Wakely

On Tue, Oct 27, 2020 at 06:27:22PM -0500, Segher Boessenkool wrote:
> Hi!
> 
> On Thu, Oct 22, 2020 at 06:11:35PM -0400, Michael Meissner wrote:
> > This patch attempts to make the error messages for intermixing IEEE 128-bit
> > floating point with IBM 128-bit extended double types to be clearer if the long
> > double type uses the IEEE 128-bit format.
> 
> > We have gotten some requests to back port these changes to GCC 10.x.  At the
> > moment, I am not planning to do the back port, but I may need to in the future.
> 
> Ping the patches if/when that happens?

Certainly.

> > +/* { dg-do compile { target { powerpc*-*-linux* } } } */
> 
> Use *-*-linux* instead?  (In all relevant tests.)

Ok.

> Is there any reason these tests should only run on Linux?  If not, it
> should not restrict itself like this; and if so, you may want another
> selsector (something ieee128 perhaps), or at the very least add a
> comment why you do this.

Right now the float128 emulation is only built on Linux, because it needs the
support in GLIBC.  If/when other systems add support for float128 in there
C/C++ libraries, we can widen the tests.

> >  /* { dg-do compile { target { powerpc*-*-linux* } } } */
> > -/* { dg-require-effective-target powerpc_vsx_ok } */
> > -/* { dg-options "-O2 -mvsx" } */
> > +/* { dg-require-effective-target ppc_float128_sw } */
> 
> Removing powerpc_vsx_ok is wrong, you still use -mvsx.  That the only
> current soft float QP stuff requires VSX is irrelevant.
> 
> Please fix those everywhere.  Okay for trunk with that.  Thanks!

IIRC, these tests were added very early in the float128 cycle, before we had
the target supports for float128.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PowerPC: Update __float128 and __ibm128 error messages.
  2020-10-29 17:03   ` Michael Meissner
@ 2020-10-29 19:18     ` Segher Boessenkool
  2020-10-30  2:30       ` Michael Meissner
  0 siblings, 1 reply; 6+ messages in thread
From: Segher Boessenkool @ 2020-10-29 19:18 UTC (permalink / raw)
  To: Michael Meissner, gcc-patches, David Edelsohn, Bill Schmidt,
	Peter Bergner, Jeff Law, Jonathan Wakely

On Thu, Oct 29, 2020 at 01:03:25PM -0400, Michael Meissner wrote:
> On Tue, Oct 27, 2020 at 06:27:22PM -0500, Segher Boessenkool wrote:
> > > +/* { dg-do compile { target { powerpc*-*-linux* } } } */
> > 
> > Use *-*-linux* instead?  (In all relevant tests.)
> 
> Ok.
> 
> > Is there any reason these tests should only run on Linux?  If not, it
> > should not restrict itself like this; and if so, you may want another
> > selsector (something ieee128 perhaps), or at the very least add a
> > comment why you do this.
> 
> Right now the float128 emulation is only built on Linux, because it needs the
> support in GLIBC.  If/when other systems add support for float128 in there
> C/C++ libraries, we can widen the tests.

It still helps to use some new selector -- you only have to change the
implementation of that when such a day will come, instead of 34638
separate testcases.  Also, it is good documentation, helping every
reader (people trying to make sense if the tests, for example).


Segher

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PowerPC: Update __float128 and __ibm128 error messages.
  2020-10-29 19:18     ` Segher Boessenkool
@ 2020-10-30  2:30       ` Michael Meissner
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Meissner @ 2020-10-30  2:30 UTC (permalink / raw)
  To: Segher Boessenkool
  Cc: Michael Meissner, gcc-patches, David Edelsohn, Bill Schmidt,
	Peter Bergner, Jeff Law, Jonathan Wakely

On Thu, Oct 29, 2020 at 02:18:58PM -0500, Segher Boessenkool wrote:
> On Thu, Oct 29, 2020 at 01:03:25PM -0400, Michael Meissner wrote:
> > On Tue, Oct 27, 2020 at 06:27:22PM -0500, Segher Boessenkool wrote:
> > > > +/* { dg-do compile { target { powerpc*-*-linux* } } } */
> > > 
> > > Use *-*-linux* instead?  (In all relevant tests.)
> > 
> > Ok.
> > 
> > > Is there any reason these tests should only run on Linux?  If not, it
> > > should not restrict itself like this; and if so, you may want another
> > > selsector (something ieee128 perhaps), or at the very least add a
> > > comment why you do this.
> > 
> > Right now the float128 emulation is only built on Linux, because it needs the
> > support in GLIBC.  If/when other systems add support for float128 in there
> > C/C++ libraries, we can widen the tests.
> 
> It still helps to use some new selector -- you only have to change the
> implementation of that when such a day will come, instead of 34638
> separate testcases.  Also, it is good documentation, helping every
> reader (people trying to make sense if the tests, for example).

This is the patch that I commited, combining this patch with the patch to allow
users with GLIBC 2.32 or newer to not get warnings if they change the long
double type.

Note, it turns out the patch submitted previously had other changes to the
tests for the new power10 instructions (scalar-extract-exp-4,
scalar-extract-sig-4, scalar-test-data-class-11, and scalar-test-neg-5).  Those
patches will be part of the re-implementation of those built-in functions.

I did remove the line from float128-mix*.c:
	{ dg-do compile { target { powerpc*-*-linux* } } }

and I added:
	{ dg-require-effective-target ppc_float128_sw }

To more properly check whether we can do float128.

Subject: [PATCH] PowerPC: Adjust float128/ibm128 warnings.

This patch ccombines two patches:

1) If GLIBC is 2.32 or newer, and the language is C or C++, allow the user to
   change the long double type without having to use -Wno-psabi.

2) Adjust the warnings for intermixing __float128 and __ibm128 to accomidate
   the future change to allow long double to use the IEEE 128-bit format.

gcc/
2020-10-29  Michael Meissner  <meissner@linux.ibm.com>

	* config/rs6000/rs6000.c (rs6000_option_override_internal): Allow
	long double type to be changed for C/C++ if glibc 2.32 or newer.
	(rs6000_invalid_binary_op): Update error messages about mixing IBM
	long double and IEEE 128-bit.

gcc/testsuite/
2020-10-27  Michael Meissner  <meissner@linux.ibm.com>

	* gcc.target/powerpc/float128-mix-2.c: New test.
	* gcc.target/powerpc/float128-mix-3.c: New test.
	* gcc.target/powerpc/float128-mix.c: Update failure messages.
---
 gcc/config/rs6000/rs6000.c                    | 29 ++++++++-----------
 .../gcc.target/powerpc/float128-mix-2.c       | 16 ++++++++++
 .../gcc.target/powerpc/float128-mix-3.c       | 16 ++++++++++
 .../gcc.target/powerpc/float128-mix.c         | 20 +++++++------
 4 files changed, 55 insertions(+), 26 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/powerpc/float128-mix-2.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/float128-mix-3.c

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 4d528a39a37..bcd4c4a82b3 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -4158,8 +4158,15 @@ rs6000_option_override_internal (bool global_init_p)
 
       if (rs6000_ieeequad != TARGET_IEEEQUAD_DEFAULT && TARGET_LONG_DOUBLE_128)
 	{
+	  /* Determine if the user can change the default long double type at
+	     compilation time.  Only C and C++ support this, and you need GLIBC
+	     2.32 or newer.  Only issue one warning.  */
 	  static bool warned_change_long_double;
-	  if (!warned_change_long_double)
+
+	  if (!warned_change_long_double
+	      && (!OPTION_GLIBC
+		  || (!lang_GNU_C () && !lang_GNU_CXX ())
+		  || ((TARGET_GLIBC_MAJOR * 1000) + TARGET_GLIBC_MINOR) < 2032))
 	    {
 	      warned_change_long_double = true;
 	      if (TARGET_IEEEQUAD)
@@ -14392,22 +14399,10 @@ rs6000_invalid_binary_op (int op ATTRIBUTE_UNUSED,
 
   if (!TARGET_FLOAT128_CVT)
     {
-      if ((mode1 == KFmode && mode2 == IFmode)
-	  || (mode1 == IFmode && mode2 == KFmode))
-	return N_("__float128 and __ibm128 cannot be used in the same "
-		  "expression");
-
-      if (TARGET_IEEEQUAD
-	  && ((mode1 == IFmode && mode2 == TFmode)
-	      || (mode1 == TFmode && mode2 == IFmode)))
-	return N_("__ibm128 and long double cannot be used in the same "
-		  "expression");
-
-      if (!TARGET_IEEEQUAD
-	  && ((mode1 == KFmode && mode2 == TFmode)
-	      || (mode1 == TFmode && mode2 == KFmode)))
-	return N_("__float128 and long double cannot be used in the same "
-		  "expression");
+      if ((FLOAT128_IEEE_P (mode1) && FLOAT128_IBM_P (mode2))
+	  || (FLOAT128_IBM_P (mode1) && FLOAT128_IEEE_P (mode2)))
+	return N_("Invalid mixing of IEEE 128-bit and IBM 128-bit floating "
+		  "point types");
     }
 
   return NULL;
diff --git a/gcc/testsuite/gcc.target/powerpc/float128-mix-2.c b/gcc/testsuite/gcc.target/powerpc/float128-mix-2.c
new file mode 100644
index 00000000000..61227132c20
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/float128-mix-2.c
@@ -0,0 +1,16 @@
+/* { dg-require-effective-target ppc_float128_sw } */
+/* { dg-options "-O2 -mvsx -Wno-psabi -mabi=ieeelongdouble -mlong-double-128" } */
+
+/* Test to make sure that __float128 and long double do not generate errors if
+   long double uses the IEEE 128-bit format.  */
+__float128
+add (__float128 a, long double b)
+{
+  return a+b;
+}
+
+long double
+sub (long double a, __float128 b)
+{
+  return a-b;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/float128-mix-3.c b/gcc/testsuite/gcc.target/powerpc/float128-mix-3.c
new file mode 100644
index 00000000000..a2582bb1035
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/float128-mix-3.c
@@ -0,0 +1,16 @@
+/* { dg-require-effective-target ppc_float128_sw } */
+/* { dg-options "-O2 -mvsx -Wno-psabi -mabi=ibmlongdouble -mlong-double-128" } */
+
+/* Test to make sure that __float128 and __ibm128 cannot be combined
+   together.  */
+__float128
+add (__float128 a, __ibm128 b)
+{
+  return a+b;	/* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
+}
+
+__ibm128
+sub (__ibm128 a, __float128 b)
+{
+  return a-b;	/* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/float128-mix.c b/gcc/testsuite/gcc.target/powerpc/float128-mix.c
index 71f840c9490..48e651cdba0 100644
--- a/gcc/testsuite/gcc.target/powerpc/float128-mix.c
+++ b/gcc/testsuite/gcc.target/powerpc/float128-mix.c
@@ -1,15 +1,17 @@
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
-/* { dg-require-effective-target powerpc_vsx_ok } */
-/* { dg-options "-O2 -mvsx" } */
+/* { dg-require-effective-target ppc_float128_sw } */
+/* { dg-options "-O2 -mvsx -Wno-psabi -mabi=ibmlongdouble -mlong-double-128" } */
 
-
-/* Test to make sure that __float128 and long double cannot be combined together.  */
-__float128 add (__float128 a, long double b)
+/* Test to make sure that __float128 and long double cannot be combined
+   together, when long double uses the IBM extended double format, and
+   __float128 uses the IEEE 128-bit format.  */
+__float128
+add (__float128 a, long double b)
 {
-  return a+b;	/* { dg-error "__float128 and long double cannot be used in the same expression" } */
+  return a+b;	/* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
 }
 
-__ibm128 sub (long double a, __float128 b)
+long double
+sub (long double a, __float128 b)
 {
-  return a-b;	/* { dg-error "__float128 and long double cannot be used in the same expression" } */
+  return a-b;	/* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
 }
-- 
2.22.0



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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-10-30  2:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-22 22:11 PowerPC: Update __float128 and __ibm128 error messages Michael Meissner
2020-10-27 14:15 ` will schmidt
2020-10-27 23:27 ` Segher Boessenkool
2020-10-29 17:03   ` Michael Meissner
2020-10-29 19:18     ` Segher Boessenkool
2020-10-30  2:30       ` Michael Meissner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).