RFR: 8357554: Enable vectorization of Bool -> CMove with different type size (on riscv)
Xiaohong Gong
xgong at openjdk.org
Fri Jun 27 03:48:44 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
src/hotspot/share/opto/vectornode.cpp line 438:
> 436: if (vopc == Op_VectorBlend) {
> 437: return VectorBlendNode::implemented(opc);
> 438: }
To keep the same code style with other ops, maybe we can directly use the body of `VectorBlendNode::implemented()` here. Or making `VectorBlendNode::implemented()` as a static method of `VectorNode` like other ops.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25336#discussion_r2170692996
More information about the hotspot-compiler-dev
mailing list