diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2022-02-09 01:42:49 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2022-02-09 01:42:49 +0100 |
commit | 11bcea7ac0ac4b2156c1b2d53f926d789b9792b4 (patch) | |
tree | a9fb00915788a924269722c0afa186d4fac5f610 | |
parent | 461a994b09c5022b93bccccf903b39438d61bbf1 (diff) | |
download | busybox-w32-11bcea7ac0ac4b2156c1b2d53f926d789b9792b4.tar.gz busybox-w32-11bcea7ac0ac4b2156c1b2d53f926d789b9792b4.tar.bz2 busybox-w32-11bcea7ac0ac4b2156c1b2d53f926d789b9792b4.zip |
libbb/sha256: code shrink in 64-bit x86
function old new delta
sha256_process_block64_shaNI 701 680 -21
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | libbb/hash_md5_sha256_x86-64_shaNI.S | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/libbb/hash_md5_sha256_x86-64_shaNI.S b/libbb/hash_md5_sha256_x86-64_shaNI.S index b5c950a9a..bc063b9cc 100644 --- a/libbb/hash_md5_sha256_x86-64_shaNI.S +++ b/libbb/hash_md5_sha256_x86-64_shaNI.S | |||
@@ -37,16 +37,18 @@ | |||
37 | #define ABEF_SAVE %xmm9 | 37 | #define ABEF_SAVE %xmm9 |
38 | #define CDGH_SAVE %xmm10 | 38 | #define CDGH_SAVE %xmm10 |
39 | 39 | ||
40 | #define SHUF(a,b,c,d) $(a+(b<<2)+(c<<4)+(d<<6)) | ||
41 | |||
40 | .balign 8 # allow decoders to fetch at least 2 first insns | 42 | .balign 8 # allow decoders to fetch at least 2 first insns |
41 | sha256_process_block64_shaNI: | 43 | sha256_process_block64_shaNI: |
42 | movu128 80+0*16(%rdi), STATE0 | ||
43 | movu128 80+1*16(%rdi), STATE1 | ||
44 | 44 | ||
45 | shuf128_32 $0xB1, STATE0, STATE0 /* CDAB */ | 45 | movu128 80+0*16(%rdi), STATE1 /* DCBA (msb-to-lsb: 3,2,1,0) */ |
46 | shuf128_32 $0x1B, STATE1, STATE1 /* EFGH */ | 46 | movu128 80+1*16(%rdi), STATE0 /* HGFE */ |
47 | /* shufps takes dwords 0,1 from *2nd* operand, and dwords 2,3 from 1st one */ | ||
47 | mova128 STATE0, XMMTMP | 48 | mova128 STATE0, XMMTMP |
48 | palignr $8, STATE1, STATE0 /* ABEF */ | 49 | shufps SHUF(1,0,1,0), STATE1, STATE0 /* ABEF */ |
49 | pblendw $0xF0, XMMTMP, STATE1 /* CDGH */ | 50 | shufps SHUF(3,2,3,2), STATE1, XMMTMP /* CDGH */ |
51 | mova128 XMMTMP, STATE1 | ||
50 | 52 | ||
51 | /* XMMTMP holds flip mask from here... */ | 53 | /* XMMTMP holds flip mask from here... */ |
52 | mova128 PSHUFFLE_BSWAP32_FLIP_MASK(%rip), XMMTMP | 54 | mova128 PSHUFFLE_BSWAP32_FLIP_MASK(%rip), XMMTMP |
@@ -242,14 +244,15 @@ sha256_process_block64_shaNI: | |||
242 | paddd CDGH_SAVE, STATE1 | 244 | paddd CDGH_SAVE, STATE1 |
243 | 245 | ||
244 | /* Write hash values back in the correct order */ | 246 | /* Write hash values back in the correct order */ |
245 | shuf128_32 $0x1B, STATE0, STATE0 /* FEBA */ | 247 | /* STATE0: ABEF (msb-to-lsb: 3,2,1,0) */ |
246 | shuf128_32 $0xB1, STATE1, STATE1 /* DCHG */ | 248 | /* STATE1: CDGH */ |
247 | mova128 STATE0, XMMTMP | 249 | mova128 STATE0, XMMTMP |
248 | pblendw $0xF0, STATE1, STATE0 /* DCBA */ | 250 | /* shufps takes dwords 0,1 from *2nd* operand, and dwords 2,3 from 1st one */ |
249 | palignr $8, XMMTMP, STATE1 /* HGFE */ | 251 | shufps SHUF(3,2,3,2), STATE1, STATE0 /* DCBA */ |
252 | shufps SHUF(1,0,1,0), STATE1, XMMTMP /* HGFE */ | ||
250 | 253 | ||
251 | movu128 STATE0, 80+0*16(%rdi) | 254 | movu128 STATE0, 80+0*16(%rdi) |
252 | movu128 STATE1, 80+1*16(%rdi) | 255 | movu128 XMMTMP, 80+1*16(%rdi) |
253 | 256 | ||
254 | ret | 257 | ret |
255 | .size sha256_process_block64_shaNI, .-sha256_process_block64_shaNI | 258 | .size sha256_process_block64_shaNI, .-sha256_process_block64_shaNI |