But this is not that good enough here if my understanding is correct.
As vmv.v.x is somehow equivalent to vec_dup but doesn't ref GR2VR,
But it should. Can't we do something like:
if (riscv_v_ext_mode_p (mode))
{
switch (GET_CODE (x))
{
case VEC_DUPLICATE:
// will add 0, 4, 8 in case of GR2VR = 0, 1, 2
*total += GR2VR * COST_N_INSNS (1);
break;
case PLUS:
rtx op2 = XEXP (XEXP (x, 1), 0);
if (GET_CODE (op2) == VEC_DUPLICATE)
*total += GR2VR * COST_N_INSNS (1);
...
break;
Could you give a short example where that doesn't work so I can have a quick
look myself?
Thanks.
--
Regards
Robin