diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-10-13 09:23:54 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-10-13 09:23:54 +0000 |
commit | 610c45fcbfff43176beefefcea74c6137a432220 (patch) | |
tree | fc56c08135f71cfb00cb65322910c3e569682d8e /gcc/cse.c | |
parent | 5752d1f7943db65667edeaf8481dc10b60a23197 (diff) | |
download | gcc-610c45fcbfff43176beefefcea74c6137a432220.zip gcc-610c45fcbfff43176beefefcea74c6137a432220.tar.gz gcc-610c45fcbfff43176beefefcea74c6137a432220.tar.bz2 |
Make more use of subreg_lowpart_offset
This patch uses subreg_lowpart_offset in places that open-coded
the calculation. It also uses it in regcprop.c to test whether,
after a mode change, the first register in a multi-register group
is still the right one.
2017-10-13 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* calls.c (expand_call): Use subreg_lowpart_offset.
* cse.c (cse_insn): Likewise.
* regcprop.c (copy_value): Likewise.
(copyprop_hardreg_forward_1): Likewise.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r253713
Diffstat (limited to 'gcc/cse.c')
-rw-r--r-- | gcc/cse.c | 10 |
1 files changed, 2 insertions, 8 deletions
@@ -5977,7 +5977,6 @@ cse_insn (rtx_insn *insn) rtx new_src = 0; unsigned src_hash; struct table_elt *src_elt; - int byte = 0; /* Ignore invalid entries. */ if (!REG_P (elt->exp) @@ -5990,13 +5989,8 @@ cse_insn (rtx_insn *insn) new_src = elt->exp; else { - /* Calculate big endian correction for the SUBREG_BYTE. - We have already checked that M1 (GET_MODE (dest)) - is not narrower than M2 (new_mode). */ - if (BYTES_BIG_ENDIAN) - byte = (GET_MODE_SIZE (GET_MODE (dest)) - - GET_MODE_SIZE (new_mode)); - + unsigned int byte + = subreg_lowpart_offset (new_mode, GET_MODE (dest)); new_src = simplify_gen_subreg (new_mode, elt->exp, GET_MODE (dest), byte); } |