Message ID | Zo7HOdgl1pbn6lP4@cowardly-lion.the-meissners.org |
---|---|
State | New |
Headers | show |
Series | Add support for -mcpu=power11 | expand |
Hi! On Wed, Jul 10, 2024 at 01:39:05PM -0400, Michael Meissner wrote: > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/power11-1.c > @@ -0,0 +1,12 @@ > +/* { dg-do compile { target powerpc*-*-* } } */ Everything in gcc.target/powerpc is only run for target powerpc*-*-* anyway, so make this just /* { dg-do compile } */ please. (Or nothing, it is the default after all, but you may want to have it explicit). > +/* { dg-options "-mdejagnu-cpu=power11 -O2" } */ > + > +/* Basic check to see if the compiler supports -mcpu=power11. */ And to check if _ARCH_PWR11 works. > +#ifndef _ARCH_PWR11 > +#error "-mcpu=power11 is not supported" > +#endif > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/power11-2.c > @@ -0,0 +1,22 @@ > +/* Require VSX and Linux to eliminate systems where you can't do > + __attribute__((__target__(...))). */ > +/* { dg-do compile { target { powerpc*-*-linux* } } } */ Same. > +/* { dg-require-effective-target powerpc_vsx_ok } */ Why is this needed? It needs a comment saying that. Saying that this is "to test if can use the target attr" is nonsense. That does not need Linux either btw. Target selection might not work correctly currently on some other systems, but this is not a run test! > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/power11-3.c > @@ -0,0 +1,11 @@ > +/* { dg-do compile { target powerpc*-*-* } } */ > +/* Require VSX and Linux to eliminate systems where you can't do > + __attribute__((__target_clones__(...))). */ All the same things here, mutatis mutandis. Segher
On 7/18/24 8:23 AM, Segher Boessenkool wrote: > Everything in gcc.target/powerpc is only run for target powerpc*-*-* > anyway, so make this just > > /* { dg-do compile } */ > > please. (Or nothing, it is the default after all, but you may want to > have it explicit). Personally, I do like seeing the /* { dg-do compile } */ even though that is the default in this testsuite directory. >> +/* { dg-require-effective-target powerpc_vsx_ok } */ > > Why is this needed? It needs a comment saying that. After Kewen's testsuite patch, powerpc_vsx_ok is pretty useless as it only checks whether the assembler knows about vsx, and what people normally want is powerpc_vsx which verifies that the compiler options used to compile the test support generating VSX insns. That said, do we really need that here? Can't we compile this test case with -mcpu=power4 as the default (ie, no VSX) and the clones should be able to generate power* and VSX just fine, correct? I don't understand the requirement on VSX here. > Saying that this is "to test if can use the target attr" is nonsense. > That does not need Linux either btw. Target selection might not work > correctly currently on some other systems, but this is not a run test! Agreed. Also, if the clones stuff really doesn't work for those targets even in a compile test, then rather than diabling this way, I think I'd like to see a target-supports clones_ok test or similar. Peter
On Thu, Jul 18, 2024 at 09:53:05AM -0500, Peter Bergner wrote: > On 7/18/24 8:23 AM, Segher Boessenkool wrote: > > Everything in gcc.target/powerpc is only run for target powerpc*-*-* > > anyway, so make this just > > > > /* { dg-do compile } */ > > > > please. (Or nothing, it is the default after all, but you may want to > > have it explicit). > > Personally, I do like seeing the /* { dg-do compile } */ even though > that is the default in this testsuite directory. It depends :-) For testsuites that often do something else as well (like in gcc.target), it can be nice to be verbose, yes. > >> +/* { dg-require-effective-target powerpc_vsx_ok } */ > > > > Why is this needed? It needs a comment saying that. > > After Kewen's testsuite patch, powerpc_vsx_ok is pretty useless as it only > checks whether the assembler knows about vsx, and what people normally want > is powerpc_vsx which verifies that the compiler options used to compile the > test support generating VSX insns. That, sure, but even then it does not make any sense. Each of the funcs uses its own -mcpu= so either will have VSX or not, and it doesn't matter at all what the default compiler target does. And, absolutely nothing in this test case uses VSX at all. > > Saying that this is "to test if can use the target attr" is nonsense. > > That does not need Linux either btw. Target selection might not work > > correctly currently on some other systems, but this is not a run test! > > Agreed. Also, if the clones stuff really doesn't work for those > targets even in a compile test, then rather than diabling this way, > I think I'd like to see a target-supports clones_ok test or similar. Yup. Segher
diff --git a/gcc/testsuite/gcc.target/powerpc/power11-1.c b/gcc/testsuite/gcc.target/powerpc/power11-1.c new file mode 100644 index 00000000000..a1bd9538cba --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/power11-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-mdejagnu-cpu=power11 -O2" } */ + +/* Basic check to see if the compiler supports -mcpu=power11. */ + +#ifndef _ARCH_PWR11 +#error "-mcpu=power11 is not supported" +#endif + +void foo (void) +{ +} diff --git a/gcc/testsuite/gcc.target/powerpc/power11-2.c b/gcc/testsuite/gcc.target/powerpc/power11-2.c new file mode 100644 index 00000000000..4521c2a37c7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/power11-2.c @@ -0,0 +1,22 @@ +/* Require VSX and Linux to eliminate systems where you can't do + __attribute__((__target__(...))). */ +/* { dg-do compile { target { powerpc*-*-linux* } } } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-options "-O2" } */ + +/* Check if we can set the power11 target via a target attribute. */ + +__attribute__((__target__("cpu=power9"))) +void foo_p9 (void) +{ +} + +__attribute__((__target__("cpu=power10"))) +void foo_p10 (void) +{ +} + +__attribute__((__target__("cpu=power11"))) +void foo_p11 (void) +{ +} diff --git a/gcc/testsuite/gcc.target/powerpc/power11-3.c b/gcc/testsuite/gcc.target/powerpc/power11-3.c new file mode 100644 index 00000000000..abf0c5866a9 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/power11-3.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target powerpc*-*-* } } */ +/* Require VSX and Linux to eliminate systems where you can't do + __attribute__((__target_clones__(...))). */ +/* { dg-options "-mdejagnu-cpu=power8 -O2" } */ + +/* Check if we can set the power11 target via a target_clones attribute. */ + +__attribute__((__target_clones__("cpu=power11,cpu=power9,default"))) +void foo (void) +{ +}