RFR: 8355699: RISC-V: support SUADD/SADD/SUSUB/SSUB [v2]

Fei Yang fyang at openjdk.org
Wed May 7 01:51:18 UTC 2025


On Tue, 6 May 2025 11:17:57 GMT, Hamlin Li <mli at openjdk.org> wrote:

> > What about the vector-scalar variants (vsaddu.vx, vsaddu.vi, etc.)? Do they help in any way?
> 
> I think so, although not sure how much benefit it will bring, as it should be able to do a vmv first, then use the instructs in this patch, so there should be some improvement, but maybe just minor one. And for other operations, like (signed/unsigned) 

We already have some vector-scalar examples like `vadd_vx`, `vadd_vi` [1][2]. I guess it will be similar for this case as well.
Maybe just replicate the scalar src2 to get a vector in the match rule will do, like:
`        match(Set dst (SaturatingAddV src1 (Replicate src2)));        `

[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/riscv_v.ad#L446
[2] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/riscv_v.ad#L417

> max/min, mulb/s/i/l/f/d, and so on, I think we can also introduce the _vx and _vi version. Maybe we could implement these bunch of instructs in another patch together?

Sure, OK.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/25005#issuecomment-2856784116


More information about the hotspot-compiler-dev mailing list