RFR: 8341052: SHA-512 implementation using SHA-NI

Sandhya Viswanathan sviswanathan at openjdk.org
Fri Oct 4 18:40:36 UTC 2024


On Mon, 19 Aug 2024 21:34:05 GMT, Smita Kamath <svkamath at openjdk.org> wrote:

> 8341052: SHA-512 implementation using SHA-NI

src/hotspot/cpu/x86/macroAssembler_x86_sha.cpp line 1526:

> 1524:     address K512_W = StubRoutines::x86::k512_W_addr();
> 1525: 
> 1526:     vbroadcasti128(xmm15, ExternalAddress(StubRoutines::x86::pshuffle_byte_flip_mask_addr_sha512()), rbx);

rbx is save on entry register. Better to use a save on call register as temp, say r10.

src/hotspot/cpu/x86/stubGenerator_x86_64.cpp line 1560:

> 1558: address StubGenerator::generate_sha512_implCompress(bool multi_block, const char *name) {
> 1559:   assert(VM_Version::supports_avx2() || VM_Version::supports_sha512(), "");
> 1560:   assert(VM_Version::supports_bmi2(), "");

The SHA512 algorithm is also using AVX2 instructions but doesn't need bmi2.
So this needs to be changed to:
 assert(VM_Version::supports_avx2(), "");
 assert(VM_Version::supports_bmi2()  || VM_Version::supports_sha512(), "");

src/hotspot/cpu/x86/stubRoutines_x86.cpp line 446:

> 444:     0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL,
> 445: };
> 446: 

Extra blank line could be removed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20633#discussion_r1788140453
PR Review Comment: https://git.openjdk.org/jdk/pull/20633#discussion_r1788127094
PR Review Comment: https://git.openjdk.org/jdk/pull/20633#discussion_r1788041727


More information about the hotspot-dev mailing list