[PATCH v1 0/3] riscv: Add multiarch/IFUNC and RVV implementation for strcpy
Yao Zihong
zihong.plct@isrc.iscas.ac.cn
Fri Sep 19 00:50:45 GMT 2025
Hi,
This series introduces multiarch/IFUNC support and an RVV implementation of
strcpy on RISC-V. The first patch sets up the multiarch scaffolding without
changing behavior, the second adds the RVV implementation but does not wire it,
and the third enables runtime selection via hwprobe and dl_hwcap.
Summary of changes
- 1/3 Add riscv multiarch support for strcpy (IFUNC + generic)
- 2/3 Add RVV implementation __strcpy_vector
- 3/3 Enable runtime selection of RVV via ifunc-impl-list and resolver
Performance
- Method: based on glibc’s standard bench-strcpy (unmodified). We benchmarked
both generic and RVV implementations with warm-up followed by 30 runs,
reporting geometric-mean ratios new/base (<1.0 faster). For instance, if the
generic version takes 1s and the RVV implementation takes 0.5s, the ratio is
0.5/1 = 0.5.
- Platform: K230
Overall: [0.507067, 0.507467]
0–8B: [0.699564, 0.714102]
8–16B: [0.699377, 0.711950]
16–32B: [0.806600, 0.817281]
32–64B: [0.599432, 0.605304]
64–128B: [0.561129, 0.564509]
128–256B: [0.547636, 0.549377]
256–512B: [0.499103, 0.499544]
512–1024B: [0.526969, 0.527928]
- Platform: SpacemiT M1
Overall: [0.365036, 0.365222]
0–8B: [0.654348, 0.660200]
8–16B: [0.492900, 0.496912]
16–32B: [0.607871, 0.610628]
32–64B: [0.639191, 0.640611]
64–128B: [0.446344, 0.447192]
128–256B: [0.381990, 0.382429]
256–512B: [0.340551, 0.340761]
512–1024B: [0.351470, 0.352308]
Reproducibility
- Isolation: system load kept minimal; background services reduced as far as practical
- Statistics: 95% CIs are reported
Thanks for reviewing.
Yao Zihong (3):
riscv: Add multiarch support for strcpy
riscv: Add RVV implementation __strcpy_vector
riscv: Enable RVV strcpy in both ifunc-impl-list and resolver
sysdeps/riscv/multiarch/strcpy-generic.c | 26 ++++++
sysdeps/riscv/multiarch/strcpy_vector.S | 89 +++++++++++++++++++
.../unix/sysv/linux/riscv/multiarch/Makefile | 3 +
.../linux/riscv/multiarch/ifunc-impl-list.c | 12 ++-
.../unix/sysv/linux/riscv/multiarch/strcpy.c | 55 ++++++++++++
5 files changed, 184 insertions(+), 1 deletion(-)
create mode 100644 sysdeps/riscv/multiarch/strcpy-generic.c
create mode 100644 sysdeps/riscv/multiarch/strcpy_vector.S
create mode 100644 sysdeps/unix/sysv/linux/riscv/multiarch/strcpy.c
--
2.47.2
More information about the Libc-alpha
mailing list