diff options
author | Pan Li <pan2.li@intel.com> | 2025-04-16 14:43:23 +0800 |
---|---|---|
committer | Pan Li <pan2.li@intel.com> | 2025-04-27 10:09:02 +0800 |
commit | cf366b62f48fc5c06b76a9a78320888a9591031b (patch) | |
tree | 3545da18c59dd9b8e449422d98a7e9335b621ab0 /gcc | |
parent | e6e42a709f3cd87e7a5efca72267cab57e0385cb (diff) | |
download | gcc-cf366b62f48fc5c06b76a9a78320888a9591031b.zip gcc-cf366b62f48fc5c06b76a9a78320888a9591031b.tar.gz gcc-cf366b62f48fc5c06b76a9a78320888a9591031b.tar.bz2 |
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>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/riscv/riscv-v.cc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc index 1eb14a24..e0af296 100644 --- a/gcc/config/riscv/riscv-v.cc +++ b/gcc/config/riscv/riscv-v.cc @@ -1225,6 +1225,18 @@ expand_const_vec_duplicate (rtx target, rtx src, rtx elt) } 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) { machine_mode mode = GET_MODE (target); @@ -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); |