atomicity.h: Remove memory clobbers.

* config/cpu/cris/atomicity.h: Remove memory clobbers.
        * config/cpu/mips/atomicity.h: Likewise.
        * config/cpu/i486/atomicity.h: Remove memory clobbers.
        Split up read-write memory operand.
        * config/cpu/m68k/atomicity.h: Likewise.
        * config/cpu/powerpc/atomicity.h: Make memory I/O explicit.
        * config/cpu/s390/atomicity.h: Likewise.
        * config/cpu/sparc/atomicity.h: Likewise.

From-SVN: r74870
This commit is contained in:
Jason Merrill 2003-12-19 22:08:42 -05:00 committed by Jason Merrill
parent a06f01ba1e
commit 46eb4b3989
8 changed files with 47 additions and 43 deletions

View File

@ -1,3 +1,14 @@
2003-12-19 Jason Merrill <jason@redhat.com>
* config/cpu/cris/atomicity.h: Remove memory clobbers.
* config/cpu/mips/atomicity.h: Likewise.
* config/cpu/i486/atomicity.h: Remove memory clobbers.
Split up read-write memory operand.
* config/cpu/m68k/atomicity.h: Likewise.
* config/cpu/powerpc/atomicity.h: Make memory I/O explicit.
* config/cpu/s390/atomicity.h: Likewise.
* config/cpu/sparc/atomicity.h: Likewise.
2003-12-20 Carlo Wood <carlo@alinoe.com>
* bits/demangle.h

View File

@ -51,8 +51,7 @@ __exchange_and_add(_Atomic_word* __mem, int __val)
" bwf 0b \n"
" clearf \n"
: "=&r" (__result), "=m" (*__mem), "=&r" (__tmp)
: "r" (__mem), "g" (__val), "m" (*__mem)
: "memory");
: "r" (__mem), "g" (__val), "m" (*__mem));
#else
__asm__ __volatile__ (" move $ccr,$r9 \n"
" di \n"
@ -63,7 +62,7 @@ __exchange_and_add(_Atomic_word* __mem, int __val)
" move $r9,$ccr \n"
: "=&r" (__result), "=m" (*__mem), "=&r" (__tmp)
: "r" (__mem), "g" (__val), "m" (*__mem)
: "memory", "r9");
: "r9");
#endif
return __result;

View File

@ -38,9 +38,8 @@ __exchange_and_add(volatile _Atomic_word* __mem, int __val)
{
register _Atomic_word __result;
__asm__ __volatile__ ("lock; xadd{l} {%0,%1|%1,%0}"
: "=r" (__result), "+m" (*__mem)
: "0" (__val)
: "memory");
: "=r" (__result), "=m" (*__mem)
: "0" (__val), "m" (*__mem));
return __result;
}
@ -49,7 +48,7 @@ __attribute__ ((__unused__))
__atomic_add(volatile _Atomic_word* __mem, int __val)
{
__asm__ __volatile__ ("lock; add{l} {%1,%0|%0,%1}"
: "+m" (*__mem) : "ir" (__val) : "memory");
: "=m" (*__mem) : "ir" (__val), "m" (*__mem));
}
#endif /* atomicity.h */

View File

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

View File

@ -52,8 +52,7 @@ __exchange_and_add(volatile _Atomic_word* __mem, int __val)
"beqz %1,1b\n\t"
"/* End exchange & add */"
: "=&r"(__result), "=&r"(__tmp), "=m"(*__mem)
: "m" (*__mem), "r"(__val)
: "memory");
: "m" (*__mem), "r"(__val));
return __result;
}
@ -78,8 +77,7 @@ __atomic_add(volatile _Atomic_word* __mem, int __val)
"beqz %0,1b\n\t"
"/* End atomic add */"
: "=&r"(__result), "=m"(*__mem)
: "m" (*__mem), "r"(__val)
: "memory");
: "m" (*__mem), "r"(__val));
}
#endif /* atomicity.h */

View File

@ -46,14 +46,14 @@ __exchange_and_add(volatile _Atomic_word* __mem, int __val)
__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"
"lwarx %0,0,%3 \n\t"
"add%I3 %1,%0,%4 \n\t"
_STWCX " %1,0,%3 \n\t"
"bne- 0b \n\t"
"/* End exchange & add */"
: "=&b"(__res), "=&r"(__tmp)
: "r" (__mem), "Ir"(__val)
: "cr0", "memory");
: "=&b"(__res), "=&r"(__tmp), "=m" (*__mem)
: "r" (__mem), "Ir"(__val), "m" (*__mem)
: "cr0");
return __res;
}
@ -65,14 +65,14 @@ __atomic_add(volatile _Atomic_word* __mem, int __val)
__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"
"lwarx %0,0,%2 \n\t"
"add%I2 %0,%0,%3 \n\t"
_STWCX " %0,0,%2 \n\t"
"bne- 0b \n\t"
"/* End atomic add */"
: "=&b"(__tmp)
: "r" (__mem), "Ir"(__val)
: "cr0", "memory");
: "=&b"(__tmp), "=m" (*__mem)
: "r" (__mem), "Ir"(__val), "m" (*__mem)
: "cr0");
}
#endif /* atomicity.h */

View File

@ -38,13 +38,13 @@ __exchange_and_add(volatile _Atomic_word* __mem, int __val)
{
register _Atomic_word __old_val, __new_val;
__asm__ __volatile__ (" l %0,0(%2)\n"
__asm__ __volatile__ (" l %0,0(%3)\n"
"0: lr %1,%0\n"
" ar %1,%3\n"
" cs %0,%1,0(%2)\n"
" ar %1,%4\n"
" cs %0,%1,0(%3)\n"
" jl 0b"
: "=&d" (__old_val), "=&d" (__new_val)
: "a" (__mem), "d" (__val) : "cc", "memory" );
: "=&d" (__old_val), "=&d" (__new_val), "=m" (*__mem)
: "a" (__mem), "d" (__val), "m" (*__mem) : "cc");
return __old_val;
}

View File

@ -41,15 +41,14 @@ __exchange_and_add(volatile _Atomic_word* __mem, int __val)
_Atomic_word __tmp1, __tmp2;
_Atomic_word __val_extended = __val;
__asm__ __volatile__("1: ldx [%2], %0\n\t"
" add %0, %3, %1\n\t"
" casx [%2], %0, %1\n\t"
__asm__ __volatile__("1: ldx [%3], %0\n\t"
" add %0, %4, %1\n\t"
" casx [%3], %0, %1\n\t"
" sub %0, %1, %0\n\t"
" brnz,pn %0, 1b\n\t"
" nop"
: "=&r" (__tmp1), "=&r" (__tmp2)
: "r" (__mem), "r" (__val_extended)
: "memory");
: "=&r" (__tmp1), "=&r" (__tmp2), "=m" (*__mem)
: "r" (__mem), "r" (__val_extended), "m" (*__mem));
return __tmp2;
}
@ -60,15 +59,14 @@ __atomic_add(volatile _Atomic_word* __mem, int __val)
_Atomic_word __tmp1, __tmp2;
_Atomic_word __val_extended = __val;
__asm__ __volatile__("1: ldx [%2], %0\n\t"
" add %0, %3, %1\n\t"
" casx [%2], %0, %1\n\t"
__asm__ __volatile__("1: ldx [%3], %0\n\t"
" add %0, %4, %1\n\t"
" casx [%3], %0, %1\n\t"
" sub %0, %1, %0\n\t"
" brnz,pn %0, 1b\n\t"
" nop"
: "=&r" (__tmp1), "=&r" (__tmp2)
: "r" (__mem), "r" (__val_extended)
: "memory");
: "=&r" (__tmp1), "=&r" (__tmp2), "=m" (*__mem)
: "r" (__mem), "r" (__val_extended), "m" (*__mem));
}
#else /* __arch32__ */