From: "Kewen.Lin" <linkw@linux.ibm.com>
To: Peter Bergner <bergner@linux.ibm.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
Segher Boessenkool <segher@gcc.gnu.org>
Subject: Re: [PATCH] rs6000: Don't ICE when we disassemble an MMA variable [PR101322]
Date: Thu, 1 Sep 2022 16:28:56 +0800 [thread overview]
Message-ID: <d8b502ac-245a-d60a-6ddc-23d25fa0a3f6@linux.ibm.com> (raw)
In-Reply-To: <6cf4ceb2-9deb-93b4-bd94-ab08c08eb330@linux.ibm.com>
>>>> + if (TREE_TYPE (TREE_TYPE (src_ptr)) != src_type)
>>>
>>> This line looks unexpected, the former is type char while the latter is type __vector_pair *.
>>>
>>> I guess you meant to compare the type of pointer type like:
>>>
>>> TREE_TYPE (TREE_TYPE (src_ptr)) != TREE_TYPE (src_type)
>>
>> Maybe? However, if that is the case, how can it be working for me?
>> Let me throw this in the debugger and verify the types and I'll report
>> back with what I find.
>
> Ok, you are correct. Thanks for catching that! I don't think we need
> those matching outer TREE_TYPE() uses. I think just a simple:
>
> if (TREE_TYPE (src_ptr) != src_type)
>
> ...should suffice.
>
Yeah, it's enough for the associated test case. :)
>
>>> or even with mode like:
>>>
>>> TYPE_MODE (TREE_TYPE (TREE_TYPE (src_ptr))) != TYPE_MODE (TREE_TYPE (src_type))
>
> I'd rather not look at the mode here, since OOmode/XOmode doesn't necessarily
> mean __vector_{pair,quad}, so I'll go with the modified test above.
Good point. I thought the cv qualifier can affect the type equality check and
assumed for test case like:
void
foo (char *resp, const __vector_pair *vpp)
{
__builtin_vsx_disassemble_pair (resp, (__vector_pair *) vpp);
}
, we don't want to have the conversion there and the ICE seems related to the
underlying mode, so I thought maybe you wanted to use TYPE_MODE.
>>>> + src_ptr = build1 (VIEW_CONVERT_EXPR, src_type, src_ptr);
>>>
>>> Nit: NOP_EXPR seems to be better suited here for pointer conversion.
>
> Ok, this works too, so code changed to use it. Thanks!
>
> Question for my own education, when would you use VIEW_CONVERT_EXPR over NOP_EXPR?
tree.def has some note about VIEW_CONVERT_EXPR, it quite matches what Segher replied.
In my experience, VIEW_CONVERT_EXPR are used a lot for vector type conversion.
BR,
Kewen
next prev parent reply other threads:[~2022-09-01 8:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-27 3:50 Peter Bergner
2022-08-31 9:22 ` Kewen.Lin
2022-08-31 13:59 ` Peter Bergner
2022-08-31 18:53 ` Peter Bergner
2022-08-31 20:51 ` Segher Boessenkool
2022-08-31 22:01 ` Peter Bergner
2022-08-31 23:08 ` Segher Boessenkool
2022-08-31 23:29 ` Peter Bergner
2022-09-01 8:29 ` Kewen.Lin
2022-09-01 14:17 ` Peter Bergner
2022-09-05 8:11 ` Kewen.Lin
2022-09-01 8:28 ` Kewen.Lin [this message]
2022-09-01 14:41 ` Segher Boessenkool
2022-08-31 15:58 ` Segher Boessenkool
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=d8b502ac-245a-d60a-6ddc-23d25fa0a3f6@linux.ibm.com \
--to=linkw@linux.ibm.com \
--cc=bergner@linux.ibm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=segher@gcc.gnu.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).