public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Andrew Pinski <pinskia@gmail.com>
To: Philipp Tomsich <ptomsich@gcc.gnu.org>,
	"Andrew Pinski (QUIC)" <quic_apinski@quicinc.com>
Cc: gcc-cvs@gcc.gnu.org
Subject: Re: [gcc(refs/vendors/vrull/heads/slp-improvements)] match.pd: Look through view_convert when folding vec_perms
Date: Tue, 23 Jan 2024 15:49:05 -0800	[thread overview]
Message-ID: <CA+=Sn1mu674QLWkuAZxoQHs+mTtKdNUjiBpDogSExVBMud=z_g@mail.gmail.com> (raw)
In-Reply-To: <20240123205716.24C46385800E@sourceware.org>

On Tue, Jan 23, 2024 at 12:57 PM Philipp Tomsich via Gcc-cvs
<gcc-cvs@gcc.gnu.org> wrote:
>
> https://gcc.gnu.org/g:b896c82f141211437b5b5b83a3537d6bd2d243dc
>
> commit b896c82f141211437b5b5b83a3537d6bd2d243dc
> Author: Manolis Tsamis <manolis.tsamis@vrull.eu>
> Date:   Wed Nov 1 12:27:28 2023 +0100
>
>     match.pd: Look through view_convert when folding vec_perms
>
>     The match.pd patterns to merge two vector permutes into one fail to
>     match when a (potentially no-op) view convert expressions is
>     separating the two permutes.  This is observable in the SLP tree for
>     the first loop of x264's satd and inhibits optimization.
>
>     This change adds a check whether a view_convert will be a no-op
>     (comparing the element precision) and rewrites the permute sequence
>     for those cases.

My suggestion is just use nop_convert instead and which does the
correct thing for a vector conversion between signed and unsigned
types.
Or  do you need one between integer and floating point types too?

Thanks,
Andrew

>
>     Ref #343
>
> Diff:
> ---
>  gcc/match.pd | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/gcc/match.pd b/gcc/match.pd
> index e42ecaf9ec7..be623d9773c 100644
> --- a/gcc/match.pd
> +++ b/gcc/match.pd
> @@ -9965,7 +9965,7 @@ and,
>       d = VEC_PERM_EXPR <a, b, NEW_VCST>;  */
>
>  (simplify
> - (vec_perm (vec_perm@0 @1 @2 VECTOR_CST@3) @0 VECTOR_CST@4)
> + (vec_perm (view_convert?@0 (vec_perm @1 @2 VECTOR_CST@3)) @0 VECTOR_CST@4)
>   (if (TYPE_VECTOR_SUBPARTS (type).is_constant ())
>    (with
>     {
> @@ -9977,7 +9977,8 @@ and,
>       vec_perm_builder builder2 (nelts, nelts, 1);
>     }
>     (if (tree_to_vec_perm_builder (&builder0, @3)
> -       && tree_to_vec_perm_builder (&builder1, @4))
> +       && tree_to_vec_perm_builder (&builder1, @4)
> +       && element_precision (type) == element_precision (TREE_TYPE (@0)))
>      (with
>       {
>         vec_perm_indices sel0 (builder0, 2, nelts);
> @@ -10002,7 +10003,7 @@ and,
>          op0 = vec_perm_indices_to_tree (TREE_TYPE (@4), sel2);
>       }
>       (if (op0)
> -      (vec_perm @1 @2 { op0; })))))))
> +      (view_convert (vec_perm @1 @2 { op0; }))))))))
>
>  /* Merge
>       c = VEC_PERM_EXPR <a, b, VCST0>;

  reply	other threads:[~2024-01-23 23:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-23 20:57 Philipp Tomsich
2024-01-23 23:49 ` Andrew Pinski [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-02-27 13:37 Philipp Tomsich
2024-01-17 19:14 Philipp Tomsich
2023-11-28 13:35 Philipp Tomsich

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='CA+=Sn1mu674QLWkuAZxoQHs+mTtKdNUjiBpDogSExVBMud=z_g@mail.gmail.com' \
    --to=pinskia@gmail.com \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=ptomsich@gcc.gnu.org \
    --cc=quic_apinski@quicinc.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).