PowerPC: Update __float128 and __ibm128 error messages.

will schmidt will_schmidt@vnet.ibm.com
Tue Oct 27 14:15:16 GMT 2020


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
> 
> 



More information about the Gcc-patches mailing list