RFR: 8365732: RISC-V: implement AES CTR intrinsics [v13]
    Fei Yang 
    fyang at openjdk.org
       
    Fri Oct 31 07:44:14 UTC 2025
    
    
  
On Wed, 29 Oct 2025 07:03:48 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:
> 
>   delete useless reg
Hi, I am having a look at the latest version. Some minor comments.
src/hotspot/cpu/riscv/stubGenerator_riscv.cpp line 2610:
> 2608:   }
> 2609: 
> 2610:   void increase_counter_128(Register counter, Register tmp) {
Maybe pass another tmp register? Otherwise, you need to assert that the input `tmp` and `t0` are different registers. Also can you add some code comment for this routine?
src/hotspot/cpu/riscv/stubGenerator_riscv.cpp line 2611:
> 2609: 
> 2610:   void increase_counter_128(Register counter, Register tmp) {
> 2611:     __ addi(t0, counter, 8);
Note that the address for `ld/sd` instructions can accept an immediate offset.
src/hotspot/cpu/riscv/stubGenerator_riscv.cpp line 2619:
> 2617:     __ mv(t0, 0x0ul);
> 2618:     __ sltu(tmp, t0, tmp);
> 2619:     __ xori(t0, tmp, 1);
Seems a simple `seqz` will do?
src/hotspot/cpu/riscv/stubGenerator_riscv.cpp line 2711:
> 2709: 
> 2710:     __ lw(used, Address(used_ptr));
> 2711:     __ beqz(input_len, L_exit);
Are the `lw` and `sw` of `used_ptr` necessary when `input_len` is zero?
src/hotspot/cpu/riscv/stubGenerator_riscv.cpp line 2738:
> 2736:     // Encrypt bytes left with last encryptedCounter
> 2737:     __ bind(L_next);
> 2738:     __ mv(t0, block_size);
Can we materialize this value in a dedicate tmp register? Then we can save these `mv` instructions in the loop.
src/hotspot/cpu/riscv/stubGenerator_riscv.cpp line 2755:
> 2753: 
> 2754:     __ bind(L_main);
> 2755:     __ vsetivli(x0, 4, Assembler::e32, Assembler::m1);
This seems to me redundant as we already have the same `vsetivli` on entry.
-------------
PR Review: https://git.openjdk.org/jdk/pull/25281#pullrequestreview-3402878829
PR Review Comment: https://git.openjdk.org/jdk/pull/25281#discussion_r2480387615
PR Review Comment: https://git.openjdk.org/jdk/pull/25281#discussion_r2480385815
PR Review Comment: https://git.openjdk.org/jdk/pull/25281#discussion_r2480383816
PR Review Comment: https://git.openjdk.org/jdk/pull/25281#discussion_r2480393779
PR Review Comment: https://git.openjdk.org/jdk/pull/25281#discussion_r2480399578
PR Review Comment: https://git.openjdk.org/jdk/pull/25281#discussion_r2480395560
    
    
More information about the hotspot-compiler-dev
mailing list