[PATCH v1 0/1] riscv: Add RVV memset via multiarch/IFUNC

Yao Zihong zihong.plct@isrc.iscas.ac.cn
Wed Oct 29 16:10:21 GMT 2025


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.

---

Testing
-------
Testing was conducted on MUSE-Pi (SpacemiT M1). The glibc testsuite passed
without any additional regressions compared with glibc master. Jeff Law also
verified the patch on both a BPI and a Pioneer board, observing no regressions
relative to a pristine build and test run.

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-ntp_adjtime
  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
  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
     6517 PASS
       25 UNSUPPORTED
       16 XFAIL
        2 XPASS
---

[1] https://patchwork.sourceware.org/project/glibc/patch/20230421075405.14892-3-hau.hsu@sifive.com/
[2] https://inbox.sourceware.org/libc-alpha/7594c7f5-8bd6-45df-8218-ce74eff6e152@gmail.com/

---

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   | 12 ++++
 .../unix/sysv/linux/riscv/multiarch/memset.c  | 59 +++++++++++++++++++
 6 files changed, 179 insertions(+)
 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