Tolerate a SEQUENCE in DN components.
[oweals/openssl.git] / crypto / perlasm / x86unix.pl
index 4381580be7b96cf95458fd8530e20b35eb83c138..e71050b6bcb512b4f16bdc11b4fd617fd5f32028 100644 (file)
@@ -200,6 +200,7 @@ sub main'call       {       my $pre=$under;
                        { if ($label{$i} eq $_[0]) { $pre=''; last; } }
                        &out1("call",$pre.$_[0]);
                }
+sub main'call_ptr { &out1p("call",@_); }
 sub main'ret   { &out0("ret"); }
 sub main'nop   { &out0("nop"); }
 sub main'test  { &out2("testl",@_); }
@@ -210,11 +211,11 @@ sub main'rdtsc    { &out0(".byte\t0x0f,0x31"); }
 sub main'halt  { &out0("hlt"); }
 sub main'movz  { &out2("movzbl",@_); }
 sub main'neg   { &out1("negl",@_); }
+sub main'cld   { &out0("cld"); }
 
 # SSE2
 sub main'emms  { &out0("emms"); }
 sub main'movd  { &out2("movd",@_); }
-sub main'movq  { &out2("movq",@_); }
 sub main'movdqu        { &out2("movdqu",@_); }
 sub main'movdqa        { &out2("movdqa",@_); }
 sub main'movdq2q{ &out2("movdq2q",@_); }
@@ -226,6 +227,13 @@ sub main'psllq     { &out2("psllq",@_); }
 sub main'pxor  { &out2("pxor",@_); }
 sub main'por   { &out2("por",@_); }
 sub main'pand  { &out2("pand",@_); }
+sub main'movq  {
+       local($p1,$p2,$optimize)=@_;
+       if ($optimize && $p1=~/^mm[0-7]$/ && $p2=~/^mm[0-7]$/)
+               # movq between mmx registers can sink Intel CPUs
+               {       push(@out,"\tpshufw\t\$0xe4,%$p2,%$p1\n");      }
+       else    {       &out2("movq",@_);                               }
+       }
 
 # The bswapl instruction is new for the 486. Emulate if i386.
 sub main'bswap
@@ -536,7 +544,8 @@ sub main'file_end
        if ($main'elf && grep {/%[x]*mm[0-7]/i} @out) {
                local($tmp);
 
-               push (@out,"\n.comm\t${under}OPENSSL_ia32cap_P,4,4\n");
+               push (@out,"\n.section\t.bss\n");
+               push (@out,".comm\t${under}OPENSSL_ia32cap_P,4,4\n");
 
                push (@out,".section\t.init\n");
                # One can argue that it's wasteful to craft every
@@ -571,6 +580,7 @@ sub main'file_end
                movl    %edx,0(%edi)
                popl    %ebx
                popl    %edi
+               jmp     1f
        .align  $align
        1:
 ___
@@ -585,6 +595,11 @@ ___
                }
        }
 
+sub main'data_byte
+       {
+       push(@out,"\t.byte\t".join(',',@_)."\n");
+       }
+
 sub main'data_word
        {
        push(@out,"\t.long\t".join(',',@_)."\n");
@@ -716,7 +731,9 @@ sub main'initseg
                $tmp=<<___;
 .section       .init
        call    $under$f
-       .align  $align
+       jmp     .Linitalign
+.align $align
+.Linitalign:
 ___
                }
        elsif ($main'coff)