[PATCH v4 0/1] riscv: Add RVV memset via multiarch/IFUNC
Yao Zihong
zihong.plct@isrc.iscas.ac.cn
Thu Nov 27 15:36:30 GMT 2025
Changes since v3:
* Clarified commit message to describe the SIGILL consequence when RVV is
disabled via prctl(). (Darius Rad)
Change since v2:
* Removed unnecessary `#include` and fixed minor spacing issues.
* Fixed commit message wording and added a note describing the resolver
behavior when the RVV extension is disabled via prctl(). (Darius Rad)
* Folded the two hwprobe calls into a single call by probing both
CPUPERF_0 and IMA_EXT_0 together. (Vineet Gupta)
Change since v1:
* Fixed typos and comment wording (Peter Bergner).
---
Hi all,
This patch wires up an RVV implementation of `memset` for RISC-V through
the existing multiarch/IFUNC mechanism.
It serves as a minimal pilot for integrating Hau Hsu's 2023 RVV work
under a unified ifunc-based framework. Once validated, this approach can
be extended to the rest of the string/memory routines.
---
Background
----------
The original RVV implementations were proposed by Hau Hsu in [1].
My earlier patch series attempted to integrate Hau's work for the entire
str*/mem* family under a unified multiarch/IFUNC framework.
Jeff Law later suggested narrowing the scope to a single function to
validate the integration model. He also identified a hang issue in my
earlier version and provided a corrective patch introducing a redirect
header to fix it [2]. This series follows that approach.
There was also a discussion regarding the use of dl_hwcap as the runtime
indicator in the v2 patch [3][4]. The case where the RVV extension is
disabled via prctl() is considered very rare, and reviewers agreed it
should not block progress on this series. Meanwhile, we are coordinating
with the kernel side to address this more properly.
---
Testing
-------
Testing was conducted on MUSE-Pi (SpacemiT M1). The glibc testsuite passed
without any additional regressions compared with glibc master when the RVV
extension was not disabled via prctl().
Summary of test results for(MUSE-Pi):
UNSUPPORTED: elf/tst-env-setuid
XPASS: elf/tst-protected1a
XPASS: elf/tst-protected1b
UNSUPPORTED: elf/tst-valgrind-smoke
UNSUPPORTED: io/tst-faccessat-setuid
UNSUPPORTED: libio/tst-fopen-compat
FAIL: locale/tst-localedef-path-norm
FAIL: malloc/tst-malloc-too-large-malloc-hugetlb2
UNSUPPORTED: math/test-ceil-except-2
UNSUPPORTED: math/test-fesetexcept-traps
UNSUPPORTED: math/test-fexcept-traps
UNSUPPORTED: math/test-floor-except-2
UNSUPPORTED: math/test-nearbyint-except-2
UNSUPPORTED: math/test-trunc-except-2
UNSUPPORTED: misc/tst-adjtimex
UNSUPPORTED: misc/tst-clock_adjtime
UNSUPPORTED: misc/tst-epoll-ioctls
UNSUPPORTED: misc/tst-mseal
UNSUPPORTED: misc/tst-mseal-pkey
UNSUPPORTED: misc/tst-ntp_adjtime
UNSUPPORTED: misc/tst-pidfd_getinfo
UNSUPPORTED: misc/tst-pkey
UNSUPPORTED: nptl/test-cond-printers
UNSUPPORTED: nptl/test-condattr-printers
UNSUPPORTED: nptl/test-mutex-printers
UNSUPPORTED: nptl/test-mutexattr-printers
UNSUPPORTED: nptl/test-rwlock-printers
UNSUPPORTED: nptl/test-rwlockattr-printers
FAIL: nptl/tst-cancel32
UNSUPPORTED: posix/tst-spawn-cgroup
FAIL: stdlib/test-bz22786
FAIL: string/test-strncasecmp
UNSUPPORTED: string/tst-strerror
UNSUPPORTED: string/tst-strsignal
UNSUPPORTED: time/tst-clock_settime
UNSUPPORTED: time/tst-settimeofday
=== Summary of results ===
5 FAIL
6553 PASS
29 UNSUPPORTED
16 XFAIL
2 XPASS
---
[1] https://inbox.sourceware.org/libc-alpha/20230421075405.14892-3-hau.hsu@sifive.com/
[2] https://inbox.sourceware.org/libc-alpha/7594c7f5-8bd6-45df-8218-ce74eff6e152@gmail.com/
[3] https://sourceware.org/pipermail/libc-alpha/2025-October/171687.html
[4] https://inbox.sourceware.org/libc-alpha/20251104123821.28787-2-zihong.plct@isrc.iscas.ac.cn/
---
Yao Zihong (1):
riscv: Add RVV memset via multiarch/IFUNC
.../riscv/multiarch/dl-symbol-redir-ifunc.h | 27 +++++++++
sysdeps/riscv/multiarch/memset-generic.c | 26 +++++++++
sysdeps/riscv/multiarch/memset_vector.S | 52 +++++++++++++++++
.../unix/sysv/linux/riscv/multiarch/Makefile | 3 +
.../linux/riscv/multiarch/ifunc-impl-list.c | 22 +++++--
.../unix/sysv/linux/riscv/multiarch/memset.c | 58 +++++++++++++++++++
6 files changed, 184 insertions(+), 4 deletions(-)
create mode 100644 sysdeps/riscv/multiarch/dl-symbol-redir-ifunc.h
create mode 100644 sysdeps/riscv/multiarch/memset-generic.c
create mode 100644 sysdeps/riscv/multiarch/memset_vector.S
create mode 100644 sysdeps/unix/sysv/linux/riscv/multiarch/memset.c
--
2.47.2
More information about the Libc-alpha
mailing list