Update copyright year
[openssl.git] / crypto / aes / asm / aesv8-armx.pl
index 9844ca1aabc97aedfd5e405c4522a077ad8420d0..eec0ed230a8886a26dd79df821574dcf2bc0139c 100755 (executable)
@@ -1,4 +1,11 @@
-#!/usr/bin/env perl
+#! /usr/bin/env perl
+# Copyright 2014-2019 The OpenSSL Project Authors. All Rights Reserved.
+#
+# Licensed under the OpenSSL license (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@openssl.org> for the OpenSSL
@@ -27,6 +34,8 @@
 # Cortex-A53   1.32            1.29            1.46
 # Cortex-A57(*)        1.95            0.85            0.93
 # Denver       1.96            0.86            0.80
+# Mongoose     1.33            1.20            1.20
+# Kryo         1.26            0.94            1.00
 #
 # (*)  original 3.64/1.34/1.32 results were for r0p0 revision
 #      and are still same even for updated module;
@@ -51,9 +60,12 @@ $code=<<___;
 .text
 ___
 $code.=".arch  armv8-a+crypto\n"                       if ($flavour =~ /64/);
-$code.=".arch  armv7-a\n.fpu   neon\n.code     32\n"   if ($flavour !~ /64/);
-               #^^^^^^ this is done to simplify adoption by not depending
-               #       on latest binutils.
+$code.=<<___                                           if ($flavour !~ /64/);
+.arch  armv7-a // don't confuse not-so-latest binutils with argv8 :-)
+.fpu   neon
+.code  32
+#undef __thumb2__
+___
 
 # Assembler mnemonics are an eclectic mix of 32- and 64-bit syntax,
 # NEON is mostly 32-bit mnemonics, integer - mostly 64. Goal is to
@@ -250,6 +262,7 @@ $code.=<<___;
 ${prefix}_set_decrypt_key:
 ___
 $code.=<<___   if ($flavour =~ /64/);
+       .inst   0xd503233f              // paciasp
        stp     x29,x30,[sp,#-16]!
        add     x29,sp,#0
 ___
@@ -293,6 +306,7 @@ $code.=<<___        if ($flavour !~ /64/);
 ___
 $code.=<<___   if ($flavour =~ /64/);
        ldp     x29,x30,[sp],#16
+       .inst   0xd50323bf              // autiasp
        ret
 ___
 $code.=<<___;
@@ -918,7 +932,7 @@ if ($flavour =~ /64/) {                     ######## 64-bit code
        s/^(\s+)v/$1/o          or      # strip off v prefix
        s/\bbx\s+lr\b/ret/o;
 
-       # fix up remainig legacy suffixes
+       # fix up remaining legacy suffixes
        s/\.[ui]?8//o;
        m/\],#8/o and s/\.16b/\.8b/go;
        s/\.[ui]?32//o and s/\.16b/\.4s/go;
@@ -953,21 +967,21 @@ if ($flavour =~ /64/) {                   ######## 64-bit code
 
        $arg =~ m/q([0-9]+),\s*\{q([0-9]+)\},\s*q([0-9]+)/o &&
        sprintf "vtbl.8 d%d,{q%d},d%d\n\t".
-               "vtbl.8 d%d,{q%d},d%d", 2*$1,$2,2*$3, 2*$1+1,$2,2*$3+1; 
+               "vtbl.8 d%d,{q%d},d%d", 2*$1,$2,2*$3, 2*$1+1,$2,2*$3+1;
     }
 
     sub unvdup32 {
        my $arg=shift;
 
        $arg =~ m/q([0-9]+),\s*q([0-9]+)\[([0-3])\]/o &&
-       sprintf "vdup.32        q%d,d%d[%d]",$1,2*$2+($3>>1),$3&1;      
+       sprintf "vdup.32        q%d,d%d[%d]",$1,2*$2+($3>>1),$3&1;
     }
 
     sub unvmov32 {
        my $arg=shift;
 
        $arg =~ m/q([0-9]+)\[([0-3])\],(.*)/o &&
-       sprintf "vmov.32        d%d[%d],%s",2*$1+($2>>1),$2&1,$3;       
+       sprintf "vmov.32        d%d[%d],%s",2*$1+($2>>1),$2&1,$3;
     }
 
     foreach(split("\n",$code)) {
@@ -977,7 +991,7 @@ if ($flavour =~ /64/) {                     ######## 64-bit code
        s/\bv([0-9])\.[12468]+[bsd]\b/q$1/go;   # new->old registers
        s/\/\/\s?/@ /o;                         # new->old style commentary
 
-       # fix up remainig new-style suffixes
+       # fix up remaining new-style suffixes
        s/\{q([0-9]+)\},\s*\[(.+)\],#8/sprintf "{d%d},[$2]!",2*$1/eo    or
        s/\],#[0-9]+/]!/o;