RFR: 8357554: Enable vectorization of Bool -> CMove with different type size (on riscv)

Emanuel Peter epeter at openjdk.org
Wed May 28 09:22:54 UTC 2025


On Tue, 20 May 2025 19:39:30 GMT, Hamlin Li <mli at openjdk.org> wrote:

> Hi,
> Can you help to review this patch?
> This pr is splited from https://github.com/openjdk/jdk/pull/25341, and contains only share code change.
> 
> This patch enable the vectorization of statement like `fd_1 bop fd_2 ? res_1 : res_2` in a loop.
> 
> The current behaviour on other platforms support vecatorization of `fd_1 bop fd_2 ? res_1 : res_2` in a loop only when `fd` and `res` have the same size, but this constraint seems not necessary at least not necessary on riscv, so I relax this constraint on riscv, maybe on other platforms it can be relaxed too, but currently I only made it work on riscv.
> Besides of this, I also relax the constraint on transforming Op_CMoveI/L to Op_VectorBlend on riscv, this bring some extra benefit when the `res` is not float or double types.
> Both relaxation bring performance benefit via vectorization.
> 
> Compared with other runs (master, master with `-XX:+UseVectorCmov -XX:+UseCMoveUnconditionally` turned on, patch without flags turned on), average improvement introduced by the patch with `-XX:+UseVectorCmov -XX:+UseCMoveUnconditionally` turned on is more than 2.1 times, in some cases it can bring more than 4 times improvement.
> When `-XX:-UseVectorCmov -XX:-UseCMoveUnconditionally` turned off, there is no regression on average.
> 
> Check more details at: https://github.com/openjdk/jdk/pull/25341.
> 
> Thanks

@Hamlin-Li Thanks for working on this!

Can you please provide the the JMH benchmark results for your measurements?
It would also be good to have some IR tests, that cover the newly vectorized cases.

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

PR Comment: https://git.openjdk.org/jdk/pull/25336#issuecomment-2915593133


More information about the hotspot-compiler-dev mailing list