GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
risc-v Performance Win

RISC-V: Fix memcpy threshold check for runtime lengths

RISC-V memcpy optimization now correctly distinguishes between compile-time and runtime length thresholds.

This change corrects the memcpy threshold check for RISC-V targets, ensuring that separate thresholds are used for compile-time and runtime length checks in the vector copy expander. This prevents incorrect optimizations by accurately selecting the threshold for the specific operation being performed, improving the reliability of string manipulation functions.

In Details

The RISC-V vector copy expander in GCC has separate thresholds for memmove operations based on whether the length is known at compile time or determined at runtime. This commit fixes an issue where these thresholds were not being independently selected, potentially leading to suboptimal code generation. The fix ensures expand_block_move correctly chooses the appropriate threshold for the actual operation.

Filed Under: risc-voptimization