libbb/sha1: x86_64 version: tidying up, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
4387077f8e
commit
7abb2bb96e
@ -60,7 +60,7 @@ sha1_process_block64:
|
|||||||
xorl %edx, %edi # ^d
|
xorl %edx, %edi # ^d
|
||||||
andl %ebx, %edi # &b
|
andl %ebx, %edi # &b
|
||||||
xorl %edx, %edi # (((c ^ d) & b) ^ d)
|
xorl %edx, %edi # (((c ^ d) & b) ^ d)
|
||||||
leal 0x5A827999(%rbp,%rsi),%ebp # e += RCONST + W[n]
|
leal 0x5A827999(%rbp,%rsi), %ebp # e += RCONST + W[n]
|
||||||
addl %edi, %ebp # e += (((c ^ d) & b) ^ d)
|
addl %edi, %ebp # e += (((c ^ d) & b) ^ d)
|
||||||
movl %eax, %esi #
|
movl %eax, %esi #
|
||||||
roll $5, %esi # rotl32(a,5)
|
roll $5, %esi # rotl32(a,5)
|
||||||
@ -72,7 +72,7 @@ sha1_process_block64:
|
|||||||
xorl %ecx, %edi # ^d
|
xorl %ecx, %edi # ^d
|
||||||
andl %eax, %edi # &b
|
andl %eax, %edi # &b
|
||||||
xorl %ecx, %edi # (((c ^ d) & b) ^ d)
|
xorl %ecx, %edi # (((c ^ d) & b) ^ d)
|
||||||
leal 0x5A827999(%rdx,%rsi),%edx # e += RCONST + W[n]
|
leal 0x5A827999(%rdx,%rsi), %edx # e += RCONST + W[n]
|
||||||
addl %edi, %edx # e += (((c ^ d) & b) ^ d)
|
addl %edi, %edx # e += (((c ^ d) & b) ^ d)
|
||||||
movl %ebp, %esi #
|
movl %ebp, %esi #
|
||||||
roll $5, %esi # rotl32(a,5)
|
roll $5, %esi # rotl32(a,5)
|
||||||
@ -84,7 +84,7 @@ sha1_process_block64:
|
|||||||
xorl %ebx, %edi # ^d
|
xorl %ebx, %edi # ^d
|
||||||
andl %ebp, %edi # &b
|
andl %ebp, %edi # &b
|
||||||
xorl %ebx, %edi # (((c ^ d) & b) ^ d)
|
xorl %ebx, %edi # (((c ^ d) & b) ^ d)
|
||||||
leal 0x5A827999(%rcx,%rsi),%ecx # e += RCONST + W[n]
|
leal 0x5A827999(%rcx,%rsi), %ecx # e += RCONST + W[n]
|
||||||
addl %edi, %ecx # e += (((c ^ d) & b) ^ d)
|
addl %edi, %ecx # e += (((c ^ d) & b) ^ d)
|
||||||
movl %edx, %esi #
|
movl %edx, %esi #
|
||||||
roll $5, %esi # rotl32(a,5)
|
roll $5, %esi # rotl32(a,5)
|
||||||
@ -96,7 +96,7 @@ sha1_process_block64:
|
|||||||
xorl %eax, %edi # ^d
|
xorl %eax, %edi # ^d
|
||||||
andl %edx, %edi # &b
|
andl %edx, %edi # &b
|
||||||
xorl %eax, %edi # (((c ^ d) & b) ^ d)
|
xorl %eax, %edi # (((c ^ d) & b) ^ d)
|
||||||
leal 0x5A827999(%rbx,%rsi),%ebx # e += RCONST + W[n]
|
leal 0x5A827999(%rbx,%rsi), %ebx # e += RCONST + W[n]
|
||||||
addl %edi, %ebx # e += (((c ^ d) & b) ^ d)
|
addl %edi, %ebx # e += (((c ^ d) & b) ^ d)
|
||||||
movl %ecx, %esi #
|
movl %ecx, %esi #
|
||||||
roll $5, %esi # rotl32(a,5)
|
roll $5, %esi # rotl32(a,5)
|
||||||
@ -108,7 +108,7 @@ sha1_process_block64:
|
|||||||
xorl %ebp, %edi # ^d
|
xorl %ebp, %edi # ^d
|
||||||
andl %ecx, %edi # &b
|
andl %ecx, %edi # &b
|
||||||
xorl %ebp, %edi # (((c ^ d) & b) ^ d)
|
xorl %ebp, %edi # (((c ^ d) & b) ^ d)
|
||||||
leal 0x5A827999(%rax,%rsi),%eax # e += RCONST + W[n]
|
leal 0x5A827999(%rax,%rsi), %eax # e += RCONST + W[n]
|
||||||
addl %edi, %eax # e += (((c ^ d) & b) ^ d)
|
addl %edi, %eax # e += (((c ^ d) & b) ^ d)
|
||||||
movl %ebx, %esi #
|
movl %ebx, %esi #
|
||||||
roll $5, %esi # rotl32(a,5)
|
roll $5, %esi # rotl32(a,5)
|
||||||
@ -120,7 +120,7 @@ sha1_process_block64:
|
|||||||
xorl %edx, %edi # ^d
|
xorl %edx, %edi # ^d
|
||||||
andl %ebx, %edi # &b
|
andl %ebx, %edi # &b
|
||||||
xorl %edx, %edi # (((c ^ d) & b) ^ d)
|
xorl %edx, %edi # (((c ^ d) & b) ^ d)
|
||||||
leal 0x5A827999(%rbp,%rsi),%ebp # e += RCONST + W[n]
|
leal 0x5A827999(%rbp,%rsi), %ebp # e += RCONST + W[n]
|
||||||
addl %edi, %ebp # e += (((c ^ d) & b) ^ d)
|
addl %edi, %ebp # e += (((c ^ d) & b) ^ d)
|
||||||
movl %eax, %esi #
|
movl %eax, %esi #
|
||||||
roll $5, %esi # rotl32(a,5)
|
roll $5, %esi # rotl32(a,5)
|
||||||
@ -132,7 +132,7 @@ sha1_process_block64:
|
|||||||
xorl %ecx, %edi # ^d
|
xorl %ecx, %edi # ^d
|
||||||
andl %eax, %edi # &b
|
andl %eax, %edi # &b
|
||||||
xorl %ecx, %edi # (((c ^ d) & b) ^ d)
|
xorl %ecx, %edi # (((c ^ d) & b) ^ d)
|
||||||
leal 0x5A827999(%rdx,%rsi),%edx # e += RCONST + W[n]
|
leal 0x5A827999(%rdx,%rsi), %edx # e += RCONST + W[n]
|
||||||
addl %edi, %edx # e += (((c ^ d) & b) ^ d)
|
addl %edi, %edx # e += (((c ^ d) & b) ^ d)
|
||||||
movl %ebp, %esi #
|
movl %ebp, %esi #
|
||||||
roll $5, %esi # rotl32(a,5)
|
roll $5, %esi # rotl32(a,5)
|
||||||
@ -144,7 +144,7 @@ sha1_process_block64:
|
|||||||
xorl %ebx, %edi # ^d
|
xorl %ebx, %edi # ^d
|
||||||
andl %ebp, %edi # &b
|
andl %ebp, %edi # &b
|
||||||
xorl %ebx, %edi # (((c ^ d) & b) ^ d)
|
xorl %ebx, %edi # (((c ^ d) & b) ^ d)
|
||||||
leal 0x5A827999(%rcx,%rsi),%ecx # e += RCONST + W[n]
|
leal 0x5A827999(%rcx,%rsi), %ecx # e += RCONST + W[n]
|
||||||
addl %edi, %ecx # e += (((c ^ d) & b) ^ d)
|
addl %edi, %ecx # e += (((c ^ d) & b) ^ d)
|
||||||
movl %edx, %esi #
|
movl %edx, %esi #
|
||||||
roll $5, %esi # rotl32(a,5)
|
roll $5, %esi # rotl32(a,5)
|
||||||
@ -156,7 +156,7 @@ sha1_process_block64:
|
|||||||
xorl %eax, %edi # ^d
|
xorl %eax, %edi # ^d
|
||||||
andl %edx, %edi # &b
|
andl %edx, %edi # &b
|
||||||
xorl %eax, %edi # (((c ^ d) & b) ^ d)
|
xorl %eax, %edi # (((c ^ d) & b) ^ d)
|
||||||
leal 0x5A827999(%rbx,%r8),%ebx # e += RCONST + W[n]
|
leal 0x5A827999(%rbx,%r8), %ebx # e += RCONST + W[n]
|
||||||
addl %edi, %ebx # e += (((c ^ d) & b) ^ d)
|
addl %edi, %ebx # e += (((c ^ d) & b) ^ d)
|
||||||
movl %ecx, %esi #
|
movl %ecx, %esi #
|
||||||
roll $5, %esi # rotl32(a,5)
|
roll $5, %esi # rotl32(a,5)
|
||||||
@ -168,7 +168,7 @@ sha1_process_block64:
|
|||||||
xorl %ebp, %edi # ^d
|
xorl %ebp, %edi # ^d
|
||||||
andl %ecx, %edi # &b
|
andl %ecx, %edi # &b
|
||||||
xorl %ebp, %edi # (((c ^ d) & b) ^ d)
|
xorl %ebp, %edi # (((c ^ d) & b) ^ d)
|
||||||
leal 0x5A827999(%rax,%r9),%eax # e += RCONST + W[n]
|
leal 0x5A827999(%rax,%r9), %eax # e += RCONST + W[n]
|
||||||
addl %edi, %eax # e += (((c ^ d) & b) ^ d)
|
addl %edi, %eax # e += (((c ^ d) & b) ^ d)
|
||||||
movl %ebx, %esi #
|
movl %ebx, %esi #
|
||||||
roll $5, %esi # rotl32(a,5)
|
roll $5, %esi # rotl32(a,5)
|
||||||
@ -180,7 +180,7 @@ sha1_process_block64:
|
|||||||
xorl %edx, %edi # ^d
|
xorl %edx, %edi # ^d
|
||||||
andl %ebx, %edi # &b
|
andl %ebx, %edi # &b
|
||||||
xorl %edx, %edi # (((c ^ d) & b) ^ d)
|
xorl %edx, %edi # (((c ^ d) & b) ^ d)
|
||||||
leal 0x5A827999(%rbp,%r10),%ebp # e += RCONST + W[n]
|
leal 0x5A827999(%rbp,%r10), %ebp # e += RCONST + W[n]
|
||||||
addl %edi, %ebp # e += (((c ^ d) & b) ^ d)
|
addl %edi, %ebp # e += (((c ^ d) & b) ^ d)
|
||||||
movl %eax, %esi #
|
movl %eax, %esi #
|
||||||
roll $5, %esi # rotl32(a,5)
|
roll $5, %esi # rotl32(a,5)
|
||||||
@ -192,7 +192,7 @@ sha1_process_block64:
|
|||||||
xorl %ecx, %edi # ^d
|
xorl %ecx, %edi # ^d
|
||||||
andl %eax, %edi # &b
|
andl %eax, %edi # &b
|
||||||
xorl %ecx, %edi # (((c ^ d) & b) ^ d)
|
xorl %ecx, %edi # (((c ^ d) & b) ^ d)
|
||||||
leal 0x5A827999(%rdx,%r11),%edx # e += RCONST + W[n]
|
leal 0x5A827999(%rdx,%r11), %edx # e += RCONST + W[n]
|
||||||
addl %edi, %edx # e += (((c ^ d) & b) ^ d)
|
addl %edi, %edx # e += (((c ^ d) & b) ^ d)
|
||||||
movl %ebp, %esi #
|
movl %ebp, %esi #
|
||||||
roll $5, %esi # rotl32(a,5)
|
roll $5, %esi # rotl32(a,5)
|
||||||
@ -204,7 +204,7 @@ sha1_process_block64:
|
|||||||
xorl %ebx, %edi # ^d
|
xorl %ebx, %edi # ^d
|
||||||
andl %ebp, %edi # &b
|
andl %ebp, %edi # &b
|
||||||
xorl %ebx, %edi # (((c ^ d) & b) ^ d)
|
xorl %ebx, %edi # (((c ^ d) & b) ^ d)
|
||||||
leal 0x5A827999(%rcx,%r12),%ecx # e += RCONST + W[n]
|
leal 0x5A827999(%rcx,%r12), %ecx # e += RCONST + W[n]
|
||||||
addl %edi, %ecx # e += (((c ^ d) & b) ^ d)
|
addl %edi, %ecx # e += (((c ^ d) & b) ^ d)
|
||||||
movl %edx, %esi #
|
movl %edx, %esi #
|
||||||
roll $5, %esi # rotl32(a,5)
|
roll $5, %esi # rotl32(a,5)
|
||||||
@ -216,7 +216,7 @@ sha1_process_block64:
|
|||||||
xorl %eax, %edi # ^d
|
xorl %eax, %edi # ^d
|
||||||
andl %edx, %edi # &b
|
andl %edx, %edi # &b
|
||||||
xorl %eax, %edi # (((c ^ d) & b) ^ d)
|
xorl %eax, %edi # (((c ^ d) & b) ^ d)
|
||||||
leal 0x5A827999(%rbx,%r13),%ebx # e += RCONST + W[n]
|
leal 0x5A827999(%rbx,%r13), %ebx # e += RCONST + W[n]
|
||||||
addl %edi, %ebx # e += (((c ^ d) & b) ^ d)
|
addl %edi, %ebx # e += (((c ^ d) & b) ^ d)
|
||||||
movl %ecx, %esi #
|
movl %ecx, %esi #
|
||||||
roll $5, %esi # rotl32(a,5)
|
roll $5, %esi # rotl32(a,5)
|
||||||
@ -228,7 +228,7 @@ sha1_process_block64:
|
|||||||
xorl %ebp, %edi # ^d
|
xorl %ebp, %edi # ^d
|
||||||
andl %ecx, %edi # &b
|
andl %ecx, %edi # &b
|
||||||
xorl %ebp, %edi # (((c ^ d) & b) ^ d)
|
xorl %ebp, %edi # (((c ^ d) & b) ^ d)
|
||||||
leal 0x5A827999(%rax,%r14),%eax # e += RCONST + W[n]
|
leal 0x5A827999(%rax,%r14), %eax # e += RCONST + W[n]
|
||||||
addl %edi, %eax # e += (((c ^ d) & b) ^ d)
|
addl %edi, %eax # e += (((c ^ d) & b) ^ d)
|
||||||
movl %ebx, %esi #
|
movl %ebx, %esi #
|
||||||
roll $5, %esi # rotl32(a,5)
|
roll $5, %esi # rotl32(a,5)
|
||||||
@ -240,7 +240,7 @@ sha1_process_block64:
|
|||||||
xorl %edx, %edi # ^d
|
xorl %edx, %edi # ^d
|
||||||
andl %ebx, %edi # &b
|
andl %ebx, %edi # &b
|
||||||
xorl %edx, %edi # (((c ^ d) & b) ^ d)
|
xorl %edx, %edi # (((c ^ d) & b) ^ d)
|
||||||
leal 0x5A827999(%rbp,%r15),%ebp # e += RCONST + W[n]
|
leal 0x5A827999(%rbp,%r15), %ebp # e += RCONST + W[n]
|
||||||
addl %edi, %ebp # e += (((c ^ d) & b) ^ d)
|
addl %edi, %ebp # e += (((c ^ d) & b) ^ d)
|
||||||
movl %eax, %esi #
|
movl %eax, %esi #
|
||||||
roll $5, %esi # rotl32(a,5)
|
roll $5, %esi # rotl32(a,5)
|
||||||
|
@ -74,22 +74,24 @@ test "$1" -ge 8 && echo "%r${1}d"
|
|||||||
RD1A() {
|
RD1A() {
|
||||||
local a=$1;local b=$2;local c=$3;local d=$4;local e=$5
|
local a=$1;local b=$2;local c=$3;local d=$4;local e=$5
|
||||||
local n=$(($6))
|
local n=$(($6))
|
||||||
echo "# $n"
|
local n0=$(((n+0) & 15))
|
||||||
test $n = 0 && echo "
|
echo "
|
||||||
|
# $n
|
||||||
|
";test $n0 = 0 && echo "
|
||||||
# W[0], already in %esi
|
# W[0], already in %esi
|
||||||
";test $n != 0 && test $n -lt 8 && echo "
|
";test $n0 != 0 && test $n0 -lt 8 && echo "
|
||||||
movl `W32 $n`, %esi # W[n]
|
movl `W32 $n0`, %esi # W[n]
|
||||||
";test $n -ge 8 && echo "
|
";test $n0 -ge 8 && echo "
|
||||||
# W[n], in %r$n
|
# W[n], in %r$n0
|
||||||
";echo "
|
";echo "
|
||||||
movl %e$c, %edi # c
|
movl %e$c, %edi # c
|
||||||
xorl %e$d, %edi # ^d
|
xorl %e$d, %edi # ^d
|
||||||
andl %e$b, %edi # &b
|
andl %e$b, %edi # &b
|
||||||
xorl %e$d, %edi # (((c ^ d) & b) ^ d)
|
xorl %e$d, %edi # (((c ^ d) & b) ^ d)
|
||||||
";test $n -lt 8 && echo "
|
";test $n0 -lt 8 && echo "
|
||||||
leal $RCONST(%r$e,%rsi),%e$e # e += RCONST + W[n]
|
leal $RCONST(%r$e,%rsi), %e$e # e += RCONST + W[n]
|
||||||
";test $n -ge 8 && echo "
|
";test $n0 -ge 8 && echo "
|
||||||
leal $RCONST(%r$e,%r$n),%e$e # e += RCONST + W[n]
|
leal $RCONST(%r$e,%r$n0), %e$e # e += RCONST + W[n]
|
||||||
";echo "
|
";echo "
|
||||||
addl %edi, %e$e # e += (((c ^ d) & b) ^ d)
|
addl %edi, %e$e # e += (((c ^ d) & b) ^ d)
|
||||||
movl %e$a, %esi #
|
movl %e$a, %esi #
|
||||||
@ -119,7 +121,7 @@ echo "
|
|||||||
xorl `W32 $n8`, `W32 $n0` # ^W[(n+8) & 15]
|
xorl `W32 $n8`, `W32 $n0` # ^W[(n+8) & 15]
|
||||||
xorl `W32 $n2`, `W32 $n0` # ^W[(n+2) & 15]
|
xorl `W32 $n2`, `W32 $n0` # ^W[(n+2) & 15]
|
||||||
roll `W32 $n0` #
|
roll `W32 $n0` #
|
||||||
"; echo "
|
";echo "
|
||||||
movl %e$c, %edi # c
|
movl %e$c, %edi # c
|
||||||
xorl %e$d, %edi # ^d
|
xorl %e$d, %edi # ^d
|
||||||
andl %e$b, %edi # &b
|
andl %e$b, %edi # &b
|
||||||
@ -165,7 +167,7 @@ echo "
|
|||||||
xorl `W32 $n8`, `W32 $n0` # ^W[(n+8) & 15]
|
xorl `W32 $n8`, `W32 $n0` # ^W[(n+8) & 15]
|
||||||
xorl `W32 $n2`, `W32 $n0` # ^W[(n+2) & 15]
|
xorl `W32 $n2`, `W32 $n0` # ^W[(n+2) & 15]
|
||||||
roll `W32 $n0` #
|
roll `W32 $n0` #
|
||||||
"; echo "
|
";echo "
|
||||||
movl %e$c, %edi # c
|
movl %e$c, %edi # c
|
||||||
xorl %e$d, %edi # ^d
|
xorl %e$d, %edi # ^d
|
||||||
xorl %e$b, %edi # ^b
|
xorl %e$b, %edi # ^b
|
||||||
@ -216,7 +218,7 @@ echo "
|
|||||||
xorl `W32 $n8`, `W32 $n0` # ^W[(n+8) & 15]
|
xorl `W32 $n8`, `W32 $n0` # ^W[(n+8) & 15]
|
||||||
xorl `W32 $n2`, `W32 $n0` # ^W[(n+2) & 15]
|
xorl `W32 $n2`, `W32 $n0` # ^W[(n+2) & 15]
|
||||||
roll `W32 $n0` #
|
roll `W32 $n0` #
|
||||||
"; echo "
|
";echo "
|
||||||
addl %edi, %e$e # += ((b | c) & d) | (b & c)
|
addl %edi, %e$e # += ((b | c) & d) | (b & c)
|
||||||
";test $n0 -lt 8 && echo "
|
";test $n0 -lt 8 && echo "
|
||||||
leal $RCONST(%r$e,%rsi), %e$e # e += RCONST + W[n & 15]
|
leal $RCONST(%r$e,%rsi), %e$e # e += RCONST + W[n & 15]
|
||||||
@ -246,6 +248,11 @@ RD2 ax bx cx dx bp 60; RD2 bp ax bx cx dx 61; RD2 dx bp ax bx cx 62; RD2 cx dx b
|
|||||||
RD2 ax bx cx dx bp 65; RD2 bp ax bx cx dx 66; RD2 dx bp ax bx cx 67; RD2 cx dx bp ax bx 68; RD2 bx cx dx bp ax 69
|
RD2 ax bx cx dx bp 65; RD2 bp ax bx cx dx 66; RD2 dx bp ax bx cx 67; RD2 cx dx bp ax bx 68; RD2 bx cx dx bp ax 69
|
||||||
RD2 ax bx cx dx bp 70; RD2 bp ax bx cx dx 71; RD2 dx bp ax bx cx 72; RD2 cx dx bp ax bx 73; RD2 bx cx dx bp ax 74
|
RD2 ax bx cx dx bp 70; RD2 bp ax bx cx dx 71; RD2 dx bp ax bx cx 72; RD2 cx dx bp ax bx 73; RD2 bx cx dx bp ax 74
|
||||||
RD2 ax bx cx dx bp 75; RD2 bp ax bx cx dx 76; RD2 dx bp ax bx cx 77; RD2 cx dx bp ax bx 78; RD2 bx cx dx bp ax 79
|
RD2 ax bx cx dx bp 75; RD2 bp ax bx cx dx 76; RD2 dx bp ax bx cx 77; RD2 cx dx bp ax bx 78; RD2 bx cx dx bp ax 79
|
||||||
|
# Note: new W[n&15] values generated in last 3 iterations
|
||||||
|
# (W[13,14,15]) are unused after each of these iterations.
|
||||||
|
# Since we use r8..r15 for W[8..15], this does not matter.
|
||||||
|
# If we switch to e.g. using r8..r15 for W[0..7], then saving of W[13,14,15]
|
||||||
|
# (the "movl %esi, `W32 $n0`" insn) is a dead store and can be removed.
|
||||||
} | grep -v '^$'
|
} | grep -v '^$'
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
|
Loading…
Reference in New Issue
Block a user