Rename *_realloc_clean to *_clear_realloc
[openssl.git] / crypto / perlasm / x86asm.pl
index d39bc28b227d4b6d3999be0df3ed03095b8d9714..cae156ae63ce322dad4e75caba349b0d5ed01f20 100644 (file)
@@ -107,22 +107,13 @@ sub ::pshufb
     {  &::generic("pshufb",@_);                }
 }
 
-# AESNI extenstion
-sub ::aeskeygenassist
+sub ::palignr
 { my($dst,$src,$imm)=@_;
     if ("$dst:$src" =~ /xmm([0-7]):xmm([0-7])/)
-    {  &::data_byte(0x66,0x0f,0x3a,0xdf,0xc0|($1<<3)|$2,$imm); }
-}
-sub ::aescommon
-{ my($opcodelet,$dst,$src)=@_;
-    if ("$dst:$src" =~ /xmm([0-7]):xmm([0-7])/)
-    {  &::data_byte(0x66,0x0f,0x38,$opcodelet,0xc0|($1<<3)|$2);}
+    {  &::data_byte(0x66,0x0f,0x3a,0x0f,0xc0|($1<<3)|$2,$imm); }
+    else
+    {  &::generic("palignr",@_);               }
 }
-sub ::aesimc           { ::aescommon(0xdb,@_); }
-sub ::aesenc           { ::aescommon(0xdc,@_); }
-sub ::aesenclast       { ::aescommon(0xdd,@_); }
-sub ::aesdec           { ::aescommon(0xde,@_); }
-sub ::aesdeclast       { ::aescommon(0xdf,@_); }
 
 sub ::pclmulqdq
 { my($dst,$src,$imm)=@_;
@@ -132,6 +123,48 @@ sub ::pclmulqdq
     {  &::generic("pclmulqdq",@_);             }
 }
 
+sub ::rdrand
+{ my ($dst)=@_;
+    if ($dst =~ /(e[a-dsd][ixp])/)
+    {  &::data_byte(0x0f,0xc7,0xf0|$regrm{$dst});      }
+    else
+    {  &::generic("rdrand",@_);        }
+}
+
+sub ::rdseed
+{ my ($dst)=@_;
+    if ($dst =~ /(e[a-dsd][ixp])/)
+    {  &::data_byte(0x0f,0xc7,0xf8|$regrm{$dst});      }
+    else
+    {  &::generic("rdrand",@_);        }
+}
+
+sub rxb {
+ local *opcode=shift;
+ my ($dst,$src1,$src2,$rxb)=@_;
+
+   $rxb|=0x7<<5;
+   $rxb&=~(0x04<<5) if($dst>=8);
+   $rxb&=~(0x01<<5) if($src1>=8);
+   $rxb&=~(0x02<<5) if($src2>=8);
+   push @opcode,$rxb;
+}
+
+sub ::vprotd
+{ my $args=join(',',@_);
+    if ($args =~ /xmm([0-7]),xmm([0-7]),([x0-9a-f]+)/)
+    { my @opcode=(0x8f);
+       rxb(\@opcode,$1,$2,-1,0x08);
+       push @opcode,0x78,0xc2;
+       push @opcode,0xc0|($2&7)|(($1&7)<<3);           # ModR/M
+       my $c=$3;
+       push @opcode,$c=~/^0/?oct($c):$c;
+       &::data_byte(@opcode);
+    }
+    else
+    {  &::generic("vprotd",@_);        }
+}
+
 # label management
 $lbdecor="L";          # local label decoration, set by package
 $label="000";
@@ -219,9 +252,11 @@ sub ::asm_init
     $filename=$fn;
     $i386=$cpu;
 
-    $elf=$cpp=$coff=$aout=$macosx=$win32=$netware=$mwerks=0;
+    $elf=$cpp=$coff=$aout=$macosx=$win32=$netware=$mwerks=$android=0;
     if    (($type eq "elf"))
     {  $elf=1;                 require "x86gas.pl";    }
+    elsif (($type eq "elf-1"))
+    {  $elf=-1;                require "x86gas.pl";    }
     elsif (($type eq "a\.out"))
     {  $aout=1;                require "x86gas.pl";    }
     elsif (($type eq "coff" or $type eq "gaswin"))
@@ -236,6 +271,8 @@ sub ::asm_init
     {  $win32=1;               require "x86masm.pl";   }
     elsif (($type eq "macosx"))
     {  $aout=1; $macosx=1;     require "x86gas.pl";    }
+    elsif (($type eq "android"))
+    {  $elf=1; $android=1;     require "x86gas.pl";    }
     else
     {  print STDERR <<"EOF";
 Pick one target type from
@@ -256,4 +293,6 @@ EOF
     &file($filename);
 }
 
+sub ::hidden {}
+
 1;