Hi Xiong Hu, On Mon, Nov 25, 2019 at 10:24:35AM +0800, luoxhu wrote: > P9LE generated instruction is not worse than P8LE. > mtvsrdd;xxlnot;stxv vs. not;not;std;std.
To be clear: it can have longer latency, but latency via memory is not so critical, and this does save decode and other resources. It's hard to choose which is best :-) > * gcc.target/powerpc/pr72804.c: Split the store function to... > * gcc.target/powerpc/pr92398.h: ... this one. New. I wanted to say that splitting one single function to a header file is a bit overkill, but it gives a nice place to discuss the differences in generated code on different CPUs, so okay, it's useful :-) > + store generates difference instructions as below: > + P9+: mtvsrdd;xxlnot;stxv. > + P8/P7/P6 LE: not;not;std;std. > + P8 BE: mtvsrd;mtvsrd;xxpermdi;xxlnor;stxvd2x. > + P7/P6 BE: std;std;addi;lxvd2x;xxlnor;stxvd2x. > + P9+ and P9- LE are expected, P6/P7/P8 BE are unexpected. */ Great overview, thanks. > diff --git a/gcc/testsuite/gcc.target/powerpc/pr92398.p9+.c > b/gcc/testsuite/gcc.target/powerpc/pr92398.p9+.c > new file mode 100644 > index 00000000000..2ebe2025cef > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/pr92398.p9+.c > @@ -0,0 +1,10 @@ > +/* { dg-do compile { target { lp64 && p9+ } } } */ > +/* { dg-require-effective-target powerpc_vsx_ok } */ > +/* { dg-options "-O2 -mvsx" } */ > + > +/* { dg-final { scan-assembler-times {\mmtvsrdd\M} 1 } } */ > +/* { dg-final { scan-assembler-times {\mxxlnor\M} 1 } } */ > +/* { dg-final { scan-assembler-times {\mstxv\M} 1 } } */ Maybe add scan-assembler-not for "not" and "std", and in the < p9 testcase for these three? > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/pr92398.p9-.c > @@ -0,0 +1,10 @@ > +/* { dg-do compile { target { lp64 && {! p9+} } } } */ > +/* { dg-require-effective-target powerpc_vsx_ok } */ > +/* { dg-options "-O2 -mvsx" } */ > + > +/* { dg-final { scan-assembler-times {\mnot\M} 2 { xfail be } } } */ > +/* { dg-final { scan-assembler-times {\mstd\M} 2 { xfail { {p8} && {be} } } > } } */ I think you can write that as just /* { dg-final { scan-assembler-times {\mstd\M} 2 { xfail { p8 && be } } } } */ Okay for trunk with or without such tweaks. Thanks, and sorry the review took a while! Segher