https://gcc.gnu.org/g:cf366b62f48fc5c06b76a9a78320888a9591031b

commit r16-166-gcf366b62f48fc5c06b76a9a78320888a9591031b
Author: Pan Li <pan2...@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...@intel.com>

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 1eb14a24e3db..e0af296449c3 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);

Reply via email to