mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-18 00:49:49 +08:00
atomicity.h (__exchange_and_add): Silence preprocessor multi-line string warnings.
2000-11-28 Franz Sirl <Franz.Sirl-kernel@lauterbach.com> * config/cpu/powerpc/bits/atomicity.h (__exchange_and_add): Silence preprocessor multi-line string warnings. (__atomic_add): Likewise. (__compare_and_swap): Likewise. (__always_swap): Likewise. (__test_and_set): Likewise. * config/cpu/arm/bits/atomicity.h (__exchange_and_add): Likewise. (__atomic_add): Likewise. (__compare_and_swap): Likewise. (__always_swap): Likewise. (__test_and_set): Likewise. From-SVN: r37831
This commit is contained in:
parent
70cf82bcf5
commit
79f41ea419
@ -1,3 +1,17 @@
|
||||
2000-11-28 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
|
||||
|
||||
* config/cpu/powerpc/bits/atomicity.h (__exchange_and_add): Silence
|
||||
preprocessor multi-line string warnings.
|
||||
(__atomic_add): Likewise.
|
||||
(__compare_and_swap): Likewise.
|
||||
(__always_swap): Likewise.
|
||||
(__test_and_set): Likewise.
|
||||
* config/cpu/arm/bits/atomicity.h (__exchange_and_add): Likewise.
|
||||
(__atomic_add): Likewise.
|
||||
(__compare_and_swap): Likewise.
|
||||
(__always_swap): Likewise.
|
||||
(__test_and_set): Likewise.
|
||||
|
||||
2000-11-28 Benjamin Kosnik <bkoz@purist.soma.redhat.com>
|
||||
|
||||
Update for 2.91 release.
|
||||
|
@ -27,16 +27,19 @@ __attribute__ ((__unused__))
|
||||
__exchange_and_add (volatile _Atomic_word* __mem, int __val)
|
||||
{
|
||||
_Atomic_word __tmp, __tmp2, __result;
|
||||
__asm__ __volatile__ ("\
|
||||
0: ldr %0,[%3]
|
||||
add %1,%0,%4
|
||||
swp %2,%1,[%3]
|
||||
cmp %0,%2
|
||||
swpne %1,%2,[%3]
|
||||
bne 0b
|
||||
" : "=&r"(__result), "=&r"(__tmp), "=&r"(__tmp2)
|
||||
: "r" (__mem), "r"(__val)
|
||||
: "cc", "memory");
|
||||
__asm__ __volatile__ (
|
||||
"\n"
|
||||
"0:\t"
|
||||
"ldr %0,[%3] \n\t"
|
||||
"add %1,%0,%4 \n\t"
|
||||
"swp %2,%1,[%3] \n\t"
|
||||
"cmp %0,%2 \n\t"
|
||||
"swpne %1,%2,[%3] \n\t"
|
||||
"bne 0b \n\t"
|
||||
""
|
||||
: "=&r"(__result), "=&r"(__tmp), "=&r"(__tmp2)
|
||||
: "r" (__mem), "r"(__val)
|
||||
: "cc", "memory");
|
||||
return __result;
|
||||
}
|
||||
|
||||
@ -45,16 +48,19 @@ __attribute__ ((__unused__))
|
||||
__atomic_add (volatile _Atomic_word *__mem, int __val)
|
||||
{
|
||||
_Atomic_word __tmp, __tmp2, __tmp3;
|
||||
__asm__ __volatile__ ("\
|
||||
0: ldr %0,[%3]
|
||||
add %1,%0,%4
|
||||
swp %2,%1,[%3]
|
||||
cmp %0,%2
|
||||
swpne %1,%2,[%3]
|
||||
bne 0b
|
||||
" : "=&r"(__tmp), "=&r"(__tmp2), "=&r"(__tmp3)
|
||||
: "r" (__mem), "r"(__val)
|
||||
: "cc", "memory");
|
||||
__asm__ __volatile__ (
|
||||
"\n"
|
||||
"0:\t"
|
||||
"ldr %0,[%3] \n\t"
|
||||
"add %1,%0,%4 \n\t"
|
||||
"swp %2,%1,[%3] \n\t"
|
||||
"cmp %0,%2 \n\t"
|
||||
"swpne %1,%2,[%3] \n\t"
|
||||
"bne 0b \n\t"
|
||||
""
|
||||
: "=&r"(__tmp), "=&r"(__tmp2), "=&r"(__tmp3)
|
||||
: "r" (__mem), "r"(__val)
|
||||
: "cc", "memory");
|
||||
}
|
||||
|
||||
static inline int
|
||||
@ -63,20 +69,23 @@ __compare_and_swap (volatile long *__p, long __oldval, long __newval)
|
||||
{
|
||||
int __result;
|
||||
long __tmp;
|
||||
__asm__ __volatile__ ("\
|
||||
0: ldr %1,[%2]
|
||||
mov %0,#0
|
||||
cmp %1,%4
|
||||
bne 1f
|
||||
swp %0,%3,[%2]
|
||||
cmp %1,%0
|
||||
swpne %1,%0,[%2]
|
||||
bne 0b
|
||||
mov %0,#1
|
||||
1:
|
||||
" : "=&r"(__result), "=&r"(__tmp)
|
||||
: "r" (__p), "r" (__newval), "r" (__oldval)
|
||||
: "cc", "memory");
|
||||
__asm__ __volatile__ (
|
||||
"\n"
|
||||
"0:\t"
|
||||
"ldr %1,[%2] \n\t"
|
||||
"mov %0,#0 \n\t"
|
||||
"cmp %1,%4 \n\t"
|
||||
"bne 1f \n\t"
|
||||
"swp %0,%3,[%2] \n\t"
|
||||
"cmp %1,%0 \n\t"
|
||||
"swpne %1,%0,[%2] \n\t"
|
||||
"bne 0b \n\t"
|
||||
"mov %0,#1 \n"
|
||||
"1:\n\t"
|
||||
""
|
||||
: "=&r"(__result), "=&r"(__tmp)
|
||||
: "r" (__p), "r" (__newval), "r" (__oldval)
|
||||
: "cc", "memory");
|
||||
return __result;
|
||||
}
|
||||
|
||||
@ -85,9 +94,13 @@ __attribute__ ((__unused__))
|
||||
__always_swap (volatile long *__p, long __newval)
|
||||
{
|
||||
long __result;
|
||||
__asm__ __volatile__ ("\
|
||||
swp %0,%2,[%1]
|
||||
" : "=&r"(__result) : "r"(__p), "r"(__newval) : "memory");
|
||||
__asm__ __volatile__ (
|
||||
"\n\t"
|
||||
"swp %0,%2,[%1] \n\t"
|
||||
""
|
||||
: "=&r"(__result)
|
||||
: "r"(__p), "r"(__newval)
|
||||
: "memory");
|
||||
return __result;
|
||||
}
|
||||
|
||||
@ -97,18 +110,21 @@ __test_and_set (volatile long *__p, long __newval)
|
||||
{
|
||||
int __result;
|
||||
long __tmp;
|
||||
__asm__ __volatile__ ("\
|
||||
0: ldr %0,[%2]
|
||||
cmp %0,#0
|
||||
bne 1f
|
||||
swp %1,%3,[%2]
|
||||
cmp %0,%1
|
||||
swpne %0,%1,[%2]
|
||||
bne 0b
|
||||
1:
|
||||
" : "=&r"(__result), "=r" (__tmp)
|
||||
: "r"(__p), "r"(__newval)
|
||||
: "cc", "memory");
|
||||
__asm__ __volatile__ (
|
||||
"\n"
|
||||
"0:\t"
|
||||
"ldr %0,[%2] \n\t"
|
||||
"cmp %0,#0 \n\t"
|
||||
"bne 1f \n\t"
|
||||
"swp %1,%3,[%2] \n\t"
|
||||
"cmp %0,%1 \n\t"
|
||||
"swpne %0,%1,[%2] \n\t"
|
||||
"bne 0b \n"
|
||||
"1:\n\t"
|
||||
""
|
||||
: "=&r"(__result), "=r" (__tmp)
|
||||
: "r"(__p), "r"(__newval)
|
||||
: "cc", "memory");
|
||||
return __result;
|
||||
}
|
||||
|
||||
|
@ -27,12 +27,17 @@ __attribute__ ((__unused__))
|
||||
__exchange_and_add (volatile _Atomic_word* __mem, int __val)
|
||||
{
|
||||
_Atomic_word __tmp, __res;
|
||||
__asm__ __volatile__ ("\
|
||||
0: lwarx %0,0,%2
|
||||
add%I3 %1,%0,%3
|
||||
stwcx. %1,0,%2
|
||||
bne- 0b
|
||||
" : "=&b"(__res), "=&r"(__tmp) : "r" (__mem), "Ir"(__val) : "cr0", "memory");
|
||||
__asm__ __volatile__ (
|
||||
"/* Inline exchange & add */\n"
|
||||
"0:\t"
|
||||
"lwarx %0,0,%2 \n\t"
|
||||
"add%I3 %1,%0,%3 \n\t"
|
||||
"stwcx. %1,0,%2 \n\t"
|
||||
"bne- 0b \n\t"
|
||||
"/* End exchange & add */"
|
||||
: "=&b"(__res), "=&r"(__tmp)
|
||||
: "r" (__mem), "Ir"(__val)
|
||||
: "cr0", "memory");
|
||||
return __res;
|
||||
}
|
||||
|
||||
@ -41,12 +46,17 @@ __attribute__ ((__unused__))
|
||||
__atomic_add (volatile _Atomic_word *__mem, int __val)
|
||||
{
|
||||
_Atomic_word __tmp;
|
||||
__asm__ __volatile__ ("\
|
||||
0: lwarx %0,0,%1
|
||||
add%I2 %0,%0,%2
|
||||
stwcx. %0,0,%1
|
||||
bne- 0b
|
||||
" : "=&b"(__tmp) : "r" (__mem), "Ir"(__val) : "cr0", "memory");
|
||||
__asm__ __volatile__ (
|
||||
"/* Inline atomic add */\n"
|
||||
"0:\t"
|
||||
"lwarx %0,0,%1 \n\t"
|
||||
"add%I2 %0,%0,%2 \n\t"
|
||||
"stwcx. %0,0,%1 \n\t"
|
||||
"bne- 0b \n\t"
|
||||
"/* End atomic add */"
|
||||
: "=&b"(__tmp)
|
||||
: "r" (__mem), "Ir"(__val)
|
||||
: "cr0", "memory");
|
||||
}
|
||||
|
||||
static inline int
|
||||
@ -54,15 +64,20 @@ __attribute__ ((__unused__))
|
||||
__compare_and_swap (volatile long *__p, long int __oldval, long int __newval)
|
||||
{
|
||||
int __res;
|
||||
__asm__ __volatile__ ("\
|
||||
0: lwarx %0,0,%1
|
||||
sub%I2c. %0,%0,%2
|
||||
cntlzw %0,%0
|
||||
bne- 1f
|
||||
stwcx. %3,0,%1
|
||||
bne- 0b
|
||||
1:
|
||||
" : "=&b"(__res) : "r"(__p), "Ir"(__oldval), "r"(__newval) : "cr0", "memory");
|
||||
__asm__ __volatile__ (
|
||||
"/* Inline compare & swap */\n"
|
||||
"0:\t"
|
||||
"lwarx %0,0,%1 \n\t"
|
||||
"sub%I2c. %0,%0,%2 \n\t"
|
||||
"cntlzw %0,%0 \n\t"
|
||||
"bne- 1f \n\t"
|
||||
"stwcx. %3,0,%1 \n\t"
|
||||
"bne- 0b \n"
|
||||
"1:\n\t"
|
||||
"/* End compare & swap */"
|
||||
: "=&b"(__res)
|
||||
: "r"(__p), "Ir"(__oldval), "r"(__newval)
|
||||
: "cr0", "memory");
|
||||
return __res >> 5;
|
||||
}
|
||||
|
||||
@ -71,11 +86,16 @@ __attribute__ ((__unused__))
|
||||
__always_swap (volatile long *__p, long int __newval)
|
||||
{
|
||||
long __res;
|
||||
__asm__ __volatile__ ("\
|
||||
0: lwarx %0,0,%1
|
||||
stwcx. %2,0,%1
|
||||
bne- 0b
|
||||
" : "=&r"(__res) : "r"(__p), "r"(__newval) : "cr0", "memory");
|
||||
__asm__ __volatile__ (
|
||||
"/* Inline always swap */\n"
|
||||
"0:\t"
|
||||
"lwarx %0,0,%1 \n\t"
|
||||
"stwcx. %2,0,%1 \n\t"
|
||||
"bne- 0b \n\t"
|
||||
"/* End always swap */"
|
||||
: "=&r"(__res)
|
||||
: "r"(__p), "r"(__newval)
|
||||
: "cr0", "memory");
|
||||
return __res;
|
||||
}
|
||||
|
||||
@ -84,14 +104,19 @@ __attribute__ ((__unused__))
|
||||
__test_and_set (volatile long *__p, long int __newval)
|
||||
{
|
||||
int __res;
|
||||
__asm__ __volatile__ ("\
|
||||
0: lwarx %0,0,%1
|
||||
cmpwi %0,0
|
||||
bne- 1f
|
||||
stwcx. %2,0,%1
|
||||
bne- 0b
|
||||
1:
|
||||
" : "=&r"(__res) : "r"(__p), "r"(__newval) : "cr0", "memory");
|
||||
__asm__ __volatile__ (
|
||||
"/* Inline test & set */\n"
|
||||
"0:\t"
|
||||
"lwarx %0,0,%1 \n\t"
|
||||
"cmpwi %0,0 \n\t"
|
||||
"bne- 1f \n\t"
|
||||
"stwcx. %2,0,%1 \n\t"
|
||||
"bne- 0b \n"
|
||||
"1:\n\t"
|
||||
"/* End test & set */"
|
||||
: "=&r"(__res)
|
||||
: "r"(__p), "r"(__newval)
|
||||
: "cr0", "memory");
|
||||
return __res;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user