From 150d0478a41e592e1aced6b392db4195eb6191f9 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Fri, 9 Jun 2017 22:07:38 +0200 Subject: [PATCH] perlasm/ppc-xlate.pl: add PowerISA 3.0B instructions. [As well as few extra instructions from earlier spec.] Reviewed-by: Rich Salz --- crypto/perlasm/ppc-xlate.pl | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/crypto/perlasm/ppc-xlate.pl b/crypto/perlasm/ppc-xlate.pl index de796d73f7..ba2842fb82 100755 --- a/crypto/perlasm/ppc-xlate.pl +++ b/crypto/perlasm/ppc-xlate.pl @@ -216,6 +216,12 @@ my $lvdx_u = sub { vsxmem_op(@_, 588); }; # lxsdx my $stvdx_u = sub { vsxmem_op(@_, 716); }; # stxsdx my $lvx_4w = sub { vsxmem_op(@_, 780); }; # lxvw4x 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 sub vcrypto_op { @@ -233,7 +239,14 @@ my $vpmsumb = sub { vcrypto_op(@_, 1032); }; my $vpmsumd = sub { vcrypto_op(@_, 1224); }; my $vpmsubh = sub { vcrypto_op(@_, 1096); }; my $vpmsumw = sub { vcrypto_op(@_, 1160); }; +# These are not really crypto, but one can use vcrypto_op 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 ($f, $arg) = @_; @@ -249,11 +262,24 @@ my $maddld = sub { my ($f, $rt, $ra, $rb, $rc) = @_; " .long ".sprintf "0x%X",(4<<26)|($rt<<21)|($ra<<16)|($rb<<11)|($rc<<6)|51; }; - my $darn = sub { my ($f, $rt, $l) = @_; " .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=<>) { @@ -288,7 +314,7 @@ while($line=<>) { my $f = $3; my $opcode = eval("\$$mnemonic"); $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; } } -- 2.25.1