aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPatrick O'Neill <patrick@rivosinc.com>2024-08-20 11:38:20 -0700
committerPatrick O'Neill <patrick@rivosinc.com>2024-08-27 10:01:13 -0700
commitac1f3a8901344759dc7c247d3749c74a0bb524b0 (patch)
treeee0637bb9e3434dd54552e51b0fb4cf905512b6b /gcc
parentc89038c7ae8bba7160ae2963647ce90171b5dd2c (diff)
downloadgcc-ac1f3a8901344759dc7c247d3749c74a0bb524b0.zip
gcc-ac1f3a8901344759dc7c247d3749c74a0bb524b0.tar.gz
gcc-ac1f3a8901344759dc7c247d3749c74a0bb524b0.tar.bz2
RISC-V: Reorder insn cost match order to match corresponding expander match order
The corresponding expander (riscv-v.cc:expand_const_vector) matches const_vec_duplicate_p before const_vec_series_p. Reorder to match this behavior when calculating costs. gcc/ChangeLog: * config/riscv/riscv.cc (riscv_const_insns): Relocate. Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/riscv/riscv.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 1f544c1..ca86754 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -2142,15 +2142,6 @@ riscv_const_insns (rtx x, bool allow_new_pseudos)
...etc. */
if (riscv_v_ext_mode_p (GET_MODE (x)))
{
- /* const series vector. */
- rtx base, step;
- if (const_vec_series_p (x, &base, &step))
- {
- /* This is not accurate, we will need to adapt the COST
- * accurately according to BASE && STEP. */
- return 1;
- }
-
rtx elt;
if (const_vec_duplicate_p (x, &elt))
{
@@ -2186,6 +2177,15 @@ riscv_const_insns (rtx x, bool allow_new_pseudos)
return 1 + 4; /*vmv.v.x + memory access. */
}
}
+
+ /* const series vector. */
+ rtx base, step;
+ if (const_vec_series_p (x, &base, &step))
+ {
+ /* This cost is not accurate, we will need to adapt the COST
+ accurately according to BASE && STEP. */
+ return 1;
+ }
}
/* TODO: We may support more const vector in the future. */