public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: jodaman@cegt201.bradley.edu
To: gcc-gnats@gcc.gnu.org
Subject: c/4134: inline assembly - gcc fails to work around register pressure
Date: Mon, 27 Aug 2001 02:16:00 -0000	[thread overview]
Message-ID: <20010827090852.16864.qmail@sourceware.cygnus.com> (raw)

>Number:         4134
>Category:       c
>Synopsis:       inline assembly - gcc fails to work around register pressure
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 27 02:16:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     jodaman@cegt201.bradley.edu
>Release:        gcc version 3.0.2 20010825 (Debian prerelease)
>Organization:
>Environment:
Linux version 2.2.18 #1 Thu Dec 21 18:49:41 CST 2000
arch: i686
>Description:
The demonstration code attached reveals that gcc may fail
to fold in inline assembly code when most all the registers
are used.  Here is the error message:

test_asm.c: In function `test_asm':
test_asm.c:6: Can't find a register in class `GENERAL_REGS' while reloading `asm'.

Just in guessing, it seems that the compiler fails to copy
a piece of data to the stack when it otherwise runs out of
registers.  The compiler should be able to figure out how
to pass the data to the assembly block without help,
especially since older gcc compilers (like egcs-2.91.66),
handle the code fine.
>How-To-Repeat:
/* compile with "-DBUG" for demonstration */
int
test_asm( int in0, int in1, int in2, int *t )
{
  int out[1];
#ifdef BUG        
  __asm__ (
           ""
           : "=m" (out)
           : "r" (in0)
           , "r" (in1)
           , "r" (in2)
           , "m" (t[0])
           : "%eax", "%ecx", "%edx"
           );
#else
  int workaround_t0 = t[0];
  __asm__ (
           ""
           : "=m" (out)
           : "r" (in0)
           , "r" (in1)
           , "r" (in2)
           , "m" (workaround_t0)
           : "%eax", "%ecx", "%edx"
           );
#endif
  return(*out);
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2001-08-27  2:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-27  2:16 jodaman [this message]
2002-04-23  1:18 rth
2002-04-25  6:56 J.D.

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=20010827090852.16864.qmail@sourceware.cygnus.com \
    --to=jodaman@cegt201.bradley.edu \
    --cc=gcc-gnats@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).