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

Robbin Ehn rehn at openjdk.org
Mon Apr 15 10:05:41 UTC 2024


On Mon, 15 Apr 2024 08:21:11 GMT, Fei Yang <fyang at openjdk.org> wrote:

>> 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)`.

Sorry, yea, the max range is:
2147481599/0x7FFFF7FF and (twoG - twoK) is 2147481600.
-2147485696/0xFFFFFFFF7FFFF800 (0xFFFFFFFF80000000 -  0xFFF) and (-twoG - twoK) is -2147485696.

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

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


More information about the hotspot-dev mailing list