summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2022-01-08 22:43:24 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2022-01-08 22:43:24 +0100
commit143356876b5712c28b8af61ea9144959a4dc6a5b (patch)
treee031e951e2b4a4a4bf859a16786dabd2c6281989 /libbb
parente2952dfaff67f3641d3a6d3226753356170ff808 (diff)
downloadbusybox-143356876b5712c28b8af61ea9144959a4dc6a5b.tar.gz
libbb/sha1: add a comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rwxr-xr-xlibbb/hash_md5_sha_x86-64.S.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/libbb/hash_md5_sha_x86-64.S.sh b/libbb/hash_md5_sha_x86-64.S.sh
index eef009590..901896e6e 100755
--- a/libbb/hash_md5_sha_x86-64.S.sh
+++ b/libbb/hash_md5_sha_x86-64.S.sh
@@ -6,6 +6,28 @@
# also contains the diff of the generated file.
exec >hash_md5_sha_x86-64.S
+# There is a way to use XMM registers (which always exist for x86-64!) for W[]
+# For example, if we load W as follows:
+# %xmm0: w[0x0] w[0x1] w[0x2] w[0x3]
+# %xmm4: w[0x4] w[0x5] w[0x6] w[0x7]
+# %xmm8: w[0x8] w[0x9] w[0xa] w[0xb]
+# %xmm12: w[0xc] w[0xd] w[0xe] w[0xf]
+# then the xor'ing operation to generate next W[0..3] is:
+# movaps %xmm0, %xmmT2
+# palignr $0x8, %xmm4, %xmmT2 # form (w[0x2],w[0x3],w[0x4],w[0x5])
+# # Right-shifts xmm4:xmmT2 by 8 bytes. Writes shifted result to xmmT2. SSSE3 insn.
+# movaps %xmm0, %xmmT13
+# palignr $0x4,%xmm0,%xmmT13 # form (w[0xd],w[0xe],w[0xf],w[0x0])
+# xmm0 = xmm0 ^ t2 ^ xmm8 ^ t13
+# xmm0 = rol32(xmm0,1) # no such insn, have to use pslld+psrld+or
+# and then results can be extracted for use:
+# movd %xmm0, %esi # new W[0]
+# pextrd $1, %xmm0, %esi # new W[1]
+# # SSE4.1 insn. Can use EXTRACTPS (also SSE4.1)
+# pextrd $2, %xmm0, %esi # new W[2]
+# pextrd $3, %xmm0, %esi # new W[3]
+# ... but this requires SSE4.1 and SSSE3, which are not universally available on x86-64.
+
echo \
'### Generated by hash_md5_sha_x86-64.S.sh ###