提交 150d0478 编写于 作者: A Andy Polyakov

perlasm/ppc-xlate.pl: add PowerISA 3.0B instructions.

[As well as few extra instructions from earlier spec.]
Reviewed-by: NRich Salz <rsalz@openssl.org>
上级 481afe2a
...@@ -216,6 +216,12 @@ my $lvdx_u = sub { vsxmem_op(@_, 588); }; # lxsdx ...@@ -216,6 +216,12 @@ my $lvdx_u = sub { vsxmem_op(@_, 588); }; # lxsdx
my $stvdx_u = sub { vsxmem_op(@_, 716); }; # stxsdx my $stvdx_u = sub { vsxmem_op(@_, 716); }; # stxsdx
my $lvx_4w = sub { vsxmem_op(@_, 780); }; # lxvw4x my $lvx_4w = sub { vsxmem_op(@_, 780); }; # lxvw4x
my $stvx_4w = sub { vsxmem_op(@_, 908); }; # stxvw4x my $stvx_4w = sub { vsxmem_op(@_, 908); }; # stxvw4x
my $lvx_splt = sub { vsxmem_op(@_, 332); }; # lxvdsx
my $vpermdi = sub { # xxpermdi
my ($f, $vrt, $vra, $vrb, $dm) = @_;
$dm = oct($dm) if ($dm =~ /^0/);
" .long ".sprintf "0x%X",(60<<26)|($vrt<<21)|($vra<<16)|($vrb<<11)|($dm<<8)|(10<<3)|7;
};
# PowerISA 2.07 stuff # PowerISA 2.07 stuff
sub vcrypto_op { sub vcrypto_op {
...@@ -233,7 +239,14 @@ my $vpmsumb = sub { vcrypto_op(@_, 1032); }; ...@@ -233,7 +239,14 @@ my $vpmsumb = sub { vcrypto_op(@_, 1032); };
my $vpmsumd = sub { vcrypto_op(@_, 1224); }; my $vpmsumd = sub { vcrypto_op(@_, 1224); };
my $vpmsubh = sub { vcrypto_op(@_, 1096); }; my $vpmsubh = sub { vcrypto_op(@_, 1096); };
my $vpmsumw = sub { vcrypto_op(@_, 1160); }; my $vpmsumw = sub { vcrypto_op(@_, 1160); };
# These are not really crypto, but one can use vcrypto_op
my $vaddudm = sub { vcrypto_op(@_, 192); }; my $vaddudm = sub { vcrypto_op(@_, 192); };
my $vadduqm = sub { vcrypto_op(@_, 256); };
my $vmuleuw = sub { vcrypto_op(@_, 648); };
my $vmulouw = sub { vcrypto_op(@_, 136); };
my $vrld = sub { vcrypto_op(@_, 196); };
my $vsld = sub { vcrypto_op(@_, 1476); };
my $vsrd = sub { vcrypto_op(@_, 1732); };
my $mtsle = sub { my $mtsle = sub {
my ($f, $arg) = @_; my ($f, $arg) = @_;
...@@ -249,11 +262,24 @@ my $maddld = sub { ...@@ -249,11 +262,24 @@ my $maddld = sub {
my ($f, $rt, $ra, $rb, $rc) = @_; my ($f, $rt, $ra, $rb, $rc) = @_;
" .long ".sprintf "0x%X",(4<<26)|($rt<<21)|($ra<<16)|($rb<<11)|($rc<<6)|51; " .long ".sprintf "0x%X",(4<<26)|($rt<<21)|($ra<<16)|($rb<<11)|($rc<<6)|51;
}; };
my $darn = sub { my $darn = sub {
my ($f, $rt, $l) = @_; my ($f, $rt, $l) = @_;
" .long ".sprintf "0x%X",(31<<26)|($rt<<21)|($l<<16)|(755<<1); " .long ".sprintf "0x%X",(31<<26)|($rt<<21)|($l<<16)|(755<<1);
}; };
my $iseleq = sub {
my ($f, $rt, $ra, $rb) = @_;
" .long ".sprintf "0x%X",(31<<26)|($rt<<21)|($ra<<16)|($rb<<11)|(2<<6)|30;
};
# PowerISA 3.0B stuff
my $addex = sub {
my ($f, $rt, $ra, $rb, $cy) = @_; # only cy==0 is specified in 3.0B
" .long ".sprintf "0x%X",(31<<26)|($rt<<21)|($ra<<16)|($rb<<11)|($cy<<9)|(170<<1);
};
my $vmsumudm = sub {
my ($f, $vrt, $vra, $vrb, $vrc) = @_;
" .long ".sprintf "0x%X",(4<<26)|($vrt<<21)|($vra<<16)|($vrb<<11)|($vrc<<6)|35;
};
while($line=<>) { while($line=<>) {
...@@ -288,7 +314,7 @@ while($line=<>) { ...@@ -288,7 +314,7 @@ while($line=<>) {
my $f = $3; my $f = $3;
my $opcode = eval("\$$mnemonic"); my $opcode = eval("\$$mnemonic");
$line =~ s/\b(c?[rf]|v|vs)([0-9]+)\b/$2/g if ($c ne "." and $flavour !~ /osx/); $line =~ s/\b(c?[rf]|v|vs)([0-9]+)\b/$2/g if ($c ne "." and $flavour !~ /osx/);
if (ref($opcode) eq 'CODE') { $line = &$opcode($f,split(',',$line)); } if (ref($opcode) eq 'CODE') { $line = &$opcode($f,split(/,\s*/,$line)); }
elsif ($mnemonic) { $line = $c.$mnemonic.$f."\t".$line; } elsif ($mnemonic) { $line = $c.$mnemonic.$f."\t".$line; }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册