aboutsummaryrefslogtreecommitdiff
path: root/libbb/hash_md5_sha256_x86-64_shaNI.S
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/hash_md5_sha256_x86-64_shaNI.S')
-rw-r--r--libbb/hash_md5_sha256_x86-64_shaNI.S25
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
41sha256_process_block64_shaNI: 43sha256_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