RFR: 8330156: RISC-V: Range check auipc + signed 12 imm instruction [v2]

Fei Yang fyang at openjdk.org
Mon Apr 15 08:26:43 UTC 2024


On Mon, 15 Apr 2024 07:47:05 GMT, Robbin Ehn <rehn at openjdk.org> wrote:

>> Hi please consider!
>> 
>> Today we check if the distance is a signed 32.
>> As the second instruction have sign bit + 11 bits the, max of such pair is shorter.
>> 
>> Sanity tested
>
> Robbin Ehn has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Correct calc

src/hotspot/cpu/riscv/macroAssembler_riscv.hpp line 684:

> 682:     constexpr int64_t twoG = (2 * G);
> 683:     constexpr int64_t twoK = (2 * K);
> 684:     return x <= (twoG - twoK) && x >= (-twoG - twoK);

Hmm.. I think the range should be `x < (twoG - twoK) && x >= (-twoG - twoK)` which maps to `[-(2G + 2K), 2G - 2K)`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18755#discussion_r1565363679


More information about the hotspot-dev mailing list