This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: PATCH: Fix ll/sc for mips
On Fri, Feb 01, 2002 at 12:35:23PM +0900, Hiroyuki Machida wrote:
> > _test_and_set (int *p, int v) __THROW
> > {
> > int r, t;
> >
> > __asm__ __volatile__
> > (".set push\n\t"
> > ".set noreorder\n"
> > "1:\n\t"
> > "ll %0,%3\n\t"
> > "beq %0,%4,2f\n\t"
> > "move %1,%4\n\t"
> > "sc %1,%2\n\t"
> > "beqz %1,1b\n\t"
> > "nop\n"
> > "2:\n\t"
> > ".set pop"
> > : "=&r" (r), "=&r" (t), "=m" (*p)
> > : "m" (*p), "r" (v)
> > : "memory");
> >
> > return r;
> > }
>
> Gas will fill delay slots. Same object codes will be produced, so I
> think you don't have to do that by hand.
It will make the code more readable. We don't have to guess what
the assembler will do.
H.J.