RFR: 8318217: RISC-V: C2 VectorizedHashCode [v10]

Yuri Gaevsky duke at openjdk.org
Sun Dec 10 11:19:19 UTC 2023


On Sat, 9 Dec 2023 01:45:12 GMT, Fei Yang <fyang at openjdk.org> wrote:

>> I meant other case(s): if '`cnt`' is equal to 4/8/... then after the initial `cnt==zero` check at L1493 the control flow _**doesn't jump**_ to `DONE ` but continue execution, _zeroed_ by `andi()` _before_ the wide loop, so after the loop the 'cnt' is zero (L1501) - that's why the check is needed.
>
> Yes, I know what you mean. And that's also what I am suggesting in my initial comment: move this `beqz` check immediately after the loop (that is after L1522 in your latest version). Like following add-on change:
> 
> 
> diff --git a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp
> index 2d93d36a37f..11cbcaa48a1 100644
> --- a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp
> +++ b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp
> @@ -1521,9 +1521,9 @@ void C2_MacroAssembler::arrays_hashcode(Register ary, Register cnt, Register res
>                                   //           + 31^^1 * ary[i+2] + 31^^0 * ary[i+3]
>    addi(ary, ary, elsize * stride);
>    bne(ary, chunks_end, WIDE_LOOP);
> +  beqz(cnt, DONE);
> 
>    bind(TAIL);
> -  beqz(cnt, DONE);
>    slli(chunks_end, cnt, chunks_end_shift);
>    add(chunks_end, ary, chunks_end);

Ah, got it finally. Nice catch, thanks!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16629#discussion_r1421730744


More information about the hotspot-dev mailing list