#define TARGET_VECTOR_AUTOVEC_SEGMENT \
(TARGET_VECTOR && riscv_mautovec_segment)
-#define GPR2VR_COST_UNPROVIDED -1
-#define FPR2VR_COST_UNPROVIDED -1
+#define COST_UNPROVIDED -1
+#define GPR2VR_COST_UNPROVIDED COST_UNPROVIDED
+#define VR2GPR_COST_UNPROVIDED COST_UNPROVIDED
+#define FPR2VR_COST_UNPROVIDED COST_UNPROVIDED
/* Extra extension flags, used for carry extra info for a RISC-V extension. */
enum
riscv_parse_tune (const char *, bool);
const cpu_vector_cost *get_vector_costs ();
int get_gr2vr_cost ();
+int get_vr2gr_cost ();
int get_fr2vr_cost ();
enum
break;
case vec_to_scalar:
stmt_cost += (FLOAT_TYPE_P (vectype) ? costs->regmove->VR2FR
- : costs->regmove->VR2GR);
+ : get_vr2gr_cost ());
break;
case vector_load:
case vector_store:
if (from == V_REGS)
{
if (to_is_gpr)
- return get_vector_costs ()->regmove->VR2GR;
+ return get_vr2gr_cost ();
else if (to_is_fpr)
return get_vector_costs ()->regmove->VR2FR;
}
return cost;
}
+/* Return the cost of operation that move from vr to gpr.
+ It will take the value of --param=vr2gpr_cost if it is provided.
+ Or the default regmove->VR2GR will be returned. */
+
+int
+get_vr2gr_cost ()
+{
+ int cost = get_vector_costs ()->regmove->VR2GR;
+
+ if (vr2gpr_cost != VR2GPR_COST_UNPROVIDED)
+ cost = vr2gpr_cost;
+
+ 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. */
Target RejectNegative Joined UInteger Var(gpr2vr_cost) Init(GPR2VR_COST_UNPROVIDED)
Set the cost value of the rvv instruction when operate from GPR to VR.
+-param=vr2gpr-cost=
+Target RejectNegative Joined UInteger Var(vr2gpr_cost) Init(VR2GPR_COST_UNPROVIDED)
+Set the cost value of the rvv instruction when operate from VR to GPR .
+
-param=fpr2vr-cost=
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.