]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Use helper function to get FPR to VR move cost
authorPaul-Antoine Arras <parras@baylibre.com>
Wed, 28 May 2025 10:09:22 +0000 (12:09 +0200)
committerPaul-Antoine Arras <parras@baylibre.com>
Tue, 3 Jun 2025 09:47:34 +0000 (11:47 +0200)
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
gcc/config/riscv/riscv.cc

index a39b611e4cefca7f3c474d0d6e9eb4df0e5ed2c8..4d8170de9b2c86aa4a2e014432305fc676ced359 100644 (file)
@@ -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
index ecacd7d178e935219fb0da5c1a9af670790751b2..06a8b5175c2b022db2ae8e433aa5071e0db0a37d 100644 (file)
@@ -9797,7 +9797,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;
@@ -12743,8 +12743,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));
        }