aboutsummaryrefslogtreecommitdiff
path: root/libbb/hash_md5_sha256_x86-32_shaNI.S
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/hash_md5_sha256_x86-32_shaNI.S')
-rw-r--r--libbb/hash_md5_sha256_x86-32_shaNI.S18
1 files changed, 9 insertions, 9 deletions
diff --git a/libbb/hash_md5_sha256_x86-32_shaNI.S b/libbb/hash_md5_sha256_x86-32_shaNI.S
index 413e2df9e..4b33449d4 100644
--- a/libbb/hash_md5_sha256_x86-32_shaNI.S
+++ b/libbb/hash_md5_sha256_x86-32_shaNI.S
@@ -4,7 +4,7 @@
4// We use shorter insns, even though they are for "wrong" 4// We use shorter insns, even though they are for "wrong"
5// data type (fp, not int). 5// data type (fp, not int).
6// For Intel, there is no penalty for doing it at all 6// For Intel, there is no penalty for doing it at all
7// (CPUs which do have such penalty do not support SHA1 insns). 7// (CPUs which do have such penalty do not support SHA insns).
8// For AMD, the penalty is one extra cycle 8// For AMD, the penalty is one extra cycle
9// (allegedly: I failed to find measurable difference). 9// (allegedly: I failed to find measurable difference).
10 10
@@ -39,12 +39,13 @@
39 .balign 8 # allow decoders to fetch at least 2 first insns 39 .balign 8 # allow decoders to fetch at least 2 first insns
40sha256_process_block64_shaNI: 40sha256_process_block64_shaNI:
41 41
42 movu128 76+0*16(%eax), XMMTMP /* DCBA (msb-to-lsb: 3,2,1,0) */ 42 movu128 76+0*16(%eax), XMMTMP /* ABCD (little-endian dword order) */
43 movu128 76+1*16(%eax), STATE1 /* HGFE */ 43 movu128 76+1*16(%eax), STATE1 /* EFGH */
44/* shufps takes dwords 0,1 from *2nd* operand, and dwords 2,3 from 1st one */ 44/* shufps takes dwords 0,1 from *2nd* operand, and dwords 2,3 from 1st one */
45 mova128 STATE1, STATE0 45 mova128 STATE1, STATE0
46 shufps SHUF(1,0,1,0), XMMTMP, STATE0 /* ABEF */ 46 /* --- -------------- ABCD -- EFGH */
47 shufps SHUF(3,2,3,2), XMMTMP, STATE1 /* CDGH */ 47 shufps SHUF(1,0,1,0), XMMTMP, STATE0 /* FEBA */
48 shufps SHUF(3,2,3,2), XMMTMP, STATE1 /* HGDC */
48 49
49/* XMMTMP holds flip mask from here... */ 50/* XMMTMP holds flip mask from here... */
50 mova128 PSHUFFLE_BSWAP32_FLIP_MASK, XMMTMP 51 mova128 PSHUFFLE_BSWAP32_FLIP_MASK, XMMTMP
@@ -232,12 +233,11 @@ sha256_process_block64_shaNI:
232 sha256rnds2 STATE1, STATE0 233 sha256rnds2 STATE1, STATE0
233 234
234 /* Write hash values back in the correct order */ 235 /* Write hash values back in the correct order */
235 /* STATE0: ABEF (msb-to-lsb: 3,2,1,0) */
236 /* STATE1: CDGH */
237 mova128 STATE0, XMMTMP 236 mova128 STATE0, XMMTMP
238/* shufps takes dwords 0,1 from *2nd* operand, and dwords 2,3 from 1st one */ 237/* shufps takes dwords 0,1 from *2nd* operand, and dwords 2,3 from 1st one */
239 shufps SHUF(3,2,3,2), STATE1, STATE0 /* DCBA */ 238 /* --- -------------- HGDC -- FEBA */
240 shufps SHUF(1,0,1,0), STATE1, XMMTMP /* HGFE */ 239 shufps SHUF(3,2,3,2), STATE1, STATE0 /* ABCD */
240 shufps SHUF(1,0,1,0), STATE1, XMMTMP /* EFGH */
241 /* add current hash values to previous ones */ 241 /* add current hash values to previous ones */
242 movu128 76+1*16(%eax), STATE1 242 movu128 76+1*16(%eax), STATE1
243 paddd XMMTMP, STATE1 243 paddd XMMTMP, STATE1