From eb77e8886df84526f42f566632be71d4ed373308 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Tue, 8 Mar 2016 09:46:19 +0100 Subject: [PATCH] SPARCv9 assembly pack: unify build rules and argument handling. Make all scripts produce .S, make interpretation of $(CFLAGS) pre-processor's responsibility, start accepting $(PERLASM_SCHEME). [$(PERLASM_SCHEME) is redundant in this case, because there are no deviataions between Solaris and Linux assemblers. This is purely to unify .pl->.S handling across all targets.] Reviewed-by: Richard Levitte --- Configurations/00-base-templates.conf | 10 +++++----- crypto/aes/Makefile.in | 8 ++++---- crypto/aes/asm/aes-sparcv9.pl | 17 ++++++++++------- crypto/aes/asm/aest4-sparcv9.pl | 11 +++++++---- crypto/aes/build.info | 6 +++--- crypto/bn/Makefile.in | 16 ++++++++-------- crypto/bn/asm/sparcv9-mont.pl | 10 +++++----- crypto/bn/asm/sparcv9a-mont.pl | 15 +++++---------- crypto/bn/asm/vis3-mont.pl | 15 ++++++++------- crypto/bn/build.info | 10 +++++----- crypto/camellia/Makefile.in | 4 ++-- crypto/camellia/asm/cmllt4-sparcv9.pl | 5 ++++- crypto/camellia/build.info | 4 ++-- crypto/des/Makefile.in | 4 ++-- crypto/des/asm/dest4-sparcv9.pl | 11 +++++++---- crypto/des/build.info | 4 ++-- crypto/ec/Makefile.in | 2 +- crypto/ec/asm/ecp_nistz256-sparcv9.pl | 3 +++ crypto/ec/build.info | 2 +- crypto/md5/Makefile.in | 2 +- crypto/md5/asm/md5-sparcv9.pl | 2 +- crypto/md5/build.info | 2 +- crypto/modes/Makefile.in | 4 ++-- crypto/modes/asm/ghash-sparcv9.pl | 21 +++++++++++---------- crypto/modes/build.info | 4 ++-- crypto/perlasm/sparcv9_modes.pl | 4 ++++ crypto/poly1305/Makefile.in | 2 +- crypto/poly1305/asm/poly1305-sparcv9.pl | 3 +++ crypto/poly1305/build.info | 2 +- crypto/sha/Makefile.in | 6 +++--- crypto/sha/asm/sha1-sparcv9.pl | 2 +- crypto/sha/asm/sha512-sparcv9.pl | 2 +- crypto/sha/build.info | 6 +++--- 33 files changed, 119 insertions(+), 100 deletions(-) diff --git a/Configurations/00-base-templates.conf b/Configurations/00-base-templates.conf index 026cdab077..4308c5c1d8 100644 --- a/Configurations/00-base-templates.conf +++ b/Configurations/00-base-templates.conf @@ -191,14 +191,14 @@ sparcv9_asm => { template => 1, cpuid_asm_src => "sparcv9cap.c sparccpuid.S", - bn_asm_src => "asm/sparcv8plus.S sparcv9-mont.s sparcv9a-mont.s vis3-mont.s sparct4-mont.S sparcv9-gf2m.S", + bn_asm_src => "asm/sparcv8plus.S sparcv9-mont.S sparcv9a-mont.S vis3-mont.S sparct4-mont.S sparcv9-gf2m.S", ec_asm_src => "ecp_nistz256.c ecp_nistz256-sparcv9.S", - des_asm_src => "des_enc-sparc.S fcrypt_b.c dest4-sparcv9.s", - aes_asm_src => "aes_core.c aes_cbc.c aes-sparcv9.s aest4-sparcv9.s", + des_asm_src => "des_enc-sparc.S fcrypt_b.c dest4-sparcv9.S", + aes_asm_src => "aes_core.c aes_cbc.c aes-sparcv9.S aest4-sparcv9.S", md5_asm_src => "md5-sparcv9.S", sha1_asm_src => "sha1-sparcv9.S sha256-sparcv9.S sha512-sparcv9.S", - cmll_asm_src => "camellia.c cmll_misc.c cmll_cbc.c cmllt4-sparcv9.s", - modes_asm_src => "ghash-sparcv9.s", + cmll_asm_src => "camellia.c cmll_misc.c cmll_cbc.c cmllt4-sparcv9.S", + modes_asm_src => "ghash-sparcv9.S", poly1305_asm_src=> "poly1305-sparcv9.S", perlasm_scheme => "void" }, diff --git a/crypto/aes/Makefile.in b/crypto/aes/Makefile.in index 938ad3c404..6ece34378a 100644 --- a/crypto/aes/Makefile.in +++ b/crypto/aes/Makefile.in @@ -66,10 +66,10 @@ aesni-sha256-x86_64.s: asm/aesni-sha256-x86_64.pl aesni-mb-x86_64.s: asm/aesni-mb-x86_64.pl $(PERL) asm/aesni-mb-x86_64.pl $(PERLASM_SCHEME) > $@ -aes-sparcv9.s: asm/aes-sparcv9.pl - $(PERL) asm/aes-sparcv9.pl $(CFLAGS) > $@ -aest4-sparcv9.s: asm/aest4-sparcv9.pl ../perlasm/sparcv9_modes.pl - $(PERL) asm/aest4-sparcv9.pl $(CFLAGS) > $@ +aes-sparcv9.S: asm/aes-sparcv9.pl + $(PERL) asm/aes-sparcv9.pl $(PERLASM_SCHEME) $@ +aest4-sparcv9.S: asm/aest4-sparcv9.pl ../perlasm/sparcv9_modes.pl + $(PERL) asm/aest4-sparcv9.pl $(PERLASM_SCHEME) $@ aes-ppc.s: asm/aes-ppc.pl $(PERL) asm/aes-ppc.pl $(PERLASM_SCHEME) $@ diff --git a/crypto/aes/asm/aes-sparcv9.pl b/crypto/aes/asm/aes-sparcv9.pl index 403c4d1290..9eb0c3d9c1 100755 --- a/crypto/aes/asm/aes-sparcv9.pl +++ b/crypto/aes/asm/aes-sparcv9.pl @@ -30,10 +30,11 @@ # optimal decrypt procedure]. Compared to GNU C generated code both # procedures are more than 60% faster:-) -$bits=32; -for (@ARGV) { $bits=64 if (/\-m64/ || /\-xarch\=v9/); } -if ($bits==64) { $bias=2047; $frame=192; } -else { $bias=0; $frame=112; } +$output = pop; +open STDOUT,">$output"; + +$frame="STACK_FRAME"; +$bias="STACK_BIAS"; $locals=16; $acc0="%l0"; @@ -74,11 +75,13 @@ sub _data_word() while(defined($i=shift)) { $code.=sprintf"\t.long\t0x%08x,0x%08x\n",$i,$i; } } -$code.=<<___ if ($bits==64); +$code.=<<___; +#include "sparc_arch.h" + +#ifdef __arch64__ .register %g2,#scratch .register %g3,#scratch -___ -$code.=<<___; +#endif .section ".text",#alloc,#execinstr .align 256 diff --git a/crypto/aes/asm/aest4-sparcv9.pl b/crypto/aes/asm/aest4-sparcv9.pl index 536f23b47c..5b0159e222 100644 --- a/crypto/aes/asm/aest4-sparcv9.pl +++ b/crypto/aes/asm/aest4-sparcv9.pl @@ -68,7 +68,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; push(@INC,"${dir}","${dir}../../perlasm"); require "sparcv9_modes.pl"; -&asm_init(@ARGV); +$output = pop; +open STDOUT,">$output"; $::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 @@ -83,12 +84,14 @@ $::evp=1; # if $evp is set to 0, script generates module with { my ($inp,$out,$key,$rounds,$tmp,$mask)=map("%o$_",(0..5)); -$code.=<<___ if ($::abibits==64); +$code.=<<___; +#include "sparc_arch.h" + +#ifdef __arch64__ .register %g2,#scratch .register %g3,#scratch +#endif -___ -$code.=<<___; .text .globl aes_t4_encrypt diff --git a/crypto/aes/build.info b/crypto/aes/build.info index 599e9ab6dc..40e01d3424 100644 --- a/crypto/aes/build.info +++ b/crypto/aes/build.info @@ -31,10 +31,10 @@ BEGINRAW[Makefile] {- $builddir -}/aesni-mb-x86_64.s: {- $sourcedir -}/asm/aesni-mb-x86_64.pl CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aesni-mb-x86_64.pl $(PERLASM_SCHEME) > $@ -{- $builddir -}/aes-sparcv9.s: {- $sourcedir -}/asm/aes-sparcv9.pl - CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aes-sparcv9.pl $(CFLAGS) > $@ +{- $builddir -}/aes-sparcv9.S: {- $sourcedir -}/asm/aes-sparcv9.pl + CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aes-sparcv9.pl $(PERLASM_SCHEME) $@ {- $builddir -}/aest4-sparcv9.s: {- $sourcedir -}/asm/aest4-sparcv9.pl {- $sourcetop -}/crypto/perlasm/sparcv9_modes.pl - CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aest4-sparcv9.pl $(CFLAGS) > $@ + CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aest4-sparcv9.pl $(PERLASM_SCHEME) $@ {- $builddir -}/aes-ppc.s: {- $sourcedir -}/asm/aes-ppc.pl CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aes-ppc.pl $(PERLASM_SCHEME) $@ diff --git a/crypto/bn/Makefile.in b/crypto/bn/Makefile.in index 594667fc84..6ae831ccda 100644 --- a/crypto/bn/Makefile.in +++ b/crypto/bn/Makefile.in @@ -70,16 +70,16 @@ sparcv8.o: asm/sparcv8.S $(CC) $(CFLAGS) -c asm/sparcv8.S bn-sparcv9.o: asm/sparcv8plus.S $(CC) $(CFLAGS) -c -o $@ asm/sparcv8plus.S -sparcv9a-mont.s: asm/sparcv9a-mont.pl - $(PERL) asm/sparcv9a-mont.pl $(CFLAGS) $@ -sparcv9-mont.s: asm/sparcv9-mont.pl - $(PERL) asm/sparcv9-mont.pl $(CFLAGS) $@ -vis3-mont.s: asm/vis3-mont.pl - $(PERL) asm/vis3-mont.pl $(CFLAGS) $@ +sparcv9a-mont.S: asm/sparcv9a-mont.pl + $(PERL) asm/sparcv9a-mont.pl $(PERLASM_SCHEME) $@ +sparcv9-mont.S: asm/sparcv9-mont.pl + $(PERL) asm/sparcv9-mont.pl $(PERLASM_SCHEME) $@ +vis3-mont.S: asm/vis3-mont.pl + $(PERL) asm/vis3-mont.pl $(PERLASM_SCHEME) $@ sparct4-mont.S: asm/sparct4-mont.pl - $(PERL) asm/sparct4-mont.pl $(CFLAGS) $@ + $(PERL) asm/sparct4-mont.pl $(PERLASM_SCHEME) $@ sparcv9-gf2m.S: asm/sparcv9-gf2m.pl - $(PERL) asm/sparcv9-gf2m.pl $(CFLAGS) $@ + $(PERL) asm/sparcv9-gf2m.pl $(PERLASM_SCHEME) $@ bn-mips.s: asm/mips.pl $(PERL) asm/mips.pl $(PERLASM_SCHEME) $@ diff --git a/crypto/bn/asm/sparcv9-mont.pl b/crypto/bn/asm/sparcv9-mont.pl index c08d8223f7..4f922c3110 100644 --- a/crypto/bn/asm/sparcv9-mont.pl +++ b/crypto/bn/asm/sparcv9-mont.pl @@ -53,10 +53,8 @@ $np="%i3"; # const BN_ULONG *np, $n0="%i4"; # const BN_ULONG *n0, $num="%i5"; # int num); -$bits=32; -for (@ARGV) { $bits=64 if (/\-m64/ || /\-xarch\=v9/); } -if ($bits==64) { $bias=2047; $frame=192; } -else { $bias=0; $frame=128; } +$frame="STACK_FRAME"; +$bias="STACK_BIAS"; $car0="%o0"; $car1="%o1"; @@ -79,6 +77,8 @@ $tpj="%l7"; $fname="bn_mul_mont_int"; $code=<<___; +#include "sparc_arch.h" + .section ".text",#alloc,#execinstr .global $fname @@ -108,7 +108,7 @@ $fname: ld [$np],$car1 ! np[0] sub %o7,$bias,%sp ! alloca ld [$np+4],$npj ! np[1] - be,pt `$bits==32?"%icc":"%xcc"`,.Lbn_sqr_mont + be,pt SIZE_T_CC,.Lbn_sqr_mont mov 12,$j mulx $car0,$mul0,$car0 ! ap[0]*bp[0] diff --git a/crypto/bn/asm/sparcv9a-mont.pl b/crypto/bn/asm/sparcv9a-mont.pl index 433ec9ecf9..7a4782e787 100755 --- a/crypto/bn/asm/sparcv9a-mont.pl +++ b/crypto/bn/asm/sparcv9a-mont.pl @@ -59,16 +59,9 @@ $output = pop; open STDOUT,">$output"; $fname="bn_mul_mont_fpu"; -$bits=32; -for (@ARGV) { $bits=64 if (/\-m64/ || /\-xarch\=v9/); } - -if ($bits==64) { - $bias=2047; - $frame=192; -} else { - $bias=0; - $frame=128; # 96 rounded up to largest known cache-line -} + +$frame="STACK_FRAME"; +$bias="STACK_BIAS"; $locals=64; # In order to provide for 32-/64-bit ABI duality, I keep integers wider @@ -124,6 +117,8 @@ $nhia="%f56"; $nhib="%f58"; $nhic="%f60"; $nhid="%f62"; $ASI_FL16_P=0xD2; # magic ASI value to engage 16-bit FP load $code=<<___; +#include "sparc_arch.h" + .section ".text",#alloc,#execinstr .global $fname diff --git a/crypto/bn/asm/vis3-mont.pl b/crypto/bn/asm/vis3-mont.pl index 8bab5a16b6..7b953a2be0 100644 --- a/crypto/bn/asm/vis3-mont.pl +++ b/crypto/bn/asm/vis3-mont.pl @@ -21,16 +21,17 @@ $output = pop; open STDOUT,">$output"; -$bits=32; -for (@ARGV) { $bits=64 if (/\-m64/ || /\-xarch\=v9/); } -if ($bits==64) { $bias=2047; $frame=192; } -else { $bias=0; $frame=112; } +$frame = "STACK_FRAME"; +$bias = "STACK_BIAS"; -$code.=<<___ if ($bits==64); +$code.=<<___; +#include "sparc_arch.h" + +#ifdef __arch64__ .register %g2,#scratch .register %g3,#scratch -___ -$code.=<<___; +#endif + .section ".text",#alloc,#execinstr ___ diff --git a/crypto/bn/build.info b/crypto/bn/build.info index e9cde75556..8e424945b9 100644 --- a/crypto/bn/build.info +++ b/crypto/bn/build.info @@ -22,11 +22,11 @@ GENERATE[x86-gf2m.s]=asm/x86-gf2m.pl \ $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) DEPEND[x86-gf2m.s]=../perlasm/x86asm.pl -GENERATE[sparcv9a-mont.s]=asm/sparcv9a-mont.pl $(CFLAGS) -GENERATE[sparcv9-mont.s]=asm/sparcv9-mont.pl $(CFLAGS) -GENERATE[vis3-mont.s]=asm/vis3-mont.pl $(CFLAGS) -GENERATE[sparct4-mont.S]=asm/sparct4-mont.pl $(CFLAGS) -GENERATE[sparcv9-gf2m.S]=asm/sparcv9-gf2m.pl $(CFLAGS) +GENERATE[sparcv9a-mont.S]=asm/sparcv9a-mont.pl $(PERLASM_SCHEME) +GENERATE[sparcv9-mont.S]=asm/sparcv9-mont.pl $(PERLASM_SCHEME) +GENERATE[vis3-mont.S]=asm/vis3-mont.pl $(PERLASM_SCHEME) +GENERATE[sparct4-mont.S]=asm/sparct4-mont.pl $(PERLASM_SCHEME) +GENERATE[sparcv9-gf2m.S]=asm/sparcv9-gf2m.pl $(PERLASM_SCHEME) GENERATE[bn-mips.s]=asm/mips.pl $(PERLASM_SCHEME) GENERATE[mips-mont.s]=asm/mips-mont.pl $(PERLASM_SCHEME) diff --git a/crypto/camellia/Makefile.in b/crypto/camellia/Makefile.in index 10c5a75341..e32a73be64 100644 --- a/crypto/camellia/Makefile.in +++ b/crypto/camellia/Makefile.in @@ -45,8 +45,8 @@ cmll-x86.s: asm/cmll-x86.pl ../perlasm/x86asm.pl $(PERL) asm/cmll-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ cmll-x86_64.s: asm/cmll-x86_64.pl $(PERL) asm/cmll-x86_64.pl $(PERLASM_SCHEME) > $@ -cmllt4-sparcv9.s: asm/cmllt4-sparcv9.pl ../perlasm/sparcv9_modes.pl - $(PERL) asm/cmllt4-sparcv9.pl $(CFLAGS) > $@ +cmllt4-sparcv9.S: asm/cmllt4-sparcv9.pl ../perlasm/sparcv9_modes.pl + $(PERL) asm/cmllt4-sparcv9.pl $(PERLASM_SCHEME) $@ files: $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO diff --git a/crypto/camellia/asm/cmllt4-sparcv9.pl b/crypto/camellia/asm/cmllt4-sparcv9.pl index a813168b42..fac53623a7 100644 --- a/crypto/camellia/asm/cmllt4-sparcv9.pl +++ b/crypto/camellia/asm/cmllt4-sparcv9.pl @@ -46,7 +46,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; push(@INC,"${dir}","${dir}../../perlasm"); require "sparcv9_modes.pl"; -&asm_init(@ARGV); +$output = pop; +open STDOUT,">$output"; $::evp=1; # if $evp is set to 0, script generates module with # Camellia_[en|de]crypt, Camellia_set_key and Camellia_cbc_encrypt @@ -59,6 +60,8 @@ $::evp=1; # if $evp is set to 0, script generates module with my ($inp,$out,$key,$rounds,$tmp,$mask)=map("%o$_",(0..5)); $code=<<___; +#include "sparc_arch.h" + .text .globl cmll_t4_encrypt diff --git a/crypto/camellia/build.info b/crypto/camellia/build.info index d212d5441d..b5c1114bac 100644 --- a/crypto/camellia/build.info +++ b/crypto/camellia/build.info @@ -8,6 +8,6 @@ BEGINRAW[Makefile] CC="$(CC)" $(PERL) {- $sourcedir -}/asm/cmll-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ {- $builddir -}/cmll-x86_64.s: {- $sourcedir -}/asm/cmll-x86_64.pl CC="$(CC)" $(PERL) {- $sourcedir -}/asm/cmll-x86_64.pl $(PERLASM_SCHEME) > $@ -{- $builddir -}/cmllt4-sparcv9.s: {- $sourcedir -}/asm/cmllt4-sparcv9.pl {- $sourcetop -}/crypto/perlasm/sparcv9_modes.pl - CC="$(CC)" $(PERL) {- $sourcedir -}/asm/cmllt4-sparcv9.pl $(CFLAGS) > $@ +{- $builddir -}/cmllt4-sparcv9.S: {- $sourcedir -}/asm/cmllt4-sparcv9.pl {- $sourcetop -}/crypto/perlasm/sparcv9_modes.pl + CC="$(CC)" $(PERL) {- $sourcedir -}/asm/cmllt4-sparcv9.pl $(PERLASM_SCHEME) $@ ENDRAW[Makefile] diff --git a/crypto/des/Makefile.in b/crypto/des/Makefile.in index 248b53d700..c056804d35 100644 --- a/crypto/des/Makefile.in +++ b/crypto/des/Makefile.in @@ -55,8 +55,8 @@ lib: $(LIBOBJ) des_enc-sparc.S: asm/des_enc.m4 m4 -B 8192 asm/des_enc.m4 > des_enc-sparc.S -dest4-sparcv9.s: asm/dest4-sparcv9.pl - $(PERL) asm/dest4-sparcv9.pl $(CFLAGS) > $@ +dest4-sparcv9.S: asm/dest4-sparcv9.pl + $(PERL) asm/dest4-sparcv9.pl $(PERLASM_SCHEME) $@ des-586.s: asm/des-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl $(PERL) asm/des-586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@ diff --git a/crypto/des/asm/dest4-sparcv9.pl b/crypto/des/asm/dest4-sparcv9.pl index 1dc60243d4..858df0ba84 100644 --- a/crypto/des/asm/dest4-sparcv9.pl +++ b/crypto/des/asm/dest4-sparcv9.pl @@ -27,14 +27,17 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; push(@INC,"${dir}","${dir}../../perlasm"); require "sparcv9_modes.pl"; -&asm_init(@ARGV); +$output=pop; +open STDOUT,">$output"; -$code.=<<___ if ($::abibits==64); +$code.=<<___; +#include "sparc_arch.h" + +#ifdef __arch64__ .register %g2,#scratch .register %g3,#scratch -___ +#endif -$code.=<<___; .text ___ diff --git a/crypto/des/build.info b/crypto/des/build.info index a0ac1de148..d3c5c1f64c 100644 --- a/crypto/des/build.info +++ b/crypto/des/build.info @@ -13,8 +13,8 @@ BEGINRAW[Makefile] {- $builddir -}/des_enc-sparc.S: {- $sourcedir -}/asm/des_enc.m4 m4 -B 8192 {- $sourcedir -}/asm/des_enc.m4 > $@ -{- $builddir -}/dest4-sparcv9.s: {- $sourcedir -}/asm/dest4-sparcv9.pl - CC="$(CC)" $(PERL) {- $sourcedir -}/asm/dest4-sparcv9.pl $(CFLAGS) > $@ +{- $builddir -}/dest4-sparcv9.S: {- $sourcedir -}/asm/dest4-sparcv9.pl + CC="$(CC)" $(PERL) {- $sourcedir -}/asm/dest4-sparcv9.pl $(PERLASM_SCHEME) $@ {- $builddir -}/des-586.s: {- $sourcedir -}/asm/des-586.pl {- $sourcetop -}/crypto/perlasm/x86asm.pl {- $sourcetop -}/crypto/perlasm/cbc.pl CC="$(CC)" $(PERL) {- $sourcedir -}/asm/des-586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@ diff --git a/crypto/ec/Makefile.in b/crypto/ec/Makefile.in index decc1740aa..342b98d316 100644 --- a/crypto/ec/Makefile.in +++ b/crypto/ec/Makefile.in @@ -58,7 +58,7 @@ ecp_nistz256-avx2.s: asm/ecp_nistz256-avx2.pl $(PERL) asm/ecp_nistz256-avx2.pl $(PERLASM_SCHEME) > $@ ecp_nistz256-sparcv9.S: asm/ecp_nistz256-sparcv9.pl - $(PERL) asm/ecp_nistz256-sparcv9.pl $(CFLAGS) > $@ + $(PERL) asm/ecp_nistz256-sparcv9.pl $(PERLASM_SCHEME) $@ ecp_nistz256-%.S: asm/ecp_nistz256-%.pl; $(PERL) $< $(PERLASM_SCHEME) $@ ecp_nistz256-armv4.o: ecp_nistz256-armv4.S diff --git a/crypto/ec/asm/ecp_nistz256-sparcv9.pl b/crypto/ec/asm/ecp_nistz256-sparcv9.pl index 5693b75e5b..29a089b4a2 100755 --- a/crypto/ec/asm/ecp_nistz256-sparcv9.pl +++ b/crypto/ec/asm/ecp_nistz256-sparcv9.pl @@ -24,6 +24,9 @@ # on benchmark. Lower coefficients are for ECDSA sign, server-side # operation. Keep in mind that +200% means 3x improvement. +$output = pop; +open STDOUT,">$output"; + $code.=<<___; #include "sparc_arch.h" diff --git a/crypto/ec/build.info b/crypto/ec/build.info index 39a9f4754c..469a7ddc5e 100644 --- a/crypto/ec/build.info +++ b/crypto/ec/build.info @@ -19,7 +19,7 @@ BEGINRAW[Makefile] CC="$(CC)" $(PERL) {- $sourcedir -}/asm/ecp_nistz256-avx2.pl $(PERLASM_SCHEME) > $@ {- $builddir -}/ecp_nistz256-sparcv9.S: {- $sourcedir -}/asm/ecp_nistz256-sparcv9.pl - CC="$(CC)" $(PERL) {- $sourcedir -}/asm/ecp_nistz256-sparcv9.pl $(CFLAGS) > $@ + CC="$(CC)" $(PERL) {- $sourcedir -}/asm/ecp_nistz256-sparcv9.pl $(PERLASM_SCHEME) $@ {- $builddir -}/ecp_nistz256-%.S: {- $sourcedir -}/asm/ecp_nistz256-%.pl CC="$(CC)" $(PERL) $< $(PERLASM_SCHEME) $@ diff --git a/crypto/md5/Makefile.in b/crypto/md5/Makefile.in index aec94b6d6b..625bdc8a10 100644 --- a/crypto/md5/Makefile.in +++ b/crypto/md5/Makefile.in @@ -50,7 +50,7 @@ md5-ia64.s: asm/md5-ia64.S $(PERL) -ne 's/;\s+/;\n/g; print;' > $@ md5-sparcv9.S: asm/md5-sparcv9.pl - $(PERL) asm/md5-sparcv9.pl $@ $(CFLAGS) + $(PERL) asm/md5-sparcv9.pl $(PERLASM_SCHEME) $@ files: $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO diff --git a/crypto/md5/asm/md5-sparcv9.pl b/crypto/md5/asm/md5-sparcv9.pl index 47a66c584e..1c4ae5200b 100644 --- a/crypto/md5/asm/md5-sparcv9.pl +++ b/crypto/md5/asm/md5-sparcv9.pl @@ -17,7 +17,7 @@ # single-process result on 8-core processor, or ~11GBps per 2.85GHz # socket. -$output=shift; +$output=pop; open STDOUT,">$output"; use integer; diff --git a/crypto/md5/build.info b/crypto/md5/build.info index 09f417c68f..6a04f37cfc 100644 --- a/crypto/md5/build.info +++ b/crypto/md5/build.info @@ -14,5 +14,5 @@ BEGINRAW[Makefile] $(PERL) -ne 's/;\s+/;\n/g; print;' > $@ {- $builddir -}/md5-sparcv9.S: {- $sourcedir -}/asm/md5-sparcv9.pl - CC="$(CC)" $(PERL) {- $sourcedir -}/asm/md5-sparcv9.pl $@ $(CFLAGS) + CC="$(CC)" $(PERL) {- $sourcedir -}/asm/md5-sparcv9.pl $(PERLASM_SCHEME) $@ ENDRAW[Makefile] diff --git a/crypto/modes/Makefile.in b/crypto/modes/Makefile.in index 5e4415c431..a62486ed13 100644 --- a/crypto/modes/Makefile.in +++ b/crypto/modes/Makefile.in @@ -48,8 +48,8 @@ ghash-x86_64.s: asm/ghash-x86_64.pl $(PERL) asm/ghash-x86_64.pl $(PERLASM_SCHEME) > $@ aesni-gcm-x86_64.s: asm/aesni-gcm-x86_64.pl $(PERL) asm/aesni-gcm-x86_64.pl $(PERLASM_SCHEME) > $@ -ghash-sparcv9.s: asm/ghash-sparcv9.pl - $(PERL) asm/ghash-sparcv9.pl $@ $(CFLAGS) +ghash-sparcv9.S: asm/ghash-sparcv9.pl + $(PERL) asm/ghash-sparcv9.pl $(PERLASM_SCHEME) $@ ghash-alpha.s: asm/ghash-alpha.pl (preproc=$$$$.$@.S; trap "rm $$preproc" INT; \ $(PERL) asm/ghash-alpha.pl > $$preproc && \ diff --git a/crypto/modes/asm/ghash-sparcv9.pl b/crypto/modes/asm/ghash-sparcv9.pl index e928c42cd7..badfcf7b09 100644 --- a/crypto/modes/asm/ghash-sparcv9.pl +++ b/crypto/modes/asm/ghash-sparcv9.pl @@ -46,14 +46,12 @@ # saturates at ~15.5x single-process result on 8-core processor, # or ~20.5GBps per 2.85GHz socket. -$bits=32; -for (@ARGV) { $bits=64 if (/\-m64/ || /\-xarch\=v9/); } -if ($bits==64) { $bias=2047; $frame=192; } -else { $bias=0; $frame=112; } - -$output=shift; +$output=pop; open STDOUT,">$output"; +$frame="STACK_FRAME"; +$bias="STACK_BIAS"; + $Zhi="%o0"; # 64-bit values $Zlo="%o1"; $Thi="%o2"; @@ -75,11 +73,14 @@ $Htbl="%i1"; $inp="%i2"; $len="%i3"; -$code.=<<___ if ($bits==64); +$code.=<<___; +#include "sparc_arch.h" + +#ifdef __arch64__ .register %g2,#scratch .register %g3,#scratch -___ -$code.=<<___; +#endif + .section ".text",#alloc,#execinstr .align 64 @@ -183,7 +184,7 @@ gcm_ghash_4bit: add $inp,16,$inp cmp $inp,$len - be,pn `$bits==64?"%xcc":"%icc"`,.Ldone + be,pn SIZE_T_CC,.Ldone and $Zlo,0xf,$remi ldx [$Htblo+$nhi],$Tlo diff --git a/crypto/modes/build.info b/crypto/modes/build.info index 220cdaf18d..dfce733cd3 100644 --- a/crypto/modes/build.info +++ b/crypto/modes/build.info @@ -13,8 +13,8 @@ BEGINRAW[Makefile] CC="$(CC)" $(PERL) {- $sourcedir -}/asm/ghash-x86_64.pl $(PERLASM_SCHEME) > $@ {- $builddir -}/aesni-gcm-x86_64.s: {- $sourcedir -}/asm/aesni-gcm-x86_64.pl CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aesni-gcm-x86_64.pl $(PERLASM_SCHEME) > $@ -{- $builddir -}/ghash-sparcv9.s: {- $sourcedir -}/asm/ghash-sparcv9.pl - CC="$(CC)" $(PERL) {- $sourcedir -}/asm/ghash-sparcv9.pl $@ $(CFLAGS) +{- $builddir -}/ghash-sparcv9.S: {- $sourcedir -}/asm/ghash-sparcv9.pl + CC="$(CC)" $(PERL) {- $sourcedir -}/asm/ghash-sparcv9.pl $(PERLASM_SCHEME) $@ {- $builddir -}/ghash-alpha.s: {- $sourcedir -}/asm/ghash-alpha.pl (preproc=$$$$.$@.S; trap "rm $$preproc" INT; \ CC="$(CC)" $(PERL) {- $sourcedir -}/asm/ghash-alpha.pl > $$preproc && \ diff --git a/crypto/perlasm/sparcv9_modes.pl b/crypto/perlasm/sparcv9_modes.pl index 74544fbe2c..81e602671b 100644 --- a/crypto/perlasm/sparcv9_modes.pl +++ b/crypto/perlasm/sparcv9_modes.pl @@ -16,6 +16,10 @@ # block sizes [though few percent better for not so long ones]. All # this based on suggestions from David Miller. +$::bias="STACK_BIAS"; +$::frame="STACK_FRAME"; +$::size_t_cc="SIZE_T_CC"; + sub asm_init { # to be called with @ARGV as argument for (@_) { $::abibits=64 if (/\-m64/ || /\-xarch\=v9/); } if ($::abibits==64) { $::bias=2047; $::frame=192; $::size_t_cc="%xcc"; } diff --git a/crypto/poly1305/Makefile.in b/crypto/poly1305/Makefile.in index 10f009ffec..2f1b256578 100644 --- a/crypto/poly1305/Makefile.in +++ b/crypto/poly1305/Makefile.in @@ -37,7 +37,7 @@ lib: $(LIBOBJ) @touch lib poly1305-sparcv9.S: asm/poly1305-sparcv9.pl - $(PERL) asm/poly1305-sparcv9.pl > $@ + $(PERL) asm/poly1305-sparcv9.pl $(PERLASM_SCHEME) $@ poly1305-x86.s: asm/poly1305-x86.pl $(PERL) asm/poly1305-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ poly1305-x86_64.s: asm/poly1305-x86_64.pl diff --git a/crypto/poly1305/asm/poly1305-sparcv9.pl b/crypto/poly1305/asm/poly1305-sparcv9.pl index a4f883ea3a..f0ce259c02 100755 --- a/crypto/poly1305/asm/poly1305-sparcv9.pl +++ b/crypto/poly1305/asm/poly1305-sparcv9.pl @@ -34,6 +34,9 @@ # (***) Multi-process benchmark saturates at ~12.5x single-process # result on 8-core processor, or ~21GBps per 2.85GHz socket. +my $output = pop; +open STDOUT,">$output"; + my ($ctx,$inp,$len,$padbit,$shl,$shr) = map("%i$_",(0..5)); my ($r0,$r1,$r2,$r3,$s1,$s2,$s3,$h4) = map("%l$_",(0..7)); my ($h0,$h1,$h2,$h3, $t0,$t1,$t2) = map("%o$_",(0..5,7)); diff --git a/crypto/poly1305/build.info b/crypto/poly1305/build.info index 5d389dc492..c93c5724f8 100644 --- a/crypto/poly1305/build.info +++ b/crypto/poly1305/build.info @@ -4,7 +4,7 @@ SOURCE[../../libcrypto]=\ BEGINRAW[Makefile(unix)] {- $builddir -}/poly1305-sparcv9.S: {- $sourcedir -}/asm/poly1305-sparcv9.pl - CC="$(CC)" $(PERL) {- $sourcedir -}/asm/poly1305-sparcv9.pl > $@ + CC="$(CC)" $(PERL) {- $sourcedir -}/asm/poly1305-sparcv9.pl $(PERLASM_SCHEME) $@ {- $builddir -}/poly1305-x86.s: {- $sourcedir -}/asm/poly1305-x86.pl CC="$(CC)" $(PERL) {- $sourcedir -}/asm/poly1305-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ {- $builddir -}/poly1305-x86_64.s: {- $sourcedir -}/asm/poly1305-x86_64.pl diff --git a/crypto/sha/Makefile.in b/crypto/sha/Makefile.in index afb161be9e..ba06085b33 100644 --- a/crypto/sha/Makefile.in +++ b/crypto/sha/Makefile.in @@ -67,9 +67,9 @@ sha1-mb-x86_64.s: asm/sha1-mb-x86_64.pl; $(PERL) asm/sha1-mb-x86_64.pl $(PERLASM sha256-x86_64.s:asm/sha512-x86_64.pl; $(PERL) asm/sha512-x86_64.pl $(PERLASM_SCHEME) $@ sha256-mb-x86_64.s: asm/sha256-mb-x86_64.pl; $(PERL) asm/sha256-mb-x86_64.pl $(PERLASM_SCHEME) > $@ sha512-x86_64.s:asm/sha512-x86_64.pl; $(PERL) asm/sha512-x86_64.pl $(PERLASM_SCHEME) $@ -sha1-sparcv9.S: asm/sha1-sparcv9.pl; $(PERL) asm/sha1-sparcv9.pl $@ $(CFLAGS) -sha256-sparcv9.S:asm/sha512-sparcv9.pl; $(PERL) asm/sha512-sparcv9.pl $@ $(CFLAGS) -sha512-sparcv9.S:asm/sha512-sparcv9.pl; $(PERL) asm/sha512-sparcv9.pl $@ $(CFLAGS) +sha1-sparcv9.S: asm/sha1-sparcv9.pl; $(PERL) asm/sha1-sparcv9.pl $(PERLASM_SCHEME) $@ +sha256-sparcv9.S:asm/sha512-sparcv9.pl; $(PERL) asm/sha512-sparcv9.pl $(PERLASM_SCHEME) $@ +sha512-sparcv9.S:asm/sha512-sparcv9.pl; $(PERL) asm/sha512-sparcv9.pl $(PERLASM_SCHEME) $@ sha1-ppc.s: asm/sha1-ppc.pl; $(PERL) asm/sha1-ppc.pl $(PERLASM_SCHEME) $@ sha256-ppc.s: asm/sha512-ppc.pl; $(PERL) asm/sha512-ppc.pl $(PERLASM_SCHEME) $@ diff --git a/crypto/sha/asm/sha1-sparcv9.pl b/crypto/sha/asm/sha1-sparcv9.pl index 9ce376cbdc..9f20725363 100644 --- a/crypto/sha/asm/sha1-sparcv9.pl +++ b/crypto/sha/asm/sha1-sparcv9.pl @@ -25,7 +25,7 @@ # single-process result on 8-core processor, or ~9GBps per 2.85GHz # socket. -$output=shift; +$output=pop; open STDOUT,">$output"; @X=("%o0","%o1","%o2","%o3","%o4","%o5","%g1","%o7"); diff --git a/crypto/sha/asm/sha512-sparcv9.pl b/crypto/sha/asm/sha512-sparcv9.pl index bd4af64066..866a7b0999 100644 --- a/crypto/sha/asm/sha512-sparcv9.pl +++ b/crypto/sha/asm/sha512-sparcv9.pl @@ -49,7 +49,7 @@ # saturates at 11.5x single-process result on 8-core processor, or # ~11/16GBps per 2.85GHz socket. -$output=shift; +$output=pop; open STDOUT,">$output"; if ($output =~ /512/) { diff --git a/crypto/sha/build.info b/crypto/sha/build.info index c6fac544a2..2543414774 100644 --- a/crypto/sha/build.info +++ b/crypto/sha/build.info @@ -39,11 +39,11 @@ BEGINRAW[Makefile] {- $builddir -}/sha512-x86_64.s:{- $sourcedir -}/asm/sha512-x86_64.pl CC="$(CC)" $(PERL) {- $sourcedir -}/asm/sha512-x86_64.pl $(PERLASM_SCHEME) $@ {- $builddir -}/sha1-sparcv9.S: {- $sourcedir -}/asm/sha1-sparcv9.pl - CC="$(CC)" $(PERL) {- $sourcedir -}/asm/sha1-sparcv9.pl $@ $(CFLAGS) + CC="$(CC)" $(PERL) {- $sourcedir -}/asm/sha1-sparcv9.pl $(PERLASM_SCHEME) $@ {- $builddir -}/sha256-sparcv9.S:{- $sourcedir -}/asm/sha512-sparcv9.pl - CC="$(CC)" $(PERL) {- $sourcedir -}/asm/sha512-sparcv9.pl $@ $(CFLAGS) + CC="$(CC)" $(PERL) {- $sourcedir -}/asm/sha512-sparcv9.pl $(PERLASM_SCHEME) $@ {- $builddir -}/sha512-sparcv9.S:{- $sourcedir -}/asm/sha512-sparcv9.pl - CC="$(CC)" $(PERL) {- $sourcedir -}/asm/sha512-sparcv9.pl $@ $(CFLAGS) + CC="$(CC)" $(PERL) {- $sourcedir -}/asm/sha512-sparcv9.pl $(PERLASM_SCHEME) $@ {- $builddir -}/sha1-ppc.s: {- $sourcedir -}/asm/sha1-ppc.pl CC="$(CC)" $(PERL) {- $sourcedir -}/asm/sha1-ppc.pl $(PERLASM_SCHEME) $@ -- 2.34.1