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

Message ID bbc6016b-1977-72fe-3f72-75177c943fac@linux.ibm.com
State New
Headers
Series rs6000: Builtins test changes for byte-in-set-2.c |

Commit Message

Li, Pan2 via Gcc-patches Nov. 18, 2021, 1:42 p.m. UTC
  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(-)
  

Comments

Segher Boessenkool Nov. 18, 2021, 9:24 p.m. UTC | #1
On Thu, Nov 18, 2021 at 07:42:34AM -0600, Bill Schmidt wrote:
> gcc/testsuite/
> 	* gcc.target/powerpc/byte-in-set-2.c: Adjust error message.

"Adjust expected error message" maybe?

Okay for trunk.  Thanks!


Segher
  

Patch

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" } */
 }