From: Dinar Temirbulatov <dinar@kugelworks.com>
To: libc-ports@sourceware.org
Cc: joseph@codesourcery.com, adeb@nvidia.com
Subject: [Patch] ARM define atomic_exchange_acq/atomic_exchange_rel to __atomic_exchange_n
Date: Tue, 13 Aug 2013 17:11:00 -0000 [thread overview]
Message-ID: <CANoaTN2hKTZ7GZCMsYqai25PHO7GLb56huLosR7+dgjAEK2FGQ@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 457 bytes --]
Hello,
Following patch redefines atomic_exchange_acq/atomic_exchange_rel to
__atomic_exchange_n for ARM, that allows for example to reduce number
of instruction sequence for lll_unlock
from:
ldex, cmp, bne, stex, cmp, bne
to
ldex, stex, cmp, bne
, more on the issue here:
http://sourceware.org/bugzilla/show_bug.cgi?id=15640
This patch was tested on ARM a9 with glibc testsuite with no new
regressions. OK to commit?
Thanks, Dinar.
[-- Attachment #2: arm_atomic.patch --]
[-- Type: application/octet-stream, Size: 1131 bytes --]
diff --git a/ports/sysdeps/arm/bits/atomic.h b/ports/sysdeps/arm/bits/atomic.h
index 6e20df7..78d4a6e 100644
--- a/ports/sysdeps/arm/bits/atomic.h
+++ b/ports/sysdeps/arm/bits/atomic.h
@@ -79,3 +79,26 @@ void __arm_link_error (void);
# define __arm_assisted_compare_and_exchange_val_32_acq(mem, newval, oldval) \
({ __arm_link_error (); oldval; })
#endif
+
+#if __GNUC_PREREQ (4, 7)
+# define atomic_exchange_acq(mem, value) \
+ __atomic_val_bysize (__arch_exchange, int, mem, value, __ATOMIC_ACQUIRE)
+
+# define atomic_exchange_rel(mem, value) \
+ __atomic_val_bysize (__arch_exchange, int, mem, value, __ATOMIC_RELEASE)
+
+/* Atomic exchange (without compare). */
+
+# define __arch_exchange_8_int(mem, newval, model) \
+ (abort (), (typeof(*mem)) 0)
+
+# define __arch_exchange_16_int(mem, newval, model) \
+ (abort (), (typeof(*mem)) 0)
+
+# define __arch_exchange_32_int(mem, newval, model) \
+ __atomic_exchange_n (mem, newval, model)
+
+# define __arch_exchange_64_int(mem, newval, model) \
+ (abort (), (typeof(*mem)) 0)
+
+#endif
next reply other threads:[~2013-08-13 17:11 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-13 17:11 Dinar Temirbulatov [this message]
2013-08-15 21:46 ` Abhishek Deb
2013-08-16 22:57 ` Dinar Temirbulatov
2013-08-17 2:42 ` Abhishek Deb
2013-08-19 19:21 ` Dinar Temirbulatov
2013-08-18 20:29 ` Joseph S. Myers
2013-09-01 20:42 Dinar Temirbulatov
2013-09-01 20:43 Dinar Temirbulatov
2013-09-02 15:08 ` Joseph S. Myers
2013-09-03 17:31 ` Abhishek Deb
2013-09-05 12:56 ` Dinar Temirbulatov
2013-09-05 15:48 ` Joseph S. Myers
2013-09-05 17:09 ` Abhishek Deb
2013-09-11 19:25 ` Dinar Temirbulatov
2013-09-11 19:27 ` Dinar Temirbulatov
2013-09-11 20:40 ` Abhishek Deb
2013-09-13 17:14 ` Joseph S. Myers
2013-09-14 3:29 ` Dinar Temirbulatov
2013-09-18 17:16 ` Joseph S. Myers
2013-09-19 6:53 ` Maxim Kuvyrkov
2013-09-19 16:29 ` Joseph S. Myers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CANoaTN2hKTZ7GZCMsYqai25PHO7GLb56huLosR7+dgjAEK2FGQ@mail.gmail.com \
--to=dinar@kugelworks.com \
--cc=adeb@nvidia.com \
--cc=joseph@codesourcery.com \
--cc=libc-ports@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).