diff options
author | Adhemerval Zanella <azanella@linux.vnet.ibm.com> | 2014-11-25 14:32:54 -0500 |
---|---|---|
committer | Adhemerval Zanella <azanella@linux.vnet.ibm.com> | 2014-11-26 07:06:28 -0500 |
commit | 704f794714704ba430d84d10d6809acaf7ca59bf (patch) | |
tree | 753816581f7d1f54d4af4921d776077b31a9a4e4 /csu | |
parent | cdcb42d7f786fe5ee1ca60065924d0b5c6649dd0 (diff) | |
download | glibc-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.c | 16 |
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) |