diff options
author | Tanguy Pruvot <tanguy.pruvot@gmail.com> | 2011-08-11 14:10:37 +0200 |
---|---|---|
committer | Tanguy Pruvot <tanguy.pruvot@gmail.com> | 2011-08-11 14:17:14 +0200 |
commit | 7956d47e7ce21f18ccd4d71874a43faa2cd88f07 (patch) | |
tree | 66735ddec9f8af28e62ac5143e5607d4218a3906 | |
parent | 70ad46f919214c40d315310d6be7ad1fca60b44a (diff) | |
download | bionic-7956d47e7ce21f18ccd4d71874a43faa2cd88f07.zip bionic-7956d47e7ce21f18ccd4d71874a43faa2cd88f07.tar.gz bionic-7956d47e7ce21f18ccd4d71874a43faa2cd88f07.tar.bz2 |
Remove the ffs ARMv4 compatibility emulation code
could also be resolved with include <machine/cpu-features.h>
use clz instruction in dmalloc ffs function, for all android devices
Change-Id: I270cb8fd4d7c959cfe3cf0b1066a57e38a7a6f58
-rw-r--r-- | libc/arch-arm/bionic/ffs.S | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/libc/arch-arm/bionic/ffs.S b/libc/arch-arm/bionic/ffs.S index c7ffca2..052b46a 100644 --- a/libc/arch-arm/bionic/ffs.S +++ b/libc/arch-arm/bionic/ffs.S @@ -36,47 +36,14 @@ * 6 bits as an index into the table. This algorithm should be a win * over the checking each bit in turn as per the C compiled version. * - * under ARMv5 there's an instruction called CLZ (count leading Zero's) that - * could be used - * - * This is the ffs algorithm devised by d.seal and posted to comp.sys.arm on - * 16 Feb 1994. + * since ARMv5 there's an instruction called CLZ (count leading Zero's) */ 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 -#if _ARM_ARCH_ < 5 - /* - * now r0 has at most one set bit, call this X - * if X = 0, all further instructions are skipped - */ - adrne r2, .L_ffs_table - orrne r0, r0, r0, lsl #4 /* r0 = X * 0x11 */ - orrne r0, r0, r0, lsl #6 /* r0 = X * 0x451 */ - rsbne r0, r0, r0, lsl #16 /* r0 = X * 0x0450fbaf */ - - /* now lookup in table indexed on top 6 bits of r0 */ - ldrneb r0, [ r2, r0, lsr #26 ] - - bx lr - -.text; -.type .L_ffs_table, _ASM_TYPE_OBJECT; -.L_ffs_table: -/* 0 1 2 3 4 5 6 7 */ - .byte 0, 1, 2, 13, 3, 7, 0, 14 /* 0- 7 */ - .byte 4, 0, 8, 0, 0, 0, 0, 15 /* 8-15 */ - .byte 11, 5, 0, 0, 9, 0, 0, 26 /* 16-23 */ - .byte 0, 0, 0, 0, 0, 22, 28, 16 /* 24-31 */ - .byte 32, 12, 6, 0, 0, 0, 0, 0 /* 32-39 */ - .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 bx lr -#endif |