RFR: 8330094: RISC-V: Save and restore FCSR in the call stub

Ludovic Henry luhenry at openjdk.org
Mon Apr 15 08:51:44 UTC 2024


On Fri, 12 Apr 2024 12:16:44 GMT, Hamlin Li <mli at openjdk.org> wrote:

> Hi,
> Can you help to review this patch?
> As discussed at https://github.com/openjdk/jdk/pull/17745#discussion_r1558783467, we should do the similar thing as [JDK-8319973](https://bugs.openjdk.org/browse/JDK-8319973) on aarch64.
> Thanks!
> 
> Tests running ...

Changes requested by luhenry (Committer).

src/hotspot/cpu/riscv/stubGenerator_riscv.cpp line 429:

> 427:     // restore fcsr
> 428:     __ ld(t1, fcsr_save);
> 429:     __ csrw(CSR_FCSR, t1);

It would be better to avoid the `csrw` in case the CSR is already set to `RoundingMode::rne` on some hardware. You can have avoid it with a simple check on the current value of FCSR.

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

PR Review: https://git.openjdk.org/jdk/pull/18758#pullrequestreview-2000378872
PR Review Comment: https://git.openjdk.org/jdk/pull/18758#discussion_r1565402389


More information about the hotspot-dev mailing list