From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27186 invoked by alias); 12 Apr 2003 14:01:49 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 27179 invoked from network); 12 Apr 2003 14:01:49 -0000 Received: from unknown (HELO mail.libertysurf.net) (213.36.80.91) by sources.redhat.com with SMTP; 12 Apr 2003 14:01:49 -0000 Received: from localhost.localdomain (212.83.190.56) by mail.libertysurf.net (6.5.026) id 3E8A4CE6001D8D10; Sat, 12 Apr 2003 16:01:44 +0200 Content-Type: text/plain; charset="iso-8859-1" From: Eric Botcazou To: Jan Hubicka Subject: Re: Reload bug Date: Sat, 12 Apr 2003 14:55:00 -0000 User-Agent: KMail/1.4.3 Cc: gcc@gcc.gnu.org References: <200304081937.16859.ebotcazou@libertysurf.fr> <200304111356.23415.ebotcazou@libertysurf.fr> <20030411182832.GM15771@kam.mff.cuni.cz> In-Reply-To: <20030411182832.GM15771@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200304121554.30377.ebotcazou@libertysurf.fr> X-SW-Source: 2003-04/txt/msg00592.txt.bz2 > I am attaching full one. It fixes the 3.2 testcases I have... > Does it appear to make sense to you? The locations from which you call the new subreg_offset_representable_p() look sensible. But I think there are some duplicate logic in reload_inner_reg_of_subreg() now. + /* This function returns true when the offset is representable via + subreg_offset in the given regno. The function appears to assume that reg XREGNO supports mode YMODE. Is that by design? If so, I think you should mention it in the header comment. + RETURN - The regno offset which would be used. */ Pasto. + bool + subreg_offset_representable_p (xregno, xmode, offset, ymode) + unsigned int xregno; + enum machine_mode xmode; + unsigned int offset; + enum machine_mode ymode; + { + int nregs_xmode, nregs_ymode; + int mode_multiple, nregs_multiple; + int y_offset; + + if (xregno >= FIRST_PSEUDO_REGISTER) + abort (); + + nregs_xmode = HARD_REGNO_NREGS (xregno, xmode); + nregs_ymode = HARD_REGNO_NREGS (xregno, ymode); + + /* paradoxical subregs are always valid. */ + if (offset == 0 + && nregs_ymode > nregs_xmode + && (GET_MODE_SIZE (ymode) > UNITS_PER_WORD + ? WORDS_BIG_ENDIAN : BYTES_BIG_ENDIAN)) + return true; + + /* Lowpart subregs are always valid. */ + if (offset == subreg_lowpart_offset (ymode, xmode)) + return true; I think you should mention that the second "if" catches paradoxical subregs too. + #ifdef ENABLE_CHECKING + /* This should always pass, otherwise we don't know how to verify the + constraint. + + These conditions may be relaxed but subreg_offset would need to be + redesigned. */ + if (GET_MODE_SIZE (xmode) % GET_MODE_SIZE (ymode) + || GET_MODE_SIZE (ymode) % nregs_ymode + || mode_for_size (GET_MODE_SIZE (ymode) / nregs_ymode, + MODE_INT, 0) == VOIDmode + || nregs_xmode % nregs_ymode) + abort (); + #endif + + /* The XMODE value can be seen as an vector of NREGS_XMODE + values. The subreg must represent an lowpart of given field. + Compute what field it is. */ + offset -= subreg_lowpart_offset (mode_for_size (GET_MODE_SIZE (ymode) + / nregs_ymode, + MODE_INT, 0), xmode); I'm clueless here: I think I understand what you want to do but I have a mixed feeling about the formula. In particular, GET_MODE_SIZE (ymode) / nregs_ymode looks weird for a size. Didn't you forget to re-multiply by nregs_ymode? + /* size of ymode must not be greater than the size of xmode. */ + mode_multiple = GET_MODE_SIZE (xmode) / GET_MODE_SIZE (ymode); + if (mode_multiple == 0) + abort (); All paradoxical subregs should already have been caught at that point, no? + y_offset = offset / GET_MODE_SIZE (ymode); + nregs_multiple = nregs_xmode / nregs_ymode; + #ifdef ENABLE_CHECKING + if (offset % GET_MODE_SIZE (ymode) + || mode_multiple % nregs_multiple) + abort (); + #endif + return (!(y_offset % (mode_multiple / nregs_multiple))); + } I think you're right about the condition. -- Eric Botcazou