Hi! On Wed, Nov 20, 2019 at 02:58:33PM +0800, luoxhu wrote: > v3: > Define and use check_effective_target_xxx etc. > pre_power8: ... power6, power7. > power8: power8 only. > post_power8: power8, power9 ... > post_power9: power9, power10 ...
"post_xxx" does not include "xxx", normally. Maybe was can call it "power8+"? Nice and short. Of course there have been CPUs called "power5+" etc. as well, but GCC does not support those as separate -mcpu= (well, except power5+, but that won't give confusion hopefully). Or can you come up with some other short name for it? {pre-power8} is the same as {!power8+} btw. The only one we need here is p9+ btw. "at-least-p9"? "p9-or-better"? Or even just "p9", and have an "exactly-p9" if we need that (but that can also be written {p9 && !p10} then). > --- a/gcc/testsuite/gcc.target/powerpc/pr72804.c > +++ b/gcc/testsuite/gcc.target/powerpc/pr72804.c > @@ -1,7 +1,6 @@ > /* { dg-do compile { target { lp64 } } } */ > -/* { dg-skip-if "" { powerpc*-*-darwin* } } */ > -/* { dg-require-effective-target powerpc_vsx_ok } */ > -/* { dg-options "-O2 -mvsx -fno-inline-functions --param > max-inline-insns-single-O2=200" } */ > +/* { dg-require-effective-target powerpc_vsx_ok } */ > +/* { dg-options "-O2 -mvsx" } */ > > __int128_t > foo (__int128_t *src) > @@ -15,11 +14,35 @@ bar (__int128_t *dst, __int128_t src) > *dst = ~src; > } > > -/* { dg-final { scan-assembler-times "not " 4 } } */ > -/* { dg-final { scan-assembler-times "std " 2 } } */ > +/* { dg-final { scan-assembler-times "not " 2 { target post_power9 } } } */ > +/* { dg-final { scan-assembler-not "std " { target post_power9 } } } */ {\mnot\M} etc.? > +/* { dg-final { scan-assembler-not "stxvd2x" { target post_power9 } } } */ > +/* { dg-final { scan-assembler-not "xxpermdi" { target post_power9 } } } */ So p9 does ld;ld;not;not and mtvsrdd;xxlnor;stxv (both BE and LE). Can you test all those, and all those we should *not* generate? > +/* { dg-final { scan-assembler-times "not " 2 { target { {power8} && {be} } > } } } */ > +/* { dg-final { scan-assembler-not "std " { target { {power8} && {be} } } } > } */ > +/* { dg-final { scan-assembler-times "stxvd2x" 1 { target { {power8} && {be} > } } } } */ > +/* { dg-final { scan-assembler-times "xxpermdi" 1 { target { {power8} && > {be} } } } } */ > +/* { dg-final { scan-assembler-times "not " 4 { target { {power8} && {le} } > } } } */ > +/* { dg-final { scan-assembler-times "std " 2 { target { {power8} && {le} } > } } } */ > +/* { dg-final { scan-assembler-not "stxvd2x" { target { {power8} && {le} } } > } } */ > +/* { dg-final { scan-assembler-not "xxpermdi" { target { {power8} && {le} } > } } } */ And p8 BE does ld;ld;not;not and mtvsrd;mtvsrd;xxpermdi;xxlnor;stxvd2x . That store is bad, should do not;not;std;std just like on LE. Can you check for the same things for both BE and LE, but xfail those you need to for BE? > +/* { dg-final { scan-assembler-not "lxvd2x" { target post_power8 } } } */ Ah okay. > +/* { dg-final { scan-assembler-times "not " 2 { target { {pre_power8} && > {be} } } } } */ > +/* { dg-final { scan-assembler-not "std " { target { {pre_power8} && {be} } > } } } */ > +/* { dg-final { scan-assembler-times "lxvd2x" 1 { target { {pre_power8} && > {be} } } } } */ > +/* { dg-final { scan-assembler-times "stxvd2x" 1 { target { {pre_power8} && > {be} } } } } */ p7 BE does ld;ld;not;not just fine, but bounces something off the stack for the store: std;std;addi;lxvd2x;xxlnor;stxvd2x. > +/* { dg-final { scan-assembler-times "not " 4 { target { {pre_power8} && > {le} } } } } */ > +/* { dg-final { scan-assembler-times "std " 2 { target { {pre_power8} && > {le} } } } } */ > +/* { dg-final { scan-assembler-not "lxvd2x" { target { {pre_power8} && {le} > } } } } */ > +/* { dg-final { scan-assembler-not "stxvd2x" { target { {pre_power8} && {le} > } } } } */ > + > +/* { dg-final { scan-assembler-not "xxpermdi" { target pre_power8 } } } */ While p7 LE is just fine (all integer). > /* { dg-final { scan-assembler-times "ld " 2 } } */ > -/* { dg-final { scan-assembler-not "lxvd2x" } } */ > -/* { dg-final { scan-assembler-not "stxvd2x" } } */ > -/* { dg-final { scan-assembler-not "xxpermdi" } } */ > /* { dg-final { scan-assembler-not "mfvsrd" } } */ > /* { dg-final { scan-assembler-not "mfvsrd" } } */ So, for all targets, the read case should be ld;ld;not;not. And for p9+ the write case should be mtvsrdd;xxlnor;stxv while for pre-p9 it should be not;not;std;std. Could you write it like that? And then add xfails where we currently fail, maybe? > +# Return 1 if we're generating code for post-power9 platforms. > +# Power9 is included. > + > +proc check_effective_target_post_power9 { } { > + return [check_no_compiler_messages_nocache post_power9 assembly { > + #if !(defined(_ARCH_PWR9)) > + #error NO > + #endif > + } ""] > +} The code for these tests is fine btw, it's just the names that I'm not sure about. Segher