From: Martin Schwenke Date: Wed, 16 Jun 2021 06:54:26 +0000 (+1000) Subject: bn: save/restore registers to/from stack X-Git-Tag: openssl-3.0.0-beta2~248 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f55ff6af5dde97c6cda53bd735606f21b5707a5;p=thirdparty%2Fopenssl.git bn: save/restore registers to/from stack mtvsrd/mfvsrd are ISA >= 2.07 only, so this won't work for older CPUs. It would be possible to use this scheme only in the ISA >= 3.0 implementation. However, in the future it may be possible for newer ISAs to allow CPU implementations without a vector unit, so don't bother. The performance improvement versus using the stack was small anyway. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/15798) --- diff --git a/crypto/bn/asm/ppc64-mont-fixed.pl b/crypto/bn/asm/ppc64-mont-fixed.pl index bb4290182db..da4967a730f 100755 --- a/crypto/bn/asm/ppc64-mont-fixed.pl +++ b/crypto/bn/asm/ppc64-mont-fixed.pl @@ -345,12 +345,12 @@ sub save_registers($) my $n = $self->{n}; $self->add_code(<<___); - mtvsrd $vsrs[0],$lo + std $lo,-8($sp) ___ for (my $j = 0; $j <= $n+1; $j++) { $self->{code}.=<<___; - mtvsrd $vsrs[$j+1],$tp[$j] + std $tp[$j],-`($j+2)*8`($sp) ___ } @@ -366,12 +366,12 @@ sub restore_registers($) my $n = $self->{n}; $self->add_code(<<___); - mfvsrd $lo,$vsrs[0] + ld $lo,-8($sp) ___ for (my $j = 0; $j <= $n+1; $j++) { $self->{code}.=<<___; - mfvsrd $tp[$j],$vsrs[$j+1] + ld $tp[$j],-`($j+2)*8`($sp) ___ }