Following the license change, modify the boilerplates in crypto/bn/
[openssl.git] / crypto / bn / asm / parisc-mont.pl
index 5b1c5eacca1470f4d91da451d25bc5797a043041..1d66c21f054af4cf70d9da96343532ec9c822fb1 100644 (file)
@@ -1,7 +1,7 @@
 #! /usr/bin/env perl
-# Copyright 2009-2016 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2009-2018 The OpenSSL Project Authors. All Rights Reserved.
 #
-# Licensed under the OpenSSL license (the "License").  You may not use
+# 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
@@ -21,7 +21,7 @@
 # optimal in respect to instruction set capabilities. Fair comparison
 # with vendor compiler is problematic, because OpenSSL doesn't define
 # BN_LLONG [presumably] for historical reasons, which drives compiler
-# toward 4 times 16x16=32-bit multiplicatons [plus complementary
+# toward 4 times 16x16=32-bit multiplications [plus complementary
 # shifts and additions] instead. This means that you should observe
 # several times improvement over code generated by vendor compiler
 # for PA-RISC 1.1, but the "baseline" is far from optimal. The actual
@@ -517,7 +517,6 @@ L\$sub
        stws,ma         $hi1,4($rp)
 
        subb            $ti0,%r0,$hi1
-       ldo             -4($tp),$tp
 ___
 $code.=<<___ if ($BN_SZ==8);
        ldd,ma          8($tp),$ti0
@@ -532,20 +531,18 @@ L\$sub
 
        extrd,u         $ti0,31,32,$ti0         ; carry in flipped word order
        sub,db          $ti0,%r0,$hi1
-       ldo             -8($tp),$tp
 ___
 $code.=<<___;
-       and             $tp,$hi1,$ap
-       andcm           $rp,$hi1,$bp
-       or              $ap,$bp,$np
-
+       ldo             `$LOCALS+32`($fp),$tp
        sub             $rp,$arrsz,$rp          ; rewind rp
        subi            0,$arrsz,$idx
-       ldo             `$LOCALS+32`($fp),$tp
 L\$copy
-       ldd             $idx($np),$hi0
+       ldd             0($tp),$ti0
+       ldd             0($rp),$hi0
        std,ma          %r0,8($tp)
-       addib,<>        8,$idx,.-8              ; L\$copy
+       comiclr,=       0,$hi1,%r0
+       copy            $ti0,$hi0
+       addib,<>        8,$idx,L\$copy
        std,ma          $hi0,8($rp)
 ___
 
@@ -856,17 +853,16 @@ L\$sub_pa11
        stws,ma         $hi1,4($rp)
 
        subb            $ti0,%r0,$hi1
-       ldo             -4($tp),$tp
-       and             $tp,$hi1,$ap
-       andcm           $rp,$hi1,$bp
-       or              $ap,$bp,$np
 
+       ldo             `$LOCALS+32`($fp),$tp
        sub             $rp,$arrsz,$rp          ; rewind rp
        subi            0,$arrsz,$idx
-       ldo             `$LOCALS+32`($fp),$tp
 L\$copy_pa11
-       ldwx            $idx($np),$hi0
+       ldw             0($tp),$ti0
+       ldw             0($rp),$hi0
        stws,ma         %r0,4($tp)
+       comiclr,=       0,$hi1,%r0
+       copy            $ti0,$hi0
        addib,<>        4,$idx,L\$copy_pa11
        stws,ma         $hi0,4($rp)
 
@@ -988,6 +984,11 @@ sub assemble {
     ref($opcode) eq 'CODE' ? &$opcode($mod,$args) : "\t$mnemonic$mod\t$args";
 }
 
+if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1`
+       =~ /GNU assembler/) {
+    $gnuas = 1;
+}
+
 foreach (split("\n",$code)) {
        s/\`([^\`]*)\`/eval $1/ge;
        # flip word order in 64-bit mode...
@@ -995,7 +996,10 @@ foreach (split("\n",$code)) {
        # assemble 2.0 instructions in 32-bit mode...
        s/^\s+([a-z]+)([\S]*)\s+([\S]*)/&assemble($1,$2,$3)/e if ($BN_SZ==4);
 
-       s/\bbv\b/bve/gm if ($SIZE_T==8);
+       s/(\.LEVEL\s+2\.0)W/$1w/        if ($gnuas && $SIZE_T==8);
+       s/\.SPACE\s+\$TEXT\$/.text/     if ($gnuas && $SIZE_T==8);
+       s/\.SUBSPA.*//                  if ($gnuas && $SIZE_T==8);
+       s/\bbv\b/bve/                   if ($SIZE_T==8);
 
        print $_,"\n";
 }