This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: locking problem with mips atomicity
- From: Richard Henderson <rth at redhat dot com>
- To: Michael Eager <eager at mvista dot com>
- Cc: gcc <gcc at gcc dot gnu dot org>
- Date: Mon, 15 Mar 2004 20:57:06 -0800
- Subject: Re: locking problem with mips atomicity
- References: <405642CE.F6DB290F@mvista.com>
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)".
r~