public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Richard Biener <richard.guenther@gmail.com>
Cc: Peter Bergner <bergner@linux.ibm.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] rs6000: Use NO_EXPR to cast to MMA pointer types
Date: Mon, 5 Sep 2022 09:51:08 -0500	[thread overview]
Message-ID: <20220905145108.GB25951@gate.crashing.org> (raw)
In-Reply-To: <CAFiYyc33_cHrJ-ox=OPyzGDQ8A7B49Krb39vnc83mGwp62nSHw@mail.gmail.com>

On Mon, Sep 05, 2022 at 11:25:21AM +0200, Richard Biener wrote:
> On Fri, Sep 2, 2022 at 7:24 PM Segher Boessenkool
> <segher@kernel.crashing.org> wrote:
> > On Fri, Sep 02, 2022 at 12:02:54PM -0500, Peter Bergner wrote:
> > > On 9/2/22 11:31 AM, Segher Boessenkool wrote:
> > > > (Did you also look at non-MMA VIEW_CONVERT_EXPR uses btw?)
> > >
> > > I did.  It seemed they were all related to pointers to vectors and I remember
> > > you mentioning that as one of the reasons for using VIEW_CONVERT_EXPR over
> > > NOP_EXPR, so I left them alone to be safe.
> >
> > Huh?  I have no idea what you mean here.
> >
> > Casting from one pointer type to another never needs it.  Casting from a
> > scalar integer type to a pointer type not either AFAIKi.  But I am not a
> > Gimple expert, all this might be wrong, it isn't documented anywbere :-(
> 
> NOP_EXPR is for conversions between types with the same kind
> (and pointer-to-integer and integer-to-pointer
> conversions when pointer and integer are of the same size).
> When used on vectors it converts the vector elements.  When you want to
> re-interpret V4SI as V4SF you need VIEW_CONVERT_EXPR (bit_cast),
> likewise V4SI interpreted as V16QI needs that.
> 
> Think of VIEW_CONVERT as bit_cast and NOP_EXPR as conversion.
> Of course for some conversions (like unsigned int to int) you can also
> use a VIEW_CONVERT since it's semantically the same.  In those cases
> we canonicalize to NOP_EXPR via folding.

Thanks for the explanation!

About that last point...  You say VIEW_CONVERT_EXPR is folded to
NOP_EXPR where possible.  Does that happen in all cases / can we depend
on that?  So that in target code like what started this thread the only
real difference is documentation of intent?  (Which never is unimportant
of course!)


Segher

  reply	other threads:[~2022-09-05 14:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02 16:22 Peter Bergner
2022-09-02 16:31 ` Segher Boessenkool
2022-09-02 17:02   ` Peter Bergner
2022-09-02 17:23     ` Segher Boessenkool
2022-09-02 18:17       ` Peter Bergner
2022-09-05  9:25       ` Richard Biener
2022-09-05 14:51         ` Segher Boessenkool [this message]
2022-09-05 18:37           ` Richard Biener

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=20220905145108.GB25951@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=bergner@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@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).