nuttx/libs/libc/machine
ganjing a0fcbb7957 libs/libc/risc-v: Refresh memcpy and memset with XLEN-adaptive loops.
Rewrite arch_memcpy.S and arch_memset.S to be register-width aware on
both RV32 and RV64 using REG_L/REG_S/SZREG macros from asm.h.

memcpy gains:
 - 16xSZREG unrolled main loop (128B/iter on RV64, 64B on RV32).
 - Shift-merge path for misaligned src: reads two aligned words
   straddling each output word and shifts them together, so no load
   or store is ever misaligned.
 - Single SZREG and byte loops for remainder and small copies.

memset gains:
 - 32xSZREG unrolled main loop (256B/iter on RV64, 128B on RV32)
   using Duff's device for non-power-of-two remainders.
 - .option norvc ensures fixed 4-byte instruction width for correct
   jump offset calculation in the Duff's device entry.
 - Zero-length input handled correctly (branch to guarded tail).

The old memcpy always used lw/sw even on RV64, wasting half the
memory bandwidth. The old memset unrolled only 16 bytes per iteration.

Signed-off-by: ganjing <ganjing@xiaomi.com>
2026-08-12 10:24:01 +08:00
..
arm arm: memcpy: add NEON paths for aligned copies 2026-05-09 09:46:43 +08:00
arm64 include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
mips arch/mips: Add support for loadable ELF modules 2026-08-11 09:46:46 -03:00
renesas libc/machine/renesas: Move all source files out of gnu folder 2025-06-30 09:56:27 +08:00
risc-v libs/libc/risc-v: Refresh memcpy and memset with XLEN-adaptive loops. 2026-08-12 10:24:01 +08:00
sim include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
sparc include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
tricore arch/tricore: Full implementation of setjmp and longjmp. 2026-05-22 00:38:02 +08:00
x86 include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
x86_64 include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
xtensa include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
arch_atomic.c sched/spin_lock: rename raw_spin_lock to spin_lock_notrace 2025-02-13 20:48:15 +08:00
arch_libc.c string:use builtin function to optimize libc function 2025-12-20 10:38:53 +08:00
CMakeLists.txt libc/machine/CMakeLists: should alaways build arch_atomic.c 2024-11-03 02:33:03 +08:00
Kconfig arch:use ARCH_64BIT to mark arch is support 64bit 2025-12-18 22:05:12 +08:00
Make.defs arch/mips: Add support for loadable ELF modules 2026-08-11 09:46:46 -03:00