LoongArch: vDSO: Make use of the t8 register for vgetrandom-chacha
authorXi Ruoyao <xry111@xry111.site>
Sun, 30 Mar 2025 08:31:12 +0000 (16:31 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Sun, 30 Mar 2025 08:31:12 +0000 (16:31 +0800)
Make use of the t8 register for vgetrandom-chacha, so we don't need to
reuse a register and rematerialize a constant.  I

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/vdso/vgetrandom-chacha.S

index c2733e6c3a8de87d63b334397d3104f34fefd288..c4dd2bab88255e6aeffc50a81be99d22980d357a 100644 (file)
@@ -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