Add scalar memmove for RISC-V
RISC-V gains a scalar memmove implementation, complementing the existing vector version and reducing reliance on library calls.
This patch introduces a scalar memmove implementation for RISC-V, which previously only had a vector version. It adds a new dispatcher riscv_expand_block_move and an overlap parameter to the block move routines. While overlap is handled for straight copies, loop-based moves currently assume no overlap, limiting optimized expansion to known lengths of 96 bytes.
In Details
This commit adds scalar memmove support for RISC-V by introducing riscv_expand_block_move and passing an overlap parameter to riscv_block_move routines. The riscv_block_move_straight function now handles overlap, but riscv_block_move_loop forwards calls to riscv_block_move_straight with a 'no overlap' assumption. This limits scalar expansion to lengths of 96 bytes where overlap is known not to occur, otherwise falling back to libcalls.
- memmove
- A standard C library function that copies a block of memory from one location to another, safely handling cases where the source and destination memory regions may overlap.
- libcall
- A call to a function in an external library, often used as a fallback when the compiler cannot generate inline code for an operation.
- block move
- An operation that moves a contiguous block of memory, such as
memcpyormemmove. - overlap
- In memory operations like
memmove, this refers to the condition where the source and destination memory regions have common addresses, requiring special handling to avoid data corruption.