Skip to content

lib/crypto: De-bloat and optimize sha512-ssse3-asm.S

Eric Biggers linux-crypto 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest8 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8lib/crypto: x86/sha512: Partially roll up sha512_transform_ssse3()lib/crypto/x86/sha512-ssse3-asm.S+67 -570 replies
2/8lib/crypto: x86/sha512: Keep message schedule in XMM registerslib/crypto/x86/sha512-ssse3-asm.S+75 -330 replies
3/8lib/crypto: x86/sha512: Keep W[t]+K[t] in %xmm5 instead of stacklib/crypto/x86/sha512-ssse3-asm.S+33 -470 replies
4/8lib/crypto: x86/sha512: Keep XMM_QWORD_BSWAP in %xmm14 across blockslib/crypto/x86/sha512-ssse3-asm.S+5 -30 replies
5/8lib/crypto: x86/sha512: Use pshufb for ror64(x, 8) in SSSE3 s0lib/crypto/x86/sha512-ssse3-asm.S+16 -100 replies
6/8lib/crypto: x86/sha512: Keep state in registers across blocks in SSSE3lib/crypto/x86/sha512-ssse3-asm.S+16 -100 replies
7/8lib/crypto: x86/sha512: Shorten critical-path additions in SSSE3lib/crypto/x86/sha512-ssse3-asm.S+10 -100 replies
8/8lib/crypto: x86/sha512: Use local labels for datalib/crypto/x86/sha512-ssse3-asm.S+10 -100 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/8] lib/crypto: De-bloat and optimize sha512-ssse3-asm.S

This series reduces the text size of sha512-ssse3-asm.o by over 10 KB, eliminates an excessively large stack frame that wasn't being zeroized, and implements various additional optimizations. Many of these optimizations were already being used in other code such as sha512-avx2-asm.o; this older file was just never updated properly.

I don't have access to an x86_64 CPU that lacks AVX2 support, but running this code on a more recent CPU shows a 30% increase in SHA-512 throughput. Since the benefit of the 'shld' hack in sha512-avx-asm.S on Sandy Bridge was allegedly 20%, it's plausible that this more than closes the gap after the removal of that file. But even if it doesn't, it should be a worthwhile cleanup, especially because of the text and stack size reductions and increased consistency with other files.

Patch 1 is an updated version of
https://lore.kernel.org/linux-crypto/[email protected]/

Eric Biggers (8):
lib/crypto: x86/sha512: Partially roll up sha512_transform_ssse3() lib/crypto: x86/sha512: Keep message schedule in XMM registers lib/crypto: x86/sha512: Keep W[t]+K[t] in %xmm5 instead of stack lib/crypto: x86/sha512: Keep XMM_QWORD_BSWAP in %xmm14 across blocks lib/crypto: x86/sha512: Use pshufb for ror64(x, 8) in SSSE3 s0 lib/crypto: x86/sha512: Keep state in registers across blocks in SSSE3 lib/crypto: x86/sha512: Shorten critical-path additions in SSSE3 lib/crypto: x86/sha512: Use local labels for data

 lib/crypto/x86/sha512-ssse3-asm.S | 298 ++++++++++++++++++------------
 1 file changed, 175 insertions(+), 123 deletions(-)

base-commit: 909ef7a9a30fa139e69e555e3606680f5cca7726

Signature · 1 line
2.56.1