[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] RISC-V: Use helper function to get FPR to VR move cost
Jeff Law
law@gcc.gnu.org
Sat Jan 17 06:56:15 GMT 2026
https://gcc.gnu.org/g:aee9cdd85f656e2e62665b6310ddbf2a6e299a30
commit aee9cdd85f656e2e62665b6310ddbf2a6e299a30
Author: Paul-Antoine Arras <parras@baylibre.com>
Date: Wed May 28 12:09:22 2025 +0200
RISC-V: Use helper function to get FPR to VR move cost
Since last patch introduced get_fr2vr_cost () to get the correct cost to move
data from a floating-point to a vector register, this patch replaces existing
uses of the constant FR2VR.
gcc/ChangeLog:
* config/riscv/riscv-vector-costs.cc (costs::adjust_stmt_cost): Replace
FR2VR with get_fr2vr_cost ().
* config/riscv/riscv.cc (riscv_register_move_cost): Likewise.
(riscv_builtin_vectorization_cost): Likewise.
(cherry picked from commit 5566b20dd5f7fa14d93d2808414bf72882ec567e)
Diff:
---
gcc/config/riscv/riscv-vector-costs.cc | 4 ++--
gcc/config/riscv/riscv.cc | 5 ++---
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/gcc/config/riscv/riscv-vector-costs.cc b/gcc/config/riscv/riscv-vector-costs.cc
index a39b611e4cef..4d8170de9b2c 100644
--- a/gcc/config/riscv/riscv-vector-costs.cc
+++ b/gcc/config/riscv/riscv-vector-costs.cc
@@ -1099,8 +1099,8 @@ costs::adjust_stmt_cost (enum vect_cost_for_stmt kind, loop_vec_info loop,
switch (kind)
{
case scalar_to_vec:
- stmt_cost += (FLOAT_TYPE_P (vectype) ? costs->regmove->FR2VR
- : get_gr2vr_cost ());
+ stmt_cost
+ += (FLOAT_TYPE_P (vectype) ? get_fr2vr_cost () : get_gr2vr_cost ());
break;
case vec_to_scalar:
stmt_cost += (FLOAT_TYPE_P (vectype) ? costs->regmove->VR2FR
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 258835e32d30..6451e149b992 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -9808,7 +9808,7 @@ riscv_register_move_cost (machine_mode mode,
if (from_is_gpr)
return get_gr2vr_cost ();
else if (from_is_fpr)
- return get_vector_costs ()->regmove->FR2VR;
+ return get_fr2vr_cost ();
}
return riscv_secondary_memory_needed (mode, from, to) ? 8 : 2;
@@ -12761,8 +12761,7 @@ riscv_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
case vec_construct:
{
/* TODO: This is too pessimistic in case we can splat. */
- int regmove_cost = fp ? costs->regmove->FR2VR
- : get_gr2vr_cost ();
+ int regmove_cost = fp ? get_fr2vr_cost () : get_gr2vr_cost ();
return (regmove_cost + common_costs->scalar_to_vec_cost)
* estimated_poly_value (TYPE_VECTOR_SUBPARTS (vectype));
}
More information about the Gcc-cvs
mailing list