[PW_SID:1095491] [v2] riscv: lib: add strrchr() zbb implementation#1949
[PW_SID:1095491] [v2] riscv: lib: add strrchr() zbb implementation#1949linux-riscv-bot wants to merge 1 commit into
Conversation
Add an zbb assembly implementation of strrchr() for RISC-V. The implementation uses ZBB bit-manipulation instructions such as orc.b, ctz, and clz to process multiple bytes per iteration and significantly improve performance for longer strings compared to the generic byte-by-byte implementation. For the test case, I used the existing string_bench_strrchr benchmark, but I changed the input character from '\0' to 'a' to obtain more realistic results, because I added a check for '\0' in the assembly code. Benchmark results (QEMU TCG, rv64): Len | ZBB | WoZBB | %ZBB/WoZBB ------|--------|--------|------------ 1 B | 20.0 | 22.9 | -12.7% 7 B | 87.5 | 110.1 | -20.5% 8 B | 166.8 | 130.3 | +28.0% 16 B | 329.5 | 189.1 | +74.2% 31 B | 366.9 | 195.7 | +87.5% 64 B | 870.3 | 231.5 | +275.9% 127 B | 1007.0 | 278.9 | +261.1% 512 B | 1751.9 | 305.5 | +473.5% 1024 B| 1841.9 | 294.7 | +525.0% 2048 B| 1955.4 | 310.4 | +530.0% 4096 B| 2034.6 | 312.5 | +551.1% Signed-off-by: Milan Tripkovic <Milan.Tripkovic@rt-rk.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[v2] riscv: lib: add strrchr() zbb implementation" |
|
Patch 1: "[v2] riscv: lib: add strrchr() zbb implementation" |
|
Patch 1: "[v2] riscv: lib: add strrchr() zbb implementation" |
|
Patch 1: "[v2] riscv: lib: add strrchr() zbb implementation" |
|
Patch 1: "[v2] riscv: lib: add strrchr() zbb implementation" |
|
Patch 1: "[v2] riscv: lib: add strrchr() zbb implementation" |
|
Patch 1: "[v2] riscv: lib: add strrchr() zbb implementation" |
|
Patch 1: "[v2] riscv: lib: add strrchr() zbb implementation" |
|
Patch 1: "[v2] riscv: lib: add strrchr() zbb implementation" |
|
Patch 1: "[v2] riscv: lib: add strrchr() zbb implementation" |
|
Patch 1: "[v2] riscv: lib: add strrchr() zbb implementation" |
|
Patch 1: "[v2] riscv: lib: add strrchr() zbb implementation" |
PR for series 1095491 applied to workflow__riscv__fixes
Name: [v2] riscv: lib: add strrchr() zbb implementation
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1095491
Version: 2