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  <wschm...@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


Reply via email to