Re: [PATCH v3 0/3] Optimize GCD performance on RISC-V by selecting implementation at runtime

From: patchwork-bot+linux-riscv
Date: Sun Aug 10 2025 - 17:13:26 EST


Hello:

This series was applied to riscv/linux.git (fixes)
by Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>:

On Fri, 6 Jun 2025 21:47:55 +0800 you wrote:
> The current implementation of gcd() selects between the binary GCD and
> the odd-even GCD algorithm at compile time, depending on whether
> CONFIG_CPU_NO_EFFICIENT_FFS is set. On platforms like RISC-V, however,
> this compile-time decision can be misleading: even when the compiler
> emits ctz instructions based on the assumption that they are efficient
> (as is the case when CONFIG_RISCV_ISA_ZBB is enabled), the actual
> hardware may lack support for the Zbb extension. In such cases, ffs()
> falls back to a software implementation at runtime, making the binary
> GCD algorithm significantly slower than the odd-even variant.
>
> [...]

Here is the summary with links:
- [v3,1/3] lib/math/gcd: Use static key to select implementation at runtime
https://git.kernel.org/riscv/c/b3d5fd6f82dd
- [v3,2/3] riscv: Optimize gcd() code size when CONFIG_RISCV_ISA_ZBB is disabled
https://git.kernel.org/riscv/c/26b537edc533
- [v3,3/3] riscv: Optimize gcd() performance on RISC-V without Zbb extension
https://git.kernel.org/riscv/c/36e224168721

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html