| To: | Hiroyuki Machida <machida@sm.sony.co.jp> |
|---|---|
| Subject: | Re: PATCH: Fix ll/sc for mips |
| From: | "H . J . Lu" <hjl@lucon.org> |
| Date: | Thu, 31 Jan 2002 23:17:14 -0800 |
| Cc: | macro@ds2.pg.gda.pl, libc-alpha@sources.redhat.com, linux-mips@oss.sgi.com |
| In-reply-to: | <20020201.123523.50041631.machida@sm.sony.co.jp>; from machida@sm.sony.co.jp on Fri, Feb 01, 2002 at 12:35:23PM +0900 |
| References: | <20020131123547.A22759@lucon.org> <Pine.GSO.3.96.1020131230104.9069A-100000@delta.ds2.pg.gda.pl> <20020131144100.A24634@lucon.org> <20020201.123523.50041631.machida@sm.sony.co.jp> |
| Sender: | owner-linux-mips@oss.sgi.com |
| User-agent: | Mutt/1.2.5i |
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.
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [libc-alpha] Re: PATCH: Fix ll/sc for mips, H . J . Lu |
|---|---|
| Next by Date: | Re: [patch] linux 2.4.17: An mb() rework, Dominic Sweetman |
| Previous by Thread: | Re: [PATCH] Migration to input api for keyboards, Vojtech Pavlik |
| Next by Thread: | Re: PATCH: Fix ll/sc for mips, Maciej W. Rozycki |
| Indexes: | [Date] [Thread] [Top] [All Lists] |