RFR: 8365732: RISC-V: implement AES CTR intrinsics [v22]

Fei Yang fyang at openjdk.org
Wed Nov 12 03:19:10 UTC 2025


On Mon, 10 Nov 2025 05:59:02 GMT, Anjian Wen <wenanjian at openjdk.org> wrote:

>> Hi everyone, please help review this patch which Implement the _counterMode_AESCrypt with Zvkned. On my QEMU, with Zvkned extension enabled, the tests in test/hotspot/jtreg/compiler/codegen/aes/ Passed.
>
> Anjian Wen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   modify parm to unsigned as aarch64 and x86

Thanks for the update. Overall LGTM. I am running some tests with this change.

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

> 2776:     __ beqz(len, L_exit);
> 2777:     __ j(L_next);
> 2778: 

Can you add code comment about what this `L_main_loop` loop does? Like:
`// Encrypt the blocks of data one by one until there is less than a full block remaining.`

And it's not that easy for me to find where the `L_main_loop` is. Maybe we can put the code of inner loop in a pair of braces to make it explicit.

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

> 2785: 
> 2786:     __ vse32_v(v16, saved_encrypted_ctr);
> 2787:     __ mv(used, 0);

Can you move this update of `used` immediately before the `bltu` at L2794?

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

> 2792:     be_store_counter_128(counter_hi, counter_lo, counter);
> 2793: 
> 2794:     __ bltu(len, block_size, L_encrypt_next);

It would be helpful if we add some extra code comment about what this check is for.
Like: `// Do we have a remaining full block?`.

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

PR Review: https://git.openjdk.org/jdk/pull/25281#pullrequestreview-3451127070
PR Review Comment: https://git.openjdk.org/jdk/pull/25281#discussion_r2516561710
PR Review Comment: https://git.openjdk.org/jdk/pull/25281#discussion_r2516544908
PR Review Comment: https://git.openjdk.org/jdk/pull/25281#discussion_r2516547016


More information about the hotspot-compiler-dev mailing list