diff options
author | Andy Polyakov <appro@openssl.org> | 2008-12-17 19:56:48 +0000 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2008-12-17 19:56:48 +0000 |
commit | 4db4882402a79345a075c62a87f2fb7cfe89e283 (patch) | |
tree | b7291b024493da79cb67ec88f7041cf57a54c683 /crypto/perlasm/x86gas.pl | |
parent | 6786f52ada04daba9733aef6a7050809bf6ce4d2 (diff) |
perlasm/x86* update: support for 3 and 4 argument instructions.
Diffstat (limited to 'crypto/perlasm/x86gas.pl')
-rw-r--r-- | crypto/perlasm/x86gas.pl | 41 |
1 files changed, 12 insertions, 29 deletions
diff --git a/crypto/perlasm/x86gas.pl b/crypto/perlasm/x86gas.pl index e3fbb940f0..6eab727fd4 100644 --- a/crypto/perlasm/x86gas.pl +++ b/crypto/perlasm/x86gas.pl @@ -25,24 +25,20 @@ sub opsize() # expand opcode with size suffix; # prefix numeric constants with $; sub ::generic -{ my($opcode,$dst,$src)=@_; - my($tmp,$suffix,@arg); - - if (defined($src)) - { $src =~ s/^(e?[a-dsixphl]{2})$/%$1/o; - $src =~ s/^(x?mm[0-7])$/%$1/o; - $src =~ s/^(\-?[0-9]+)$/\$$1/o; - $src =~ s/^(\-?0x[0-9a-f]+)$/\$$1/o; - push(@arg,$src); - } - if (defined($dst)) - { $dst =~ s/^(\*?)(e?[a-dsixphl]{2})$/$1%$2/o; - $dst =~ s/^(x?mm[0-7])$/%$1/o; - $dst =~ s/^(\-?[0-9]+)$/\$$1/o if(!defined($src)); - $dst =~ s/^(\-?0x[0-9a-f]+)$/\$$1/o if(!defined($src)); - push(@arg,$dst); +{ my($opcode,@arg)=@_; + my($suffix,$dst,$src); + + @arg=reverse(@arg); + + for (@arg) + { s/^(\*?)(e?[a-dsixphl]{2})$/$1%$2/o; # gp registers + s/^([xy]?mm[0-7])$/%$1/o; # xmm/mmx registers + s/^(\-?[0-9]+)$/\$$1/o; # constants + s/^(\-?0x[0-9a-f]+)$/\$$1/o; # constants } + $dst = $arg[$#arg] if ($#arg>=0); + $src = $arg[$#arg-1] if ($#arg>=1); if ($dst =~ m/^%/o) { $suffix=&opsize($dst); } elsif ($src =~ m/^%/o) { $suffix=&opsize($src); } else { $suffix="l"; } @@ -71,19 +67,6 @@ sub ::jmp_ptr { &::generic("jmp","*$_[0]"); } *::bswap = sub { &::emit("bswap","%$_[0]"); } if (!$::i386); -*::pshufw = sub -{ my($dst,$src,$magic)=@_; - &::emit("pshufw","\$$magic","%$src","%$dst"); -}; -*::shld = sub -{ my($dst,$src,$bits)=@_; - &::emit("shldl",$bits eq "cl"?"%cl":"\$$bits","%$src","%$dst"); -}; -*::shrd = sub -{ my($dst,$src,$bits)=@_; - &::emit("shrdl",$bits eq "cl"?"%cl":"\$$bits","%$src","%$dst"); -}; - sub ::DWP { my($addr,$reg1,$reg2,$idx)=@_; my $ret=""; |