Similar to vr2gpr-cost=, add the one for fpr as well.
PR/target 123916
gcc/ChangeLog:
* config/riscv/riscv-opts.h (VR2FPR_COST_UNPROVIDED): Add new
sentinel for unprovided cost.
* config/riscv/riscv-protos.h (get_vr2fr_cost): Add new func
decl.
* config/riscv/riscv-vector-costs.cc (costs::adjust_stmt_cost):
Leverage new func to get cost of vr2fpr.
* config/riscv/riscv.cc (riscv_register_move_cost): Ditto.
(get_vr2fr_cost): Add new func to wrap access to the cost
of the vr2fpr.
* config/riscv/riscv.opt: Add new param vr2fpr-cost.
Signed-off-by: Pan Li <pan2.li@intel.com>
#define GPR2VR_COST_UNPROVIDED COST_UNPROVIDED
#define VR2GPR_COST_UNPROVIDED COST_UNPROVIDED
#define FPR2VR_COST_UNPROVIDED COST_UNPROVIDED
+#define VR2FPR_COST_UNPROVIDED COST_UNPROVIDED
/* Extra extension flags, used for carry extra info for a RISC-V extension. */
enum
int get_gr2vr_cost ();
int get_vr2gr_cost ();
int get_fr2vr_cost ();
+int get_vr2fr_cost ();
enum
{
+= (FLOAT_TYPE_P (vectype) ? get_fr2vr_cost () : get_gr2vr_cost ());
break;
case vec_to_scalar:
- stmt_cost += (FLOAT_TYPE_P (vectype) ? costs->regmove->VR2FR
- : get_vr2gr_cost ());
+ stmt_cost
+ += (FLOAT_TYPE_P (vectype) ? get_vr2fr_cost () : get_vr2gr_cost ());
break;
case vector_load:
case vector_store:
if (to_is_gpr)
return get_vr2gr_cost ();
else if (to_is_fpr)
- return get_vector_costs ()->regmove->VR2FR;
+ return get_vr2fr_cost ();
}
if (to == V_REGS)
return cost;
}
+/* Return the cost of moving data from floating-point to vector register.
+ It will take the value of --param=fpr2vr-cost if it is provided.
+ Otherwise the default regmove->FR2VR will be returned. */
+
+int
+get_vr2fr_cost ()
+{
+ int cost = get_vector_costs ()->regmove->VR2FR;
+
+ if (vr2fpr_cost != VR2FPR_COST_UNPROVIDED)
+ cost = vr2fpr_cost;
+
+ return cost;
+}
+
/* Implement targetm.vectorize.builtin_vectorization_cost. */
static int
Target RejectNegative Joined UInteger Var(fpr2vr_cost) Init(FPR2VR_COST_UNPROVIDED)
Set the cost value of the rvv instruction when operate from FPR to VR.
+-param=vr2fpr-cost=
+Target RejectNegative Joined UInteger Var(vr2fpr_cost) Init(VR2FPR_COST_UNPROVIDED)
+Set the cost value of the rvv instruction when operate from VR to FPR.
+
-param=riscv-autovec-mode=
Target Undocumented RejectNegative Joined Var(riscv_autovec_mode) Save
Set the only autovec mode to try.