rs6000: Builtins test changes for pr80315-*.c, pr88100.c

Message ID 4c3c43ca-6a51-4f42-b230-f369117b5eea@linux.ibm.com
State New
Headers
Series rs6000: Builtins test changes for pr80315-*.c, pr88100.c |

Commit Message

Li, Pan2 via Gcc-patches Nov. 18, 2021, 4:15 p.m. UTC
  Hi!  This patch is broken out from the test case patch for the new
builtins support.

One advantage of the new builtins support is uniform error messages for
arguments with restricted values.  Previously this was done in many places
in an ad hoc manner, with little uniformity.  This patch adjusts the
expected error messages accordingly.

All error messages are now one of the following:
  "argument %d must be a %d-bit unsigned literal"
  "argument %d must be a literal between %d and %d, inclusive"
  "argument %d must be a variable or a literal between %d and %d, inclusive"
  "argument %d must be either a literal %d or a literal %d"

These messages were chosen to require the fewest changes from previous
messages while still introducing uniformity.  This patch adjusts error
messages for some cases where this produces changed messages.

Tested on powerpc64le-linux-gnu and powerpc64-linux-gnu (-m32/-m64) with
no regressions.  is this okay for trunk?

Thanks!
Bill


2021-11-17  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/testsuite/
	* gcc.target/powerpc/pr80315-1.c: Adjust error message.
	* gcc.target/powerpc/pr80315-2.c: Likewise.
	* gcc.target/powerpc/pr80315-3.c: Likewise.
	* gcc.target/powerpc/pr80315-4.c: Likewise.
	* gcc.target/powerpc/pr88100.c: Likewise.
---
 gcc/testsuite/gcc.target/powerpc/pr80315-1.c |  2 +-
 gcc/testsuite/gcc.target/powerpc/pr80315-2.c |  2 +-
 gcc/testsuite/gcc.target/powerpc/pr80315-3.c |  2 +-
 gcc/testsuite/gcc.target/powerpc/pr80315-4.c |  2 +-
 gcc/testsuite/gcc.target/powerpc/pr88100.c   | 12 ++++++------
 5 files changed, 10 insertions(+), 10 deletions(-)
  

Comments

Li, Pan2 via Gcc-patches Dec. 1, 2021, 4:35 p.m. UTC | #1
Hi!  I'd like to ping this patch.

Thanks!
Bill

On 11/18/21 10:15 AM, Bill Schmidt wrote:
> Hi!  This patch is broken out from the test case patch for the new
> builtins support.
>
> One advantage of the new builtins support is uniform error messages for
> arguments with restricted values.  Previously this was done in many places
> in an ad hoc manner, with little uniformity.  This patch adjusts the
> expected error messages accordingly.
>
> All error messages are now one of the following:
>   "argument %d must be a %d-bit unsigned literal"
>   "argument %d must be a literal between %d and %d, inclusive"
>   "argument %d must be a variable or a literal between %d and %d, inclusive"
>   "argument %d must be either a literal %d or a literal %d"
>
> These messages were chosen to require the fewest changes from previous
> messages while still introducing uniformity.  This patch adjusts error
> messages for some cases where this produces changed messages.
>
> Tested on powerpc64le-linux-gnu and powerpc64-linux-gnu (-m32/-m64) with
> no regressions.  is this okay for trunk?
>
> Thanks!
> Bill
>
>
> 2021-11-17  Bill Schmidt  <wschmidt@linux.ibm.com>
>
> gcc/testsuite/
> 	* gcc.target/powerpc/pr80315-1.c: Adjust error message.
> 	* gcc.target/powerpc/pr80315-2.c: Likewise.
> 	* gcc.target/powerpc/pr80315-3.c: Likewise.
> 	* gcc.target/powerpc/pr80315-4.c: Likewise.
> 	* gcc.target/powerpc/pr88100.c: Likewise.
> ---
>  gcc/testsuite/gcc.target/powerpc/pr80315-1.c |  2 +-
>  gcc/testsuite/gcc.target/powerpc/pr80315-2.c |  2 +-
>  gcc/testsuite/gcc.target/powerpc/pr80315-3.c |  2 +-
>  gcc/testsuite/gcc.target/powerpc/pr80315-4.c |  2 +-
>  gcc/testsuite/gcc.target/powerpc/pr88100.c   | 12 ++++++------
>  5 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/gcc/testsuite/gcc.target/powerpc/pr80315-1.c b/gcc/testsuite/gcc.target/powerpc/pr80315-1.c
> index e2db0ff4b5f..f37f1f169a2 100644
> --- a/gcc/testsuite/gcc.target/powerpc/pr80315-1.c
> +++ b/gcc/testsuite/gcc.target/powerpc/pr80315-1.c
> @@ -10,6 +10,6 @@ main()
>    int mask;
>  
>    /* Argument 2 must be 0 or 1.  Argument 3 must be in range 0..15.  */
> -  res = __builtin_crypto_vshasigmaw (test, 1, 0xff); /* { dg-error {argument 3 must be in the range \[0, 15\]} } */
> +  res = __builtin_crypto_vshasigmaw (test, 1, 0xff); /* { dg-error {argument 3 must be a 4-bit unsigned literal} } */
>    return 0;
>  }
> diff --git a/gcc/testsuite/gcc.target/powerpc/pr80315-2.c b/gcc/testsuite/gcc.target/powerpc/pr80315-2.c
> index 144b705c012..0819a0511b7 100644
> --- a/gcc/testsuite/gcc.target/powerpc/pr80315-2.c
> +++ b/gcc/testsuite/gcc.target/powerpc/pr80315-2.c
> @@ -10,6 +10,6 @@ main ()
>    int mask;
>  
>    /* Argument 2 must be 0 or 1.  Argument 3 must be in range 0..15.  */
> -  res = __builtin_crypto_vshasigmad (test, 1, 0xff); /* { dg-error {argument 3 must be in the range \[0, 15\]} } */
> +  res = __builtin_crypto_vshasigmad (test, 1, 0xff); /* { dg-error {argument 3 must be a 4-bit unsigned literal} } */
>    return 0;
>  }
> diff --git a/gcc/testsuite/gcc.target/powerpc/pr80315-3.c b/gcc/testsuite/gcc.target/powerpc/pr80315-3.c
> index 99a3e24eadd..cc2e46cf5cb 100644
> --- a/gcc/testsuite/gcc.target/powerpc/pr80315-3.c
> +++ b/gcc/testsuite/gcc.target/powerpc/pr80315-3.c
> @@ -12,6 +12,6 @@ main ()
>    int mask;
>  
>    /* Argument 2 must be 0 or 1.  Argument 3 must be in range 0..15.  */
> -  res = vec_shasigma_be (test, 1, 0xff); /* { dg-error {argument 3 must be in the range \[0, 15\]} } */
> +  res = vec_shasigma_be (test, 1, 0xff); /* { dg-error {argument 3 must be a 4-bit unsigned literal} } */
>    return res;
>  }
> diff --git a/gcc/testsuite/gcc.target/powerpc/pr80315-4.c b/gcc/testsuite/gcc.target/powerpc/pr80315-4.c
> index 7f5f6f75029..ac12910741b 100644
> --- a/gcc/testsuite/gcc.target/powerpc/pr80315-4.c
> +++ b/gcc/testsuite/gcc.target/powerpc/pr80315-4.c
> @@ -12,6 +12,6 @@ main ()
>    int mask;
>  
>    /* Argument 2 must be 0 or 1.  Argument 3 must be in range 0..15.  */
> -  res = vec_shasigma_be (test, 1, 0xff); /* { dg-error {argument 3 must be in the range \[0, 15\]} } */
> +  res = vec_shasigma_be (test, 1, 0xff); /* { dg-error {argument 3 must be a 4-bit unsigned literal} } */
>    return res;
>  }
> diff --git a/gcc/testsuite/gcc.target/powerpc/pr88100.c b/gcc/testsuite/gcc.target/powerpc/pr88100.c
> index 4452145ce95..764c897a497 100644
> --- a/gcc/testsuite/gcc.target/powerpc/pr88100.c
> +++ b/gcc/testsuite/gcc.target/powerpc/pr88100.c
> @@ -10,35 +10,35 @@
>  vector unsigned char
>  splatu1 (void)
>  {
> -  return vec_splat_u8(0x100);/* { dg-error "argument 1 must be a 5-bit signed literal" } */
> +  return vec_splat_u8(0x100);/* { dg-error "argument 1 must be a literal between -16 and 15, inclusive" } */
>  }
>  
>  vector unsigned short
>  splatu2 (void)
>  {
> -  return vec_splat_u16(0x10000);/* { dg-error "argument 1 must be a 5-bit signed literal" } */
> +  return vec_splat_u16(0x10000);/* { dg-error "argument 1 must be a literal between -16 and 15, inclusive" } */
>  }
>  
>  vector unsigned int
>  splatu3 (void)
>  {
> -  return vec_splat_u32(0x10000000);/* { dg-error "argument 1 must be a 5-bit signed literal" } */
> +  return vec_splat_u32(0x10000000);/* { dg-error "argument 1 must be a literal between -16 and 15, inclusive" } */
>  }
>  
>  vector signed char
>  splats1 (void)
>  {
> -  return vec_splat_s8(0x100);/* { dg-error "argument 1 must be a 5-bit signed literal" } */
> +  return vec_splat_s8(0x100);/* { dg-error "argument 1 must be a literal between -16 and 15, inclusive" } */
>  }
>  
>  vector signed short
>  splats2 (void)
>  {
> -  return vec_splat_s16(0x10000);/* { dg-error "argument 1 must be a 5-bit signed literal" } */
> +  return vec_splat_s16(0x10000);/* { dg-error "argument 1 must be a literal between -16 and 15, inclusive" } */
>  }
>  
>  vector signed int
>  splats3 (void)
>  {
> -  return vec_splat_s32(0x10000000);/* { dg-error "argument 1 must be a 5-bit signed literal" } */
> +  return vec_splat_s32(0x10000000);/* { dg-error "argument 1 must be a literal between -16 and 15, inclusive" } */
>  }
  
Segher Boessenkool Dec. 1, 2021, 10:29 p.m. UTC | #2
On Thu, Nov 18, 2021 at 10:15:21AM -0600, Bill Schmidt wrote:
> Hi!  This patch is broken out from the test case patch for the new
> builtins support.
> 
> One advantage of the new builtins support is uniform error messages for
> arguments with restricted values.  Previously this was done in many places
> in an ad hoc manner, with little uniformity.  This patch adjusts the
> expected error messages accordingly.
> 
> All error messages are now one of the following:
>   "argument %d must be a %d-bit unsigned literal"
>   "argument %d must be a literal between %d and %d, inclusive"
>   "argument %d must be a variable or a literal between %d and %d, inclusive"
>   "argument %d must be either a literal %d or a literal %d"
> 
> These messages were chosen to require the fewest changes from previous
> messages while still introducing uniformity.  This patch adjusts error
> messages for some cases where this produces changed messages.
> 
> Tested on powerpc64le-linux-gnu and powerpc64-linux-gnu (-m32/-m64) with
> no regressions.  is this okay for trunk?

We should have opnly the middle two of those messages.  But, okay for
trunk if you put this on some to-do list.  Thanks!


Segher
  
Li, Pan2 via Gcc-patches Dec. 1, 2021, 10:42 p.m. UTC | #3
Hi!

On 12/1/21 4:29 PM, Segher Boessenkool wrote:
> On Thu, Nov 18, 2021 at 10:15:21AM -0600, Bill Schmidt wrote:
>> Hi!  This patch is broken out from the test case patch for the new
>> builtins support.
>>
>> One advantage of the new builtins support is uniform error messages for
>> arguments with restricted values.  Previously this was done in many places
>> in an ad hoc manner, with little uniformity.  This patch adjusts the
>> expected error messages accordingly.
>>
>> All error messages are now one of the following:
>>   "argument %d must be a %d-bit unsigned literal"
>>   "argument %d must be a literal between %d and %d, inclusive"
>>   "argument %d must be a variable or a literal between %d and %d, inclusive"
>>   "argument %d must be either a literal %d or a literal %d"
>>
>> These messages were chosen to require the fewest changes from previous
>> messages while still introducing uniformity.  This patch adjusts error
>> messages for some cases where this produces changed messages.
>>
>> Tested on powerpc64le-linux-gnu and powerpc64-linux-gnu (-m32/-m64) with
>> no regressions.  is this okay for trunk?
> We should have opnly the middle two of those messages.  But, okay for
> trunk if you put this on some to-do list.  Thanks!

The last one is actually needed also, because we have at least one case 
where the two supported values aren't contiguous.  We can do without the
first one, but that will affect quite a number of test cases, so agree
that this should be done later.  (We already had a whole lot of tests
of this form.)

Thanks for the review!
Bill

>
> Segher
  
Segher Boessenkool Dec. 2, 2021, 8:36 a.m. UTC | #4
On Wed, Dec 01, 2021 at 04:42:19PM -0600, Bill Schmidt wrote:
> On 12/1/21 4:29 PM, Segher Boessenkool wrote:
> > On Thu, Nov 18, 2021 at 10:15:21AM -0600, Bill Schmidt wrote:
> >> All error messages are now one of the following:
> >>   "argument %d must be a %d-bit unsigned literal"
> >>   "argument %d must be a literal between %d and %d, inclusive"
> >>   "argument %d must be a variable or a literal between %d and %d, inclusive"
> >>   "argument %d must be either a literal %d or a literal %d"
> >>
> >> These messages were chosen to require the fewest changes from previous
> >> messages while still introducing uniformity.  This patch adjusts error
> >> messages for some cases where this produces changed messages.
> >>
> >> Tested on powerpc64le-linux-gnu and powerpc64-linux-gnu (-m32/-m64) with
> >> no regressions.  is this okay for trunk?
> > We should have opnly the middle two of those messages.  But, okay for
> > trunk if you put this on some to-do list.  Thanks!
> 
> The last one is actually needed also, because we have at least one case 
> where the two supported values aren't contiguous.

Ah okay.  Nasty :-)

> We can do without the
> first one, but that will affect quite a number of test cases, so agree
> that this should be done later.  (We already had a whole lot of tests
> of this form.)

We never say "must be a 5-bit signed literal", although we have
instructions like that (vspltis[bhw] for example).  We also don't say
"unsigned 2-bit literal" or "unsigned 3-bit literal" because those are
just silly (almost as bad as "unsigned 1-bit literal" :-) )  And saying
"unsigned" keeps promulgating the confusion about what "unsigned"
*means* in C.


Segher
  

Patch

diff --git a/gcc/testsuite/gcc.target/powerpc/pr80315-1.c b/gcc/testsuite/gcc.target/powerpc/pr80315-1.c
index e2db0ff4b5f..f37f1f169a2 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr80315-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr80315-1.c
@@ -10,6 +10,6 @@  main()
   int mask;
 
   /* Argument 2 must be 0 or 1.  Argument 3 must be in range 0..15.  */
-  res = __builtin_crypto_vshasigmaw (test, 1, 0xff); /* { dg-error {argument 3 must be in the range \[0, 15\]} } */
+  res = __builtin_crypto_vshasigmaw (test, 1, 0xff); /* { dg-error {argument 3 must be a 4-bit unsigned literal} } */
   return 0;
 }
diff --git a/gcc/testsuite/gcc.target/powerpc/pr80315-2.c b/gcc/testsuite/gcc.target/powerpc/pr80315-2.c
index 144b705c012..0819a0511b7 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr80315-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr80315-2.c
@@ -10,6 +10,6 @@  main ()
   int mask;
 
   /* Argument 2 must be 0 or 1.  Argument 3 must be in range 0..15.  */
-  res = __builtin_crypto_vshasigmad (test, 1, 0xff); /* { dg-error {argument 3 must be in the range \[0, 15\]} } */
+  res = __builtin_crypto_vshasigmad (test, 1, 0xff); /* { dg-error {argument 3 must be a 4-bit unsigned literal} } */
   return 0;
 }
diff --git a/gcc/testsuite/gcc.target/powerpc/pr80315-3.c b/gcc/testsuite/gcc.target/powerpc/pr80315-3.c
index 99a3e24eadd..cc2e46cf5cb 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr80315-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr80315-3.c
@@ -12,6 +12,6 @@  main ()
   int mask;
 
   /* Argument 2 must be 0 or 1.  Argument 3 must be in range 0..15.  */
-  res = vec_shasigma_be (test, 1, 0xff); /* { dg-error {argument 3 must be in the range \[0, 15\]} } */
+  res = vec_shasigma_be (test, 1, 0xff); /* { dg-error {argument 3 must be a 4-bit unsigned literal} } */
   return res;
 }
diff --git a/gcc/testsuite/gcc.target/powerpc/pr80315-4.c b/gcc/testsuite/gcc.target/powerpc/pr80315-4.c
index 7f5f6f75029..ac12910741b 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr80315-4.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr80315-4.c
@@ -12,6 +12,6 @@  main ()
   int mask;
 
   /* Argument 2 must be 0 or 1.  Argument 3 must be in range 0..15.  */
-  res = vec_shasigma_be (test, 1, 0xff); /* { dg-error {argument 3 must be in the range \[0, 15\]} } */
+  res = vec_shasigma_be (test, 1, 0xff); /* { dg-error {argument 3 must be a 4-bit unsigned literal} } */
   return res;
 }
diff --git a/gcc/testsuite/gcc.target/powerpc/pr88100.c b/gcc/testsuite/gcc.target/powerpc/pr88100.c
index 4452145ce95..764c897a497 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr88100.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr88100.c
@@ -10,35 +10,35 @@ 
 vector unsigned char
 splatu1 (void)
 {
-  return vec_splat_u8(0x100);/* { dg-error "argument 1 must be a 5-bit signed literal" } */
+  return vec_splat_u8(0x100);/* { dg-error "argument 1 must be a literal between -16 and 15, inclusive" } */
 }
 
 vector unsigned short
 splatu2 (void)
 {
-  return vec_splat_u16(0x10000);/* { dg-error "argument 1 must be a 5-bit signed literal" } */
+  return vec_splat_u16(0x10000);/* { dg-error "argument 1 must be a literal between -16 and 15, inclusive" } */
 }
 
 vector unsigned int
 splatu3 (void)
 {
-  return vec_splat_u32(0x10000000);/* { dg-error "argument 1 must be a 5-bit signed literal" } */
+  return vec_splat_u32(0x10000000);/* { dg-error "argument 1 must be a literal between -16 and 15, inclusive" } */
 }
 
 vector signed char
 splats1 (void)
 {
-  return vec_splat_s8(0x100);/* { dg-error "argument 1 must be a 5-bit signed literal" } */
+  return vec_splat_s8(0x100);/* { dg-error "argument 1 must be a literal between -16 and 15, inclusive" } */
 }
 
 vector signed short
 splats2 (void)
 {
-  return vec_splat_s16(0x10000);/* { dg-error "argument 1 must be a 5-bit signed literal" } */
+  return vec_splat_s16(0x10000);/* { dg-error "argument 1 must be a literal between -16 and 15, inclusive" } */
 }
 
 vector signed int
 splats3 (void)
 {
-  return vec_splat_s32(0x10000000);/* { dg-error "argument 1 must be a 5-bit signed literal" } */
+  return vec_splat_s32(0x10000000);/* { dg-error "argument 1 must be a literal between -16 and 15, inclusive" } */
 }