[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] RISC-V: Extract vec_series for expand_const_vector [NFC]
Jeff Law
law@gcc.gnu.org
Sat Sep 13 16:01:02 GMT 2025
https://gcc.gnu.org/g:ab1776f72aed64420f0074b7183b7ab841cc61fc
commit ab1776f72aed64420f0074b7183b7ab841cc61fc
Author: Pan Li <pan2.li@intel.com>
Date: Wed Apr 16 14:43:23 2025 +0800
RISC-V: Extract vec_series for expand_const_vector [NFC]
Consider the expand_const_vector is quit long (about 500 lines)
and complicated, we would like to extract the different case
into different functions. For example, the const vec_series
will be extracted into expand_const_vec_series.
The below test suites are passed for this patch.
* The rv64gcv fully regression test.
gcc/ChangeLog:
* config/riscv/riscv-v.cc (expand_const_vec_series): Add new
func to take care of the const vec_series.
(expand_const_vector): Extract const vec_series into separated
function.
Signed-off-by: Pan Li <pan2.li@intel.com>
(cherry picked from commit cf366b62f48fc5c06b76a9a78320888a9591031b)
Diff:
---
gcc/config/riscv/riscv-v.cc | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc
index edb9abcbcad7..f95dfd009ec7 100644
--- a/gcc/config/riscv/riscv-v.cc
+++ b/gcc/config/riscv/riscv-v.cc
@@ -1224,6 +1224,18 @@ expand_const_vec_duplicate (rtx target, rtx src, rtx elt)
emit_move_insn (target, result);
}
+static void
+expand_const_vec_series (rtx target, rtx base, rtx step)
+{
+ machine_mode mode = GET_MODE (target);
+ rtx result = register_operand (target, mode) ? target : gen_reg_rtx (mode);
+
+ expand_vec_series (result, base, step);
+
+ if (result != target)
+ emit_move_insn (target, result);
+}
+
static void
expand_const_vector (rtx target, rtx src)
{
@@ -1237,13 +1249,7 @@ expand_const_vector (rtx target, rtx src)
/* Support scalable const series vector. */
rtx base, step;
if (const_vec_series_p (src, &base, &step))
- {
- expand_vec_series (result, base, step);
-
- if (result != target)
- emit_move_insn (target, result);
- return;
- }
+ return expand_const_vec_series (target, base, step);
/* Handle variable-length vector. */
unsigned int nelts_per_pattern = CONST_VECTOR_NELTS_PER_PATTERN (src);
More information about the Gcc-cvs
mailing list