Skip to content

Commit c83b5fe

Browse files
abner-chencsophie-zhao
authored andcommitted
runtime: add regABI support in memclr and memmove functions on loong64
Update #40724 Co-authored-by: Xiaolin Zhao <[email protected]> Change-Id: I55c78bab5c697ea6c30f9d81f5f8fb75abb3987c Reviewed-on: https://go-review.googlesource.com/c/go/+/521786 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Reviewed-by: Meidan Li <[email protected]> Run-TryBot: David Chase <[email protected]> Auto-Submit: David Chase <[email protected]> Reviewed-by: David Chase <[email protected]>
1 parent 1052d09 commit c83b5fe

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

src/runtime/memclr_loong64.s

+17-15
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,39 @@
66
#include "textflag.h"
77

88
// func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
9-
TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT,$0-16
10-
MOVV ptr+0(FP), R6
11-
MOVV n+8(FP), R7
12-
ADDV R6, R7, R4
9+
TEXT runtime·memclrNoHeapPointers<ABIInternal>(SB),NOSPLIT,$0-16
10+
#ifndef GOEXPERIMENT_regabiargs
11+
MOVV ptr+0(FP), R4
12+
MOVV n+8(FP), R5
13+
#endif
14+
ADDV R4, R5, R6
1315

1416
// if less than 8 bytes, do one byte at a time
15-
SGTU $8, R7, R8
17+
SGTU $8, R5, R8
1618
BNE R8, out
1719

1820
// do one byte at a time until 8-aligned
19-
AND $7, R6, R8
21+
AND $7, R4, R8
2022
BEQ R8, words
21-
MOVB R0, (R6)
22-
ADDV $1, R6
23+
MOVB R0, (R4)
24+
ADDV $1, R4
2325
JMP -4(PC)
2426

2527
words:
2628
// do 8 bytes at a time if there is room
27-
ADDV $-7, R4, R7
29+
ADDV $-7, R6, R5
2830

2931
PCALIGN $16
30-
SGTU R7, R6, R8
32+
SGTU R5, R4, R8
3133
BEQ R8, out
32-
MOVV R0, (R6)
33-
ADDV $8, R6
34+
MOVV R0, (R4)
35+
ADDV $8, R4
3436
JMP -4(PC)
3537

3638
out:
37-
BEQ R6, R4, done
38-
MOVB R0, (R6)
39-
ADDV $1, R6
39+
BEQ R4, R6, done
40+
MOVB R0, (R4)
41+
ADDV $1, R4
4042
JMP -3(PC)
4143
done:
4244
RET

src/runtime/memmove_loong64.s

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
// See memmove Go doc for important implementation constraints.
88

99
// func memmove(to, from unsafe.Pointer, n uintptr)
10-
TEXT runtime·memmove(SB), NOSPLIT|NOFRAME, $0-24
10+
TEXT runtime·memmove<ABIInternal>(SB), NOSPLIT|NOFRAME, $0-24
11+
#ifndef GOEXPERIMENT_regabiargs
1112
MOVV to+0(FP), R4
1213
MOVV from+8(FP), R5
1314
MOVV n+16(FP), R6
15+
#endif
1416
BNE R6, check
1517
RET
1618

0 commit comments

Comments
 (0)