public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/34312] [4.3 regression] spill failure with -O2 -fPIC -march=pentium-m on i386
Date: Wed, 05 Dec 2007 13:55:00 -0000	[thread overview]
Message-ID: <20071205135447.31500.qmail@sourceware.org> (raw)
In-Reply-To: <bug-34312-10561@http.gcc.gnu.org/bugzilla/>



------- Comment #9 from ubizjak at gmail dot com  2007-12-05 13:54 -------
(In reply to comment #8)
> > Instead, -fPIC should unconditionally decrease the available regparm by 1.
> Yes, this seems to be the best solution in the short term.

I'm testing following patch:

Index: i386.c
===================================================================
--- i386.c      (revision 130622)
+++ i386.c      (working copy)
@@ -3200,7 +3200,7 @@ ix86_function_regparm (const_tree type, 
          /* Make sure no regparm register is taken by a
             global register variable.  */
          for (local_regparm = 0; local_regparm < 3; local_regparm++)
-           if (global_regs[local_regparm])
+           if (global_regs[local_regparm] || fixed_regs[local_regparm])
              break;

          /* We can't use regparm(3) for nested functions as these use
@@ -3226,7 +3226,7 @@ ix86_function_regparm (const_tree type, 
             so the more global reg vars there are, the smaller regparm
             optimization use, unless requested by the user explicitly.  */
          for (regno = 0; regno < 6; regno++)
-           if (global_regs[regno])
+           if (global_regs[regno] || fixed_regs[regno])
              globals++;
          local_regparm
            = globals < local_regparm ? local_regparm - globals : 0;

The rationale is that fixed reg, as well as global reg should decrease the
number of registers available for argument passing. When %ebx is used as -fpic
reg for 32bit targets, this does exactly what Comment #6 suggests.

This patch of course doesn't lower the importance of the fix for PR 19398. ;)


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ubizjak at gmail dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-12-03 11:28:04         |2007-12-05 13:54:47
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34312


  parent reply	other threads:[~2007-12-05 13:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-01 23:17 [Bug target/34312] New: " christophe at saout dot de
2007-12-01 23:19 ` [Bug target/34312] " christophe at saout dot de
2007-12-03 11:25 ` ubizjak at gmail dot com
2007-12-03 11:28 ` [Bug target/34312] [4.3 regression] " ubizjak at gmail dot com
2007-12-03 13:45 ` [Bug rtl-optimization/34312] " ubizjak at gmail dot com
2007-12-03 15:16 ` bonzini at gnu dot org
2007-12-03 16:32 ` rguenth at gcc dot gnu dot org
2007-12-03 17:52 ` rask at gcc dot gnu dot org
2007-12-03 20:48 ` ebotcazou at gcc dot gnu dot org
2007-12-05 13:55 ` ubizjak at gmail dot com [this message]
2007-12-05 16:01 ` uros at gcc dot gnu dot org
2007-12-05 16:03 ` ubizjak at gmail dot com

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=20071205135447.31500.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).