RFR: 8299844: RISC-V: Implement _onSpinWait intrinsic

Yadong Wang yadongwang at openjdk.org
Sun Jan 15 02:24:12 UTC 2023


On Wed, 11 Jan 2023 17:23:13 GMT, Ludovic Henry <luhenry at openjdk.org> wrote:

>> Implement _onSpinWait() intrinsic for RISC-V, and it can be implemented by using PAUSE instruction from Zihintpause Extension, which is ratified and a mandatory extension of RVA22U64 (https://github.com/riscv/riscv-profiles/blob/main/profiles.adoc#rva22u64-mandatory-extensions).
>> Software can use the PAUSE instruction to reduce energy consumption while executing spinwait
>> code sequences (https://github.com/riscv/riscv-isa-manual/blob/master/src/zihintpause.tex).
>> 
>> Add a test case of test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitRISCV64.java, passed on QEMU.
>
> src/hotspot/cpu/riscv/riscv.ad line 1820:
> 
>> 1818:   switch (opcode) {
>> 1819:     case Op_OnSpinWait:
>> 1820:       return VM_Version::supports_on_spin_wait();
> 
> You can use `UseZihintpause` directly just like for `UseRVV`, `UsePopCountInstruction`, or `UseZbb` below.

supports_on_spin_wait() is called both from share and cpu specific code. I think it's better to be a unified switch.

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

PR: https://git.openjdk.org/jdk/pull/11921


More information about the hotspot-dev mailing list