Skip to content

Commit a34ea54

Browse files
xry111chenhuacai
authored andcommitted
LoongArch: vDSO: Make use of the t8 register for vgetrandom-chacha
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>
1 parent c271c86 commit a34ea54

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

arch/loongarch/vdso/vgetrandom-chacha.S

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ SYM_FUNC_START(__arch_chacha20_blocks_nostack)
5858
#define copy0 t5
5959
#define copy1 t6
6060
#define copy2 t7
61-
62-
/* Reuse i as copy3 */
63-
#define copy3 i
61+
#define copy3 t8
6462

6563
/* Packs to be used with OP_4REG */
6664
#define line0 state0, state1, state2, state3
@@ -99,6 +97,7 @@ SYM_FUNC_START(__arch_chacha20_blocks_nostack)
9997
li.w copy0, 0x61707865
10098
li.w copy1, 0x3320646e
10199
li.w copy2, 0x79622d32
100+
li.w copy3, 0x6b206574
102101

103102
ld.w cnt_lo, counter, 0
104103
ld.w cnt_hi, counter, 4
@@ -108,7 +107,7 @@ SYM_FUNC_START(__arch_chacha20_blocks_nostack)
108107
move state0, copy0
109108
move state1, copy1
110109
move state2, copy2
111-
li.w state3, 0x6b206574
110+
move state3, copy3
112111

113112
/* state[4,5,..,11] = key */
114113
ld.w state4, key, 0
@@ -167,12 +166,6 @@ SYM_FUNC_START(__arch_chacha20_blocks_nostack)
167166
addi.w i, i, -1
168167
bnez i, .Lpermute
169168

170-
/*
171-
* copy[3] = "expa", materialize it here because copy[3] shares the
172-
* same register with i which just became dead.
173-
*/
174-
li.w copy3, 0x6b206574
175-
176169
/* output[0,1,2,3] = copy[0,1,2,3] + state[0,1,2,3] */
177170
OP_4REG add.w line0, copy
178171
st.w state0, output, 0

0 commit comments

Comments
 (0)