diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-10-22 21:07:50 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-10-22 21:07:50 +0000 |
commit | e10326ff910ab337741d0781a536435d51c5f044 (patch) | |
tree | c06a568f9e31903ca74a6e355e410a71dfe83311 /gcc/regcprop.c | |
parent | cae115d6d4552a29efb4ea94363d63bde985b4d8 (diff) | |
download | gcc-e10326ff910ab337741d0781a536435d51c5f044.zip gcc-e10326ff910ab337741d0781a536435d51c5f044.tar.gz gcc-e10326ff910ab337741d0781a536435d51c5f044.tar.bz2 |
Make more use of subreg_size_lowpart_offset
This patch uses subreg_size_lowpart_offset in places that open-coded
the calculation. The reload use (and the LRA one that was based on it)
seemed to ignore the BYTES_BIG_ENDIAN != WORDS_BIG_ENDIAN case; it's not
obvious whether that was deliberate or an oversight.
2017-10-22 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* lra-spills.c (assign_mem_slot): Use subreg_size_lowpart_offset.
* regcprop.c (maybe_mode_change): Likewise.
* reload1.c (alter_reg): Likewise.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r253989
Diffstat (limited to 'gcc/regcprop.c')
-rw-r--r-- | gcc/regcprop.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/gcc/regcprop.c b/gcc/regcprop.c index 5db5b5d..b80019b 100644 --- a/gcc/regcprop.c +++ b/gcc/regcprop.c @@ -407,13 +407,9 @@ maybe_mode_change (machine_mode orig_mode, machine_mode copy_mode, int use_nregs = hard_regno_nregs (copy_regno, new_mode); int copy_offset = GET_MODE_SIZE (copy_mode) / copy_nregs * (copy_nregs - use_nregs); - int offset - = GET_MODE_SIZE (orig_mode) - GET_MODE_SIZE (new_mode) - copy_offset; - int byteoffset = offset % UNITS_PER_WORD; - int wordoffset = offset - byteoffset; - - offset = ((WORDS_BIG_ENDIAN ? wordoffset : 0) - + (BYTES_BIG_ENDIAN ? byteoffset : 0)); + unsigned int offset + = subreg_size_lowpart_offset (GET_MODE_SIZE (new_mode) + copy_offset, + GET_MODE_SIZE (orig_mode)); regno += subreg_regno_offset (regno, orig_mode, offset, new_mode); if (targetm.hard_regno_mode_ok (regno, new_mode)) return gen_raw_REG (new_mode, regno); |