I see, thanks Robin, will have a try for this change.

Pan

-----Original Message-----
From: Robin Dapp <rdapp....@gmail.com> 
Sent: Wednesday, November 27, 2024 9:44 PM
To: Li, Pan2 <pan2...@intel.com>; gcc-patches@gcc.gnu.org
Cc: juzhe.zh...@rivai.ai; kito.ch...@gmail.com; jeffreya...@gmail.com; Robin 
Dapp <rdapp....@gmail.com>
Subject: Re: [PATCH v1 1/3] RISC-V: Combine vec_duplicate + vadd.vv to vadd.vx

> I see, didn't aware of that. I am not sure if we need to consider vsetvl here?
> As there are extra 2 insn here.

I wouldn't consider it as it's outside of the loop.  What matters is latency
inside the loop.

> I see, need to consider the cost here. Any example I can reference? Sorry I
> haven't touch cost model in previous.

Refer to riscv_rtx_costs.  We set all vector instruction costs to 1. What you
would need to do is pattern-match scalar (broadcast) operands inside our
IF_THEN_ELSE vector patterns.  There are a some scalar examples that show how
it's done in principle.

Then make use of either
  get_vector_costs ()->regmove->GR2VR;
or riscv_register_move_cost to increase the pattern cost respectively.

-- 
Regards
 Robin

Reply via email to