public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH rs6000] Addition fixes to BMI intrinsic tests, 3rd edition
@ 2017-05-31 18:26 Steven Munroe
  2017-05-31 21:36 ` Segher Boessenkool
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Munroe @ 2017-05-31 18:26 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 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.

Also added:

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

and 

dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } }

To ward off the evil spirits 

Tests on BE --with-cpu=power6 -m32/-m64 and LE --with-cpu=power8. All
bmi/bmi2 intrinsic tests pasted.

[gcc/testsuite]

2017-05-31  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.  Add dg-skip-if directive disable this test if
	-mcpu overridden.
	* 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-option.  Add dg-skip-if directive to disable this test
	for darwin.

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,8 @@
 /* { 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 } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" }
{ "-mcpu=power7" } } */
 
 #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,8 @@
 /* { 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 } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" }
{ "-mcpu=power7" } } */
 
 #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,8 @@
 /* { 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 } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" }
{ "-mcpu=power7" } } */
 
 #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,8 @@
 /* { 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 } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" }
{ "-mcpu=power7" } } */
 
 #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,6 @@
 /* { dg-do compile } */
-/* { dg-options "-O3" } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-options "-O3 -mcpu=power7" } */
 /* { dg-require-effective-target lp64 } */
 /* { dg-require-effective-target powerpc_vsx_ok } */
 

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

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

Hi!

On Wed, May 31, 2017 at 12:35:57PM -0500, Steven Munroe wrote:
> 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,6 @@
>  /* { dg-do compile } */
> -/* { dg-options "-O3" } */
> +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
> +/* { dg-options "-O3 -mcpu=power7" } */
>  /* { dg-require-effective-target lp64 } */
>  /* { dg-require-effective-target powerpc_vsx_ok } */

This one needs the

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

as well.  Okay with that added.

Thanks,


Segher

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

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

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

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