linux/arch/riscv/purgatory
Feng Jiang bef64bcb94 riscv: lib: add strrchr() implementation
Add an assembly implementation of strrchr() for RISC-V.

This implementation minimizes instruction count and avoids unnecessary
memory access to the stack. The performance benefits are most visible
on small workloads (1-16 bytes) where the architectural savings in
function overhead outweigh the execution time of the scan loop.

Benchmark results (QEMU TCG, rv64):
  Length | Original (MB/s) | Optimized (MB/s) | Improvement
  -------|-----------------|------------------|------------
  1 B    | 20              | 21               | +5.0%
  7 B    | 111             | 120              | +8.1%
  16 B   | 189             | 199              | +5.3%
  512 B  | 361             | 382              | +5.8%
  4096 B | 388             | 391              | +0.8%

Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
Tested-by: Joel Stanley <joel@jms.id.au>
Link: https://patch.msgid.link/20260130025018.172925-9-jiangfeng@kylinos.cn
Signed-off-by: Paul Walmsley <pjw@kernel.org>
2026-04-04 18:42:44 -06:00
..
.gitignore riscv/purgatory: Omit use of bin2c 2022-08-11 09:32:34 -07:00
entry.S riscv/purgatory: 4B align purgatory_start 2025-04-01 07:07:12 +00:00
kexec-purgatory.S riscv: Fix typo in purgatory end label 2026-04-04 18:42:42 -06:00
Makefile riscv: lib: add strrchr() implementation 2026-04-04 18:42:44 -06:00
purgatory.c lib/crypto: sha256: Make library API use strongly-typed contexts 2025-07-04 10:18:53 -07:00