Don't give dependency warning for fips builds.
[openssl.git] / crypto / perlasm / x86asm.pl
index 3ec97221a93bed0ca3852015fade7527ea895348..e0b228eb5572f0be9af3e6d2ec8f5789d87bd774 100644 (file)
@@ -17,7 +17,7 @@ $i386=0;
 sub ::AUTOLOAD
 { my $opcode = $AUTOLOAD;
 
-    die "more than 2 arguments passed to $opcode" if ($#_>1);
+    die "more than 4 arguments passed to $opcode" if ($#_>3);
 
     $opcode =~ s/.*:://;
     if    ($opcode =~ /^push/) { $stack+=4; }
@@ -66,8 +66,8 @@ sub ::rotr    { &ror(@_);     }
 sub ::exch     { &xchg(@_);    }
 sub ::halt     { &hlt;         }
 sub ::movz     { &movzx(@_);   }
-sub ::pushf    { &::pushfd;    }
-sub ::popf     { &::popfd;     }
+sub ::pushf    { &pushfd;      }
+sub ::popf     { &popfd;       }
 
 # 3 argument instructions
 sub ::movq
@@ -79,9 +79,33 @@ sub ::movq
     else
     {  &::generic("movq",@_);                  }
 }
-sub ::pshufw   { &::emit("pshufw",@_); }
-sub ::shld     { &::emit("shld",@_);   }
-sub ::shrd     { &::emit("shrd",@_);   }
+
+# SSE>2 instructions
+my %regrm = (  "eax"=>0, "ecx"=>1, "edx"=>2, "ebx"=>3,
+               "esp"=>4, "ebp"=>5, "esi"=>6, "edi"=>7  );
+sub ::pextrd
+{ my($dst,$src,$imm)=@_;
+    if ("$dst:$src" =~ /(e[a-dsd][ixp]):xmm([0-7])/)
+    {  &::data_byte(0x66,0x0f,0x3a,0x16,0xc0|($2<<3)|$regrm{$1},$imm); }
+    else
+    {  &::generic("pextrd",@_);                }
+}
+
+sub ::pinsrd
+{ my($dst,$src,$imm)=@_;
+    if ("$dst:$src" =~ /xmm([0-7]):(e[a-dsd][ixp])/)
+    {  &::data_byte(0x66,0x0f,0x3a,0x22,0xc0|($1<<3)|$regrm{$2},$imm); }
+    else
+    {  &::generic("pinsrd",@_);                }
+}
+
+sub ::pshufb
+{ my($dst,$src)=@_;
+    if ("$dst:$src" =~ /xmm([0-7]):xmm([0-7])/)
+    {  &data_byte(0x66,0x0f,0x38,0x00,0xc0|($1<<3)|$2);        }
+    else
+    {  &::generic("pshufb",@_);                }
+}
 
 # label management
 $lbdecor="L";          # local label decoration, set by package