Subject: Re: cpu_switch (was Re: 1.5 Release documentation ...)
To: Robert Swindells <rjs@fdy2.demon.co.uk>
From: Richard Earnshaw <rearnsha@arm.com>
List: port-arm32
Date: 11/07/2000 10:23:47
> I want to do some work on it to make use of the process ID register on
> the SA11x0 and XScale processors, and need to take the time to see how
> it works.
On Xscale (or any ARMv5 chip, for that matter) ffs() is easy:
ffs:
rsb r1, r0, #0
and r0, r0, r1 @ Find least significant bit
clz r0, r0 @ Count leading zeros
rsb r0, r0, #32 @ Normalize to ffs form (from LSB)
mov pc, lr
No loops, 4 cycles (plus any stalls I haven't thought about :-)
R.