[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAhV-H4uacrS-kgvvrTQAGxdsGDsjDeE=eb6BcdCjRdgw8HLRg@mail.gmail.com>
Date: Tue, 25 Feb 2025 20:43:23 +0800
From: Huacai Chen <chenhuacai@...nel.org>
To: Xi Ruoyao <xry111@...111.site>
Cc: WANG Xuerui <kernel@...0n.name>, "Jason A. Donenfeld" <Jason@...c4.com>, linux-crypto@...r.kernel.org,
loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] LoongArch: vDSO: vgetrandom-chacha: Make use of the t8 register
Applied, thanks.
Huacai
On Fri, Feb 21, 2025 at 7:34 PM Xi Ruoyao <xry111@...111.site> wrote:
>
> So we don't need to reuse a register and rematerialize a constant. I
> couldn't count :(.
>
> Signed-off-by: Xi Ruoyao <xry111@...111.site>
> ---
>
> Tested with vdso_test_getrandom and vdso_test_chacha.
>
> arch/loongarch/vdso/vgetrandom-chacha.S | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/arch/loongarch/vdso/vgetrandom-chacha.S b/arch/loongarch/vdso/vgetrandom-chacha.S
> index c2733e6c3a8d..c4dd2bab8825 100644
> --- a/arch/loongarch/vdso/vgetrandom-chacha.S
> +++ b/arch/loongarch/vdso/vgetrandom-chacha.S
> @@ -58,9 +58,7 @@ SYM_FUNC_START(__arch_chacha20_blocks_nostack)
> #define copy0 t5
> #define copy1 t6
> #define copy2 t7
> -
> -/* Reuse i as copy3 */
> -#define copy3 i
> +#define copy3 t8
>
> /* Packs to be used with OP_4REG */
> #define line0 state0, state1, state2, state3
> @@ -99,6 +97,7 @@ SYM_FUNC_START(__arch_chacha20_blocks_nostack)
> li.w copy0, 0x61707865
> li.w copy1, 0x3320646e
> li.w copy2, 0x79622d32
> + li.w copy3, 0x6b206574
>
> ld.w cnt_lo, counter, 0
> ld.w cnt_hi, counter, 4
> @@ -108,7 +107,7 @@ SYM_FUNC_START(__arch_chacha20_blocks_nostack)
> move state0, copy0
> move state1, copy1
> move state2, copy2
> - li.w state3, 0x6b206574
> + move state3, copy3
>
> /* state[4,5,..,11] = key */
> ld.w state4, key, 0
> @@ -167,12 +166,6 @@ SYM_FUNC_START(__arch_chacha20_blocks_nostack)
> addi.w i, i, -1
> bnez i, .Lpermute
>
> - /*
> - * copy[3] = "expa", materialize it here because copy[3] shares the
> - * same register with i which just became dead.
> - */
> - li.w copy3, 0x6b206574
> -
> /* output[0,1,2,3] = copy[0,1,2,3] + state[0,1,2,3] */
> OP_4REG add.w line0, copy
> st.w state0, output, 0
> --
> 2.48.1
>
Powered by blists - more mailing lists