Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: findbit: provide more efficient ARMv7 implementation

Provide a more efficient ARMv7 implementation to determine the first
set bit in the supplied value.

Signed-off-by: Russell King (Oracle) <rmk@armlinux.org.uk>

+5 -1
+5 -1
arch/arm/lib/findbit.S
··· 170 170 * One or more bits in the LSB of r3 are assumed to be set. 171 171 */ 172 172 .L_found: 173 - #if __LINUX_ARM_ARCH__ >= 5 173 + #if __LINUX_ARM_ARCH__ >= 7 174 + rbit r3, r3 @ reverse bits 175 + clz r3, r3 @ count high zero bits 176 + add r0, r2, r3 @ add offset of first set bit 177 + #elif __LINUX_ARM_ARCH__ >= 5 174 178 rsb r0, r3, #0 175 179 and r3, r3, r0 @ mask out lowest bit set 176 180 clz r3, r3 @ count high zero bits