RFR: 8330156: RISC-V: Range check auipc + signed 12 imm instruction
Fei Yang
fyang at openjdk.org
Fri Apr 12 12:56:44 UTC 2024
On Fri, 12 Apr 2024 10:41:39 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
Thanks for fixing this. I have a question about the range checking.
src/hotspot/cpu/riscv/macroAssembler_riscv.hpp line 684:
> 682: int64_t twoG = (2 * G);
> 683: int64_t twoK = (2 * K);
> 684: return x <= (twoG - twoK) && x >= (-twoG + twoK);
As I remembered, the true range of RISC-V PC-relative addressing should be: [-2^31 - 2^11, 2^31 - 2^11). See [1].
[1] https://patchwork.kernel.org/project/linux-riscv/patch/20220131182145.236005-3-kernel@esmil.dk/
-------------
PR Review: https://git.openjdk.org/jdk/pull/18755#pullrequestreview-1996854823
PR Review Comment: https://git.openjdk.org/jdk/pull/18755#discussion_r1562508950
More information about the hotspot-dev
mailing list