libbb/sha1: shrink x86 hardware accelerated hashing (32-bit)

function                                             old     new   delta
sha1_process_block64_shaNI                           511     507      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2022-02-08 15:34:02 +01:00
parent eb52e7fa52
commit eb8d5f3b8f
2 changed files with 5 additions and 7 deletions

View File

@ -53,8 +53,8 @@ sha1_process_block64_shaNI:
pshufb %xmm7, MSG3 pshufb %xmm7, MSG3
/* Save hash values for addition after rounds */ /* Save hash values for addition after rounds */
movu128 E0, %xmm7 mova128 E0, %xmm7
/*movu128 ABCD, %xmm8 - NOPE, 32bit has no xmm8 */ /*mova128 ABCD, %xmm8 - NOPE, 32bit has no xmm8 */
/* Rounds 0-3 */ /* Rounds 0-3 */
paddd MSG0, E0 paddd MSG0, E0
@ -207,12 +207,11 @@ sha1_process_block64_shaNI:
/* Add current hash values with previously saved */ /* Add current hash values with previously saved */
sha1nexte %xmm7, E0 sha1nexte %xmm7, E0
/*paddd %xmm8, ABCD - 32-bit mode has no xmm8 */ /*paddd %xmm8, ABCD - 32-bit mode has no xmm8 */
movu128 76(%eax), %xmm7 # recreate original ABCD movu128 76(%eax), %xmm7 # get original ABCD (not shuffled)...
shuf128_32 $0x1B, %xmm7, %xmm7 # DCBA -> ABCD
paddd %xmm7, ABCD
/* Write hash values back in the correct order */ /* Write hash values back in the correct order */
shuf128_32 $0x1B, ABCD, ABCD shuf128_32 $0x1B, ABCD, ABCD
paddd %xmm7, ABCD # ...add it to final ABCD
movu128 ABCD, 76(%eax) movu128 ABCD, 76(%eax)
extr128_32 $3, E0, 76+4*4(%eax) extr128_32 $3, E0, 76+4*4(%eax)

View File

@ -36,9 +36,8 @@
.balign 8 # allow decoders to fetch at least 2 first insns .balign 8 # allow decoders to fetch at least 2 first insns
sha1_process_block64_shaNI: sha1_process_block64_shaNI:
/* load initial hash values */ /* load initial hash values */
xor128 E0, E0
movu128 80(%rdi), ABCD movu128 80(%rdi), ABCD
xor128 E0, E0
pinsrd $3, 80+4*4(%rdi), E0 # load to uppermost 32-bit word pinsrd $3, 80+4*4(%rdi), E0 # load to uppermost 32-bit word
shuf128_32 $0x1B, ABCD, ABCD # DCBA -> ABCD shuf128_32 $0x1B, ABCD, ABCD # DCBA -> ABCD