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

Hamlin Li mli at openjdk.org
Tue May 21 13:54:01 UTC 2024


On Mon, 20 May 2024 15:23:26 GMT, Gui Cao <gcao at openjdk.org> wrote:

> 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)

Is `UseRVV ` a const? Seems you need to remove `constexpr`.
Or you can just return true (so, keep constexpr), as `supports_vector_variable_shifts` is not a independent check, and it's protected by `Matcher::match_rule_supported_vector` in both vector api and auto-vectorization.

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

PR Comment: https://git.openjdk.org/jdk/pull/19313#issuecomment-2122687800


More information about the hotspot-compiler-dev mailing list