public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH rs6000] Addition fixes to BMI intrinsic tests, 2nd edition
@ 2017-05-26 15:48 Steven Munroe
  2017-05-30 23:23 ` Segher Boessenkool
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Munroe @ 2017-05-26 15:48 UTC (permalink / raw)
  To: gcc-patches; +Cc: Segher Boessenkool, David Edelsohn

Bill Seurer pointed out that building the BMI tests on a power8 but with
gcc built --with-cpu=power6 fails with link errors. The intrinsics
_pdep_u64/32 and _pext_u64/32 are guarded with #ifdef _ARCH_PWR7 as the
implementation uses bpermd and popcntd instructions introduced with
power7 (PowerISA-2.06).

But if the GCC is built --with-cpu=power6, the compiler is capable of
supporting -mcpu=power7 but will not generate bpermd/popcntd by default.
Then if some code them uses say _pext_u64 with -mcpu=power6 the
intrinsic is not not supported (needs power7) and so is not defined. 

The { dg-require-effective-target powerpc_vsx_ok } is not sufficient for
the { dg-do run } and need to be changed to vsx_hw. Also we need add
-mcpu=power7 to dg-options to insure the compiler will generated the
bpermd/popcntd instructions.

This is sufficient for all the bmi/bmi2 tests to skip/pass for power6
and later.

[gcc/testsuite]

2017-05-26  Steven Munroe  <munroesj@gcc.gnu.org>

	* gcc.target/powerpc/bmi2-pdep32-1.c []: Add -mcpu=power7 to
	dg-options.  Change dg-require-effective-target powerpc_vsx_ok
	to vsx_hw.
	* gcc.target/powerpc/bmi2-pdep64-1.c: Likewise.
	* gcc.target/powerpc/bmi2-pext32-1.c: Likewise.
	* gcc.target/powerpc/bmi2-pext64-1.c: Likewise.
	* gcc.target/powerpc/bmi2-pext64-1a.c: Add -mcpu=power7 to
	dg-options.

Index: gcc/testsuite/gcc.target/powerpc/bmi2-pdep32-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/bmi2-pdep32-1.c	(revision 248468)
+++ gcc/testsuite/gcc.target/powerpc/bmi2-pdep32-1.c	(working copy)
@@ -1,7 +1,7 @@
 /* { dg-do run } */
-/* { dg-options "-O3" } */
+/* { dg-options "-O3 -mcpu=power7" } */
 /* { dg-require-effective-target lp64 } */
-/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-require-effective-target vsx_hw } */
 
 #define NO_WARN_X86_INTRINSICS 1
 #include <x86intrin.h>
Index: gcc/testsuite/gcc.target/powerpc/bmi2-pdep64-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/bmi2-pdep64-1.c	(revision 248468)
+++ gcc/testsuite/gcc.target/powerpc/bmi2-pdep64-1.c	(working copy)
@@ -1,7 +1,7 @@
 /* { dg-do run } */
-/* { dg-options "-O3" } */
+/* { dg-options "-O3 -mcpu=power7" } */
 /* { dg-require-effective-target lp64 } */
-/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-require-effective-target vsx_hw } */
 
 #define NO_WARN_X86_INTRINSICS 1
 #include <x86intrin.h>
Index: gcc/testsuite/gcc.target/powerpc/bmi2-pext32-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/bmi2-pext32-1.c	(revision 248468)
+++ gcc/testsuite/gcc.target/powerpc/bmi2-pext32-1.c	(working copy)
@@ -1,7 +1,7 @@
 /* { dg-do run } */
-/* { dg-options "-O3" } */
+/* { dg-options "-O3 -mcpu=power7" } */
 /* { dg-require-effective-target lp64 } */
-/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-require-effective-target vsx_hw } */
 
 #define NO_WARN_X86_INTRINSICS 1
 #include <x86intrin.h>
Index: gcc/testsuite/gcc.target/powerpc/bmi2-pext64-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/bmi2-pext64-1.c	(revision 248468)
+++ gcc/testsuite/gcc.target/powerpc/bmi2-pext64-1.c	(working copy)
@@ -1,7 +1,7 @@
 /* { dg-do run } */
-/* { dg-options "-O3" } */
+/* { dg-options "-O3 -mcpu=power7" } */
 /* { dg-require-effective-target lp64 } */
-/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-require-effective-target vsx_hw } */
 
 #define NO_WARN_X86_INTRINSICS 1
 #include <x86intrin.h>
Index: gcc/testsuite/gcc.target/powerpc/bmi2-pext64-1a.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/bmi2-pext64-1a.c	(revision 248468)
+++ gcc/testsuite/gcc.target/powerpc/bmi2-pext64-1a.c	(working copy)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O3" } */
+/* { dg-options "-O3 -mcpu=power7" } */
 /* { dg-require-effective-target lp64 } */
 /* { dg-require-effective-target powerpc_vsx_ok } */
 

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

* Re: [PATCH rs6000] Addition fixes to BMI intrinsic tests, 2nd edition
  2017-05-26 15:48 [PATCH rs6000] Addition fixes to BMI intrinsic tests, 2nd edition Steven Munroe
@ 2017-05-30 23:23 ` Segher Boessenkool
  2017-05-31  4:17   ` Steven Munroe
  0 siblings, 1 reply; 3+ messages in thread
From: Segher Boessenkool @ 2017-05-30 23:23 UTC (permalink / raw)
  To: Steven Munroe; +Cc: gcc-patches, David Edelsohn

On Fri, May 26, 2017 at 10:32:54AM -0500, Steven Munroe wrote:
> 	* gcc.target/powerpc/bmi2-pdep32-1.c []: Add -mcpu=power7 to
> 	dg-options.  Change dg-require-effective-target powerpc_vsx_ok
> 	to vsx_hw.

Stray "[]"?

> --- gcc/testsuite/gcc.target/powerpc/bmi2-pdep32-1.c	(revision 248468)
> +++ gcc/testsuite/gcc.target/powerpc/bmi2-pdep32-1.c	(working copy)
> @@ -1,7 +1,7 @@
>  /* { dg-do run } */
> -/* { dg-options "-O3" } */
> +/* { dg-options "-O3 -mcpu=power7" } */
>  /* { dg-require-effective-target lp64 } */
> -/* { dg-require-effective-target powerpc_vsx_ok } */
> +/* { dg-require-effective-target vsx_hw } */

Other testcases selecting a -mcpu= also use

/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */

Do you really want -mcpu=power7 always?  Or just at least power7?


Segher

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

* Re: [PATCH rs6000] Addition fixes to BMI intrinsic tests, 2nd edition
  2017-05-30 23:23 ` Segher Boessenkool
@ 2017-05-31  4:17   ` Steven Munroe
  0 siblings, 0 replies; 3+ messages in thread
From: Steven Munroe @ 2017-05-31  4:17 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: gcc-patches, David Edelsohn

On Tue, 2017-05-30 at 17:26 -0500, Segher Boessenkool wrote:
> On Fri, May 26, 2017 at 10:32:54AM -0500, Steven Munroe wrote:
> > 	* gcc.target/powerpc/bmi2-pdep32-1.c []: Add -mcpu=power7 to
> > 	dg-options.  Change dg-require-effective-target powerpc_vsx_ok
> > 	to vsx_hw.
> 
> Stray "[]"?
Yes, still not sure of the changelog conventions for DG options
> 
> > --- gcc/testsuite/gcc.target/powerpc/bmi2-pdep32-1.c	(revision 248468)
> > +++ gcc/testsuite/gcc.target/powerpc/bmi2-pdep32-1.c	(working copy)
> > @@ -1,7 +1,7 @@
> >  /* { dg-do run } */
> > -/* { dg-options "-O3" } */
> > +/* { dg-options "-O3 -mcpu=power7" } */
> >  /* { dg-require-effective-target lp64 } */
> > -/* { dg-require-effective-target powerpc_vsx_ok } */
> > +/* { dg-require-effective-target vsx_hw } */
> 
> Other testcases selecting a -mcpu= also use
> 
> /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */
> 
> Do you really want -mcpu=power7 always?  Or just at least power7?
> 

I need at least -mcpu=power7 to generate popcntd/bpermd. The
pdep_u32/pext_u32 implementations call the respective 64-bit versions as
the ISA does not provide a 32-bit bpermd.

It is not obvious how to the skip until a minimum -mcpu=power7 for these
dc-do run tests.

If the dg-skip-if is required I will add it.

For the dg-do compile test for _pext_u64 I need the -mcpu=power7
specifically to get the correct counts for bpermd, popcntd and cntlzd.


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

end of thread, other threads:[~2017-05-31  2:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-26 15:48 [PATCH rs6000] Addition fixes to BMI intrinsic tests, 2nd edition Steven Munroe
2017-05-30 23:23 ` Segher Boessenkool
2017-05-31  4:17   ` Steven Munroe

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