From: Eric Botcazou <ebotcazou@libertysurf.fr>
To: Jan Hubicka <jh@suse.cz>
Cc: gcc@gcc.gnu.org
Subject: Re: Reload bug
Date: Sat, 12 Apr 2003 14:55:00 -0000 [thread overview]
Message-ID: <200304121554.30377.ebotcazou@libertysurf.fr> (raw)
In-Reply-To: <20030411182832.GM15771@kam.mff.cuni.cz>
> 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
next prev parent reply other threads:[~2003-04-12 14:01 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-08 18:52 Eric Botcazou
2003-04-08 23:16 ` Jan Hubicka
2003-04-09 0:44 ` Jan Hubicka
2003-04-09 7:00 ` Eric Botcazou
2003-04-09 3:00 ` Eric Botcazou
2003-04-09 9:49 ` Jan Hubicka
2003-04-09 8:57 ` Eric Botcazou
2003-04-09 9:45 ` Jan Hubicka
2003-04-09 9:50 ` Eric Botcazou
2003-04-09 14:52 ` Jan Hubicka
2003-04-09 18:10 ` Eric Botcazou
2003-04-09 19:15 ` Jan Hubicka
2003-04-10 14:25 ` Eric Botcazou
2003-04-10 16:31 ` Jan Hubicka
2003-04-10 16:35 ` Jan Hubicka
2003-04-10 20:21 ` Eric Botcazou
2003-04-10 20:43 ` Jan Hubicka
2003-04-11 14:44 ` Eric Botcazou
2003-04-11 17:49 ` Jan Hubicka
2003-04-11 18:09 ` Jan Hubicka
2003-04-11 19:01 ` Jan Hubicka
2003-04-11 19:07 ` Jan Hubicka
2003-04-12 14:55 ` Eric Botcazou [this message]
2003-04-12 17:45 ` Jan Hubicka
2003-04-13 19:57 ` Eric Botcazou
2003-04-13 20:04 ` Jan Hubicka
2003-04-12 17:55 ` Make reload to avoid invalid subregs Jan Hubicka
2003-04-17 22:32 ` Richard Henderson
2003-04-10 20:51 ` Reload bug Dale Johannesen
2003-04-09 9:13 ` Eric Botcazou
2003-04-09 11:25 ` Jan Hubicka
2003-04-09 12:04 ` Eric Botcazou
2003-04-09 18:05 ` Jan Hubicka
2003-04-09 18:26 ` Eric Botcazou
2003-04-09 21:23 ` Richard Henderson
-- strict thread matches above, loose matches on Subject: below --
1999-09-01 8:40 Andreas Schwab
1999-09-02 0:32 ` Jeffrey A Law
1999-09-02 2:15 ` Andreas Schwab
1999-09-30 18:02 ` Andreas Schwab
1999-09-30 18:02 ` Jeffrey A Law
1999-09-30 18:02 ` Andreas Schwab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200304121554.30377.ebotcazou@libertysurf.fr \
--to=ebotcazou@libertysurf.fr \
--cc=gcc@gcc.gnu.org \
--cc=jh@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).