RFR: 8332533: RISC-V: Enable vector variable shift instructions for machines with RVV [v3]

Gui Cao gcao at openjdk.org
Wed May 22 02:31:16 UTC 2024


> Hi, I noticed the following warning in the Opto JIT Code for the Vector API in the `test/jdk/jdk/incubator/vector/Byte256VectorTests.java: ASHRByte256VectorTests` test:
> 
> --------------------------------------------------------------------------------
>   ** Rejected vector op (RShiftVB,byte,32) because architecture does not support variable vector shifts
>   ** not supported: arity=2 opc=405 vlen=32 etype=byte ismask=0 is_masked_op=0
> ``` 
> the reason is because Matcher::supports_vector_ variable_shifts returns false. the port of RISC-V Vector API now supports the vector shifts, so this should return with UseRVV.  By the Way, the Matcher::supports_vector_variable_shifts function was introduced by Vector API, and I think forgot to modify the Matcher::supports_vector_variable_shifts function when implementing vector shift.
> After the fix, the test passes normally and generates the Opto JIT Code such as:
> 
> 1c2     loadV V1, [R7]  # vector (rvv)
> 1ca     lwu  R28, [R28, #12]    # loadN, compressed ptr, #@loadN ! Field: jdk/internal/vm/vector/VectorSupport$VectorPayload.payload (constant)
> 1ce     decode_heap_oop  R7, R28    #@decodeHeapOop
> 1d2     addi  R7, R7, #16   # ptr, #@addP_reg_imm
> 1d4     loadV V2, [R7]  # vector (rvv)
> 1dc     vand_immI V1, V1, #7
> 1e4     spill [sp, #48] -> R7    # spill size = 32
> 1e6     # castII of R7, #@castII
> 1e6     vasrB V3, V2, V1
> 1fa     spill [sp, #96] -> R29   # spill size = 32
> 1fc     bgeu  R7, R29, B101 #@cmpU_branch  P=0.000001 C=-1.000000
> 
> 
> ### Testing:
> qemu 8.1.50 with UseRVV:
> - [x] Run tier1-3 tests (release)
> - [x] Run test/jdk/jdk/incubator/vector (fastdebug)

Gui Cao has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:

 - Merge remote-tracking branch 'upstream/master' into JDK-8332533
 - Remove constexpr in Matcher::supports_vector_variable_shifts
 - 8332533: RISC-V: Enable Matcher::supports_vector_variable_shifts with UseRVV

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/19313/files
  - new: https://git.openjdk.org/jdk/pull/19313/files/0c64eee1..e8042c6d

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=19313&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19313&range=01-02

  Stats: 2264 lines in 110 files changed: 1195 ins; 826 del; 243 mod
  Patch: https://git.openjdk.org/jdk/pull/19313.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19313/head:pull/19313

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


More information about the hotspot-compiler-dev mailing list