public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@libertysurf.fr>
To: Jan Hubicka  <jh@suse.cz>
Cc: gcc@gcc.gnu.org
Subject: Reload bug
Date: Tue, 08 Apr 2003 18:52:00 -0000	[thread overview]
Message-ID: <200304081937.16859.ebotcazou@libertysurf.fr> (raw)

[-- Attachment #1: Type: text/plain, Size: 1766 bytes --]

Hello Jan,

I've narrowed down the bug reported as PR optimization/10233, a regression 
from GCC 3.2 present on the 3.2 branch since 3.2.1 (but latent on all active 
branches), to this patch

Thu Oct 17 17:14:07 CEST 2002  Jan Hubicka  <jh@suse.cz>

	PR opt/7630
	* reload.c (reload_inner_reg_of_subreg): New argument output;
	(push_reload): Update call.


We are trying to reload

	(subreg:SI (reg/v:DI 29 rmm0 [68]) 4)

as the 'in' argument of push_reload.

Before your patch, the compiler correctly detected that the whole register 
needs to be reloaded because we can't access the high part of MMX regs.

But now reload_inner_reg_of_subreg returns 0 for this subreg because its 
return value depends upon the context: if we pass it an 'in' argument, it 
will not check the following condition

  /* 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
     number of words in INNER, then INNER will need reloading.  */

which happens to apply to this subreg.

Then the subsequent logic is fooled and we end up reloading

	(reg/v:SI 29 emm0)


The rationale for the patch is there:
http://gcc.gnu.org/ml/gcc-patches/2002-10/msg00628.html

The last sentence: "However it is completely irrelevant for input operand in 
all cases - we always can move just the small part of register and use it 
directly, so I've added new operand to bypass this logic in the input 
operand case."

Did you intend to disable the condition for low parts only? (there appears to 
be no testcase associated with the patch so it's hard to tell). If so, does 
the following patch fit your needs?

-- 
Eric Botcazou


	* reload.c (reload_inner_reg_of_subreg): Require reloading for
	non-low parts of input operands.

[-- Attachment #2: pr10233.diff --]
[-- Type: text/x-diff, Size: 1007 bytes --]

Index: reload.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload.c,v
retrieving revision 1.178.2.4.2.6
diff -u -p -r1.178.2.4.2.6 reload.c
--- reload.c	29 Mar 2003 19:30:39 -0000	1.178.2.4.2.6
+++ reload.c	8 Apr 2003 17:40:34 -0000
@@ -826,10 +826,12 @@ reload_inner_reg_of_subreg (x, mode, out
      word and the number of regs for INNER is not the same as 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)
-	      != HARD_REGNO_NREGS (REGNO (inner), GET_MODE (inner))));
+	      != HARD_REGNO_NREGS (REGNO (inner), GET_MODE (inner)))
+	  /* This is not necessary for low parts of input operands
+	     because we can always access them directly.  */
+	  && (output || ! subreg_lowpart_p (x)));
 }
 
 /* Record one reload that needs to be performed.

             reply	other threads:[~2003-04-08 17:47 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-08 18:52 Eric Botcazou [this message]
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
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=200304081937.16859.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).