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 20:37:53 +0200 [thread overview]
Message-ID: <A76E62E1-4F48-4F04-84D9-1C591EC1D53C@gmail.com> (raw)
In-Reply-To: <20220905145108.GB25951@gate.crashing.org>
> Am 05.09.2022 um 16:53 schrieb Segher Boessenkool <segher@kernel.crashing.org>:
>
> 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!)
You should be able to depend on that, yes.
Richard
>
>
> Segher
prev parent reply other threads:[~2022-09-05 18:37 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
2022-09-05 18:37 ` Richard Biener [this message]
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=A76E62E1-4F48-4F04-84D9-1C591EC1D53C@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).