RFR: 8322753: RISC-V: C2 ReverseBytesV [v3]

Fei Yang fyang at openjdk.org
Wed May 8 11:08:54 UTC 2024


On Wed, 8 May 2024 10:42:10 GMT, Hamlin Li <mli at openjdk.org> wrote:

>> Hi,
>> Can you review this patch to add ReverseBytesV intrinsic?
>> Thanks.
>
> Hamlin Li has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fix merge

src/hotspot/cpu/riscv/assembler_riscv.hpp line 1891:

> 1889:   // Vector Bit-manipulation used in Cryptography (Zvkb) Extension
> 1890:   INSN(vbrev_v,  0b1010111, 0b010, 0b01010, 0b010010); // reverse bits in every element
> 1891:   INSN(vbrev8_v, 0b1010111, 0b010, 0b01000, 0b010010); // reverse btis in every byte of element

Typo: s/btis/bits/

src/hotspot/cpu/riscv/riscv_v.ad line 3762:

> 3760: // -------------------------------- Reverse Bytes Vector Operations ------------------------
> 3761: 
> 3762: instruct vreverse_bytes_mask(vReg dst, vReg src, vRegMask_V0 v0) %{

Suggestion: s/vpopcount_mask/vpopcount_masked/
Maybe you can rename `vpopcount_mask` to `vpopcount_masked` as well?

src/hotspot/cpu/riscv/riscv_v.ad line 3764:

> 3762: instruct vreverse_bytes_mask(vReg dst, vReg src, vRegMask_V0 v0) %{
> 3763:   match(Set dst (ReverseBytesV src v0));
> 3764:   format %{ "vector_reverse_byte $dst, $src, v0.t" %}

Suggestion: format %{ "vreverse_bytes_masked $dst, $src, $v0" %}

src/hotspot/cpu/riscv/riscv_v.ad line 3766:

> 3764:   format %{ "vector_reverse_byte $dst, $src, v0.t" %}
> 3765:   ins_encode %{
> 3766:     __ vrev8_v(as_VectorRegister($dst$$reg), as_VectorRegister($src$$reg), __ VectorMask::v0_t);

I think we should call `vsetvli_helper(bt, vlen)` for both newly-added instructs. Also, can we use `Assembler::v0_t` here like you do in https://github.com/openjdk/jdk/pull/19065 for consistency?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19120#discussion_r1593830691
PR Review Comment: https://git.openjdk.org/jdk/pull/19120#discussion_r1593842831
PR Review Comment: https://git.openjdk.org/jdk/pull/19120#discussion_r1593844198
PR Review Comment: https://git.openjdk.org/jdk/pull/19120#discussion_r1593838481


More information about the hotspot-dev mailing list