diff options
author | Bernardo Innocenti <bernie@develer.com> | 2003-10-16 21:47:45 +0200 |
---|---|---|
committer | Bernardo Innocenti <bernie@gcc.gnu.org> | 2003-10-16 21:47:45 +0200 |
commit | 068c84e3b5320330426785102f3d784f078d1144 (patch) | |
tree | 877ce22a76bd7a75d1d241528d69a5d11d75a614 /libstdc++-v3 | |
parent | 1e8a52484b64956ec2cc84e98eb4110b43c7b885 (diff) | |
download | gcc-068c84e3b5320330426785102f3d784f078d1144.zip gcc-068c84e3b5320330426785102f3d784f078d1144.tar.gz gcc-068c84e3b5320330426785102f3d784f078d1144.tar.bz2 |
atomicity.h (__exchange_and_add): Use TAS on __mcf5400__.
* config/cpu/m68k/atomicity.h (__exchange_and_add): Use TAS on
__mcf5400__. Don't rely on __mc68000__ to detect a bare 68000.
Document SMP safeness of asm macros.
From-SVN: r72570
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 6 | ||||
-rw-r--r-- | libstdc++-v3/config/cpu/m68k/atomicity.h | 17 |
2 files changed, 16 insertions, 7 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 7b0f83f..043e3cd 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2003-10-16 Bernardo Innocenti <bernie@develer.com> + + * config/cpu/m68k/atomicity.h (__exchange_and_add): Use TAS on + __mcf5400__. Don't rely on __mc68000__ to detect a bare 68000. + Document SMP safeness of asm macros. + 2003-10-16 Paolo Carlini <pcarlini@suse.de> * src/locale.cc (locale::locale(const char*)): Tweak diff --git a/libstdc++-v3/config/cpu/m68k/atomicity.h b/libstdc++-v3/config/cpu/m68k/atomicity.h index d33bbef..c4ce17d 100644 --- a/libstdc++-v3/config/cpu/m68k/atomicity.h +++ b/libstdc++-v3/config/cpu/m68k/atomicity.h @@ -94,22 +94,25 @@ __exchange_and_add (volatile _Atomic_word *__mem, int __val) { _Atomic_word __result; -// bset with no immediate addressing -#if defined(__mcf5200__) || defined(__mcf5300__) || defined(__mcf5400__) +// bset with no immediate addressing (not SMP-safe) +#if defined(__mcf5200__) || defined(__mcf5300__) __asm__ __volatile__("1: bset.b #7,%0@\n\tjbne 1b" : /* no outputs */ : "a"(&__Atomicity_lock<0>::_S_atomicity_lock) : "cc", "memory"); -// bset with immediate addressing -#elif defined(__mc68000__) - __asm__ __volatile__("1: bset.b #7,%0\n\tjbne 1b" +// CPU32 and MCF5400 support test-and-set (SMP-safe). +#elif defined(__mcpu32__) || defined(__mcf5400__) + __asm__ __volatile__("1: tas %0\n\tjbne 1b" : "+m"(__Atomicity_lock<0>::_S_atomicity_lock) : /* none */ : "cc"); -#else // 680x0, cpu32, 5400 support test-and-set. - __asm__ __volatile__("1: tas %0\n\tjbne 1b" +// Use bset with immediate addressing for 68000/68010 (not SMP-safe) +// NOTE: TAS is available on the 68000, but unsupported by some Amiga +// memory controllers. +#else + __asm__ __volatile__("1: bset.b #7,%0\n\tjbne 1b" : "+m"(__Atomicity_lock<0>::_S_atomicity_lock) : /* none */ : "cc"); |