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

Emanuel Peter epeter at openjdk.org
Tue Nov 11 15:05:02 UTC 2025


On Tue, 11 Nov 2025 14:56:47 GMT, Hamlin Li <mli at openjdk.org> wrote:

>> Hi,
>> 
>> Can you help to review this patch?
>> 
>> This patch enables the vectorization of statement like `op_1 bop op_2 ? res_f_d_1 : res_f_d_2` in a loop, where op_x's size is different from res_f_d_x's.
>> 
>> To assist with code review, this pr contains only the shared code change, is splitted from https://github.com/openjdk/jdk/pull/28230, which enable & implement the riscv part. The similar optimization could be extended to other platforms. 
>> 
>> ## Some background
>> 
>> Previously, it's https://github.com/openjdk/jdk/pull/25336, which was blocked by unsigned comparison issue. The issue was recently resolved by https://github.com/openjdk/jdk/pull/27942, so I'm re-start working on this optimization.
>> 
>> This pr only relaxes one of the constraints in https://github.com/openjdk/jdk/pull/25336, i.e. transform CMoveF/D to vector operations no matter what's the size of comparison's operator, but remove the optimization of transform CMoveI/L to vector operations which I think need more investigation.
>> 
>> # Test
>> ## Jtreg
>> 
>> in progress...
>> 
>> ## Performance
>> 
>> check the performance data in https://github.com/openjdk/jdk/pull/25341 on riscv.
>> 
>> Thanks
>
> Hamlin Li has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fix typo

This seems like an empty refactor, and it's not clear what it solves. It also does not seem riscv specific. It would probably be better if you actually did this together with the patch that actually ensures vectorization for riscv, including IR tests and all. That's probably what you plan to do with https://github.com/openjdk/jdk/pull/28230, right?

It is difficult to review the code here, without seeing how it all goes together.

src/hotspot/share/opto/vectornode.hpp line 115:

> 113:   // Return true if every bit in this vector is 1, e.g. based on the comparison
> 114:   // result of 2 floats, set a double result.
> 115:   static bool is_different_use_def_size_supported();

I'm a bit confused about your description here. It sounds like this method is looking at a specific vector, and returns results based on that. But that's not what's happening here, is it?

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

PR Review: https://git.openjdk.org/jdk/pull/28231#pullrequestreview-3448485583
PR Review Comment: https://git.openjdk.org/jdk/pull/28231#discussion_r2514550009


More information about the hotspot-compiler-dev mailing list