RFR: 8315716: RISC-V: implement ChaCha20 intrinsic

Robbin Ehn rehn at openjdk.org
Thu Sep 28 14:51:31 UTC 2023


On Mon, 25 Sep 2023 11:47:40 GMT, Hamlin Li <mli at openjdk.org> wrote:

> Only vector version is included in this patch.
> 
> ### Test
> The patch passed the jdk tests found via `find test/jdk/ -iname *ChaCha*`

I had a look at the added registers, I think you can revert that.

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

> 148: constexpr Register t5 = x30;
> 149: constexpr Register t6 = x31;
> 150: 

In your case it doesn't look like we need them?

So I think you should revert these changes.
As we may want to reserve one of those registers for something in the future.
I don't think we should take lightly on just start using them.

src/hotspot/cpu/riscv/stubGenerator_riscv.cpp line 4326:

> 4324:     const Register tmp_addr = t1;
> 4325:     const Register length = t2;
> 4326:     const Register avl = t3;

There seems to be no overlapping with loop/t0.
So avl van just be t0? No need for a fourth temp reg?

src/hotspot/cpu/riscv/stubGenerator_riscv.cpp line 4327:

> 4325:     const Register length = t2;
> 4326:     const Register avl = t3;
> 4327:     const Register stride = t4;

There seems to be no overlapping with loop/t0.
So avl van just be t0? No need for a fourth/fifth temp reg?

src/hotspot/cpu/riscv/stubGenerator_riscv.cpp line 4339:

> 4337:     // in java level.
> 4338:     __ mv(avl, 16);
> 4339:     __ vsetvli(length, avl, Assembler::e32, Assembler::m1);

Here avl can t0, no?

src/hotspot/cpu/riscv/stubGenerator_riscv.cpp line 4377:

> 4375: 
> 4376:     // Store result to key stream
> 4377:     __ mv(stride, 64);

Here stride can be t0, no?

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

Changes requested by rehn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/15899#pullrequestreview-1649045488
PR Review Comment: https://git.openjdk.org/jdk/pull/15899#discussion_r1340264742
PR Review Comment: https://git.openjdk.org/jdk/pull/15899#discussion_r1340273743
PR Review Comment: https://git.openjdk.org/jdk/pull/15899#discussion_r1340274188
PR Review Comment: https://git.openjdk.org/jdk/pull/15899#discussion_r1340267856
PR Review Comment: https://git.openjdk.org/jdk/pull/15899#discussion_r1340267577


More information about the hotspot-dev mailing list