This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: locking problem with mips atomicity
- From: Michael Eager <eager at mvista dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc <gcc at gcc dot gnu dot org>
- Date: Tue, 16 Mar 2004 08:09:45 -0800
- Subject: Re: locking problem with mips atomicity
- Organization: MontaVista Software, Inc.
- References: <405642CE.F6DB290F@mvista.com> <20040316045706.GA5985@redhat.com>
Richard Henderson wrote:
>
> On Mon, Mar 15, 2004 at 03:57:02PM -0800, Michael Eager wrote:
> > - "ll %0,%3\n\t"
> > - "addu %1,%4,%0\n\t"
> > - "sc %1,%2\n\t"
> > + "la %3,%2\n\t"
> > + "ll %0,0(%3)\n\t"
> > + "addu %1,%5,%0\n\t"
> > + "sc %1,0(%3)\n\t"
> > ".set pop\n\t"
> > "beqz %1,1b\n\t"
> > "/* End exchange & add */"
> > - : "=&r"(__result), "=&r"(__tmp), "=m"(*__mem)
> > + : "=&r"(__result), "=&r"(__tmp), "=m"(*__mem), "=r" (temp)
>
> Better is to make the compiler force the address into a register.
> It may already be that way, resulting in "la r3,0(r4)".
This is exactly what this code does.
--
Michael Eager eager@mvista.com 408-328-8426
MontaVista Software, Inc. 1237 E. Arques Ave., Sunnyvale, CA 94085