diff mbox series

rs6000: Builtins test changes for compare-bytes tests

Message ID 3103d029-8fef-c8fc-5762-f27a88b5f499@linux.ibm.com
State New
Headers show
Series rs6000: Builtins test changes for compare-bytes tests | expand

Commit Message

soeren--- via Gcc-patches Nov. 18, 2021, 1:47 p.m. UTC
Hi!  This patch is broken out from the patch with test suite changes for the
new builtins support.

With the old builtins support, cmpb-2.c produces:
  warning: implicit declaration of function '__builtin_cmpb; did you mean '__builtin_bcmp'?

With the new support, it produces:
  error: '__builtin_p6_cmpb requires the '-mcpu=power6' option and either the '-m64' or '-mpowerpc64' option
  note: builtin '__builtin_cmpb' requires builtin '__builtin_p6_cmpb'

The reason for this is that this builtin wasn't even initialized in the
old support.  This reflects a difference in philosophy between the old and
new methods.  The old support often doesn't initialize builtins for which
the conditions don't apply based on compile options, but this can backfire
in general when such constructs as "#pragma target" are used.  The new
support initializes all builtins, and waits until expand time to determine
whether or not they are enabled.  Besides added flexibility, we also get
better error messages as a result.

The case for cmpb32-2.c is similar.

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/cmpb-2.c: Adjust error message.
	* gcc.target/powerpc/cmpb32-2.c: Likewise.
---
 gcc/testsuite/gcc.target/powerpc/cmpb-2.c   | 2 +-
 gcc/testsuite/gcc.target/powerpc/cmpb32-2.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

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

Thanks!
Bill

On 11/18/21 7:47 AM, Bill Schmidt wrote:
> Hi!  This patch is broken out from the patch with test suite changes for the
> new builtins support.
>
> With the old builtins support, cmpb-2.c produces:
>   warning: implicit declaration of function '__builtin_cmpb; did you mean '__builtin_bcmp'?
>
> With the new support, it produces:
>   error: '__builtin_p6_cmpb requires the '-mcpu=power6' option and either the '-m64' or '-mpowerpc64' option
>   note: builtin '__builtin_cmpb' requires builtin '__builtin_p6_cmpb'
>
> The reason for this is that this builtin wasn't even initialized in the
> old support.  This reflects a difference in philosophy between the old and
> new methods.  The old support often doesn't initialize builtins for which
> the conditions don't apply based on compile options, but this can backfire
> in general when such constructs as "#pragma target" are used.  The new
> support initializes all builtins, and waits until expand time to determine
> whether or not they are enabled.  Besides added flexibility, we also get
> better error messages as a result.
>
> The case for cmpb32-2.c is similar.
>
> 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/cmpb-2.c: Adjust error message.
> 	* gcc.target/powerpc/cmpb32-2.c: Likewise.
> ---
>  gcc/testsuite/gcc.target/powerpc/cmpb-2.c   | 2 +-
>  gcc/testsuite/gcc.target/powerpc/cmpb32-2.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/testsuite/gcc.target/powerpc/cmpb-2.c b/gcc/testsuite/gcc.target/powerpc/cmpb-2.c
> index 113ab6a5f99..02b84d0731d 100644
> --- a/gcc/testsuite/gcc.target/powerpc/cmpb-2.c
> +++ b/gcc/testsuite/gcc.target/powerpc/cmpb-2.c
> @@ -8,7 +8,7 @@ void abort ();
>  unsigned long long int
>  do_compare (unsigned long long int a, unsigned long long int b)
>  {
> -  return __builtin_cmpb (a, b);	/* { dg-warning "implicit declaration of function '__builtin_cmpb'" } */
> +  return __builtin_cmpb (a, b);	/* { dg-error "'__builtin_p6_cmpb' requires the '-mcpu=power6' option" } */
>  }
>  
>  void
> diff --git a/gcc/testsuite/gcc.target/powerpc/cmpb32-2.c b/gcc/testsuite/gcc.target/powerpc/cmpb32-2.c
> index 37b54745e0e..d4264ab6e7d 100644
> --- a/gcc/testsuite/gcc.target/powerpc/cmpb32-2.c
> +++ b/gcc/testsuite/gcc.target/powerpc/cmpb32-2.c
> @@ -7,7 +7,7 @@ void abort ();
>  unsigned int
>  do_compare (unsigned int a, unsigned int b)
>  {
> -  return __builtin_cmpb (a, b);  /* { dg-warning "implicit declaration of function '__builtin_cmpb'" } */
> +  return __builtin_cmpb (a, b);  /* { dg-error "'__builtin_p6_cmpb_32' requires the '-mcpu=power6' option" } */
>  }
>  
>  void
Segher Boessenkool Dec. 1, 2021, 10:18 p.m. UTC | #2
On Thu, Nov 18, 2021 at 07:47:38AM -0600, Bill Schmidt wrote:
> Hi!  This patch is broken out from the patch with test suite changes for the
> new builtins support.
> 
> With the old builtins support, cmpb-2.c produces:
>   warning: implicit declaration of function '__builtin_cmpb; did you mean '__builtin_bcmp'?
> 
> With the new support, it produces:
>   error: '__builtin_p6_cmpb requires the '-mcpu=power6' option and either the '-m64' or '-mpowerpc64' option
>   note: builtin '__builtin_cmpb' requires builtin '__builtin_p6_cmpb'

I am still not happy with this at all, it is clearly worse than what we
had.  But, okay for trunk, and hopefully we can fix it before GCC 12
release.  Thanks!


Segher
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.target/powerpc/cmpb-2.c b/gcc/testsuite/gcc.target/powerpc/cmpb-2.c
index 113ab6a5f99..02b84d0731d 100644
--- a/gcc/testsuite/gcc.target/powerpc/cmpb-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/cmpb-2.c
@@ -8,7 +8,7 @@  void abort ();
 unsigned long long int
 do_compare (unsigned long long int a, unsigned long long int b)
 {
-  return __builtin_cmpb (a, b);	/* { dg-warning "implicit declaration of function '__builtin_cmpb'" } */
+  return __builtin_cmpb (a, b);	/* { dg-error "'__builtin_p6_cmpb' requires the '-mcpu=power6' option" } */
 }
 
 void
diff --git a/gcc/testsuite/gcc.target/powerpc/cmpb32-2.c b/gcc/testsuite/gcc.target/powerpc/cmpb32-2.c
index 37b54745e0e..d4264ab6e7d 100644
--- a/gcc/testsuite/gcc.target/powerpc/cmpb32-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/cmpb32-2.c
@@ -7,7 +7,7 @@  void abort ();
 unsigned int
 do_compare (unsigned int a, unsigned int b)
 {
-  return __builtin_cmpb (a, b);  /* { dg-warning "implicit declaration of function '__builtin_cmpb'" } */
+  return __builtin_cmpb (a, b);  /* { dg-error "'__builtin_p6_cmpb_32' requires the '-mcpu=power6' option" } */
 }
 
 void