From: Hongtao Liu <crazylht@gmail.com>
To: Jeff Law <jeffreyalaw@gmail.com>
Cc: liuhongt <hongtao.liu@intel.com>,
gcc-patches@gcc.gnu.org, hjl.tools@gmail.com
Subject: Re: [PATCH] Canonicalize vec_merge when mask is constant.
Date: Thu, 4 May 2023 10:49:42 +0800 [thread overview]
Message-ID: <CAMZc-by5XUNLh65xFXud5RxS3vAzt_S7_FFDR7N5McEAdWnfOQ@mail.gmail.com> (raw)
In-Reply-To: <1995c643-47bb-6376-ce72-d5440e59196b@gmail.com>
On Mon, May 1, 2023 at 3:37 AM Jeff Law <jeffreyalaw@gmail.com> wrote:
>
>
>
> On 4/19/23 21:58, liuhongt via Gcc-patches wrote:
> > Use swap_communattive_operands_p for canonicalization. When both value
> > has same operand precedence value, then first bit in the mask should
> > select first operand.
> >
> > The canonicalization should help backends for pattern match. .i.e. x86
> > backend has lots of vec_merge patterns, combine will create any form
> > of vec_merge(mask, or inverted mask), then backend need to add 2
> > patterns to match exact 1 instruction. The canonicalization can
> > simplify 2 patterns to 1.
> >
> > Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}, aarch64-linux-gnu.
> > Ok for trunk?
> >
> > gcc/ChangeLog:
> >
> > * combine.cc (maybe_swap_commutative_operands): Canonicalize
> > vec_merge when mask is constant.
> ISTM that if we're going to call this the canonical form, then we should
> document it in rtl.texi.
Yes., how about the wording:
1 file changed, 7 insertions(+)
gcc/doc/md.texi | 7 +++++++
modified gcc/doc/md.texi
@@ -8215,6 +8215,13 @@ second operand. If a machine only supports a
constant as the second
operand, only patterns that match a constant in the second operand need
be supplied.
+@cindex @code{vec_merge}, canonicalization of
+@item
+For the @code{vec_merge} with constant mask(the third operand), the first
+and the second operand can be exchanged by inverting the mask. In such cases,
+a constant is always made the second operand, otherwise the least significant
+bit of the mask is always set(select the first operand first).
+
@item
For associative operators, a sequence of operators will always chain
to the left; for instance, only the left operand of an integer @code{plus}
>
> Otherwise it looks pretty good to me. So let's get the docs updated and
> get this installed.
>
> jeff
--
BR,
Hongtao
next prev parent reply other threads:[~2023-05-04 2:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-20 3:58 liuhongt
2023-04-30 19:37 ` Jeff Law
2023-05-04 2:49 ` Hongtao Liu [this message]
2023-05-04 3:25 ` [PATCH v2] " liuhongt
2023-05-05 23:34 ` Jeff Law
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=CAMZc-by5XUNLh65xFXud5RxS3vAzt_S7_FFDR7N5McEAdWnfOQ@mail.gmail.com \
--to=crazylht@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hjl.tools@gmail.com \
--cc=hongtao.liu@intel.com \
--cc=jeffreyalaw@gmail.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).