summaryrefslogtreecommitdiffstats
path: root/sys/libkern
diff options
context:
space:
mode:
authorcognet <cognet@FreeBSD.org>2004-11-07 16:53:29 +0000
committercognet <cognet@FreeBSD.org>2004-11-07 16:53:29 +0000
commit964bf9d8f7224bc91023df9f0e4ed3694db44c62 (patch)
treec2bf97e8288c64fd6d5ab204bf6991c1c9a49545 /sys/libkern
parentce94b57ab1d34bc9fbee57209be44b713c7f9104 (diff)
downloadFreeBSD-src-964bf9d8f7224bc91023df9f0e4ed3694db44c62.zip
FreeBSD-src-964bf9d8f7224bc91023df9f0e4ed3694db44c62.tar.gz
Implement ffs with clz for Xscale.
Idea taken from: NetBSD
Diffstat (limited to 'sys/libkern')
-rw-r--r--sys/libkern/arm/ffs.S9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/libkern/arm/ffs.S b/sys/libkern/arm/ffs.S
index 4e6fe3d..6fe31b9 100644
--- a/sys/libkern/arm/ffs.S
+++ b/sys/libkern/arm/ffs.S
@@ -46,9 +46,12 @@ __FBSDID("$FreeBSD$");
*/
ENTRY(ffs)
+
/* Standard trick to isolate bottom bit in r0 or 0 if r0 = 0 on entry */
rsb r1, r0, #0
ands r0, r0, r1
+#ifndef __XSCALE__
+
/*
* now r0 has at most one set bit, call this X
* if X = 0, all further instructions are skipped
@@ -74,4 +77,8 @@ ENTRY(ffs)
.byte 10, 0, 0, 25, 0, 0, 21, 27 /* 40-47 */
.byte 31, 0, 0, 0, 0, 24, 0, 20 /* 48-55 */
.byte 30, 0, 23, 19, 29, 18, 17, 0 /* 56-63 */
-
+#else
+ clzne r0, r0
+ rsbne r0, r0, #32
+ mov pc, lr
+#endif
OpenPOWER on IntegriCloud