linux-mips
[Top] [All Lists]

Re: [PATCH] incorrect asm constraints for ll/sc constructs

To: Daniel Jacobowitz <dan@debian.org>
Subject: Re: [PATCH] incorrect asm constraints for ll/sc constructs
From: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
Date: Fri, 25 May 2001 15:13:04 +0200 (MET DST)
Cc: linux-mips@oss.sgi.com
In-reply-to: <20010524164459.A19466@nevyn.them.org>
Organization: Technical University of Gdansk
Reply-to: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
Sender: owner-linux-mips@oss.sgi.com
On Thu, 24 May 2001, Daniel Jacobowitz wrote:

> They aren't the same for MIPS, though.  I exhibit as evidence the fact
> that my patch fixed the problem I was seeing.  I didn't know about 'R';
> I suppose that it is more correct.  'm' at least is closer than 'o',
> though.

 The following program cannot be compiled with gcc 2.95.3, because the
offset is out of range (I consider it a bug in gcc -- it should allocate
and load a temporary register itself and pass it appropriately as %0,
matching the "R" constraint; still it's better than generating bad code): 

int main(void)
{
        int *p;

        asm volatile(".set push\n\t"
                ".set noat\n\t"
                "lw $0,%0\n\t"
                ".set pop"
                :
                : "R" (p[0x10000]));

        return 0;
}

After changing "R" to "m" or "o", bad assembly is generated if optimizing
as follows: 

 #APP
        .set push
        .set noat
        lw $0,262144($2)
        .set pop
 #NO_APP

Note that it's an expected behaviour -- there are no non-offsettable
address modes for MIPS.

> If 'R' will behave correctly, could that be applied to CVS, then?

 I suppose so -- I'm not in a position to apply changes. 

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +


<Prev in Thread] Current Thread [Next in Thread>