From b943b7d2c7be535a996b7103b6fe7011735e7f0b Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Sun, 4 May 2014 16:56:00 +0200 Subject: [PATCH] md5/asm/md5-[586|x86_64].pl: +15% on Atom. [MD5 is hardly relevant, just cleaning up repository] --- crypto/md5/asm/md5-586.pl | 17 ++++++++--------- crypto/md5/asm/md5-x86_64.pl | 13 ++++++++++++- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/crypto/md5/asm/md5-586.pl b/crypto/md5/asm/md5-586.pl index 6cb66bb499..4971357173 100644 --- a/crypto/md5/asm/md5-586.pl +++ b/crypto/md5/asm/md5-586.pl @@ -56,14 +56,14 @@ sub R0 &lea($a,&DWP($t,$a,$tmp2,1)); &xor($tmp1,$d); # F function - part 4 + &mov($tmp2,&DWP($xo[$ki+1]*4,$K,"",0)) if ($pos != 2); &add($a,$tmp1); - &mov($tmp1,&Np($c)) if $pos < 1; # next tmp1 for R0 - &mov($tmp1,&Np($c)) if $pos == 1; # next tmp1 for R1 &rotl($a,$s); - &mov($tmp2,&DWP($xo[$ki+1]*4,$K,"",0)) if ($pos != 2); + &mov($tmp1,&Np($c)) if $pos < 1; # next tmp1 for R0 + &mov($tmp1,&Np($c)) if $pos == 1; # next tmp1 for R1 &add($a,$b); } @@ -74,13 +74,12 @@ sub R1 &comment("R1 $ki"); - &lea($a,&DWP($t,$a,$tmp2,1)); - &xor($tmp1,$b); # G function - part 2 &and($tmp1,$d); # G function - part 3 + &lea($a,&DWP($t,$a,$tmp2,1)); - &mov($tmp2,&DWP($xo[$ki+1]*4,$K,"",0)) if ($pos != 2); &xor($tmp1,$c); # G function - part 4 + &mov($tmp2,&DWP($xo[$ki+1]*4,$K,"",0)) if ($pos != 2); &add($a,$tmp1); &mov($tmp1,&Np($c)) if $pos < 1; # G function - part 1 @@ -108,10 +107,10 @@ if (($n & 1) == 0) &lea($a,&DWP($t,$a,$tmp2,1)); &add($a,$tmp1); + &mov($tmp2,&DWP($xo[$ki+1]*4,$K,"",0)); &rotl($a,$s); - &mov($tmp2,&DWP($xo[$ki+1]*4,$K,"",0)); &mov($tmp1,&Np($c)); } else @@ -120,11 +119,11 @@ else # make sure to do 'D' first, not 'B', else we clash with # the last add from the previous round. - &lea($a,&DWP($t,$a,$tmp2,1)); - &add($b,$c); # MOVED FORWARD &xor($tmp1,$d); # H function - part 2 + &lea($a,&DWP($t,$a,$tmp2,1)); + &xor($tmp1,$b); # H function - part 3 &mov($tmp2,&DWP($xo[$ki+1]*4,$K,"",0)) if ($pos != 2); diff --git a/crypto/md5/asm/md5-x86_64.pl b/crypto/md5/asm/md5-x86_64.pl index a79d0e46ea..f7dae27576 100755 --- a/crypto/md5/asm/md5-x86_64.pl +++ b/crypto/md5/asm/md5-x86_64.pl @@ -47,8 +47,8 @@ sub round2_step $code .= " mov %edx, %r12d /* (NEXT STEP) z' = %edx */\n" if ($pos == -1); $code .= <