diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2022-02-08 15:23:26 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2022-02-08 15:23:26 +0100 |
commit | eb52e7fa522d829fb400461ca4c808ee5c1d6428 (patch) | |
tree | ef78b00437f8c2c9ce10cd99a70798d2f9bd2b1b | |
parent | 71a1cccaad679bd102f87283f78c581a8fb0e255 (diff) | |
download | busybox-w32-eb52e7fa522d829fb400461ca4c808ee5c1d6428.tar.gz busybox-w32-eb52e7fa522d829fb400461ca4c808ee5c1d6428.tar.bz2 busybox-w32-eb52e7fa522d829fb400461ca4c808ee5c1d6428.zip |
libbb/sha1: shrink x86 hardware accelerated hashing (32-bit)
function old new delta
sha1_process_block64_shaNI 517 511 -6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | libbb/hash_md5_sha_x86-32_shaNI.S | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libbb/hash_md5_sha_x86-32_shaNI.S b/libbb/hash_md5_sha_x86-32_shaNI.S index 0f3fe57ca..ad814a21b 100644 --- a/libbb/hash_md5_sha_x86-32_shaNI.S +++ b/libbb/hash_md5_sha_x86-32_shaNI.S | |||
@@ -35,11 +35,9 @@ | |||
35 | 35 | ||
36 | .balign 8 # allow decoders to fetch at least 2 first insns | 36 | .balign 8 # allow decoders to fetch at least 2 first insns |
37 | sha1_process_block64_shaNI: | 37 | sha1_process_block64_shaNI: |
38 | subl $16, %esp | ||
39 | |||
40 | /* load initial hash values */ | 38 | /* load initial hash values */ |
41 | xor128 E0, E0 | ||
42 | movu128 76(%eax), ABCD | 39 | movu128 76(%eax), ABCD |
40 | xor128 E0, E0 | ||
43 | pinsrd $3, 76+4*4(%eax), E0 # load to uppermost 32-bit word | 41 | pinsrd $3, 76+4*4(%eax), E0 # load to uppermost 32-bit word |
44 | shuf128_32 $0x1B, ABCD, ABCD # DCBA -> ABCD | 42 | shuf128_32 $0x1B, ABCD, ABCD # DCBA -> ABCD |
45 | 43 | ||
@@ -56,7 +54,7 @@ sha1_process_block64_shaNI: | |||
56 | 54 | ||
57 | /* Save hash values for addition after rounds */ | 55 | /* Save hash values for addition after rounds */ |
58 | movu128 E0, %xmm7 | 56 | movu128 E0, %xmm7 |
59 | movu128 ABCD, (%esp) | 57 | /*movu128 ABCD, %xmm8 - NOPE, 32bit has no xmm8 */ |
60 | 58 | ||
61 | /* Rounds 0-3 */ | 59 | /* Rounds 0-3 */ |
62 | paddd MSG0, E0 | 60 | paddd MSG0, E0 |
@@ -208,7 +206,9 @@ sha1_process_block64_shaNI: | |||
208 | 206 | ||
209 | /* Add current hash values with previously saved */ | 207 | /* Add current hash values with previously saved */ |
210 | sha1nexte %xmm7, E0 | 208 | sha1nexte %xmm7, E0 |
211 | movu128 (%esp), %xmm7 | 209 | /*paddd %xmm8, ABCD - 32-bit mode has no xmm8 */ |
210 | movu128 76(%eax), %xmm7 # recreate original ABCD | ||
211 | shuf128_32 $0x1B, %xmm7, %xmm7 # DCBA -> ABCD | ||
212 | paddd %xmm7, ABCD | 212 | paddd %xmm7, ABCD |
213 | 213 | ||
214 | /* Write hash values back in the correct order */ | 214 | /* Write hash values back in the correct order */ |
@@ -216,7 +216,6 @@ sha1_process_block64_shaNI: | |||
216 | movu128 ABCD, 76(%eax) | 216 | movu128 ABCD, 76(%eax) |
217 | extr128_32 $3, E0, 76+4*4(%eax) | 217 | extr128_32 $3, E0, 76+4*4(%eax) |
218 | 218 | ||
219 | addl $16, %esp | ||
220 | ret | 219 | ret |
221 | .size sha1_process_block64_shaNI, .-sha1_process_block64_shaNI | 220 | .size sha1_process_block64_shaNI, .-sha1_process_block64_shaNI |
222 | 221 | ||