[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] [RISC-V] Restore inline expansion of block moves on RISC-V in some cases
Jeff Law
law@gcc.gnu.org
Thu Jan 29 19:52:52 GMT 2026
https://gcc.gnu.org/g:12bd187ac41d5430ce6dc494b4b23b7752822dee
commit 12bd187ac41d5430ce6dc494b4b23b7752822dee
Author: Jeff Law <jeffrey.law@oss.qualcomm.com>
Date: Mon Jan 5 09:34:28 2026 -0700
[RISC-V] Restore inline expansion of block moves on RISC-V in some cases
Edwin's patch to add a --param for a size threshold on block moves
inadvertently disabled using inline block moves for cases where the count is
unknown. This caused testsuite regressions (I don't remember which test, it
was ~6 weeks ago if not longer). I'd hoped Edwin would see the new failures,
but I suspect he's buried by transition stuff with Rivos/Meta.
This patch restores prior behavior when the count is unknown and no --param was
specified.
Bootstrapped and regression tested on both the BPI and Pioneer systems and
regression tested on riscv{32,64}-elf as well.
Pushing to the trunk after pre-commit CI does its thing.
gcc/
* config/riscv/riscv-string.cc (expand_block_move): Restore using
inlined memcpy/memmove for unknown counts if the param hasn't been
specified.
(expand_vec_setmem): Similarly for memset.
(cherry picked from commit 0c3d8dd92811dfbf1ac31b69b58d7946f8d5512d)
Diff:
---
gcc/config/riscv/riscv-string.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/config/riscv/riscv-string.cc b/gcc/config/riscv/riscv-string.cc
index c5710e4c8962..d888dac8e5f7 100644
--- a/gcc/config/riscv/riscv-string.cc
+++ b/gcc/config/riscv/riscv-string.cc
@@ -1249,7 +1249,7 @@ expand_block_move (rtx dst_in, rtx src_in, rtx length_in, bool movmem_p)
&& length > riscv_memcpy_size_threshold)
return false;
}
- else
+ else if (riscv_memmove_size_threshold != -1)
return false;
/* Inlining general memmove is a pessimisation: we can't avoid having to
@@ -1641,7 +1641,7 @@ expand_vec_setmem (rtx dst_in, rtx length_in, rtx fill_value_in)
&& length > riscv_memset_size_threshold)
return false;
}
- else
+ else if (riscv_memset_size_threshold != -1)
return false;
rtx dst_addr = copy_addr_to_reg (XEXP (dst_in, 0));
More information about the Gcc-cvs
mailing list