From eb77e8886df84526f42f566632be71d4ed373308 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Tue, 8 Mar 2016 09:46:19 +0100 Subject: 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 --- 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 +++++----- 5 files changed, 31 insertions(+), 35 deletions(-) (limited to 'crypto/bn') 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) -- cgit v1.2.3