[PATCH] rs6000: Builtins test changes for byte-in-set-2.c

Bill Schmidt wschmidt@linux.ibm.com
Thu Nov 18 13:42:34 GMT 2021


Hi!  This patch is broken out from the previous patch for builtins test suite
changes.  With the old builtins support, this test case produces:
  warning: implicit declaration of function '__builtin_byte_in_set'; did you mean '__builtin_byte_in_range'?

With the new support, it produces:
  error: '__builtin_scalar_byte_in_set' requires the '-mcpu=power9' option and either the '-m64' or '-mpowerpc64' option
  note: builtin '__builtin_byte_in_set' requires builtin '__builtin_scalar_byte_in_set'

The reason for this is that this builtin wasn't even initialized in the
old support, being defined as a "BU_P9_64BIT_2".  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.

Tested on powerpc64le-linux-gnu and powerpc-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/byte-in-set-2.c: Adjust error message.
---
 gcc/testsuite/gcc.target/powerpc/byte-in-set-2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.target/powerpc/byte-in-set-2.c b/gcc/testsuite/gcc.target/powerpc/byte-in-set-2.c
index 44cc7782760..4c676ba356d 100644
--- a/gcc/testsuite/gcc.target/powerpc/byte-in-set-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/byte-in-set-2.c
@@ -10,5 +10,5 @@
 int
 test_byte_in_set (unsigned char b, unsigned long long set_members)
 {
-  return __builtin_byte_in_set (b, set_members); /* { dg-warning "implicit declaration of function" } */
+  return __builtin_byte_in_set (b, set_members); /* { dg-error "'__builtin_scalar_byte_in_set' requires the" } */
 }
-- 
2.27.0




More information about the Gcc-patches mailing list