From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7638 invoked by alias); 30 Jul 2007 16:10:34 -0000 Received: (qmail 7627 invoked by uid 22791); 30 Jul 2007 16:10:33 -0000 X-Spam-Check-By: sourceware.org Received: from pfepa.post.tele.dk (HELO pfepa.post.tele.dk) (195.41.46.235) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 30 Jul 2007 16:10:27 +0000 Received: from x1-6-00-0f-9f-c6-3e-90 (x1-6-00-0f-9f-c6-3e-90.k75.webspeed.dk [80.197.1.215]) by pfepa.post.tele.dk (Postfix) with ESMTP id AE61FFAC02D for ; Mon, 30 Jul 2007 18:10:24 +0200 (CEST) Received: from x1-6-00-0f-9f-c6-3e-90 (localhost.localdomain [127.0.0.1]) by x1-6-00-0f-9f-c6-3e-90 (8.14.0/8.14.0) with ESMTP id l6UGAOjt011841 for ; Mon, 30 Jul 2007 18:10:24 +0200 Received: (from rask@localhost) by x1-6-00-0f-9f-c6-3e-90 (8.14.0/8.14.0/Submit) id l6UGANar011840 for gcc-patches@gcc.gnu.org; Mon, 30 Jul 2007 18:10:23 +0200 Date: Mon, 30 Jul 2007 16:35:00 -0000 From: Rask Ingemann Lambertsen To: gcc-patches@gcc.gnu.org Subject: [PATCH 4/9] Subreg handling in reload_inner_reg_of_subreg() and push_reload() Message-ID: <20070730161023.GO25795@sygehus.dk> References: <20070730134217.GK25795@sygehus.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070730134217.GK25795@sygehus.dk> User-Agent: Mutt/1.5.14 (2007-02-12) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2007-07/txt/msg02116.txt.bz2 In and (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 * 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