summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLin Runze <lrzlin@163.com>2024-01-14 20:21:49 +0800
committerTomas Mraz <tomas@openssl.org>2024-01-17 09:42:14 +0100
commit96dd7b23f5f1a54316ab9408be630f7cd61e262e (patch)
tree5a27cb714dfc4b7ddf3ec0d4a7a738557cf6f3dc
parent91e8a3fb5cb4481697d372b98a274f3c233a7594 (diff)
Fix performance regression of ChaCha20 on LoongArch64
The regression was introduced in PR #22817. In that pull request, the input length check was moved forward, but the related ori instruction was missing, and it will cause input of any length down to the much slower scalar implementation. Fixes #23300 CLA: trivial Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23301) (cherry picked from commit 971028535e6531c89449e06b1f6862c18f04ff91)
-rw-r--r--crypto/chacha/asm/chacha-loongarch64.pl3
1 files changed, 1 insertions, 2 deletions
diff --git a/crypto/chacha/asm/chacha-loongarch64.pl b/crypto/chacha/asm/chacha-loongarch64.pl
index 9eed5860de..0a194dd799 100644
--- a/crypto/chacha/asm/chacha-loongarch64.pl
+++ b/crypto/chacha/asm/chacha-loongarch64.pl
@@ -71,6 +71,7 @@ ChaCha20_ctr32:
# $a4 = arg #5 (counter array)
beqz $len,.Lno_data
+ ori $t3,$zero,64
la.pcrel $t0,OPENSSL_loongarch_hwcap_P
ld.w $t0,$t0,0
@@ -461,7 +462,6 @@ EOF
$code .= <<EOF;
.align 6
.LChaCha20_4x:
- ori $t3,$zero,64
addi.d $sp,$sp,-128
# Save the initial block counter in $t4
@@ -886,7 +886,6 @@ EOF
$code .= <<EOF;
.align 6
.LChaCha20_8x:
- ori $t3,$zero,64
addi.d $sp,$sp,-128
# Save the initial block counter in $t4