https://gcc.gnu.org/g:32e8e523a917b95763aa020645e221651f43b575

commit r17-2278-g32e8e523a917b95763aa020645e221651f43b575
Author: Jim Lin <[email protected]>
Date:   Thu Jul 9 09:02:51 2026 -0600

    [PATCH] RISC-V: Fix memcpy size threshold gating in vector block move
    
    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.

Diff:
---
 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 7deb0a572dea..fcafae61f5a3 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;
     }

Reply via email to