public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
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 11:25:21 +0200	[thread overview]
Message-ID: <CAFiYyc33_cHrJ-ox=OPyzGDQ8A7B49Krb39vnc83mGwp62nSHw@mail.gmail.com> (raw)
In-Reply-To: <20220902172325.GV25951@gate.crashing.org>

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.

Richard.

>
>
> Segher

  parent reply	other threads:[~2022-09-05  9:25 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 [this message]
2022-09-05 14:51         ` Segher Boessenkool
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='CAFiYyc33_cHrJ-ox=OPyzGDQ8A7B49Krb39vnc83mGwp62nSHw@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=bergner@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=segher@kernel.crashing.org \
    /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).