This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
ping^3 [PATCH] Subreg handling in reload_inner_reg_of_subreg() and push_reload()
- From: Rask Ingemann Lambertsen <rask at sygehus dot dk>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 30 Aug 2007 10:28:33 +0200
- Subject: ping^3 [PATCH] Subreg handling in reload_inner_reg_of_subreg() and push_reload()
- References: <20070730134217.GK25795@sygehus.dk> <20070730161023.GO25795@sygehus.dk>
On Mon, Jul 30, 2007 at 06:10:23PM +0200, Rask Ingemann Lambertsen wrote:
> In <URL:http://gcc.gnu.org/ml/gcc/2007-05/msg00505.html> and
> <URL:http://gcc.gnu.org/ml/gcc-patches/2007-05/msg01570.html> (which was
> briefly discussed) I described a case where reload is given HImode subreg of
> a multiword SImode hard reg. Because the HImode subreg is made of two QImode
> hard regs rather than one HImode hard reg, reload decides to write to the
> whole SImode hard reg instead of just the HImode subreg on the assumption
> that the subreg is "problematic", as a comment puts it. In fact, the rest of
> reload handles such a subreg just fine with no special treatment. This patch
> adjusts the checks in reload_inner_reg_of_subreg() and push_reload()
> accordingly.
>
> This and the other two reload patches in this patch set were bootstrapped
> and tested together on x86_64-unknown-linux-gnu with no new failures. I also
> built and tested cross compilers for arm-unknown-elf, cris-axis-elf,
> m32c-unknown-elf, mipsisa64-unknown-elf, sh-unknown-elf and v850-unknown-elf
> with no new failures.
>
> Ok for trunk?
>
> 2007-07-30 Rask Ingemann Lambertsen <rask@sygehus.dk>
>
> * reload.c (reload_inner_reg_of_subreg): No special handling is
> needed if a subreg consists of more hard regs than words.
> (push_reload): Likewise.
>
> Index: gcc/reload.c
> ===================================================================
> --- gcc/reload.c (revision 126653)
> +++ gcc/reload.c (working copy)
> @@ -809,13 +809,13 @@ reload_inner_reg_of_subreg (rtx x, enum
> return 1;
>
> /* If the outer part is a word or smaller, INNER larger than a
> - word and the number of regs for INNER is not the same as the
> + word and the number of regs for INNER is smaller than the
> number of words in INNER, then INNER will need reloading. */
> return (GET_MODE_SIZE (mode) <= UNITS_PER_WORD
> && output
> && GET_MODE_SIZE (GET_MODE (inner)) > UNITS_PER_WORD
> && ((GET_MODE_SIZE (GET_MODE (inner)) / UNITS_PER_WORD)
> - != (int) hard_regno_nregs[REGNO (inner)][GET_MODE (inner)]));
> + > (int) hard_regno_nregs[REGNO (inner)][GET_MODE (inner)]));
> }
>
> /* Return nonzero if IN can be reloaded into REGNO with mode MODE without
> @@ -1035,8 +1035,8 @@ push_reload (rtx in, rtx out, rtx *inloc
> > UNITS_PER_WORD)
> && ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (in)))
> / UNITS_PER_WORD)
> - != (int) hard_regno_nregs[REGNO (SUBREG_REG (in))]
> - [GET_MODE (SUBREG_REG (in))]))
> + > (int) hard_regno_nregs[REGNO (SUBREG_REG (in))]
> + [GET_MODE (SUBREG_REG (in))]))
> || ! HARD_REGNO_MODE_OK (subreg_regno (in), inmode)))
> || (secondary_reload_class (1, class, inmode, in) != NO_REGS
> && (secondary_reload_class (1, class, GET_MODE (SUBREG_REG (in)),
> @@ -1128,8 +1128,8 @@ push_reload (rtx in, rtx out, rtx *inloc
> > UNITS_PER_WORD)
> && ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (out)))
> / UNITS_PER_WORD)
> - != (int) hard_regno_nregs[REGNO (SUBREG_REG (out))]
> - [GET_MODE (SUBREG_REG (out))]))
> + > (int) hard_regno_nregs[REGNO (SUBREG_REG (out))]
> + [GET_MODE (SUBREG_REG (out))]))
> || ! HARD_REGNO_MODE_OK (subreg_regno (out), outmode)))
> || (secondary_reload_class (0, class, outmode, out) != NO_REGS
> && (secondary_reload_class (0, class, GET_MODE (SUBREG_REG (out)),
>
> --
> Rask Ingemann Lambertsen