[PATCH v3 6/8] riscv: lib: add strnlen implementation

Andy Shevchenko andriy.shevchenko at intel.com
Mon Jan 19 23:31:25 PST 2026


On Tue, Jan 20, 2026 at 02:58:50PM +0800, Feng Jiang wrote:
> Add an optimized strnlen() implementation for RISC-V. This version
> includes a generic word-at-a-time optimization and a Zbb-powered
> optimization using the 'orc.b' instruction, derived from the strlen
> implementation.
> 
> Benchmark results (QEMU TCG, rv64):
>   Length | Original (MB/s) | Optimized (MB/s) | Improvement
>   -------|-----------------|------------------|------------
>   16 B   | 189             | 310              | +64.0%
>   512 B  | 344             | 1535             | +346.2%
>   4096 B | 363             | 1854             | +410.7%

> Suggested-by: Andy Shevchenko <andy at kernel.org>

Wrong tag, I have zero knowledge about RISC V.

-- 
With Best Regards,
Andy Shevchenko





More information about the linux-riscv mailing list