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.
---
 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 a39b611e4ce..4d8170de9b2 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 d99249f70e8..7134a024e80 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -9796,7 +9796,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;
@@ -12742,8 +12742,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));
        }
-- 
2.49.0

Reply via email to