Unify all assembler file generators

They now generally conform to the following argument sequence:

    script.pl "$(PERLASM_SCHEME)" [ C preprocessor arguments ... ] \
              $(PROCESSOR) <output file>

However, in the spirit of being able to use these scripts manually,
they also allow for no argument, or for only the flavour, or for only
the output file.  This is done by only using the last argument as
output file if it's a file (it has an extension), and only using the
first argument as flavour if it isn't a file (it doesn't have an
extension).

While we're at it, we make all $xlate calls the same, i.e. the $output
argument is always quoted, and we always die on error when trying to
start $xlate.

There's a perl lesson in this, regarding operator priority...

This will always succeed, even when it fails:

    open FOO, "something" || die "ERR: $!";

The reason is that '||' has higher priority than list operators (a
function is essentially a list operator and gobbles up everything
following it that isn't lower priority), and since a non-empty string
is always true, so that ends up being exactly the same as:

    open FOO, "something";

This, however, will fail if "something" can't be opened:

    open FOO, "something" or die "ERR: $!";

The reason is that 'or' has lower priority that list operators,
i.e. it's performed after the 'open' call.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9884)
This commit is contained in:
Richard Levitte 2019-09-13 00:06:46 +02:00
parent a1c8befd66
commit 1aa89a7a3a
165 changed files with 677 additions and 481 deletions

View file

@ -198,9 +198,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
push(@INC,"${dir}","${dir}../../perlasm"); push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl"; require "x86asm.pl";
$output = pop; $output = pop and open STDOUT,">$output";
open OUT,">$output";
*STDOUT=*OUT;
&asm_init($ARGV[0],$x86only = $ARGV[$#ARGV] eq "386"); &asm_init($ARGV[0],$x86only = $ARGV[$#ARGV] eq "386");
&static_label("AES_Te"); &static_label("AES_Te");

View file

@ -39,9 +39,10 @@
# Profiler-assisted and platform-specific optimization resulted in 16% # Profiler-assisted and platform-specific optimization resulted in 16%
# improvement on Cortex A8 core and ~21.5 cycles per byte. # improvement on Cortex A8 core and ~21.5 cycles per byte.
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
if ($flavour=~/\w[\w\-]*\.\w+$/) { $output=$flavour; undef $flavour; } # $flavour is the first argument if it doesn't look like a file
else { while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour && $flavour ne "void") { if ($flavour && $flavour ne "void") {
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
@ -49,9 +50,10 @@ if ($flavour && $flavour ne "void") {
( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or
die "can't locate arm-xlate.pl"; die "can't locate arm-xlate.pl";
open STDOUT,"| \"$^X\" $xlate $flavour $output"; open STDOUT,"| \"$^X\" $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
} else { } else {
open STDOUT,">$output"; $output and open STDOUT,">$output";
} }
$s0="r0"; $s0="r0";

View file

@ -37,8 +37,7 @@
# cost of 8x increased pressure on L1D. 8x because you'd have # cost of 8x increased pressure on L1D. 8x because you'd have
# to interleave both Te and Td tables... # to interleave both Te and Td tables...
while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
($TEA,$TEB)=("A5","B5"); ($TEA,$TEB)=("A5","B5");
($KPA,$KPB)=("A3","B1"); ($KPA,$KPB)=("A3","B1");

View file

@ -65,8 +65,12 @@
# ($t0,$t1,$t2,$t3,$t8,$t9)=map("\$$_",(12..15,24,25)); # ($t0,$t1,$t2,$t3,$t8,$t9)=map("\$$_",(12..15,24,25));
# ($s0,$s1,$s2,$s3,$s4,$s5,$s6,$s7)=map("\$$_",(16..23)); # ($s0,$s1,$s2,$s3,$s4,$s5,$s6,$s7)=map("\$$_",(16..23));
# ($gp,$sp,$fp,$ra)=map("\$$_",(28..31)); # ($gp,$sp,$fp,$ra)=map("\$$_",(28..31));
#
$flavour = shift || "o32"; # supported flavours are o32,n32,64,nubi32,nubi64 # $output is the last argument if it looks like a file (it has an extension)
# $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$flavour ||= "o32"; # supported flavours are o32,n32,64,nubi32,nubi64
if ($flavour =~ /64|n32/i) { if ($flavour =~ /64|n32/i) {
$PTR_LA="dla"; $PTR_LA="dla";
@ -95,17 +99,13 @@ $pf = ($flavour =~ /nubi/i) ? $t0 : $t2;
$big_endian=(`echo MIPSEB | $ENV{CC} -E -`=~/MIPSEB/)?0:1 if ($ENV{CC}); $big_endian=(`echo MIPSEB | $ENV{CC} -E -`=~/MIPSEB/)?0:1 if ($ENV{CC});
for (@ARGV) { $output=$_ if (/\w[\w\-]*\.\w+$/); }
open STDOUT,">$output";
if (!defined($big_endian)) if (!defined($big_endian))
{ $big_endian=(unpack('L',pack('N',1))==1); } { $big_endian=(unpack('L',pack('N',1))==1); }
while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {}
open STDOUT,">$output";
my ($MSB,$LSB)=(0,3); # automatically converted to little-endian my ($MSB,$LSB)=(0,3); # automatically converted to little-endian
$output and open STDOUT,">$output";
$code.=<<___; $code.=<<___;
#include "mips_arch.h" #include "mips_arch.h"

View file

@ -28,9 +28,12 @@
# #
# Special thanks to polarhome.com for providing HP-UX account. # Special thanks to polarhome.com for providing HP-UX account.
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
open STDOUT,">$output"; $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$output and open STDOUT,">$output";
if ($flavour =~ /64/) { if ($flavour =~ /64/) {
$LEVEL ="2.0W"; $LEVEL ="2.0W";

View file

@ -36,7 +36,10 @@
# ppc_AES_encrypt_compact operates at 42 cycles per byte, while # ppc_AES_encrypt_compact operates at 42 cycles per byte, while
# ppc_AES_decrypt_compact - at 55 (in 64-bit build). # ppc_AES_decrypt_compact - at 55 (in 64-bit build).
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
# $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour =~ /64/) { if ($flavour =~ /64/) {
$SIZE_T =8; $SIZE_T =8;
@ -59,7 +62,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
die "can't locate ppc-xlate.pl"; die "can't locate ppc-xlate.pl";
open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!"; open STDOUT,"| $^X $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
$FRAME=32*$SIZE_T; $FRAME=32*$SIZE_T;

View file

@ -89,7 +89,10 @@
# instructions, which deliver ~70% improvement at 8KB block size over # instructions, which deliver ~70% improvement at 8KB block size over
# vanilla km-based code, 37% - at most like 512-bytes block size. # vanilla km-based code, 37% - at most like 512-bytes block size.
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
# $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour =~ /3[12]/) { if ($flavour =~ /3[12]/) {
$SIZE_T=4; $SIZE_T=4;
@ -99,8 +102,7 @@ if ($flavour =~ /3[12]/) {
$g="g"; $g="g";
} }
while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} $output and open STDOUT,">$output";
open STDOUT,">$output";
$softonly=0; # allow hardware support $softonly=0; # allow hardware support

View file

@ -37,8 +37,7 @@
# optimal decrypt procedure]. Compared to GNU C generated code both # optimal decrypt procedure]. Compared to GNU C generated code both
# procedures are more than 60% faster:-) # procedures are more than 60% faster:-)
$output = pop; $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
$frame="STACK_FRAME"; $frame="STACK_FRAME";
$bias="STACK_BIAS"; $bias="STACK_BIAS";

View file

@ -33,9 +33,10 @@
# #
# (*) with hyper-threading off # (*) with hyper-threading off
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
@ -44,7 +45,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
die "can't locate x86_64-xlate.pl"; die "can't locate x86_64-xlate.pl";
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
$verticalspin=1; # unlike 32-bit version $verticalspin performs $verticalspin=1; # unlike 32-bit version $verticalspin performs

View file

@ -33,8 +33,7 @@
# instructions and improve single-block and short-input performance # instructions and improve single-block and short-input performance
# with misaligned data. # with misaligned data.
$output = pop; $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
{ {
my ($inp,$out,$key,$rounds,$tmp,$mask) = map("%o$_",(0..5)); my ($inp,$out,$key,$rounds,$tmp,$mask) = map("%o$_",(0..5));

View file

@ -42,9 +42,10 @@
# (*) Sandy/Ivy Bridge are known to handle high interleave factors # (*) Sandy/Ivy Bridge are known to handle high interleave factors
# suboptimally; # suboptimally;
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
@ -74,7 +75,8 @@ if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([
$avx = ($2>=3.0) + ($2>3.0); $avx = ($2>=3.0) + ($2>3.0);
} }
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
# void aesni_multi_cbc_encrypt ( # void aesni_multi_cbc_encrypt (

View file

@ -88,9 +88,10 @@
# (**) Execution is fully dominated by integer code sequence and # (**) Execution is fully dominated by integer code sequence and
# SIMD still hardly shows [in single-process benchmark;-] # SIMD still hardly shows [in single-process benchmark;-]
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
@ -114,7 +115,8 @@ $shaext=1; ### set to zero if compiling for 1.0.1
$stitched_decrypt=0; $stitched_decrypt=0;
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
# void aesni_cbc_sha1_enc(const void *inp, # void aesni_cbc_sha1_enc(const void *inp,

View file

@ -44,9 +44,10 @@
# -evp aes-256-cbc-hmac-sha256' will vary by percent or two; # -evp aes-256-cbc-hmac-sha256' will vary by percent or two;
# (***) these are SHAEXT results; # (***) these are SHAEXT results;
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
@ -77,7 +78,8 @@ if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([
$shaext=$avx; ### set to zero if compiling for 1.0.1 $shaext=$avx; ### set to zero if compiling for 1.0.1
$avx=1 if (!$shaext && $avx); $avx=1 if (!$shaext && $avx);
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
$func="aesni_cbc_sha256_enc"; $func="aesni_cbc_sha256_enc";

View file

@ -76,9 +76,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
push(@INC,"${dir}","${dir}../../perlasm"); push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl"; require "x86asm.pl";
$output = pop; $output = pop and open STDOUT,">$output";
open OUT,">$output";
*STDOUT=*OUT;
&asm_init($ARGV[0]); &asm_init($ARGV[0]);

View file

@ -192,9 +192,10 @@ $PREFIX="aesni"; # if $PREFIX is set to "AES", the script
# generates drop-in replacement for # generates drop-in replacement for
# crypto/aes/asm/aes-x86_64.pl:-) # crypto/aes/asm/aes-x86_64.pl:-)
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
@ -203,7 +204,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
die "can't locate x86_64-xlate.pl"; die "can't locate x86_64-xlate.pl";
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
$movkey = $PREFIX eq "aesni" ? "movups" : "movups"; $movkey = $PREFIX eq "aesni" ? "movups" : "movups";

View file

@ -43,7 +43,10 @@
# POWER9[le] 4.02/0.86 0.84 1.05 # POWER9[le] 4.02/0.86 0.84 1.05
# POWER9[be] 3.99/0.78 0.79 0.97 # POWER9[be] 3.99/0.78 0.79 0.97
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
# $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour =~ /64/) { if ($flavour =~ /64/) {
$SIZE_T =8; $SIZE_T =8;
@ -70,7 +73,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
die "can't locate ppc-xlate.pl"; die "can't locate ppc-xlate.pl";
open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!"; open STDOUT,"| $^X $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
$FRAME=8*$SIZE_T; $FRAME=8*$SIZE_T;
$prefix="aes_p8"; $prefix="aes_p8";

View file

@ -75,8 +75,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
push(@INC,"${dir}","${dir}../../perlasm"); push(@INC,"${dir}","${dir}../../perlasm");
require "sparcv9_modes.pl"; require "sparcv9_modes.pl";
$output = pop; $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
$::evp=1; # if $evp is set to 0, script generates module with $::evp=1; # if $evp is set to 0, script generates module with
# AES_[en|de]crypt, AES_set_[en|de]crypt_key and AES_cbc_encrypt entry # AES_[en|de]crypt, AES_set_[en|de]crypt_key and AES_cbc_encrypt entry

View file

@ -56,15 +56,18 @@
# (**) numbers after slash are for 32-bit code, which is 3x- # (**) numbers after slash are for 32-bit code, which is 3x-
# interleaved; # interleaved;
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or ( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or
( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or
die "can't locate arm-xlate.pl"; die "can't locate arm-xlate.pl";
open OUT,"| \"$^X\" $xlate $flavour $output"; open OUT,"| \"$^X\" $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
$prefix="aes_v8"; $prefix="aes_v8";

View file

@ -50,9 +50,10 @@
# April-August 2013 # April-August 2013
# Add CBC, CTR and XTS subroutines and adapt for kernel use; courtesy of Ard. # Add CBC, CTR and XTS subroutines and adapt for kernel use; courtesy of Ard.
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
if ($flavour=~/\w[\w\-]*\.\w+$/) { $output=$flavour; undef $flavour; } # $flavour is the first argument if it doesn't look like a file
else { while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour && $flavour ne "void") { if ($flavour && $flavour ne "void") {
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
@ -60,9 +61,10 @@ if ($flavour && $flavour ne "void") {
( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or
die "can't locate arm-xlate.pl"; die "can't locate arm-xlate.pl";
open STDOUT,"| \"$^X\" $xlate $flavour $output"; open STDOUT,"| \"$^X\" $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
} else { } else {
open STDOUT,">$output"; $output and open STDOUT,">$output";
} }
my ($inp,$out,$len,$key)=("r0","r1","r2","r3"); my ($inp,$out,$len,$key)=("r0","r1","r2","r3");

View file

@ -97,9 +97,10 @@
# #
# <appro@openssl.org> # <appro@openssl.org>
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
@ -108,7 +109,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
die "can't locate x86_64-xlate.pl"; die "can't locate x86_64-xlate.pl";
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
my ($inp,$out,$len,$key,$ivp)=("%rdi","%rsi","%rdx","%rcx"); my ($inp,$out,$len,$key,$ivp)=("%rdi","%rsi","%rdx","%rcx");

View file

@ -38,15 +38,18 @@
# code, but it's constant-time and therefore preferred; # code, but it's constant-time and therefore preferred;
# (***) presented for reference/comparison purposes; # (***) presented for reference/comparison purposes;
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} # $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or ( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or
( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or
die "can't locate arm-xlate.pl"; die "can't locate arm-xlate.pl";
open OUT,"| \"$^X\" $xlate $flavour $output"; open OUT,"| \"$^X\" $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
$code.=<<___; $code.=<<___;

View file

@ -35,7 +35,10 @@
# (**) Inadequate POWER6 performance is due to astronomic AltiVec # (**) Inadequate POWER6 performance is due to astronomic AltiVec
# latency, 9 cycles per simple logical operation. # latency, 9 cycles per simple logical operation.
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
# $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour =~ /64/) { if ($flavour =~ /64/) {
$SIZE_T =8; $SIZE_T =8;
@ -61,7 +64,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
die "can't locate ppc-xlate.pl"; die "can't locate ppc-xlate.pl";
open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!"; open STDOUT,"| $^X $xlate $flavour \"$output\""
|| die "can't call $xlate: $!";
$code.=<<___; $code.=<<___;
.machine "any" .machine "any"

View file

@ -58,9 +58,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
push(@INC,"${dir}","${dir}../../perlasm"); push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl"; require "x86asm.pl";
$output = pop; $output = pop and open STDOUT,">$output";
open OUT,">$output";
*STDOUT=*OUT;
&asm_init($ARGV[0],$x86only = $ARGV[$#ARGV] eq "386"); &asm_init($ARGV[0],$x86only = $ARGV[$#ARGV] eq "386");

View file

@ -54,9 +54,10 @@
# #
# <appro@openssl.org> # <appro@openssl.org>
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
@ -65,7 +66,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
die "can't locate x86_64-xlate.pl"; die "can't locate x86_64-xlate.pl";
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
$PREFIX="vpaes"; $PREFIX="vpaes";

View file

@ -7,8 +7,7 @@
# https://www.openssl.org/source/license.html # https://www.openssl.org/source/license.html
$output = pop; $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
print <<'___'; print <<'___';
.text .text

View file

@ -7,15 +7,18 @@
# https://www.openssl.org/source/license.html # https://www.openssl.org/source/license.html
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or ( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or
( $xlate="${dir}perlasm/arm-xlate.pl" and -f $xlate) or ( $xlate="${dir}perlasm/arm-xlate.pl" and -f $xlate) or
die "can't locate arm-xlate.pl"; die "can't locate arm-xlate.pl";
open OUT,"| \"$^X\" $xlate $flavour $output"; open OUT,"| \"$^X\" $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
$code.=<<___; $code.=<<___;

View file

@ -7,15 +7,18 @@
# https://www.openssl.org/source/license.html # https://www.openssl.org/source/license.html
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or ( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or
( $xlate="${dir}perlasm/arm-xlate.pl" and -f $xlate) or ( $xlate="${dir}perlasm/arm-xlate.pl" and -f $xlate) or
die "can't locate arm-xlate.pl"; die "can't locate arm-xlate.pl";
open OUT,"| \"$^X\" $xlate $flavour $output"; open OUT,"| \"$^X\" $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
$code.=<<___; $code.=<<___;

View file

@ -12,8 +12,7 @@ push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl"; require "x86asm.pl";
require "cbc.pl"; require "cbc.pl";
$output = pop; $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
&asm_init($ARGV[0],$ARGV[$#ARGV] eq "386"); &asm_init($ARGV[0],$ARGV[$#ARGV] eq "386");

View file

@ -22,8 +22,7 @@
# I.e. if you compare 1GHz 21264 and 2GHz Opteron, you'll observe ~2x # I.e. if you compare 1GHz 21264 and 2GHz Opteron, you'll observe ~2x
# difference. # difference.
$output=pop; $output=pop and open STDOUT,">$output";
open STDOUT,">$output";
# int bn_mul_mont( # int bn_mul_mont(
$rp="a0"; # BN_ULONG *rp, $rp="a0"; # BN_ULONG *rp,

View file

@ -39,9 +39,10 @@
# #
# http://conradoplg.cryptoland.net/files/2010/12/mocrysen13.pdf # http://conradoplg.cryptoland.net/files/2010/12/mocrysen13.pdf
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
if ($flavour=~/\w[\w\-]*\.\w+$/) { $output=$flavour; undef $flavour; } # $flavour is the first argument if it doesn't look like a file
else { while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour && $flavour ne "void") { if ($flavour && $flavour ne "void") {
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
@ -49,9 +50,10 @@ if ($flavour && $flavour ne "void") {
( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or
die "can't locate arm-xlate.pl"; die "can't locate arm-xlate.pl";
open STDOUT,"| \"$^X\" $xlate $flavour $output"; open STDOUT,"| \"$^X\" $xlate $flavour \"$output\""
or die "can't call $xlate: $1";
} else { } else {
open STDOUT,">$output"; $output and open STDOUT,">$output";
} }
$code=<<___; $code=<<___;

View file

@ -54,9 +54,10 @@
# integer-only on Cortex-A8, ~10-210% on Cortex-A15, ~70-450% on # integer-only on Cortex-A8, ~10-210% on Cortex-A15, ~70-450% on
# Snapdragon S4. # Snapdragon S4.
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
if ($flavour=~/\w[\w\-]*\.\w+$/) { $output=$flavour; undef $flavour; } # $flavour is the first argument if it doesn't look like a file
else { while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} } my $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
my $flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour && $flavour ne "void") { if ($flavour && $flavour ne "void") {
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
@ -64,9 +65,10 @@ if ($flavour && $flavour ne "void") {
( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or
die "can't locate arm-xlate.pl"; die "can't locate arm-xlate.pl";
open STDOUT,"| \"$^X\" $xlate $flavour $output"; open STDOUT,"| \"$^X\" $xlate $flavour \"$output\""
or die "can't call $xlate: $1";
} else { } else {
open STDOUT,">$output"; $output and open STDOUT,">$output";
} }
$num="r0"; # starts as num argument, but holds &tp[num-1] $num="r0"; # starts as num argument, but holds &tp[num-1]

View file

@ -40,15 +40,18 @@
# 50-70% improvement for RSA4096 sign. RSA2048 sign is ~25% faster # 50-70% improvement for RSA4096 sign. RSA2048 sign is ~25% faster
# on Cortex-A57 and ~60-100% faster on others. # on Cortex-A57 and ~60-100% faster on others.
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
my $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
my $flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or ( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or
( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or
die "can't locate arm-xlate.pl"; die "can't locate arm-xlate.pl";
open OUT,"| \"$^X\" $xlate $flavour $output"; open OUT,"| \"$^X\" $xlate $flavour \"$output\""
or die "can't call $xlate: $1";
*STDOUT=*OUT; *STDOUT=*OUT;
($lo0,$hi0,$aj,$m0,$alo,$ahi, ($lo0,$hi0,$aj,$m0,$alo,$ahi,

View file

@ -11,8 +11,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
push(@INC,"${dir}","${dir}../../perlasm"); push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl"; require "x86asm.pl";
$output = pop; $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
&asm_init($ARGV[0]); &asm_init($ARGV[0]);

View file

@ -23,8 +23,7 @@
# totally unfair, because this module utilizes Galois Field Multiply # totally unfair, because this module utilizes Galois Field Multiply
# instruction. # instruction.
while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
($rp,$a1,$a0,$b1,$b0)=("A4","B4","A6","B6","A8"); # argument vector ($rp,$a1,$a0,$b1,$b0)=("A4","B4","A6","B6","A8"); # argument vector

View file

@ -10,8 +10,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
push(@INC,"${dir}","${dir}../../perlasm"); push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl"; require "x86asm.pl";
$output = pop; $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
&asm_init($ARGV[0]); &asm_init($ARGV[0]);

View file

@ -67,7 +67,8 @@
# hereafter less for longer keys, while verify - by 74-13%. # hereafter less for longer keys, while verify - by 74-13%.
# DSA performance improves by 115-30%. # DSA performance improves by 115-30%.
$output=pop; # $output is the last argument if it looks like a file (it has an extension)
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
if ($^O eq "hpux") { if ($^O eq "hpux") {
$ADDP="addp4"; $ADDP="addp4";

View file

@ -52,8 +52,12 @@
# ($t0,$t1,$t2,$t3,$t8,$t9)=map("\$$_",(12..15,24,25)); # ($t0,$t1,$t2,$t3,$t8,$t9)=map("\$$_",(12..15,24,25));
# ($s0,$s1,$s2,$s3,$s4,$s5,$s6,$s7)=map("\$$_",(16..23)); # ($s0,$s1,$s2,$s3,$s4,$s5,$s6,$s7)=map("\$$_",(16..23));
# ($gp,$sp,$fp,$ra)=map("\$$_",(28..31)); # ($gp,$sp,$fp,$ra)=map("\$$_",(28..31));
#
$flavour = shift || "o32"; # supported flavours are o32,n32,64,nubi32,nubi64 # $output is the last argument if it looks like a file (it has an extension)
# $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
# supported flavours are o32,n32,64,nubi32,nubi64, default is o32
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : "o32";
if ($flavour =~ /64|n32/i) { if ($flavour =~ /64|n32/i) {
$PTR_ADD="daddu"; # incidentally works even on n32 $PTR_ADD="daddu"; # incidentally works even on n32
@ -74,8 +78,7 @@ $SAVED_REGS_MASK = ($flavour =~ /nubi/i) ? 0x00fff000 : 0x00ff0000;
# #
###################################################################### ######################################################################
while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} $output and open STDOUT,">$output";
open STDOUT,">$output";
if ($flavour =~ /64|n32/i) { if ($flavour =~ /64|n32/i) {
$LD="ld"; $LD="ld";

View file

@ -54,9 +54,10 @@
# has to content with 40-85% improvement depending on benchmark and # has to content with 40-85% improvement depending on benchmark and
# key length, more for longer keys. # key length, more for longer keys.
$flavour = shift || "o32"; # $output is the last argument if it looks like a file (it has an extension)
while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} # $flavour is the first argument if it doesn't look like a file
open STDOUT,">$output"; $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : "o32";
if ($flavour =~ /64|n32/i) { if ($flavour =~ /64|n32/i) {
$LD="ld"; $LD="ld";
@ -91,6 +92,8 @@ if ($flavour =~ /64|n32/i) {
$code="#if !(defined (__mips_isa_rev) && (__mips_isa_rev >= 6))\n.set mips2\n#endif\n"; $code="#if !(defined (__mips_isa_rev) && (__mips_isa_rev >= 6))\n.set mips2\n#endif\n";
} }
$output and open STDOUT,">$output";
# Below is N32/64 register layout used in the original module. # Below is N32/64 register layout used in the original module.
# #
($zero,$at,$v0,$v1)=map("\$$_",(0..3)); ($zero,$at,$v0,$v1)=map("\$$_",(0..3));

View file

@ -69,10 +69,12 @@
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
open STDOUT,">$output"; $output and open STDOUT,">$output";
if ($flavour =~ /64/) { if ($flavour =~ /64/) {
$LEVEL ="2.0W"; $LEVEL ="2.0W";

View file

@ -41,7 +41,10 @@
# builds. On low-end 32-bit processors performance improvement turned # builds. On low-end 32-bit processors performance improvement turned
# to be marginal... # to be marginal...
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
# $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour =~ /32/) { if ($flavour =~ /32/) {
$BITS= 32; $BITS= 32;
@ -94,7 +97,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
die "can't locate ppc-xlate.pl"; die "can't locate ppc-xlate.pl";
open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!"; open STDOUT,"| $^X $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
$sp="r1"; $sp="r1";
$toc="r2"; $toc="r2";

View file

@ -103,7 +103,10 @@
# Performance increase of ~60% # Performance increase of ~60%
# Based on submission from Suresh N. Chari of IBM # Based on submission from Suresh N. Chari of IBM
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
# $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour =~ /32/) { if ($flavour =~ /32/) {
$BITS= 32; $BITS= 32;
@ -159,7 +162,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
die "can't locate ppc-xlate.pl"; die "can't locate ppc-xlate.pl";
open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!"; open STDOUT,"| $^X $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
$data=<<EOF; $data=<<EOF;
#-------------------------------------------------------------------- #--------------------------------------------------------------------

View file

@ -80,7 +80,10 @@
# ppc-mont.pl, but improvement coefficient is not as impressive # ppc-mont.pl, but improvement coefficient is not as impressive
# for longer keys... # for longer keys...
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
# $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour =~ /32/) { if ($flavour =~ /32/) {
$SIZE_T=4; $SIZE_T=4;
@ -108,7 +111,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
die "can't locate ppc-xlate.pl"; die "can't locate ppc-xlate.pl";
open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!"; open STDOUT,"| $^X $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
$FRAME=64; # padded frame header $FRAME=64; # padded frame header
$TRANSFER=16*8; $TRANSFER=16*8;

View file

@ -37,9 +37,10 @@
# (***) scalar AD*X code is faster than AVX2 and is preferred code # (***) scalar AD*X code is faster than AVX2 and is preferred code
# path for Broadwell; # path for Broadwell;
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
@ -72,7 +73,8 @@ if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|based on LLVM) ([3-
$addx = ($ver>=3.03); $addx = ($ver>=3.03);
} }
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT = *OUT; *STDOUT = *OUT;
if ($avx>1) {{{ if ($avx>1) {{{

View file

@ -52,9 +52,10 @@
# purposes; # purposes;
# (**) MULX was attempted, but found to give only marginal improvement; # (**) MULX was attempted, but found to give only marginal improvement;
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
@ -63,7 +64,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
die "can't locate x86_64-xlate.pl"; die "can't locate x86_64-xlate.pl";
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1` if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1`

View file

@ -32,7 +32,10 @@
# so that improvement coefficients can vary from one specific # so that improvement coefficients can vary from one specific
# setup to another. # setup to another.
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
# $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour =~ /3[12]/) { if ($flavour =~ /3[12]/) {
$SIZE_T=4; $SIZE_T=4;
@ -42,8 +45,7 @@ if ($flavour =~ /3[12]/) {
$g="g"; $g="g";
} }
while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} $output and open STDOUT,">$output";
open STDOUT,">$output";
$stdframe=16*$SIZE_T+4*8; $stdframe=16*$SIZE_T+4*8;

View file

@ -51,7 +51,10 @@
# On z990 it was measured to perform 2.6-2.2 times better than # On z990 it was measured to perform 2.6-2.2 times better than
# compiler-generated code, less for longer keys... # compiler-generated code, less for longer keys...
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
# $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour =~ /3[12]/) { if ($flavour =~ /3[12]/) {
$SIZE_T=4; $SIZE_T=4;
@ -61,8 +64,7 @@ if ($flavour =~ /3[12]/) {
$g="g"; $g="g";
} }
while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} $output and open STDOUT,">$output";
open STDOUT,">$output";
$stdframe=16*$SIZE_T+4*8; $stdframe=16*$SIZE_T+4*8;

View file

@ -83,8 +83,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
push(@INC,"${dir}","${dir}../../perlasm"); push(@INC,"${dir}","${dir}../../perlasm");
require "sparcv9_modes.pl"; require "sparcv9_modes.pl";
$output = pop; $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
$code.=<<___; $code.=<<___;
#include "sparc_arch.h" #include "sparc_arch.h"

View file

@ -25,8 +25,7 @@
# ~100-230% faster than gcc-generated code and ~35-90% faster than # ~100-230% faster than gcc-generated code and ~35-90% faster than
# the pure SPARCv9 code path. # the pure SPARCv9 code path.
$output = pop; $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
$locals=16*8; $locals=16*8;

View file

@ -49,8 +49,7 @@
# module still have hidden potential [see TODO list there], which is # module still have hidden potential [see TODO list there], which is
# estimated to be larger than 20%... # estimated to be larger than 20%...
$output = pop; $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
# int bn_mul_mont( # int bn_mul_mont(
$rp="%i0"; # BN_ULONG *rp, $rp="%i0"; # BN_ULONG *rp,

View file

@ -62,8 +62,10 @@
# key length, more for longer keys] on USI&II cores and 30-80% - on # key length, more for longer keys] on USI&II cores and 30-80% - on
# USIII&IV. # USIII&IV.
$output = pop; # $output is the last argument if it looks like a file (it has an extension)
open STDOUT,">$output"; $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$output and open STDOUT,">$output";
$fname="bn_mul_mont_fpu"; $fname="bn_mul_mont_fpu";

View file

@ -88,8 +88,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
push(@INC,"${dir}","${dir}../../perlasm"); push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl"; require "x86asm.pl";
$output = pop; $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
&asm_init($ARGV[0]); &asm_init($ARGV[0]);

View file

@ -25,8 +25,7 @@
# for reference purposes, because T4 has dedicated Montgomery # for reference purposes, because T4 has dedicated Montgomery
# multiplication and squaring *instructions* that deliver even more. # multiplication and squaring *instructions* that deliver even more.
$output = pop; $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
$frame = "STACK_FRAME"; $frame = "STACK_FRAME";
$bias = "STACK_BIAS"; $bias = "STACK_BIAS";

View file

@ -43,8 +43,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
push(@INC,"${dir}","${dir}../../perlasm"); push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl"; require "x86asm.pl";
$output = pop; $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
&asm_init($ARGV[0],$x86only = $ARGV[$#ARGV] eq "386"); &asm_init($ARGV[0],$x86only = $ARGV[$#ARGV] eq "386");

View file

@ -37,8 +37,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
push(@INC,"${dir}","${dir}../../perlasm"); push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl"; require "x86asm.pl";
$output = pop; $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
&asm_init($ARGV[0]); &asm_init($ARGV[0]);

View file

@ -27,9 +27,10 @@
# these coefficients are not ones for bn_GF2m_mul_2x2 itself, as not # these coefficients are not ones for bn_GF2m_mul_2x2 itself, as not
# all CPU time is burnt in it... # all CPU time is burnt in it...
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
@ -38,7 +39,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
die "can't locate x86_64-xlate.pl"; die "can't locate x86_64-xlate.pl";
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
($lo,$hi)=("%rax","%rdx"); $a=$lo; ($lo,$hi)=("%rax","%rdx"); $a=$lo;

View file

@ -46,9 +46,10 @@
# #
# Add MULX/ADOX/ADCX code path. # Add MULX/ADOX/ADCX code path.
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
@ -57,7 +58,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
die "can't locate x86_64-xlate.pl"; die "can't locate x86_64-xlate.pl";
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1` if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1`

View file

@ -31,9 +31,10 @@
# the np argument is not just modulus value, but one interleaved # the np argument is not just modulus value, but one interleaved
# with 0. This is to optimize post-condition... # with 0. This is to optimize post-condition...
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
@ -42,7 +43,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
die "can't locate x86_64-xlate.pl"; die "can't locate x86_64-xlate.pl";
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1` if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1`

View file

@ -49,8 +49,7 @@ require "x86asm.pl";
$OPENSSL=1; $OPENSSL=1;
$output = pop; $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
&asm_init($ARGV[0],$ARGV[$#ARGV] eq "386"); &asm_init($ARGV[0],$ARGV[$#ARGV] eq "386");

View file

@ -36,9 +36,10 @@
# EM64T, pre-Core2 Intel x86_64 CPU, is not as impressive, because it # EM64T, pre-Core2 Intel x86_64 CPU, is not as impressive, because it
# apparently emulates some of 64-bit operations in [32-bit] microcode. # apparently emulates some of 64-bit operations in [32-bit] microcode.
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
@ -47,7 +48,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
die "can't locate x86_64-xlate.pl"; die "can't locate x86_64-xlate.pl";
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
sub hi() { my $r=shift; $r =~ s/%[er]([a-d])x/%\1h/; $r; } sub hi() { my $r=shift; $r =~ s/%[er]([a-d])x/%\1h/; $r; }

View file

@ -53,8 +53,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
push(@INC,"${dir}","${dir}../../perlasm"); push(@INC,"${dir}","${dir}../../perlasm");
require "sparcv9_modes.pl"; require "sparcv9_modes.pl";
$output = pop; $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
$::evp=1; # if $evp is set to 0, script generates module with $::evp=1; # if $evp is set to 0, script generates module with
# Camellia_[en|de]crypt, Camellia_set_key and Camellia_cbc_encrypt # Camellia_[en|de]crypt, Camellia_set_key and Camellia_cbc_encrypt

View file

@ -18,8 +18,7 @@ push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl"; require "x86asm.pl";
require "cbc.pl"; require "cbc.pl";
$output=pop; $output=pop and open STDOUT,">$output";
open STDOUT,">$output";
&asm_init($ARGV[0],$ARGV[$#ARGV] eq "386"); &asm_init($ARGV[0],$ARGV[$#ARGV] eq "386");

View file

@ -34,9 +34,10 @@
# but then Snapdragon S4 and Cortex-A8 results get # but then Snapdragon S4 and Cortex-A8 results get
# 20-25% worse; # 20-25% worse;
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
if ($flavour=~/\w[\w\-]*\.\w+$/) { $output=$flavour; undef $flavour; } # $flavour is the first argument if it doesn't look like a file
else { while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour && $flavour ne "void") { if ($flavour && $flavour ne "void") {
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
@ -44,9 +45,10 @@ if ($flavour && $flavour ne "void") {
( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or
die "can't locate arm-xlate.pl"; die "can't locate arm-xlate.pl";
open STDOUT,"| \"$^X\" $xlate $flavour $output"; open STDOUT,"| \"$^X\" $xlate $flavour $output"
or die "can't call $xlate: $!";
} else { } else {
open STDOUT,">$output"; $output and open STDOUT,">$output";
} }
sub AUTOLOAD() # thunk [simplified] x86-style perlasm sub AUTOLOAD() # thunk [simplified] x86-style perlasm

View file

@ -44,15 +44,18 @@
# #
# (*) slower than 4+1:-( # (*) slower than 4+1:-(
$flavour=shift; # $output is the last argument if it looks like a file (it has an extension)
$output=shift; # $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or ( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or
( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or
die "can't locate arm-xlate.pl"; die "can't locate arm-xlate.pl";
open OUT,"| \"$^X\" $xlate $flavour $output"; open OUT,"| \"$^X\" $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
sub AUTOLOAD() # thunk [simplified] x86-style perlasm sub AUTOLOAD() # thunk [simplified] x86-style perlasm

View file

@ -24,8 +24,7 @@
# dependent on input length. This module on the other hand is free # dependent on input length. This module on the other hand is free
# from such limitation. # from such limitation.
$output=pop; $output=pop and open STDOUT,">$output";
open STDOUT,">$output";
($OUT,$INP,$LEN,$KEYB,$COUNTERA)=("A4","B4","A6","B6","A8"); ($OUT,$INP,$LEN,$KEYB,$COUNTERA)=("A4","B4","A6","B6","A8");
($KEYA,$COUNTERB,$STEP)=("A7","B7","A3"); ($KEYA,$COUNTERB,$STEP)=("A7","B7","A3");

View file

@ -15,8 +15,7 @@
# pass runs slower than expected... Overall result is 15.6 cpb, two # pass runs slower than expected... Overall result is 15.6 cpb, two
# cycles more than theoretical estimate. # cycles more than theoretical estimate.
$output = pop; $output = pop and open STDOUT, ">$output";
open STDOUT, ">$output" if $output;
my @k = map("r$_",(16..31)); my @k = map("r$_",(16..31));
my @x = map("r$_",(38..53)); my @x = map("r$_",(38..53));

View file

@ -44,7 +44,10 @@
# instructions, which is why switch to vector-only code pays # instructions, which is why switch to vector-only code pays
# off that much; # off that much;
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
# $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour =~ /64/) { if ($flavour =~ /64/) {
$SIZE_T =8; $SIZE_T =8;
@ -69,7 +72,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
die "can't locate ppc-xlate.pl"; die "can't locate ppc-xlate.pl";
open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!"; open STDOUT,"| $^X $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
$LOCALS=6*$SIZE_T; $LOCALS=6*$SIZE_T;
$FRAME=$LOCALS+64+18*$SIZE_T; # 64 is for local variables $FRAME=$LOCALS+64+18*$SIZE_T; # 64 is for local variables

View file

@ -42,7 +42,10 @@ use FindBin qw($Bin);
use lib "$Bin/../.."; use lib "$Bin/../..";
use perlasm::s390x qw(:DEFAULT :VX :LD AUTOLOAD LABEL INCLUDE); use perlasm::s390x qw(:DEFAULT :VX :LD AUTOLOAD LABEL INCLUDE);
my $flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
# $flavour is the first argument if it doesn't look like a file
my $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
my $flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
my ($z,$SIZE_T); my ($z,$SIZE_T);
if ($flavour =~ /3[12]/) { if ($flavour =~ /3[12]/) {
@ -53,9 +56,6 @@ if ($flavour =~ /3[12]/) {
$SIZE_T=8; $SIZE_T=8;
} }
my $output;
while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {}
my $sp="%r15"; my $sp="%r15";
my $stdframe=16*$SIZE_T+4*8; my $stdframe=16*$SIZE_T+4*8;

View file

@ -40,8 +40,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
push(@INC,"${dir}","${dir}../../perlasm"); push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl"; require "x86asm.pl";
$output=pop; $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
&asm_init($ARGV[0],$ARGV[$#ARGV] eq "386"); &asm_init($ARGV[0],$ARGV[$#ARGV] eq "386");

View file

@ -58,9 +58,10 @@
# (vi) even though Skylake-X can execute AVX512F code and deliver 0.57 # (vi) even though Skylake-X can execute AVX512F code and deliver 0.57
# cpb in single thread, the corresponding capability is suppressed; # cpb in single thread, the corresponding capability is suppressed;
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
@ -89,7 +90,8 @@ if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([
$avx = ($2>=3.0) + ($2>3.0); $avx = ($2>=3.0) + ($2>3.0);
} }
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
# input parameter block # input parameter block

View file

@ -13,8 +13,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
push(@INC,"${dir}","${dir}../../perlasm"); push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl"; require "x86asm.pl";
$output=pop; $output=pop and open STDOUT,">$output";
open STDOUT,">$output";
&asm_init($ARGV[0]); &asm_init($ARGV[0]);

View file

@ -20,8 +20,7 @@ require "desboth.pl";
# format. # format.
# #
$output=pop; $output=pop and open STDOUT,">$output";
open STDOUT,">$output";
&asm_init($ARGV[0]); &asm_init($ARGV[0]);

View file

@ -34,8 +34,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
push(@INC,"${dir}","${dir}../../perlasm"); push(@INC,"${dir}","${dir}../../perlasm");
require "sparcv9_modes.pl"; require "sparcv9_modes.pl";
$output=pop; $output=pop and open STDOUT,">$output";
open STDOUT,">$output";
$code.=<<___; $code.=<<___;
#include "sparc_arch.h" #include "sparc_arch.h"

View file

@ -33,9 +33,10 @@
# on benchmark. Lower coefficients are for ECDSA sign, server-side # on benchmark. Lower coefficients are for ECDSA sign, server-side
# operation. Keep in mind that +200% means 3x improvement. # operation. Keep in mind that +200% means 3x improvement.
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
if ($flavour=~/\w[\w\-]*\.\w+$/) { $output=$flavour; undef $flavour; } # $flavour is the first argument if it doesn't look like a file
else { while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour && $flavour ne "void") { if ($flavour && $flavour ne "void") {
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
@ -43,9 +44,10 @@ if ($flavour && $flavour ne "void") {
( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or
die "can't locate arm-xlate.pl"; die "can't locate arm-xlate.pl";
open STDOUT,"| \"$^X\" $xlate $flavour $output"; open STDOUT,"| \"$^X\" $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
} else { } else {
open STDOUT,">$output"; $output and open STDOUT,">$output";
} }
$code.=<<___; $code.=<<___;

View file

@ -31,15 +31,18 @@
# on benchmark. Lower coefficients are for ECDSA sign, server-side # on benchmark. Lower coefficients are for ECDSA sign, server-side
# operation. Keep in mind that +400% means 5x improvement. # operation. Keep in mind that +400% means 5x improvement.
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} # $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or ( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or
( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or
die "can't locate arm-xlate.pl"; die "can't locate arm-xlate.pl";
open OUT,"| \"$^X\" $xlate $flavour $output"; open OUT,"| \"$^X\" $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
{ {

View file

@ -15,9 +15,10 @@
# S.Gueron and V.Krasnov, "Fast Prime Field Elliptic Curve Cryptography with # S.Gueron and V.Krasnov, "Fast Prime Field Elliptic Curve Cryptography with
# 256 Bit Primes" # 256 Bit Primes"
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
@ -26,7 +27,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
die "can't locate x86_64-xlate.pl"; die "can't locate x86_64-xlate.pl";
open OUT,"| \"$^X\" $xlate $flavour $output"; open OUT,"| \"$^X\" $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1` if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1`

View file

@ -25,15 +25,18 @@
# POWER7 +260-530% # POWER7 +260-530%
# POWER8 +220-340% # POWER8 +220-340%
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} # $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}ppc-xlate.pl" and -f $xlate ) or ( $xlate="${dir}ppc-xlate.pl" and -f $xlate ) or
( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
die "can't locate ppc-xlate.pl"; die "can't locate ppc-xlate.pl";
open OUT,"| \"$^X\" $xlate $flavour $output"; open OUT,"| \"$^X\" $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
my $sp="r1"; my $sp="r1";

View file

@ -31,8 +31,7 @@
# on benchmark. Lower coefficients are for ECDSA sign, server-side # on benchmark. Lower coefficients are for ECDSA sign, server-side
# operation. Keep in mind that +200% means 3x improvement. # operation. Keep in mind that +200% means 3x improvement.
$output = pop; $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
$code.=<<___; $code.=<<___;
#include "sparc_arch.h" #include "sparc_arch.h"

View file

@ -42,8 +42,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
push(@INC,"${dir}","${dir}../../perlasm"); push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl"; require "x86asm.pl";
$output=pop; $output=pop and open STDOUT,">$output";
open STDOUT,">$output";
&asm_init($ARGV[0],$ARGV[$#ARGV] eq "386"); &asm_init($ARGV[0],$ARGV[$#ARGV] eq "386");

View file

@ -40,9 +40,10 @@
# higher - for ECDSA sign, relatively fastest server-side operation. # higher - for ECDSA sign, relatively fastest server-side operation.
# Keep in mind that +100% means 2x improvement. # Keep in mind that +100% means 2x improvement.
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
@ -51,7 +52,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
die "can't locate x86_64-xlate.pl"; die "can't locate x86_64-xlate.pl";
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1` if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1`

View file

@ -27,15 +27,18 @@
# this module delivers more than 2x improvement, and when it does, # this module delivers more than 2x improvement, and when it does,
# from 12% to 30% improvement was measured... # from 12% to 30% improvement was measured...
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} # $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}ppc-xlate.pl" and -f $xlate ) or ( $xlate="${dir}ppc-xlate.pl" and -f $xlate ) or
( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
die "can't locate ppc-xlate.pl"; die "can't locate ppc-xlate.pl";
open OUT,"| \"$^X\" $xlate $flavour $output"; open OUT,"| \"$^X\" $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
my $sp = "r1"; my $sp = "r1";

View file

@ -61,9 +61,10 @@
# C implementation, so that comparison is always against # C implementation, so that comparison is always against
# 2^51 radix; # 2^51 radix;
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
@ -72,7 +73,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
die "can't locate x86_64-xlate.pl"; die "can't locate x86_64-xlate.pl";
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1` if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1`

View file

@ -18,8 +18,10 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
push(@INC,"${dir}","${dir}../../perlasm"); push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl"; require "x86asm.pl";
$output=pop; # $output is the last argument if it looks like a file (it has an extension)
open STDOUT,">$output"; $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$output and open STDOUT,">$output";
&asm_init($ARGV[0]); &asm_init($ARGV[0]);

View file

@ -24,8 +24,10 @@
# single-process result on 8-core processor, or ~11GBps per 2.85GHz # single-process result on 8-core processor, or ~11GBps per 2.85GHz
# socket. # socket.
$output=pop; # $output is the last argument if it looks like a file (it has an extension)
open STDOUT,">$output"; $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$output and open STDOUT,">$output";
use integer; use integer;

View file

@ -119,9 +119,10 @@ EOF
} }
no warnings qw(uninitialized); no warnings qw(uninitialized);
my $flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
my $output = shift; # $flavour is the first argument if it doesn't look like a file
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } my $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
my $flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
my $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); my $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
@ -130,7 +131,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; my $dir=$1; my $xlate;
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
die "can't locate x86_64-xlate.pl"; die "can't locate x86_64-xlate.pl";
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
$code .= <<EOF; $code .= <<EOF;

View file

@ -40,9 +40,10 @@
# [1] http://rt.openssl.org/Ticket/Display.html?id=2900&user=guest&pass=guest # [1] http://rt.openssl.org/Ticket/Display.html?id=2900&user=guest&pass=guest
# [2] http://www.intel.com/content/dam/www/public/us/en/documents/software-support/enabling-high-performance-gcm.pdf # [2] http://www.intel.com/content/dam/www/public/us/en/documents/software-support/enabling-high-performance-gcm.pdf
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
@ -70,7 +71,8 @@ if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([
$avx = ($2>=3.0) + ($2>3.0); $avx = ($2>=3.0) + ($2>3.0);
} }
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
if ($avx>1) {{{ if ($avx>1) {{{

View file

@ -78,9 +78,10 @@
# *native* byte order on current platform. See gcm128.c for working # *native* byte order on current platform. See gcm128.c for working
# example... # example...
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
if ($flavour=~/\w[\w\-]*\.\w+$/) { $output=$flavour; undef $flavour; } # $flavour is the first argument if it doesn't look like a file
else { while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour && $flavour ne "void") { if ($flavour && $flavour ne "void") {
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
@ -88,9 +89,10 @@ if ($flavour && $flavour ne "void") {
( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or
die "can't locate arm-xlate.pl"; die "can't locate arm-xlate.pl";
open STDOUT,"| \"$^X\" $xlate $flavour $output"; open STDOUT,"| \"$^X\" $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
} else { } else {
open STDOUT,">$output"; $output and open STDOUT,">$output";
} }
$Xi="r0"; # argument block $Xi="r0"; # argument block

View file

@ -26,8 +26,7 @@
# better, because theoretical [though not necessarily achievable] # better, because theoretical [though not necessarily achievable]
# estimate for "4-bit" table-driven implementation is ~12 cycles. # estimate for "4-bit" table-driven implementation is ~12 cycles.
while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} $output = pop and open STDOUT,">$output";
open STDOUT,">$output";
($Xip,$Htable,$inp,$len)=("A4","B4","A6","B6"); # arguments ($Xip,$Htable,$inp,$len)=("A4","B4","A6","B6"); # arguments

View file

@ -27,9 +27,12 @@
# #
# Special thanks to polarhome.com for providing HP-UX account. # Special thanks to polarhome.com for providing HP-UX account.
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
open STDOUT,">$output"; $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$output and open STDOUT,">$output";
if ($flavour =~ /64/) { if ($flavour =~ /64/) {
$LEVEL ="2.0W"; $LEVEL ="2.0W";

View file

@ -44,7 +44,10 @@
# it's actually almost 2 times slower. Which is the reason why # it's actually almost 2 times slower. Which is the reason why
# KIMD-GHASH is not used in gcm_gmult_4bit. # KIMD-GHASH is not used in gcm_gmult_4bit.
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
# $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour =~ /3[12]/) { if ($flavour =~ /3[12]/) {
$SIZE_T=4; $SIZE_T=4;
@ -54,8 +57,7 @@ if ($flavour =~ /3[12]/) {
$g="g"; $g="g";
} }
while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} $output and open STDOUT,">$output";
open STDOUT,">$output";
$softonly=0; $softonly=0;

View file

@ -53,8 +53,7 @@
# saturates at ~15.5x single-process result on 8-core processor, # saturates at ~15.5x single-process result on 8-core processor,
# or ~20.5GBps per 2.85GHz socket. # or ~20.5GBps per 2.85GHz socket.
$output=pop; $output=pop and open STDOUT,">$output";
open STDOUT,">$output";
$frame="STACK_FRAME"; $frame="STACK_FRAME";
$bias="STACK_BIAS"; $bias="STACK_BIAS";

View file

@ -135,8 +135,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
push(@INC,"${dir}","${dir}../../perlasm"); push(@INC,"${dir}","${dir}../../perlasm");
require "x86asm.pl"; require "x86asm.pl";
$output=pop; $output=pop and open STDOUT,">$output";
open STDOUT,">$output";
&asm_init($ARGV[0],$x86only = $ARGV[$#ARGV] eq "386"); &asm_init($ARGV[0],$x86only = $ARGV[$#ARGV] eq "386");

View file

@ -90,9 +90,10 @@
# #
# [1] http://rt.openssl.org/Ticket/Display.html?id=2900&user=guest&pass=guest # [1] http://rt.openssl.org/Ticket/Display.html?id=2900&user=guest&pass=guest
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
@ -120,7 +121,8 @@ if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([
$avx = ($2>=3.0) + ($2>3.0); $avx = ($2>=3.0) + ($2>3.0);
} }
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""; open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
$do4xaggr=1; $do4xaggr=1;

View file

@ -32,8 +32,10 @@
# aggregated reduction - by 170% or 2.7x (resulting in 0.55 cpb). # aggregated reduction - by 170% or 2.7x (resulting in 0.55 cpb).
# POWER9 delivers 0.51 cpb. # POWER9 delivers 0.51 cpb.
$flavour=shift; # $output is the last argument if it looks like a file (it has an extension)
$output =shift; # $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour =~ /64/) { if ($flavour =~ /64/) {
$SIZE_T=8; $SIZE_T=8;
@ -61,7 +63,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
die "can't locate ppc-xlate.pl"; die "can't locate ppc-xlate.pl";
open STDOUT,"| $^X $xlate $flavour $output" || die "can't call $xlate: $!"; open STDOUT,"| $^X $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
my ($Xip,$Htbl,$inp,$len)=map("r$_",(3..6)); # argument block my ($Xip,$Htbl,$inp,$len)=map("r$_",(3..6)); # argument block

View file

@ -46,15 +46,18 @@
# #
# (*) presented for reference/comparison purposes; # (*) presented for reference/comparison purposes;
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or ( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or
( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or
die "can't locate arm-xlate.pl"; die "can't locate arm-xlate.pl";
open OUT,"| \"$^X\" $xlate $flavour $output"; open OUT,"| \"$^X\" $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
$Xi="x0"; # argument block $Xi="x0"; # argument block

View file

@ -7,9 +7,12 @@
# https://www.openssl.org/source/license.html # https://www.openssl.org/source/license.html
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
$output = shift; # $flavour is the first argument if it doesn't look like a file
open STDOUT,">$output"; $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$output and open STDOUT,">$output";
if ($flavour =~ /64/) { if ($flavour =~ /64/) {
$LEVEL ="2.0W"; $LEVEL ="2.0W";

View file

@ -28,9 +28,10 @@
# the cost of 15/12% regression on Cortex-A5/A7, it's even possible # the cost of 15/12% regression on Cortex-A5/A7, it's even possible
# to improve Cortex-A9 result, but then A5/A7 loose more than 20%; # to improve Cortex-A9 result, but then A5/A7 loose more than 20%;
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
if ($flavour=~/\w[\w\-]*\.\w+$/) { $output=$flavour; undef $flavour; } # $flavour is the first argument if it doesn't look like a file
else { while (($output=shift) && ($output!~/\w[\w\-]*\.\w+$/)) {} } $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour && $flavour ne "void") { if ($flavour && $flavour ne "void") {
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
@ -38,9 +39,10 @@ if ($flavour && $flavour ne "void") {
( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or
die "can't locate arm-xlate.pl"; die "can't locate arm-xlate.pl";
open STDOUT,"| \"$^X\" $xlate $flavour $output"; open STDOUT,"| \"$^X\" $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
} else { } else {
open STDOUT,">$output"; $output and open STDOUT,">$output";
} }
($ctx,$inp,$len,$padbit)=map("r$_",(0..3)); ($ctx,$inp,$len,$padbit)=map("r$_",(0..3));

View file

@ -35,15 +35,18 @@
# i.e. measured result is worse than expected, presumably binary # i.e. measured result is worse than expected, presumably binary
# translator is not almighty; # translator is not almighty;
$flavour=shift; # $output is the last argument if it looks like a file (it has an extension)
$output=shift; # $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or ( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or
( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or
die "can't locate arm-xlate.pl"; die "can't locate arm-xlate.pl";
open OUT,"| \"$^X\" $xlate $flavour $output"; open OUT,"| \"$^X\" $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
*STDOUT=*OUT; *STDOUT=*OUT;
my ($ctx,$inp,$len,$padbit) = map("x$_",(0..3)); my ($ctx,$inp,$len,$padbit) = map("x$_",(0..3));

View file

@ -26,8 +26,7 @@
# time dependent on input length. This module on the other hand is free # time dependent on input length. This module on the other hand is free
# from such limitation. # from such limitation.
$output=pop; $output=pop and open STDOUT,">$output";
open STDOUT,">$output";
($CTXA,$INPB,$LEN,$PADBIT)=("A4","B4","A6","B6"); ($CTXA,$INPB,$LEN,$PADBIT)=("A4","B4","A6","B6");
($H0,$H1,$H2,$H3,$H4,$H4a)=("A8","B8","A10","B10","B2",$LEN); ($H0,$H1,$H2,$H3,$H4,$H4a)=("A8","B8","A10","B10","B2",$LEN);

View file

@ -56,7 +56,11 @@
# #
###################################################################### ######################################################################
$flavour = shift || "o32"; # supported flavours are o32,n32,64,nubi32,nubi64 # $output is the last argument if it looks like a file (it has an extension)
# $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
# supported flavours are o32,n32,64,nubi32,nubi64, default is o32
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : "o32";
die "MIPS64 only" unless ($flavour =~ /64|n32/i); die "MIPS64 only" unless ($flavour =~ /64|n32/i);
@ -431,7 +435,7 @@ poly1305_emit:
___ ___
} }
$output=pop and open STDOUT,">$output"; $output and open STDOUT,">$output";
print $code; print $code;
close STDOUT; close STDOUT;

View file

@ -52,7 +52,10 @@
# not, not one usable in the context. Improvement is ~40% over -m64 # not, not one usable in the context. Improvement is ~40% over -m64
# result above and is ~1.43 on little-endian systems. # result above and is ~1.43 on little-endian systems.
$flavour = shift; # $output is the last argument if it looks like a file (it has an extension)
# $flavour is the first argument if it doesn't look like a file
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
if ($flavour =~ /64/) { if ($flavour =~ /64/) {
$SIZE_T =8; $SIZE_T =8;
@ -79,7 +82,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or ( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or
die "can't locate ppc-xlate.pl"; die "can't locate ppc-xlate.pl";
open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!"; open STDOUT,"| $^X $xlate $flavour \"$output\""
or die "can't call $xlate: $!";
$FRAME=24*$SIZE_T; $FRAME=24*$SIZE_T;

Some files were not shown because too many files have changed in this diff Show more