RFR: 8318218: RISC-V: C2 CompressBits [v3]
Fei Yang
fyang at openjdk.org
Wed Nov 8 07:37:00 UTC 2023
On Tue, 7 Nov 2023 10:00:45 GMT, Hamlin Li <mli at openjdk.org> wrote:
>> Hi,
>> Can you review the change to add intrinsic for CompressBits for Long & Integer?
>> Thanks!
>>
>> ## Test
>> pass jtreg test:
>> test/jdk/java/lang/CompressExpand*.java
>
> Hamlin Li has updated the pull request incrementally with one additional commit since the last revision:
>
> Match Op_CompressBits based on UseRVV only
Changes requested by fyang (Reviewer).
src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp line 1684:
> 1682: }
> 1683:
> 1684: void C2_MacroAssembler::compress_bits_v(Register dst, Register src, Register mask, Register tmp, bool is_long) {
Seems that this is quite similar to the implementation of `CompressM` node in `riscv_v.ad` [1] which I think should be more efficient. The only difference is that we only need to move `src` into a vector register beforehand and change to perform `vcpop_m` under the given `mask`. Please consider.
[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/riscv_v.ad#L3506-L3518
src/hotspot/cpu/riscv/riscv.ad line 1901:
> 1899:
> 1900: case Op_EncodeISOArray:
> 1901: return UseRVV && SpecialEncodeISOArray;
Seems that we can remove this extra check for `SpecialEncodeISOArray` (and related code at [1]) and group those 5 cases (which return UseRVV) together.
[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/vm_version_riscv.cpp#L290-L292
src/hotspot/cpu/riscv/riscv_v.ad line 2884:
> 2882:
> 2883: instruct compressBitsI(iRegINoSp dst, iRegIorL2I src, iRegIorL2I mask, iRegPNoSp tmp, vRegMask_V0 v0, vReg_V4 v4, vReg_V8 v8) %{
> 2884: predicate(UseRVV && (MaxVectorSize >= 16));
Can we simply remote the `(MaxVectorSize >= 16)` condition as that has already been ensured on JVM startup?
src/hotspot/cpu/riscv/riscv_v.ad line 2909:
> 2907:
> 2908: instruct compressBitsL(iRegLNoSp dst, iRegL src, iRegL mask, iRegPNoSp tmp, vRegMask_V0 v0, vReg_V4 v4, vReg_V8 v8) %{
> 2909: predicate(UseRVV && (MaxVectorSize >= 16));
Same as above.
-------------
PR Review: https://git.openjdk.org/jdk/pull/16481#pullrequestreview-1719420758
PR Review Comment: https://git.openjdk.org/jdk/pull/16481#discussion_r1386125552
PR Review Comment: https://git.openjdk.org/jdk/pull/16481#discussion_r1386040152
PR Review Comment: https://git.openjdk.org/jdk/pull/16481#discussion_r1386028318
PR Review Comment: https://git.openjdk.org/jdk/pull/16481#discussion_r1386028471
More information about the hotspot-dev
mailing list