public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "xyzzy at speakeasy dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug inline-asm/11203] source doesn't compile with -O0 but they compile with -O3
Date: Wed, 08 Nov 2006 20:03:00 -0000	[thread overview]
Message-ID: <20061108200302.27432.qmail@sourceware.org> (raw)
In-Reply-To: <bug-11203-1507@http.gcc.gnu.org/bugzilla/>



------- Comment #36 from xyzzy at speakeasy dot org  2006-11-08 20:03 -------
(In reply to comment #21)
>     asm volatile(""
>         : "=m" (*(unsigned int*)(src + 0*stride)),
>           "=m" (*(unsigned int*)(src + 1*stride)),
>           "=m" (*(unsigned int*)(src + 2*stride)),
>           "=m" (*(unsigned int*)(src + 3*stride)),
>           "=m" (*(unsigned int*)(src + 4*stride)),
>           "=m" (*(unsigned int*)(src + 5*stride)),
>           "=m" (*(unsigned int*)(src + 6*stride)),
>           "=m" (*(unsigned int*)(src + 7*stride))
>     );

(In reply to comment #26)
> it might also happen that in some intentionally overconstrained cases it ends up
> searching the whole 5040 possible assignments of 7 registers onto 7 non memory
> operands but still it wont fail

The example Martin gave has *8* operands.  You can try every possible direct
mapping of those 8 addresses to just 7 registers, but they will obviously all
fail.  Except with ia32 addressing modes it _can_ be done, and with only 4
registers.

reg1 = src, reg2 = stride, reg3 = src+stride*3, reg4 = src+stride*6
Then the 8 memory operands are:
(reg1), (reg1,reg2,1), (reg1,reg2,2), (reg3),
(reg1,reg2,4), (reg3,reg2,2), (reg4), (reg3,reg2,4)

When one considers all the addressing modes, there are not just 7 possible
registers, but (I think) 261 possible addresses.  There are not just 5040
possibilities as Michael said, but over 76 x 10^15 possible ways of assigning
these addresses to 7 operands!  Then each register can be loaded not just with
an address but with some sub-expression too, like how I loaded reg2 with
stride.

Even for ia32, which makes up for its limited number of registers with complex
addressing modes, finding a register allocation that satisfies an asm statement
is not something that can always be done in reasonable time.  If the number of
operands <= number of available registers it should be able to (but gcc
doesn't) always find an allocation (_an_ allocation, not the best allocation).


-- 

xyzzy at speakeasy dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xyzzy at speakeasy dot org


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


  parent reply	other threads:[~2006-11-08 20:03 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-11203-1507@http.gcc.gnu.org/bugzilla/>
2005-12-02 17:44 ` pinskia at gcc dot gnu dot org
2005-12-02 17:46 ` pinskia at gcc dot gnu dot org
2006-01-19 12:38 ` pinskia at gcc dot gnu dot org
2006-04-21 15:56 ` langer_mann at web dot de
2006-04-21 15:59 ` langer_mann at web dot de
2006-11-08 20:03 ` xyzzy at speakeasy dot org [this message]
2006-11-08 20:45 ` michaelni at gmx dot at
2007-02-27 19:36 ` xyzzy at speakeasy dot org
2007-02-27 22:50 ` michaelni at gmx dot at
2009-10-18 19:56 ` astrange at ithinksw dot com
     [not found] <bug-11203-4@http.gcc.gnu.org/bugzilla/>
2014-02-16 10:01 ` jackie.rosen at hushmail dot com
2003-06-16  7:08 [Bug optimization/11203] New: " spigel@olvs.miee.ru
2003-06-16 14:32 ` [Bug inline-asm/11203] " bangerth@dealii.org
2003-07-09  4:28 ` neroden at gcc dot gnu dot org
2003-07-29  8:25 ` steven at gcc dot gnu dot org
2003-08-23  0:28 ` dhazeghi at yahoo dot com
2003-12-17  0:24 ` pinskia at gcc dot gnu dot org
2004-02-10  1:16 ` pinskia at gcc dot gnu dot org
2004-03-31  8:37 ` spigel at olvs dot miee dot ru
2004-08-06  7:01 ` pinskia at gcc dot gnu dot org
2004-08-15 11:00 ` pluto at pld-linux dot org
2004-09-02 18:26 ` pinskia at gcc dot gnu dot org
2005-01-01 17:15 ` stian at nixia dot no
2005-01-01 17:22 ` pinskia at gcc dot gnu dot org
2005-01-01 18:57 ` michaelni at gmx dot at
2005-01-01 22:50 ` steven at gcc dot gnu dot org
2005-01-01 23:05 ` steven at gcc dot gnu dot org
2005-01-20 21:04 ` pinskia at gcc dot gnu dot org
2005-01-21 12:39 ` drab at kepler dot fjfi dot cvut dot cz
2005-01-21 13:55 ` falk at debian dot org
2005-01-21 14:10 ` drab at kepler dot fjfi dot cvut dot cz
2005-01-21 15:15 ` pinskia at gcc dot gnu dot org
2005-01-21 15:51 ` drab at kepler dot fjfi dot cvut dot cz
2005-01-21 16:34 ` falk at debian dot org
2005-01-21 16:48 ` drab at kepler dot fjfi dot cvut dot cz
2005-01-22 12:14 ` steven at gcc dot gnu dot org
2005-01-22 15:58 ` stian at nixia dot no
2005-01-22 17:10 ` michaelni at gmx dot at
2005-01-22 17:20   ` Daniel Berlin
2005-01-22 17:21 ` dberlin at dberlin dot org
2005-01-24  6:45 ` spigel at olvs dot miee dot ru
2005-03-26  0:29 ` pinskia at gcc dot gnu dot org
2005-09-05 22:20 ` pinskia at gcc dot gnu dot org

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=20061108200302.27432.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).