Hi! On Mon, Sep 06, 2021 at 02:10:58PM +0800, HAO CHEN GUI wrote: > The patch optimized expansion for long long or double vec_reve builtin. > > Bootstrapped and tested on powerpc64le-linux with no regressions. > Is this okay for trunk? Any recommendations? Thanks a lot.
In the future, please say something about what you changed, something about the new code? "Use xxswapd instead of <whatever we did before>" or even "Use xxswapd". It doesn't have to be long, but something to guide the reader helps a lot :-) > * config/rs6000/altivec.md (altivec_vreve<mode>2): > Modify the expansion when number of elements is 2. * config/rs6000/altivec.md (altivec_vreve<mode>2): Modify the expansion when num_elements is 2. But "Modify" does not say what you changed it to. So something like * config/rs6000/altivec.md (altivec_vreve<mode>2): Use xxswapd if num_elements is 2. But, there are multiple patterns with that name. So this would be * config/rs6000/altivec.md (altivec_vreve<mode>2 for VEC_A): Use xxswapd if num_elements is 2. That check is a bit nasty, so maybe you should just split this pattern into one for VEC_K and one for VEC_64? > --- a/gcc/config/rs6000/altivec.md > +++ b/gcc/config/rs6000/altivec.md > @@ -4063,6 +4063,13 @@ (define_expand "altivec_vreve<mode>2" > size = GET_MODE_UNIT_SIZE (<MODE>mode); > num_elements = GET_MODE_NUNITS (<MODE>mode); > > + if (num_elements == 2) > + { > + emit_insn (gen_vsx_xxpermdi_<mode> (operands[0], operands[1], > + operands[1], GEN_INT (2))); > + DONE; > + } emit_insn (gen_xxswapd_<mode> (operands[0], operands[1])); If this doesn't compile like this, it will need some "parameterized names" magic (for xxswapd), a bit more work (but one-time work, and it is worth it). > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/vec_reve.c > @@ -0,0 +1,17 @@ > +/* { dg-do compile { target { powerpc*-*-* } } } */ That is the only allowed target in gcc.target/powerpc anyway. Just write /* { dg-do compile } */ and nothing more (this (compile) is the default as well, you can just leave it out completely if you want). Finally: should whatever the old code generated have been optimised better? Segher