public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH], Update cpu-builtin-1.c test on PowerPC
@ 2017-07-18 20:24 Michael Meissner
  2017-07-19 17:33 ` Segher Boessenkool
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Meissner @ 2017-07-18 20:24 UTC (permalink / raw)
  To: GCC Patches, Segher Boessenkool, David Edelsohn, Bill Schmidt

[-- Attachment #1: Type: text/plain, Size: 1017 bytes --]

This patch modifies the change I made on July 12th.  It modifies the test for
the __builtin_cpu_is and __builtin_cpu_supports built-in functions to use an
#ifdef instead of target-requires for doing the tests.  One motavation is to
make the back port to GCC 6/7 easier, as I won't have to back port the change
to add the target option ppc_cpu_supports_hw.

I've checked the trunk with compilers built with a new GLIBC and without, and
it passes both compilers.  I also checked the back port to GCC 6/7 and both
work fine as well.

Can I check this patch into the trunk and backports to GCC 6 and 7?

2017-07-18  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/81193
	* gcc.target/powerpc/cpu-builtin-1.c: Change test to use #ifdef
	__BUILTIN_CPU_SUPPORTS to see if the GLIBC is new enough that
	__builtin_cpu_is and __builtin_cpu_supports are supported.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797

[-- Attachment #2: pr81193.patch05b --]
[-- Type: text/plain, Size: 1578 bytes --]

Index: gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c	(revision 250316)
+++ gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c	(working copy)
@@ -1,10 +1,14 @@
 /* { dg-do compile { target { powerpc*-*-* } } } */
 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
-/* { dg-require-effective-target ppc_cpu_supports_hw } */
 
 void
 use_cpu_is_builtins (unsigned int *p)
 {
+  /* If GCC was configured to use an old GLIBC (before 2.23), the
+     __builtin_cpu_is and __builtin_cpu_supports built-in functions return 0,
+     and the compiler issues a warning that you need a newer glibc to use them.
+     Use #ifdef to avoid the warning.  */
+#ifdef __BUILTIN_CPU_SUPPORTS__
   p[0] = __builtin_cpu_is ("power9");
   p[1] = __builtin_cpu_is ("power8");
   p[2] = __builtin_cpu_is ("power7");
@@ -20,11 +24,15 @@ use_cpu_is_builtins (unsigned int *p)
   p[12] = __builtin_cpu_is ("ppc440");
   p[13] = __builtin_cpu_is ("ppc405");
   p[14] = __builtin_cpu_is ("ppc-cell-be");
+#else
+  p[0] = 0;
+#endif
 }
 
 void
 use_cpu_supports_builtins (unsigned int *p)
 {
+#ifdef __BUILTIN_CPU_SUPPORTS__
   p[0] = __builtin_cpu_supports ("4xxmac");
   p[1] = __builtin_cpu_supports ("altivec");
   p[2] = __builtin_cpu_supports ("arch_2_05");
@@ -63,4 +71,7 @@ use_cpu_supports_builtins (unsigned int
   p[35] = __builtin_cpu_supports ("ucache");
   p[36] = __builtin_cpu_supports ("vcrypto");
   p[37] = __builtin_cpu_supports ("vsx");
+#else
+  p[0] = 0;
+#endif
 }

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

* Re: [PATCH], Update cpu-builtin-1.c test on PowerPC
  2017-07-18 20:24 [PATCH], Update cpu-builtin-1.c test on PowerPC Michael Meissner
@ 2017-07-19 17:33 ` Segher Boessenkool
  2017-07-19 19:24   ` Michael Meissner
  0 siblings, 1 reply; 3+ messages in thread
From: Segher Boessenkool @ 2017-07-19 17:33 UTC (permalink / raw)
  To: Michael Meissner, GCC Patches, David Edelsohn, Bill Schmidt

On Tue, Jul 18, 2017 at 04:24:47PM -0400, Michael Meissner wrote:
> This patch modifies the change I made on July 12th.  It modifies the test for
> the __builtin_cpu_is and __builtin_cpu_supports built-in functions to use an
> #ifdef instead of target-requires for doing the tests.  One motavation is to
> make the back port to GCC 6/7 easier, as I won't have to back port the change
> to add the target option ppc_cpu_supports_hw.
> 
> I've checked the trunk with compilers built with a new GLIBC and without, and
> it passes both compilers.  I also checked the back port to GCC 6/7 and both
> work fine as well.
> 
> Can I check this patch into the trunk and backports to GCC 6 and 7?

You will only do this for the tests of __builtin_cpu_* itself?  Okay
(for all branches) in that case.


Segher


> 2017-07-18  Michael Meissner  <meissner@linux.vnet.ibm.com>
> 
> 	PR target/81193
> 	* gcc.target/powerpc/cpu-builtin-1.c: Change test to use #ifdef
> 	__BUILTIN_CPU_SUPPORTS to see if the GLIBC is new enough that
> 	__builtin_cpu_is and __builtin_cpu_supports are supported.

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

* Re: [PATCH], Update cpu-builtin-1.c test on PowerPC
  2017-07-19 17:33 ` Segher Boessenkool
@ 2017-07-19 19:24   ` Michael Meissner
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Meissner @ 2017-07-19 19:24 UTC (permalink / raw)
  To: Segher Boessenkool
  Cc: Michael Meissner, GCC Patches, David Edelsohn, Bill Schmidt

On Wed, Jul 19, 2017 at 12:33:03PM -0500, Segher Boessenkool wrote:
> On Tue, Jul 18, 2017 at 04:24:47PM -0400, Michael Meissner wrote:
> > This patch modifies the change I made on July 12th.  It modifies the test for
> > the __builtin_cpu_is and __builtin_cpu_supports built-in functions to use an
> > #ifdef instead of target-requires for doing the tests.  One motavation is to
> > make the back port to GCC 6/7 easier, as I won't have to back port the change
> > to add the target option ppc_cpu_supports_hw.
> > 
> > I've checked the trunk with compilers built with a new GLIBC and without, and
> > it passes both compilers.  I also checked the back port to GCC 6/7 and both
> > work fine as well.
> > 
> > Can I check this patch into the trunk and backports to GCC 6 and 7?
> 
> You will only do this for the tests of __builtin_cpu_* itself?  Okay
> (for all branches) in that case.

Yes, I'm only changing the one test that is in the GCC 7/6 branches.  The other
tests that use the __builtin_cpu_supports built-in (the bmi* tests) will
continue to use the target supports method.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797

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

end of thread, other threads:[~2017-07-19 19:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-18 20:24 [PATCH], Update cpu-builtin-1.c test on PowerPC Michael Meissner
2017-07-19 17:33 ` Segher Boessenkool
2017-07-19 19:24   ` Michael Meissner

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