From 971028535e6531c89449e06b1f6862c18f04ff91 Mon Sep 17 00:00:00 2001 From: Lin Runze Date: Sun, 14 Jan 2024 20:21:49 +0800 Subject: [PATCH] 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 Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/23301) --- crypto/chacha/asm/chacha-loongarch64.pl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crypto/chacha/asm/chacha-loongarch64.pl b/crypto/chacha/asm/chacha-loongarch64.pl index 9eed5860de9..0a194dd7990 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 .= <