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.S19
1 files changed, 9 insertions, 10 deletions
diff --git a/libbb/hash_md5_sha256_x86-64_shaNI.S b/libbb/hash_md5_sha256_x86-64_shaNI.S
index c246762aa..5ed80c2ef 100644
--- a/libbb/hash_md5_sha256_x86-64_shaNI.S
+++ b/libbb/hash_md5_sha256_x86-64_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
@@ -42,12 +42,13 @@
42 .balign 8 # allow decoders to fetch at least 2 first insns 42 .balign 8 # allow decoders to fetch at least 2 first insns
43sha256_process_block64_shaNI: 43sha256_process_block64_shaNI:
44 44
45 movu128 80+0*16(%rdi), XMMTMP /* DCBA (msb-to-lsb: 3,2,1,0) */ 45 movu128 80+0*16(%rdi), XMMTMP /* ABCD (little-endian dword order) */
46 movu128 80+1*16(%rdi), STATE1 /* HGFE */ 46 movu128 80+1*16(%rdi), STATE1 /* EFGH */
47/* shufps takes dwords 0,1 from *2nd* operand, and dwords 2,3 from 1st one */ 47/* shufps takes dwords 0,1 from *2nd* operand, and dwords 2,3 from 1st one */
48 mova128 STATE1, STATE0 48 mova128 STATE1, STATE0
49 shufps SHUF(1,0,1,0), XMMTMP, STATE0 /* ABEF */ 49 /* --- -------------- ABCD -- EFGH */
50 shufps SHUF(3,2,3,2), XMMTMP, STATE1 /* CDGH */ 50 shufps SHUF(1,0,1,0), XMMTMP, STATE0 /* FEBA */
51 shufps SHUF(3,2,3,2), XMMTMP, STATE1 /* HGDC */
51 52
52/* XMMTMP holds flip mask from here... */ 53/* XMMTMP holds flip mask from here... */
53 mova128 PSHUFFLE_BSWAP32_FLIP_MASK(%rip), XMMTMP 54 mova128 PSHUFFLE_BSWAP32_FLIP_MASK(%rip), XMMTMP
@@ -243,13 +244,11 @@ sha256_process_block64_shaNI:
243 paddd CDGH_SAVE, STATE1 244 paddd CDGH_SAVE, STATE1
244 245
245 /* Write hash values back in the correct order */ 246 /* Write hash values back in the correct order */
246 /* STATE0: ABEF (msb-to-lsb: 3,2,1,0) */
247 /* STATE1: CDGH */
248 mova128 STATE0, XMMTMP 247 mova128 STATE0, XMMTMP
249/* shufps takes dwords 0,1 from *2nd* operand, and dwords 2,3 from 1st one */ 248/* shufps takes dwords 0,1 from *2nd* operand, and dwords 2,3 from 1st one */
250 shufps SHUF(3,2,3,2), STATE1, STATE0 /* DCBA */ 249 /* --- -------------- HGDC -- FEBA */
251 shufps SHUF(1,0,1,0), STATE1, XMMTMP /* HGFE */ 250 shufps SHUF(3,2,3,2), STATE1, STATE0 /* ABCD */
252 251 shufps SHUF(1,0,1,0), STATE1, XMMTMP /* EFGH */
253 movu128 STATE0, 80+0*16(%rdi) 252 movu128 STATE0, 80+0*16(%rdi)
254 movu128 XMMTMP, 80+1*16(%rdi) 253 movu128 XMMTMP, 80+1*16(%rdi)
255 254