Also check for errors in x86_64-xlate.pl.
[oweals/openssl.git] / crypto / sha / asm / sha1-sparcv9a.pl
index 9e8d0ca3828568ee290d658e63ef8214b9477d8f..d9f05de53a15242e0186a2347ba51e679f1765ef 100644 (file)
@@ -1,7 +1,14 @@
-#!/usr/bin/env perl
+#! /usr/bin/env perl
+# Copyright 2009-2016 The OpenSSL Project Authors. All Rights Reserved.
+#
+# Licensed under the Apache License 2.0 (the "License").  You may not use
+# this file except in compliance with the License.  You can obtain a copy
+# in the file LICENSE in the source distribution or at
+# https://www.openssl.org/source/license.html
+
 
 # ====================================================================
-# Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL
+# Written by Andy Polyakov <appro@openssl.org> for the OpenSSL
 # project. The module is, however, dual licensed under OpenSSL and
 # CRYPTOGAMS licenses depending on where you obtain it. For further
 # details see http://www.openssl.org/~appro/cryptogams/.
@@ -40,8 +47,7 @@ for (@ARGV)   { $bits=64 if (/\-m64/ || /\-xarch\=v9/); }
 if ($bits==64) { $bias=2047; $frame=192; }
 else           { $bias=0;    $frame=112; }
 
-$output=shift;
-open STDOUT,">$output";
+$output=pop and open STDOUT,">$output";
 
 $ctx="%i0";
 $inp="%i1";
@@ -415,7 +421,7 @@ sha1_block_data_order:
        add     %fp,$bias-256,$base
 
 1:     call    .+8
-       sub     %o7,1b-vis_const,$tmp0
+       add     %o7,vis_const-1b,$tmp0
 
        ldd     [$tmp0+0],$VK_00_19
        ldd     [$tmp0+8],$VK_20_39
@@ -433,7 +439,7 @@ sha1_block_data_order:
        and     $inp,-8,$inp
        ld      [$ctx+16],$Ectx
 
-       # X[16] is maintained in FP register bank
+       ! X[16] is maintained in FP register bank
        alignaddr       %g0,$align,%g0
        ldd             [$inp+0],@X[0]
        sub             $inp,-64,$Xfer
@@ -512,7 +518,7 @@ $code.=<<___;
        mov             $Cctx,$C
        mov             $Dctx,$D
        mov             $Ectx,$E
-       alignaddr       %g0,$tmp0,%g0   
+       alignaddr       %g0,$tmp0,%g0
        dec             1,$len
        ba              .Loop
        mov             $nXfer,$Xfer
@@ -539,16 +545,17 @@ $code.=<<___;
 .type  sha1_block_data_order,#function
 .size  sha1_block_data_order,(.-sha1_block_data_order)
 .asciz "SHA1 block transform for SPARCv9a, CRYPTOGAMS by <appro\@openssl.org>"
+.align 4
 ___
 
 # Purpose of these subroutines is to explicitly encode VIS instructions,
 # so that one can compile the module without having to specify VIS
-# extentions on compiler command line, e.g. -xarch=v9 vs. -xarch=v9a.
+# extensions on compiler command line, e.g. -xarch=v9 vs. -xarch=v9a.
 # Idea is to reserve for option to produce "universal" binary and let
 # programmer detect if current CPU is VIS capable at run-time.
 sub unvis {
 my ($mnemonic,$rs1,$rs2,$rd)=@_;
-my $ref,$opf;
+my ($ref,$opf);
 my %visopf = ( "fmul8ulx16"    => 0x037,
                "faligndata"    => 0x048,
                "fpadd32"       => 0x052,
@@ -597,4 +604,4 @@ $code =~ s/\b(alignaddr)\s+(%[goli][0-7]),(%[goli][0-7]),(%[goli][0-7])/
                &unalignaddr($1,$2,$3,$4)
          /gem;
 print $code;
-close STDOUT;
+close STDOUT or die "error closing STDOUT: $!";