diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 1aeecd1bda7..e2d1924c0f4 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,14 @@ +2003-12-19 Jason Merrill + + * 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 * bits/demangle.h diff --git a/libstdc++-v3/config/cpu/cris/atomicity.h b/libstdc++-v3/config/cpu/cris/atomicity.h index f254c769b18..fecb9dc186f 100644 --- a/libstdc++-v3/config/cpu/cris/atomicity.h +++ b/libstdc++-v3/config/cpu/cris/atomicity.h @@ -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; diff --git a/libstdc++-v3/config/cpu/i486/atomicity.h b/libstdc++-v3/config/cpu/i486/atomicity.h index eab0f3da264..06ab866bbe3 100644 --- a/libstdc++-v3/config/cpu/i486/atomicity.h +++ b/libstdc++-v3/config/cpu/i486/atomicity.h @@ -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 */ diff --git a/libstdc++-v3/config/cpu/m68k/atomicity.h b/libstdc++-v3/config/cpu/m68k/atomicity.h index 0c7b189237b..eb801dec50c 100644 --- a/libstdc++-v3/config/cpu/m68k/atomicity.h +++ b/libstdc++-v3/config/cpu/m68k/atomicity.h @@ -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; } diff --git a/libstdc++-v3/config/cpu/mips/atomicity.h b/libstdc++-v3/config/cpu/mips/atomicity.h index 919bba7a3cc..3d0c7a10e09 100644 --- a/libstdc++-v3/config/cpu/mips/atomicity.h +++ b/libstdc++-v3/config/cpu/mips/atomicity.h @@ -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 */ diff --git a/libstdc++-v3/config/cpu/powerpc/atomicity.h b/libstdc++-v3/config/cpu/powerpc/atomicity.h index 518fd62ac96..6c474b48a89 100644 --- a/libstdc++-v3/config/cpu/powerpc/atomicity.h +++ b/libstdc++-v3/config/cpu/powerpc/atomicity.h @@ -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 */ diff --git a/libstdc++-v3/config/cpu/s390/atomicity.h b/libstdc++-v3/config/cpu/s390/atomicity.h index 5c5254c5b8e..8647c7635ea 100644 --- a/libstdc++-v3/config/cpu/s390/atomicity.h +++ b/libstdc++-v3/config/cpu/s390/atomicity.h @@ -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; } diff --git a/libstdc++-v3/config/cpu/sparc/atomicity.h b/libstdc++-v3/config/cpu/sparc/atomicity.h index 1caf344ebac..2db079c95ec 100644 --- a/libstdc++-v3/config/cpu/sparc/atomicity.h +++ b/libstdc++-v3/config/cpu/sparc/atomicity.h @@ -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__ */