From: Richard Earnshaw <rearnsha@arm.com>
To: gcc-patches@gcc.gnu.org
Cc: Richard Earnshaw <rearnsha@arm.com>, richard.guenther@gmail.com
Subject: [PATCH v3 1/3] rtl: directly handle MEM in gen_highpart [PR102125]
Date: Fri, 10 Sep 2021 15:48:39 +0100 [thread overview]
Message-ID: <20210910144841.3139174-2-rearnsha@arm.com> (raw)
In-Reply-To: <20210910144841.3139174-1-rearnsha@arm.com>
[-- Attachment #1: Type: text/plain, Size: 454 bytes --]
gen_lowpart_general handles forming a lowpart of a MEM by using
adjust_address to rework and validate a new version of the MEM.
Do the same for gen_highpart rather than calling simplify_gen_subreg
for this case.
gcc/ChangeLog:
PR target/102125
* emit-rtl.c (gen_highpart): Use adjust_address to handle
MEM rather than calling simplify_gen_subreg.
---
gcc/emit-rtl.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: v3-0001-rtl-directly-handle-MEM-in-gen_highpart-PR102125.patch --]
[-- Type: text/x-patch; name="v3-0001-rtl-directly-handle-MEM-in-gen_highpart-PR102125.patch", Size: 1449 bytes --]
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 77ea8948ee8..0ba110879aa 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -1585,19 +1585,22 @@ gen_highpart (machine_mode mode, rtx x)
gcc_assert (known_le (msize, (unsigned int) UNITS_PER_WORD)
|| known_eq (msize, GET_MODE_UNIT_SIZE (GET_MODE (x))));
- result = simplify_gen_subreg (mode, x, GET_MODE (x),
- subreg_highpart_offset (mode, GET_MODE (x)));
- gcc_assert (result);
-
- /* simplify_gen_subreg is not guaranteed to return a valid operand for
- the target if we have a MEM. gen_highpart must return a valid operand,
- emitting code if necessary to do so. */
- if (MEM_P (result))
+ /* gen_lowpart_common handles a lot of special cases due to needing to handle
+ paradoxical subregs; it only calls simplify_gen_subreg when certain that
+ it will produce something meaningful. The only case we need to handle
+ specially here is MEM. */
+ if (MEM_P (x))
{
- result = validize_mem (result);
- gcc_assert (result);
+ poly_int64 offset = subreg_highpart_offset (mode, GET_MODE (x));
+ return adjust_address (x, mode, offset);
}
+ result = simplify_gen_subreg (mode, x, GET_MODE (x),
+ subreg_highpart_offset (mode, GET_MODE (x)));
+ /* Since we handle MEM directly above, we should never get a MEM back
+ from simplify_gen_subreg. */
+ gcc_assert (result && !MEM_P (result));
+
return result;
}
next prev parent reply other threads:[~2021-09-10 14:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-10 14:48 [PATCH v3 0/3] lower more cases of memcpy [PR102125] Richard Earnshaw
2021-09-10 14:48 ` Richard Earnshaw [this message]
2021-09-13 9:38 ` [PATCH v3 1/3] rtl: directly handle MEM in gen_highpart [PR102125] Richard Biener
2021-09-13 9:38 ` Richard Sandiford
2021-09-13 9:51 ` Richard Earnshaw
2021-09-13 9:54 ` Richard Sandiford
2021-09-10 14:48 ` [PATCH v3 2/3] arm: expand handling of movmisalign for DImode [PR102125] Richard Earnshaw
2021-09-10 14:48 ` [PATCH v3 3/3] gimple: allow more folding of memcpy [PR102125] Richard Earnshaw
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=20210910144841.3139174-2-rearnsha@arm.com \
--to=rearnsha@arm.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).