public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Roger Sayle" <roger@nextmovesoftware.com>
To: "'Richard Sandiford'" <richard.sandiford@arm.com>,
	"'Richard Biener'" <richard.guenther@gmail.com>
Cc: "'GCC Patches'" <gcc-patches@gcc.gnu.org>
Subject: RE: [DOC PATCH] Document the VEC_PERM_EXPR tree code (and minor clean-ups).
Date: Mon, 6 Feb 2023 14:44:39 -0000	[thread overview]
Message-ID: <05dc01d93a39$8b8c12a0$a2a437e0$@nextmovesoftware.com> (raw)
In-Reply-To: <mpt8rhb7zlv.fsf@arm.com>


Perhaps I'm missing something (I'm not too familiar with SVE semantics), but
is there
a reason that the solution for PR96473 uses a VEC_PERM_EXPR and not just a 
VEC_DUPLICATE_EXPR?  The folding of sv1d1rq (svptrue_..., ...) doesn't seem
to
require either the blending or the permutation functionality of a
VEC_PERM_EXPR.
Instead, it seems to be misusing (the modified) VEC_PERM_EXPR as a form of
VIEW_CONVERT_EXPR that allows us to convert/mismatch the type of the
operands
to the type of the result.

Conceptually, (as in Richard's original motivation for the PR),
svint32_t foo (int32x4_t x) { return svld1rq (svptrue_b8 (), &x[0]); }
can be optimized to (something like)
svint32_t foo (int32x4_t x) { return svdup_32 (x[0]); }  // or dup z0.q,
z0.q[0] equivalent
hence it makes sense for fold to transform the gimple form of the first,
into the
gimple form of the second(?)

Just curious.
Roger
--

> -----Original Message-----
> From: Richard Sandiford <richard.sandiford@arm.com>
> Sent: 06 February 2023 12:22
> To: Richard Biener <richard.guenther@gmail.com>
> Cc: Roger Sayle <roger@nextmovesoftware.com>; GCC Patches <gcc-
> patches@gcc.gnu.org>
> Subject: Re: [DOC PATCH] Document the VEC_PERM_EXPR tree code (and minor
> clean-ups).
> 
> Richard Biener <richard.guenther@gmail.com> writes:
> > On Sat, Feb 4, 2023 at 9:35 PM Roger Sayle <roger@nextmovesoftware.com>
> wrote:
> >>
> >>
> >> This patch (primarily) documents the VEC_PERM_EXPR tree code in
> >> generic.texi.  For ease of review, it is provided below as a pair of
> >> diffs.  The first contains just the new text added to describe
> >> VEC_PERM_EXPR, the second tidies up this part of the documentation by
> >> sorting the tree codes into alphabetical order, and providing
> >> consistent section naming/capitalization, so changing this section
> >> from "Vectors" to "Vector Expressions" (matching the nearby "Unary
> >> and Binary Expressions").
> >>
> >> Tested with make pdf and make html on x86_64-pc-linux-gnu.
> >> The reviewer(s) can decide whether to approve just the new content,
> >> or the content+clean-up.  Ok for mainline?
> >
> > +@item VEC_PERM_EXPR
> > +This node represents a vector permute/blend operation.  The three
> > +operands must be vectors of the same number of elements.  The first
> > +and second operands must be vectors of the same type as the entire
> > +expression,
> >
> > this was recently relaxed for the case of constant permutes in which
> > case the first and second operands only have to have the same element
> > type as the result.  See tree-cfg.cc:verify_gimple_assign_ternary.
> >
> > The following description will become a bit more awkward here and for
> > rhs1/rhs2 with different number of elements the modulo interpretation
> > doesn't hold - I believe we require in-bounds elements for constant
> > permutes.  Richard can probably clarify things here.
> 
> I thought that the modulo behaviour still applies when the node has a
constant
> selector, it's just that the in-range form is the canonical one.
> 
> With variable-length vectors, I think it's in principle possible to have a
stepped
> constant selector whose start elements are in-range but whose final
elements
> aren't (and instead wrap around when applied).
> E.g. the selector could zip the last quarter of the inputs followed by the
first
> quarter.
> 
> Thanks,
> Richard


  reply	other threads:[~2023-02-06 14:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-04 20:33 Roger Sayle
2023-02-06  7:10 ` Richard Biener
2023-02-06 12:22   ` Richard Sandiford
2023-02-06 14:44     ` Roger Sayle [this message]
2023-02-07  8:07       ` Prathamesh Kulkarni
2023-03-12  1:37 ` Sandra Loosemore

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='05dc01d93a39$8b8c12a0$a2a437e0$@nextmovesoftware.com' \
    --to=roger@nextmovesoftware.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    --cc=richard.sandiford@arm.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).