Re: [PATCH] csky: bitops: Use the compiler builtin for __fls()

From: Tzu-Ching Yang

Date: Wed Oct 28 2026 - 23:47:14 EST


On Wed, Oct 28, 2026 at 11:12:45AM -0400, Yury Norov wrote:
> I wonder why the older GCC works better... Can you make sure its the
> same kernel version and the config?

Same tree and config: both tables compare csky/linux-next at
abb81e5ce7d9 before and after the patch, with csky defconfig (CK807),
built with kernel.org GCC 12.5 for one table and GCC 16.2 for the other.
The .config files are identical except for the toolchain-derived symbols
(CONFIG_CC_VERSION_TEXT, CONFIG_GCC_VERSION, CONFIG_AS_VERSION,
CONFIG_LD_VERSION and CONFIG_CC_HAS_*).

The Before totals differ because GCC 16 emits more code than GCC 12 for
this config, with or without the patch. __fls() itself compiles to the
same 4 instructions (8 bytes) with GCC 9 to 16, before and after.

> Anyways the numbers show that the switch to the generic implementation
> is worth to try. I've added the numbers to the commit message and
> pushed in bitmap-for-next for testing.
>
> Conditionally on the (so far, missing) csky engineers feedback.

Thanks for picking it up.

Tzu-Ching