RFR: 8308997: RISC-V: Sign extend when comparing 32-bit value with zero instead of testing the sign bit [v5]

Dingli Zhang dzhang at openjdk.org
Tue May 30 06:50:58 UTC 2023


> RISC-V branch and jump instructions use 64-bit registers instead of 32-bit 
> versions in RV64I. We use test_bit to test if bit 31 is zero to determine if a
> 32-bit register is less than zero currently.
> 
> However, there will be two instructions when we use test_bit to test bit
> 31/63 without Zbs extension[1], we can just use sign_extend instead, which
> only use one instruction.
> 
> At the same time, we also change some 32-bit symbolic extension operations to
> sign_extend for better readability.
> 
> [1] https://github.com/openjdk/jdk/blob/e21f865d84c7c861843ff568019e1ad11d280a50/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp#L4596-L4603
> 
> ## Testing:
> Unmatched:
> - [x] Tier1 tests (release)
> - [x] Tier2 tests (release)
> - [x] Tier3 tests (release)

Dingli Zhang has updated the pull request incrementally with one additional commit since the last revision:

  Rename x22_elsize to x30_elsize

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/14197/files
  - new: https://git.openjdk.org/jdk/pull/14197/files/c2db6282..416eb084

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=14197&range=04
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14197&range=03-04

  Stats: 6 lines in 1 file changed: 0 ins; 0 del; 6 mod
  Patch: https://git.openjdk.org/jdk/pull/14197.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14197/head:pull/14197

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


More information about the hotspot-dev mailing list