public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] rs6000: Builtins test changes for compare-bytes tests
@ 2021-11-18 13:47 Bill Schmidt
  2021-12-01 16:34 ` [PATCH, PING] " Bill Schmidt
  2021-12-01 22:18 ` [PATCH] " Segher Boessenkool
  0 siblings, 2 replies; 3+ messages in thread
From: Bill Schmidt @ 2021-11-18 13:47 UTC (permalink / raw)
  To: GCC Patches; +Cc: Segher Boessenkool, David Edelsohn

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



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

* [PATCH, PING] rs6000: Builtins test changes for compare-bytes tests
  2021-11-18 13:47 [PATCH] rs6000: Builtins test changes for compare-bytes tests Bill Schmidt
@ 2021-12-01 16:34 ` Bill Schmidt
  2021-12-01 22:18 ` [PATCH] " Segher Boessenkool
  1 sibling, 0 replies; 3+ messages in thread
From: Bill Schmidt @ 2021-12-01 16:34 UTC (permalink / raw)
  To: GCC Patches; +Cc: Segher Boessenkool, David Edelsohn

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

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

* Re: [PATCH] rs6000: Builtins test changes for compare-bytes tests
  2021-11-18 13:47 [PATCH] rs6000: Builtins test changes for compare-bytes tests Bill Schmidt
  2021-12-01 16:34 ` [PATCH, PING] " Bill Schmidt
@ 2021-12-01 22:18 ` Segher Boessenkool
  1 sibling, 0 replies; 3+ messages in thread
From: Segher Boessenkool @ 2021-12-01 22:18 UTC (permalink / raw)
  To: Bill Schmidt; +Cc: GCC Patches, David Edelsohn

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

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

end of thread, other threads:[~2021-12-01 22:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-18 13:47 [PATCH] rs6000: Builtins test changes for compare-bytes tests Bill Schmidt
2021-12-01 16:34 ` [PATCH, PING] " Bill Schmidt
2021-12-01 22:18 ` [PATCH] " Segher Boessenkool

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