RFR: 8318227: RISC-V: C2 ConvHF2F [v2]

Hamlin Li mli at openjdk.org
Wed Nov 29 08:28:06 UTC 2023


On Tue, 28 Nov 2023 13:46:40 GMT, Hamlin Li <mli at openjdk.org> wrote:

>> src/hotspot/cpu/riscv/riscv.ad line 8288:
>> 
>>> 8286:     __ float16_to_float($dst$$FloatRegister, $src$$Register, $tmp$$Register);
>>> 8287:   %}
>>> 8288:   ins_pipe(fp_f2i);
>> 
>> Seems we should use `ins_pipe(pipe_slow)` here as this emits multiple instructions.
>
> In fact, I'm not quite sure.
> I see in the ad file:
> 
> pipe_class pipe_slow()
> %{
>   instruction_count(10);
> 
> 
> and, all instruct's with `pipe_slow` are related to cmpxchg, which indeed involve lots of instructions in common case.
> But for `float16_to_float`, in normal case, there is at most 5 instructions; only the rare case `NaN` involves more instructions.
> 
> Please let me know how do you think about it.

Some more information:
1. `fcvt_w_s_safe` is quite similar to float16_to_float in cost, it's labeled in `fp_f2i`.
2. `float_compare` is too, but labeled with `pipe_class_default`
3.  while instruct's with multiple instructions in riscv_v.ad are labeled with `pipe_slow`.

I'm not sure what should be chosen here, seems `fcvt_w_s_safe` is more similar to our situation, how do you think about it?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16802#discussion_r1408915704


More information about the hotspot-dev mailing list