atomicity.h (__exchange_and_add, [...]): *__mem is also an output.

* config/cpu/i486/atomicity.h (__exchange_and_add, __atomic_add):
        *__mem is also an output.
        * config/cpu/m68k/atomicity.h (__exchange_and_add): Likewise.

From-SVN: r60807
This commit is contained in:
Jason Merrill 2003-01-02 17:48:21 -05:00 committed by Jason Merrill
parent 6ec6e2c297
commit e55393db34
3 changed files with 15 additions and 9 deletions

View File

@ -1,3 +1,9 @@
2003-01-02 Jason Merrill <jason@redhat.com>
* config/cpu/i486/atomicity.h (__exchange_and_add, __atomic_add):
*__mem is also an output.
* config/cpu/m68k/atomicity.h (__exchange_and_add): Likewise.
2002-12-30 Loren J. Rittle <ljrittle@acm.org>
* src/Makefile.am: Resolve non-portable use of $<.

View File

@ -37,9 +37,9 @@ __attribute__ ((__unused__))
__exchange_and_add (volatile _Atomic_word *__mem, int __val)
{
register _Atomic_word __result;
__asm__ __volatile__ ("lock; xaddl %0,%2"
: "=r" (__result)
: "0" (__val), "m" (*__mem)
__asm__ __volatile__ ("lock; xaddl %0,%1"
: "=r" (__result), "+m" (*__mem)
: "0" (__val)
: "memory");
return __result;
}
@ -48,8 +48,8 @@ static inline void
__attribute__ ((__unused__))
__atomic_add (volatile _Atomic_word* __mem, int __val)
{
__asm__ __volatile__ ("lock; addl %0,%1"
: : "ir" (__val), "m" (*__mem) : "memory");
__asm__ __volatile__ ("lock; addl %1,%0"
: "+m" (*__mem) : "ir" (__val) : "memory");
}
#endif /* atomicity.h */

View File

@ -43,11 +43,11 @@ __exchange_and_add (volatile _Atomic_word *__mem, int __val)
register _Atomic_word __result = *__mem;
register _Atomic_word __temp;
__asm__ __volatile__ ("1: move%.l %0,%1\n\t"
"add%.l %2,%1\n\t"
"cas%.l %0,%1,%3\n\t"
"add%.l %3,%1\n\t"
"cas%.l %0,%1,%2\n\t"
"jne 1b"
: "=d" (__result), "=&d" (__temp)
: "d" (__val), "m" (*__mem), "0" (__result)
: "=d" (__result), "=&d" (__temp), "+m" (*__mem)
: "d" (__val), "0" (__result)
: "memory");
return __result;
}