perlasm/x86masm.pl: fix last fix.
[openssl.git] / crypto / perlasm / ppc-xlate.pl
index 43adfaca5309342f0ba2a0fba1db4291d4f30d86..a3edd982b664778e17b89b45f644e6133451744e 100755 (executable)
@@ -2,10 +2,10 @@
 
 # PowerPC assembler distiller by <appro>.
 
+my $flavour = shift;
 my $output = shift;
 open STDOUT,">$output" || die "can't open $output: $!";
 
-my $flavour = $output;
 my %GLOBALS;
 my $dotinlocallabels=($flavour=~/linux/)?1:0;
 
@@ -31,10 +31,9 @@ my $globl = sub {
                                $ret .= ".type  $name,\@function";
                                last;
                              };
-       /linux.*64/     && do { $ret .= ".globl .$name\n";
-                               $ret .= ".type  .$name,\@function\n";
+       /linux.*64/     && do { $ret .= ".globl $name\n";
+                               $ret .= ".type  $name,\@function\n";
                                $ret .= ".section       \".opd\",\"aw\"\n";
-                               $ret .= ".globl $name\n";
                                $ret .= ".align 3\n";
                                $ret .= "$name:\n";
                                $ret .= ".quad  .$name,.TOC.\@tocbase,0\n";
@@ -62,6 +61,14 @@ my $machine = sub {
     }
     ".machine  $arch";
 };
+my $size = sub {
+    if ($flavour =~ /linux.*32/)
+    {  shift;
+       ".size  " . join(",",@_);
+    }
+    else
+    {  "";     }
+};
 my $asciz = sub {
     shift;
     my $line = join(",",@_);
@@ -101,6 +108,13 @@ my $bnelr = sub {
        "       .long   ".sprintf "0x%x",19<<26|$bo<<21|2<<16|16<<1 :
        "       bclr    $bo,2";
 };
+my $beqlr = sub {
+    my $f = shift;
+    my $bo = $f=~/-/ ? 12+2 : 12;      # optional "not to be taken" hint
+    ($flavour =~ /linux/) ?            # GNU as doesn't allow most recent hints
+       "       .long   ".sprintf "0x%X",19<<26|$bo<<21|2<<16|16<<1 :
+       "       bclr    $bo,2";
+};
 # GNU assembler can't handle extrdi rA,rS,16,48, or when sum of last two
 # arguments is 64, with "operand out of range" error.
 my $extrdi = sub {