From: Andre McCurdy <armccurdy@gmail.com>
To: musl@lists.openwall.com
Cc: Andre McCurdy <armccurdy@gmail.com>
Subject: [PATCH 2/2] provide a_ctz_32 helper
Date: Wed, 18 Apr 2018 17:41:00 -0700 [thread overview]
Message-ID: <1524098460-8072-3-git-send-email-armccurdy@gmail.com> (raw)
In-Reply-To: <1524098460-8072-1-git-send-email-armccurdy@gmail.com>
Provide an ARM specific a_ctz_32 helper function for architecture
versions for which it can be implemented efficiently via the "rbit"
instruction (ie all Thumb-2 capable versions of ARM v6 and above).
---
arch/arm/atomic_arch.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm/atomic_arch.h b/arch/arm/atomic_arch.h
index c5c56f8..72fcddb 100644
--- a/arch/arm/atomic_arch.h
+++ b/arch/arm/atomic_arch.h
@@ -91,4 +91,16 @@ static inline int a_clz_32(uint32_t x)
return x;
}
+#if __ARM_ARCH_6T2__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
+
+#define a_ctz_32 a_ctz_32
+static inline int a_ctz_32(uint32_t x)
+{
+ uint32_t xr;
+ __asm__ ("rbit %0, %1" : "=r"(xr) : "r"(x));
+ return a_clz_32(xr);
+}
+
+#endif
+
#endif
--
1.9.1
prev parent reply other threads:[~2018-04-19 0:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-19 0:40 [PATCH 0/2] a_ctz optimisations Andre McCurdy
2018-04-19 0:40 ` [PATCH 1/2] remove a_ctz_l from arch specific atomic_arch.h Andre McCurdy
2018-04-19 0:41 ` Andre McCurdy [this message]
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=1524098460-8072-3-git-send-email-armccurdy@gmail.com \
--to=armccurdy@gmail.com \
--cc=musl@lists.openwall.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).