Module: xenomai-3
Branch: next
Commit: 4a9e7435c38f7f7b92cc863482839f14e314009a
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4a9e7435c38f7f7b92cc863482839f14e314009a

Author: Dmitriy Cherkasov <dmit...@mperpetuo.com>
Date:   Wed Jun 17 16:09:20 2015 -0700

cobalt/arm64: machine.h: use slightly faster ffnz implementation

---

 kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h 
b/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
index 417a7b0..b8290bf 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/machine.h
@@ -37,13 +37,23 @@
 #include <asm/processor.h>
 #include <asm/ipipe.h>
 #include <asm/cacheflush.h>
+#include <cobalt/kernel/assert.h>
 
 /* D-side always behaves as PIPT on AArch64 (see 
arch/arm64/include/asm/cachetype.h) */
 #define xnarch_cache_aliasing() 0
 
 static inline __attribute_const__ unsigned long ffnz(unsigned long ul)
 {
-       return __builtin_ffsl(ul) - 1;
+       int __r;
+
+       /* zero input is not valid */
+       XENO_WARN_ON(COBALT, ul == 0);
+
+       __asm__ ("rbit\t%0, %1\n"
+                "clz\t%0, %0\n"
+               : "=r" (__r) : "r"(ul) : "cc");
+
+       return __r;
 }
 
 #include <asm-generic/xenomai/machine.h>


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to