RFR: 8322179: RISC-V: Implement SHA-1 intrinsic [v10]
Hamlin Li
mli at openjdk.org
Wed Feb 21 16:10:22 UTC 2024
On Sat, 17 Feb 2024 13:27:19 GMT, Fei Yang <fyang at openjdk.org> wrote:
>> Hamlin Li has updated the pull request incrementally with one additional commit since the last revision:
>>
>> refine register usage and comment
>
> src/hotspot/cpu/riscv/stubGenerator_riscv.cpp line 4953:
>
>> 4951: __ rolw_imm(cur_w, a, 5, t0);
>> 4952: // as pointed above, we can use cur_w as temporary register here.
>> 4953: sha1_f(round, tmp, b, c, d);
>
> Could we also reuse `cur_k` in this function where input param `tmp` is used? I see `cur_k` will also be recalculated at the beginning of each round like `cur_w`. Hope this could help eliminate `tmp` param and finally free `t2`.
Seems not, as cur_k is only calculated when `(round % 20) == 0`.
Other comments are all resolved.
> src/hotspot/cpu/riscv/stubGenerator_riscv.cpp line 5123:
>
>> 5121:
>> 5122: if (multi_block) {
>> 5123: __ bge(limit, buf, L_sha1_loop, true);
>
> A small question: Is it OK to continue the loop when `limit` equals `buf`?
I think the answer to your question is at https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/sun/security/provider/DigestBase.java#L130, the `limit` is indeed `limit - blockSize`, hope this answer your question?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17130#discussion_r1497850315
PR Review Comment: https://git.openjdk.org/jdk/pull/17130#discussion_r1497850122
More information about the hotspot-dev
mailing list