summary refs log tree commit diff
path: root/csu
diff options
context:
space:
mode:
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>2014-11-25 14:32:54 -0500
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>2014-11-26 07:06:28 -0500
commit704f794714704ba430d84d10d6809acaf7ca59bf (patch)
tree753816581f7d1f54d4af4921d776077b31a9a4e4 /csu
parentcdcb42d7f786fe5ee1ca60065924d0b5c6649dd0 (diff)
downloadglibc-704f794714704ba430d84d10d6809acaf7ca59bf.tar.gz
glibc-704f794714704ba430d84d10d6809acaf7ca59bf.tar.xz
glibc-704f794714704ba430d84d10d6809acaf7ca59bf.zip
powerpc: Fix missing barriers in atomic_exchange_and_add_{acq,rel}
On powerpc, atomic_exchange_and_add is implemented without any
barriers.  This patchs adds the missing instruction and memory barrier
for acquire and release semanthics.
Diffstat (limited to 'csu')
-rw-r--r--csu/tst-atomic.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/csu/tst-atomic.c b/csu/tst-atomic.c
index c6e786d92e..5ab651e9f4 100644
--- a/csu/tst-atomic.c
+++ b/csu/tst-atomic.c
@@ -113,6 +113,22 @@ do_test (void)
       ret = 1;
     }
 
+  mem = 2;
+  if (atomic_exchange_and_add_acq (&mem, 11) != 2
+      || mem != 13)
+    {
+      puts ("atomic_exchange_and_add test failed");
+      ret = 1;
+    }
+
+  mem = 2;
+  if (atomic_exchange_and_add_rel (&mem, 11) != 2
+      || mem != 13)
+    {
+      puts ("atomic_exchange_and_add test failed");
+      ret = 1;
+    }
+
   mem = -21;
   atomic_add (&mem, 22);
   if (mem != 1)