From 610c45fcbfff43176beefefcea74c6137a432220 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 13 Oct 2017 09:23:54 +0000 Subject: 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 Alan Hayward David Sherwood 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 Co-Authored-By: David Sherwood From-SVN: r253713 --- gcc/cse.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'gcc/cse.c') diff --git a/gcc/cse.c b/gcc/cse.c index 672fd2e..717aaf8 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -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); } -- cgit v1.1