linux-origin
[Top] [All Lists]

Re: broken compiler?

To: ulfc@xxxxxxxxxxxxxxxxxxxx (Ulf Carlsson)
Subject: Re: broken compiler?
From: kanoj@xxxxxxxxxxxxxxxxxxx (Kanoj Sarcar)
Date: Tue, 28 Mar 2000 12:48:34 -0800 (PST)
Cc: linux-origin@xxxxxxxxxxx
In-reply-to: <Pine.LNX.4.10.10003281239410.26268-100000@xxxxxxxxxxxxxxxxxxxx> from "Ulf Carlsson" at Mar 28, 2000 12:42:27 PM
Sender: owner-linux-origin@xxxxxxxxxxx
> 
> > Now, I don't see any problems with the test4() code, but I would like
> > to change the code to something like
> > 
> > lui X,0x801c
> > ld  a1,-19064(X)
> 
> This is ok, you can use the same register as base and target.
> 
> Ulf
> 

Not okay. Here's the code again:

static __inline__ unsigned long
value_bit2(void *addr)
{
        unsigned long *m = (unsigned long *) addr;
        unsigned long temp;
        __asm__ __volatile__(
                ".set\tnoreorder\n"
                "ld\t%0, %2\n\t"
                "#there may be more instructions here"
                ".set\treorder\n"
                :"=&r" (temp), "=m" (*m)
                :"m" (*m));
        return temp;
}

By the output/input specs, I am explicitly saying to gcc: look, you 
pick the register to hold the variable temp, but make sure you do not
use that same register to compute the address, or hold, any of the 
input variables, because this is an "earlyclobber" register (the &
indicates that).

Obviously, gcc is not listening and has used a1 to hold temp, as well 
as use it for address computation of the memory input.

Kanoj

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