From: Segher Boessenkool <segher@kernel.crashing.org>
To: HAO CHEN GUI <guihaoc@linux.ibm.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
Bill Schmidt <wschmidt@linux.ibm.com>
Subject: Re: [PATCH, rs6000] optimization for long long and double vec_reve [PR100868]
Date: Mon, 6 Sep 2021 17:40:20 -0500 [thread overview]
Message-ID: <20210906224020.GC1583@gate.crashing.org> (raw)
In-Reply-To: <8306df2a-775a-6162-bcc8-77e808f8ec1d@linux.ibm.com>
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
prev parent reply other threads:[~2021-09-06 22:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-06 6:10 HAO CHEN GUI
2021-09-06 22:40 ` Segher Boessenkool [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210906224020.GC1583@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=guihaoc@linux.ibm.com \
--cc=wschmidt@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).