[PATCH] arm: Use builtins for ffs/fls

Tom Rini trini at konsulko.com
Fri Aug 18 19:49:31 CEST 2023


On Mon, Jul 31, 2023 at 05:27:33PM -0400, Sean Anderson wrote:

> Since ARMv5, the clz instruction allows for efficient implementation of
> ffs/fls with builtins. Until ARMv7 (with Thumb-2), this instruction is
> only available in ARM mode. LTO makes it difficult to force specific
> functions to be in ARM mode, as it is effectively a form of very
> aggressive inlining. To work around this, fls/ffs are implemented in
> assembly for ARMv5 and ARMv6 when compiling U-Boot in Thumb mode.
> Overall, this saves around 75 bytes per call.
> 
> This code is synced with v5.15 of the Linux kernel.
> 
> Signed-off-by: Sean Anderson <sean.anderson at seco.com>
> Reviewed-by: Tom Rini <trini at konsulko.com>

Applied to u-boot/next, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20230818/1acfbac1/attachment.sig>


More information about the U-Boot mailing list