summaryrefslogtreecommitdiffstats
path: root/crypto/perlasm/x86ms.pl
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/perlasm/x86ms.pl')
-rw-r--r--crypto/perlasm/x86ms.pl30
1 files changed, 19 insertions, 11 deletions
diff --git a/crypto/perlasm/x86ms.pl b/crypto/perlasm/x86ms.pl
index 82538a9..a0be293 100644
--- a/crypto/perlasm/x86ms.pl
+++ b/crypto/perlasm/x86ms.pl
@@ -146,6 +146,7 @@ sub main'exch { &out2("xchg",@_); }
sub main'cmp { &out2("cmp",@_); }
sub main'lea { &out2("lea",@_); }
sub main'mul { &out1("mul",@_); }
+sub main'imul { &out2("imul",@_); }
sub main'div { &out1("div",@_); }
sub main'dec { &out1("dec",@_); }
sub main'inc { &out1("inc",@_); }
@@ -204,16 +205,17 @@ sub main'pand { &out2("pand",@_); }
sub out2
{
local($name,$p1,$p2)=@_;
- local($l,$t);
+ local($l,$t,$line);
- push(@out,"\t$name\t");
+ $line="\t$name\t";
$t=&conv($p1).",";
$l=length($t);
- push(@out,$t);
+ $line.="$t";
$l=4-($l+9)/8;
- push(@out,"\t" x $l);
- push(@out,&conv($p2));
- push(@out,"\n");
+ $line.="\t" x $l;
+ $line.=&conv($p2);
+ if ($line=~/\bxmm[0-7]\b/i) { $line=~s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i; }
+ push(@out,$line."\n");
}
sub out0
@@ -338,11 +340,17 @@ EOF
sub main'file_end
{
# try to detect if SSE2 or MMX extensions were used...
- if (grep {/xmm[0-7]\s*,/i} @out) {
- grep {s/\.[3-7]86/\.686\n\t\.XMM/} @out;
- }
- elsif (grep {/mm[0-7]\s*,/i} @out) {
- grep {s/\.[3-7]86/\.686\n\t\.MMX/} @out;
+ my $xmmheader=<<___;
+.686
+.XMM
+IF \@Version LT 800
+XMMWORD STRUCT 16
+ DQ 2 dup (?)
+XMMWORD ENDS
+ENDIF
+___
+ if (grep {/\b[x]?mm[0-7]\b/i} @out) {
+ grep {s/\.[3-7]86/$xmmheader/} @out;
}
push(@out,"_TEXT\$ ENDS\n");
push(@out,"END\n");
OpenPOWER on IntegriCloud