From: Richard Earnshaw <Richard.Earnshaw@foss.arm.com>
To: Richard Biener <richard.guenther@gmail.com>,
Richard Earnshaw <rearnsha@arm.com>
Cc: Bernd Edlinger <bernd.edlinger@hotmail.de>,
GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 1/3] rtl: allow forming subregs of already unaligned mems [PR102125]
Date: Mon, 6 Sep 2021 12:08:23 +0100 [thread overview]
Message-ID: <d358c82e-e3c0-fc3b-f13d-dc89f56f7895@foss.arm.com> (raw)
In-Reply-To: <CAFiYyc3q+EVwAa_uBLXofRW6Lz=FzY4jdoFkFGrzE3LhNiYs9Q@mail.gmail.com>
On 06/09/2021 11:58, Richard Biener via Gcc-patches wrote:
> On Mon, Sep 6, 2021 at 12:40 PM Richard Earnshaw <rearnsha@arm.com> wrote:
>>
>>
>> GCC was recently changed to prevent simplify_subreg from simplifying
>> a subreg of a mem when the mode of the new mem would have stricter alignment
>> constraints than the inner mem already has when the target requires
>> STRICT_ALIGNMENT.
>>
>> However, such targets may have specialist patterns that can handle
>> unaligned accesses and this restriction turns out to be unduly restrictive.
>> So limit this restriction to only apply when the inner mem is naturally
>> aligned to the inner mode.
>
> Hmm, I think this can end up either generating wrong code or
> recog fails. The specific combination of alignment and mode of 'op'
> has been validated to be supported, replacing the mode with sth
> else would need re-validation of the combination. I'm not sure
> we can for example just query movmisalign support here and
> hope for LRA to reload the mem with that.
>
> So - where do you run into this? Is it possible to catch the
> situation on a higher level where more context as in the whole insn
> is visible?
I ran into it with patch 2 of this series when calling gen_highpart on a
misaligned mem. IIRC gen_highpart would end up returning (subreg:SI
(mem:DI (addr [A8])) 4), while gen_lowpart would simplify the operation
to (mem:SI (addr [A8])) as expected.
(subreg:SI (mem:DI (addr [A8])) 4) is really problematic, because it's
not a memory_operand (from the manual: it will get reloaded into a
register later on). But that's no good here, I don't want this
reloading into a wide register later, I need it to be narrowed to the
component part now.
R.
>
> Thanks,
> Richard.
>
>>
>> gcc/ChangeLog:
>>
>> PR target/102125
>> * simplify-rtx.c (simplify_context::simplify_subreg): Allow
>> simplifying (subreg (mem())) when the inner mem is already
>> misaligned for its type.
>> ---
>> gcc/simplify-rtx.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
next prev parent reply other threads:[~2021-09-06 11:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-06 10:40 [PATCH 0/3] lower more cases of memcpy [PR102125] Richard Earnshaw
2021-09-06 10:40 ` [PATCH 1/3] rtl: allow forming subregs of already unaligned mems [PR102125] Richard Earnshaw
2021-09-06 10:58 ` Richard Biener
2021-09-06 11:08 ` Richard Earnshaw [this message]
2021-09-06 11:13 ` Richard Biener
2021-09-06 11:23 ` Richard Earnshaw
2021-09-06 12:01 ` Richard Biener
2021-09-06 10:40 ` [PATCH 2/3] arm: expand handling of movmisalign for DImode [PR102125] Richard Earnshaw
2021-09-06 10:40 ` [PATCH 3/3] gimple: allow more folding of memcpy [PR102125] Richard Earnshaw
2021-09-06 10:51 ` 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=d358c82e-e3c0-fc3b-f13d-dc89f56f7895@foss.arm.com \
--to=richard.earnshaw@foss.arm.com \
--cc=bernd.edlinger@hotmail.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=rearnsha@arm.com \
--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).