Commit e704c6bf by Benjamin Kosnik Committed by Benjamin Kosnik

atomicity.h (__exchange_and_add): More fixes.


2000-05-01  Benjamin Kosnik  <bkoz@redhat.com>

	* config/cpu/powerpc/bits/atomicity.h (__exchange_and_add): More
	fixes.

From-SVN: r33606
parent 15ac7707
2000-05-01 Benjamin Kosnik <bkoz@redhat.com>
* config/cpu/powerpc/bits/atomicity.h (__exchange_and_add): More
fixes.
2000-05-01 Vadim Egorov <egorovv@@mailandnews.com> 2000-05-01 Vadim Egorov <egorovv@@mailandnews.com>
* bits/char_traits.h: Fix parameter types. * bits/char_traits.h: Fix parameter types.
......
...@@ -32,14 +32,14 @@ static __ATOMICITY_INLINE _Atomic_word ...@@ -32,14 +32,14 @@ static __ATOMICITY_INLINE _Atomic_word
__attribute__ ((unused)) __attribute__ ((unused))
__exchange_and_add (volatile _Atomic_word* __mem, int __val) __exchange_and_add (volatile _Atomic_word* __mem, int __val)
{ {
_Atomic_word __tmp, __result; _Atomic_word __tmp, __res;
__asm__ ("\ __asm__ ("\
0: lwarx %0,0,%2 0: lwarx %0,0,%2
add%I3 %1,%0,%3 add%I3 %1,%0,%3
stwcx. %1,0,%2 stwcx. %1,0,%2
bne- 0b bne- 0b
" : "=&b"(__result), "=&r"(__tmp) : "r" (__mem), "Ir"(__val) : "cr0", "memory"); " : "=&b"(__res), "=&r"(__tmp) : "r" (__mem), "Ir"(__val) : "cr0", "memory");
return __result; return __res;
} }
static __ATOMICITY_INLINE void static __ATOMICITY_INLINE void
...@@ -59,7 +59,7 @@ static __ATOMICITY_INLINE int ...@@ -59,7 +59,7 @@ static __ATOMICITY_INLINE int
__attribute__ ((unused)) __attribute__ ((unused))
__compare_and_swap (volatile long *__p, long int __oldval, long int __newval) __compare_and_swap (volatile long *__p, long int __oldval, long int __newval)
{ {
int __result; int __res;
__asm__ ("\ __asm__ ("\
0: lwarx %0,0,%1 0: lwarx %0,0,%1
sub%I2c. %0,%0,%2 sub%I2c. %0,%0,%2
...@@ -68,30 +68,28 @@ __compare_and_swap (volatile long *__p, long int __oldval, long int __newval) ...@@ -68,30 +68,28 @@ __compare_and_swap (volatile long *__p, long int __oldval, long int __newval)
stwcx. %3,0,%1 stwcx. %3,0,%1
bne- 0b bne- 0b
1: 1:
" : "=&b"(__result) " : "=&b"(__res) : "r"(__p), "Ir"(__oldval), "r"(__newval) : "cr0", "memory");
: "r"(__p), "Ir"(__oldval), "r"(__newval) return __res >> 5;
: "cr0", "memory");
return __result >> 5;
} }
static __ATOMICITY_INLINE long static __ATOMICITY_INLINE long
__attribute__ ((unused)) __attribute__ ((unused))
__always_swap (volatile long *__p, long int __newval) __always_swap (volatile long *__p, long int __newval)
{ {
long __result; long __res;
__asm__ ("\ __asm__ ("\
0: lwarx %0,0,%1 0: lwarx %0,0,%1
stwcx. %2,0,%1 stwcx. %2,0,%1
bne- 0b bne- 0b
" : "=&r"(__result) : "r"(__p), "r"(__newval) : "cr0", "memory"); " : "=&r"(__res) : "r"(__p), "r"(__newval) : "cr0", "memory");
return __result; return __res;
} }
static __ATOMICITY_INLINE int static __ATOMICITY_INLINE int
__attribute__ ((unused)) __attribute__ ((unused))
__test_and_set (volatile long *__p, long int __newval) __test_and_set (volatile long *__p, long int __newval)
{ {
int __result; int __res;
__asm__ ("\ __asm__ ("\
0: lwarx %0,0,%1 0: lwarx %0,0,%1
cmpwi %0,0 cmpwi %0,0
...@@ -99,8 +97,8 @@ __test_and_set (volatile long *__p, long int __newval) ...@@ -99,8 +97,8 @@ __test_and_set (volatile long *__p, long int __newval)
stwcx. %2,0,%1 stwcx. %2,0,%1
bne- 0b bne- 0b
1: 1:
" : "=&r"(__result) : "r"(__p), "r"(__newval) : "cr0", "memory"); " : "=&r"(__res) : "r"(__p), "r"(__newval) : "cr0", "memory");
return __result; return __res;
} }
#endif /* atomicity.h */ #endif /* atomicity.h */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment