aboutsummaryrefslogtreecommitdiff
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
parente2952dfaff67f3641d3a6d3226753356170ff808 (diff)
downloadbusybox-w32-143356876b5712c28b8af61ea9144959a4dc6a5b.tar.gz
busybox-w32-143356876b5712c28b8af61ea9144959a4dc6a5b.tar.bz2
busybox-w32-143356876b5712c28b8af61ea9144959a4dc6a5b.zip
libbb/sha1: add a comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-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 @@
6# also contains the diff of the generated file. 6# also contains the diff of the generated file.
7exec >hash_md5_sha_x86-64.S 7exec >hash_md5_sha_x86-64.S
8 8
9# There is a way to use XMM registers (which always exist for x86-64!) for W[]
10# For example, if we load W as follows:
11# %xmm0: w[0x0] w[0x1] w[0x2] w[0x3]
12# %xmm4: w[0x4] w[0x5] w[0x6] w[0x7]
13# %xmm8: w[0x8] w[0x9] w[0xa] w[0xb]
14# %xmm12: w[0xc] w[0xd] w[0xe] w[0xf]
15# then the xor'ing operation to generate next W[0..3] is:
16# movaps %xmm0, %xmmT2
17# palignr $0x8, %xmm4, %xmmT2 # form (w[0x2],w[0x3],w[0x4],w[0x5])
18# # Right-shifts xmm4:xmmT2 by 8 bytes. Writes shifted result to xmmT2. SSSE3 insn.
19# movaps %xmm0, %xmmT13
20# palignr $0x4,%xmm0,%xmmT13 # form (w[0xd],w[0xe],w[0xf],w[0x0])
21# xmm0 = xmm0 ^ t2 ^ xmm8 ^ t13
22# xmm0 = rol32(xmm0,1) # no such insn, have to use pslld+psrld+or
23# and then results can be extracted for use:
24# movd %xmm0, %esi # new W[0]
25# pextrd $1, %xmm0, %esi # new W[1]
26# # SSE4.1 insn. Can use EXTRACTPS (also SSE4.1)
27# pextrd $2, %xmm0, %esi # new W[2]
28# pextrd $3, %xmm0, %esi # new W[3]
29# ... but this requires SSE4.1 and SSSE3, which are not universally available on x86-64.
30
9echo \ 31echo \
10'### Generated by hash_md5_sha_x86-64.S.sh ### 32'### Generated by hash_md5_sha_x86-64.S.sh ###
11 33