atomicity.h (__Atomicity_lock<__inst>::_S_atomicity_lock): Correct alignment.
authorJohn David Anglin <dave.anglin@nrc-cnrc.gc.ca>
Sun, 9 Feb 2003 03:23:13 +0000 (03:23 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Sun, 9 Feb 2003 03:23:13 +0000 (03:23 +0000)
* hppa/atomicity.h (__Atomicity_lock<__inst>::_S_atomicity_lock):
Correct alignment.
(__exchange_and_add, __atomic_add): Use PA 2.0 ordered store to reset
lock.

From-SVN: r62593

libstdc++-v3/ChangeLog
libstdc++-v3/config/cpu/hppa/atomicity.h

index 588d23dec30decade420f5277ad3c52226489aa6..703000de4070d501531e1934220a35537dce7ea0 100644 (file)
@@ -1,3 +1,10 @@
+2003-02-08  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+       * hppa/atomicity.h (__Atomicity_lock<__inst>::_S_atomicity_lock):
+       Correct alignment.
+       (__exchange_and_add, __atomic_add): Use PA 2.0 ordered store to reset
+       lock.
+
 2003-02-07  Paolo Carlini  <pcarlini@unitus.it>
 
        * testsuite/27_io/filebuf_virtuals.cc (test08): Fix for
index eefb32d4a8eb363717ff4a0d3877cf41d50e766f..d99ac34d0b3e322daf87afe780ef90ce6b580599 100644 (file)
@@ -25,11 +25,12 @@ typedef int _Atomic_word;
 template <int __inst>
 struct __Atomicity_lock
 {
-  static volatile int __attribute__ ((aligned (16))) _S_atomicity_lock;
+  static volatile int _S_atomicity_lock;
 };
 
 template <int __inst>
-volatile int __Atomicity_lock<__inst>::_S_atomicity_lock = 1;
+volatile int
+__Atomicity_lock<__inst>::_S_atomicity_lock __attribute__ ((aligned (16))) = 1;
 
 /* Because of the lack of weak support when using the hpux
    som linker, we explicitly instantiate the atomicity lock
@@ -58,8 +59,9 @@ __exchange_and_add (volatile _Atomic_word* __mem, int __val)
 
   result = *__mem;
   *__mem = result + __val;
-  __asm__ __volatile__("");
-  lock = tmp;
+  /* Reset lock with PA 2.0 "ordered" store.  */
+  __asm__ __volatile__ ("stw,ma %1,0(%0)"
+                       : : "r" (&lock), "r" (tmp) : "memory");
   return result;
 }
 
@@ -80,8 +82,9 @@ __atomic_add (_Atomic_word* __mem, int __val)
                        : "r" (&lock));
 
   *__mem += __val;
-  __asm__ __volatile__("");
-  lock = tmp;
+  /* Reset lock with PA 2.0 "ordered" store.  */
+  __asm__ __volatile__ ("stw,ma %1,0(%0)"
+                       : : "r" (&lock), "r" (tmp) : "memory");
 }
 
 #endif