diff options
author | Richard Earnshaw <rearnsha@arm.com> | 2021-09-09 10:56:01 +0100 |
---|---|---|
committer | Richard Earnshaw <rearnsha@arm.com> | 2021-09-13 11:26:47 +0100 |
commit | 408e8b906632f215f6652b8851bba612cde07c25 (patch) | |
tree | 81192ff3c414005b02b317432a5409fcfe80a852 | |
parent | c012297c9d5dfb177adf1423bdd05e5f4b87e5ec (diff) | |
download | gcc-408e8b906632f215f6652b8851bba612cde07c25.zip gcc-408e8b906632f215f6652b8851bba612cde07c25.tar.gz gcc-408e8b906632f215f6652b8851bba612cde07c25.tar.bz2 |
rtl: directly handle MEM in gen_highpart [PR102125]
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.
-rw-r--r-- | gcc/emit-rtl.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index ff3b444..e6158f2 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -1625,19 +1625,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; } |