In riscv_vector_expand_block_move, the memcpy path (!movmem_p) compared
the length against riscv_memcpy_size_threshold but gated the check on
riscv_memmove_size_threshold >= 0. Both params default to -1, so the
memcpy threshold was honored only when the unrelated memmove param was
set, and when memmove was set but memcpy left at -1 the "length > -1"
test rejected every constant-length copy.
Gate the memcpy path on riscv_memcpy_size_threshold, matching the
memmove branch above.
gcc/ChangeLog:
* config/riscv/riscv-string.cc (riscv_vector_expand_block_move):
Gate the memcpy path on riscv_memcpy_size_threshold instead of
riscv_memmove_size_threshold.
Signed-off-by: Jim Lin <[email protected]>
---
gcc/config/riscv/riscv-string.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/config/riscv/riscv-string.cc b/gcc/config/riscv/riscv-string.cc
index 7deb0a572de..fcafae61f5a 100644
--- a/gcc/config/riscv/riscv-string.cc
+++ b/gcc/config/riscv/riscv-string.cc
@@ -1255,7 +1255,7 @@ expand_block_move (rtx dst_in, rtx src_in, rtx length_in,
bool movmem_p)
&& length > riscv_memmove_size_threshold)
return false;
else if (!movmem_p
- && riscv_memmove_size_threshold >= 0
+ && riscv_memcpy_size_threshold >= 0
&& length > riscv_memcpy_size_threshold)
return false;
}
--
2.52.0