x86_64 assembly pack: make Windows build more robust.
[openssl.git] / crypto / modes / asm / ghash-x86_64.pl
index b80be6c742d17e485195c719a63cb6b81e49a0f4..cd93c0f95ec0da61f87913ab505df8be62a25130 100644 (file)
 #              gcc 3.4.x(*)    assembler
 #
 # P4           28.6            14.0            +100%
 #              gcc 3.4.x(*)    assembler
 #
 # P4           28.6            14.0            +100%
-# Opteron      18.5            7.7             +140%
-# Core2                17.5            8.1(**)         +115%
+# Opteron      19.3            7.7             +150%
+# Core2                17.8            8.1(**)         +120%
+# Atom         31.6            16.8            +88%
+# VIA Nano     21.8            10.1            +115%
 #
 # (*)  comparison is not completely fair, because C results are
 #
 # (*)  comparison is not completely fair, because C results are
-#      for vanilla "256B" implementation, not "528B";-)
+#      for vanilla "256B" implementation, while assembler results
+#      are for "528B";-)
 # (**) it's mystery [to me] why Core2 result is not same as for
 #      Opteron;
 
 # May 2010
 #
 # (**) it's mystery [to me] why Core2 result is not same as for
 #      Opteron;
 
 # May 2010
 #
-# Add PCLMULQDQ version performing at 2.07 cycles per processed byte.
+# Add PCLMULQDQ version performing at 2.02 cycles per processed byte.
 # See ghash-x86.pl for background information and details about coding
 # techniques.
 #
 # See ghash-x86.pl for background information and details about coding
 # techniques.
 #
@@ -49,7 +52,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
 die "can't locate x86_64-xlate.pl";
 
 ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
 die "can't locate x86_64-xlate.pl";
 
-open STDOUT,"| $^X $xlate $flavour $output";
+open OUT,"| \"$^X\" $xlate $flavour $output";
+*STDOUT=*OUT;
 
 # common register layout
 $nlo="%rax";
 
 # common register layout
 $nlo="%rax";
@@ -797,35 +801,7 @@ se_handler:
 ___
 }
 \f
 ___
 }
 \f
-sub rex {
- local *opcode=shift;
- my ($dst,$src)=@_;
-
-   if ($dst>=8 || $src>=8) {
-       $rex=0x40;
-       $rex|=0x04 if($dst>=8);
-       $rex|=0x01 if($src>=8);
-       push @opcode,$rex;
-   }
-}
-
-sub pclmulqdq {
-  my $arg=shift;
-  my @opcode=(0x66);
-
-    if ($arg=~/\$([x0-9a-f]+),\s*%xmm([0-9]+),\s*%xmm([0-9]+)/) {
-       rex(\@opcode,$3,$2);
-       push @opcode,0x0f,0x3a,0x44;
-       push @opcode,0xc0|($2&7)|(($3&7)<<3);   # ModR/M
-       my $c=$1;
-       push @opcode,$c=~/^0/?oct($c):$c;
-       return ".byte\t".join(',',@opcode);
-    }
-    return "pclmulqdq\t".$arg;
-}
-
 $code =~ s/\`([^\`]*)\`/eval($1)/gem;
 $code =~ s/\`([^\`]*)\`/eval($1)/gem;
-$code =~ s/\bpclmulqdq\s+(\$.*%xmm[0-9]+).*$/pclmulqdq($1)/gem;
 
 print $code;
 
 
 print $code;