RFR: 8357554: Enable vectorization of Bool -> CMove with different type size (on riscv)
Hamlin Li
mli at openjdk.org
Mon May 26 10:42:05 UTC 2025
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
-------------
Commit messages:
- split from pr 25341
- disable cmovei/l => vectorblend
- initial commit
Changes: https://git.openjdk.org/jdk/pull/25336/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25336&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8357554
Stats: 120 lines in 9 files changed: 118 ins; 0 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/25336.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/25336/head:pull/25336
PR: https://git.openjdk.org/jdk/pull/25336
More information about the hotspot-compiler-dev
mailing list