libbb/sha1: add a comment

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2022-01-08 22:43:24 +01:00
parent e2952dfaff
commit 143356876b

View File

@ -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 ###