1
0
mirror of https://github.com/golang/go synced 2024-11-17 13:04:54 -07:00

runtime: add regABI support in memclr and memmove functions on loong64

Update #40724

Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Change-Id: I55c78bab5c697ea6c30f9d81f5f8fb75abb3987c
Reviewed-on: https://go-review.googlesource.com/c/go/+/521786
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Run-TryBot: David Chase <drchase@google.com>
Auto-Submit: David Chase <drchase@google.com>
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
Guoqi Chen 2023-08-16 09:05:30 +08:00 committed by Gopher Robot
parent 1052d09dd7
commit c83b5fefab
2 changed files with 20 additions and 16 deletions

View File

@ -6,37 +6,39 @@
#include "textflag.h"
// func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT,$0-16
MOVV ptr+0(FP), R6
MOVV n+8(FP), R7
ADDV R6, R7, R4
TEXT runtime·memclrNoHeapPointers<ABIInternal>(SB),NOSPLIT,$0-16
#ifndef GOEXPERIMENT_regabiargs
MOVV ptr+0(FP), R4
MOVV n+8(FP), R5
#endif
ADDV R4, R5, R6
// if less than 8 bytes, do one byte at a time
SGTU $8, R7, R8
SGTU $8, R5, R8
BNE R8, out
// do one byte at a time until 8-aligned
AND $7, R6, R8
AND $7, R4, R8
BEQ R8, words
MOVB R0, (R6)
ADDV $1, R6
MOVB R0, (R4)
ADDV $1, R4
JMP -4(PC)
words:
// do 8 bytes at a time if there is room
ADDV $-7, R4, R7
ADDV $-7, R6, R5
PCALIGN $16
SGTU R7, R6, R8
SGTU R5, R4, R8
BEQ R8, out
MOVV R0, (R6)
ADDV $8, R6
MOVV R0, (R4)
ADDV $8, R4
JMP -4(PC)
out:
BEQ R6, R4, done
MOVB R0, (R6)
ADDV $1, R6
BEQ R4, R6, done
MOVB R0, (R4)
ADDV $1, R4
JMP -3(PC)
done:
RET

View File

@ -7,10 +7,12 @@
// See memmove Go doc for important implementation constraints.
// func memmove(to, from unsafe.Pointer, n uintptr)
TEXT runtime·memmove(SB), NOSPLIT|NOFRAME, $0-24
TEXT runtime·memmove<ABIInternal>(SB), NOSPLIT|NOFRAME, $0-24
#ifndef GOEXPERIMENT_regabiargs
MOVV to+0(FP), R4
MOVV from+8(FP), R5
MOVV n+16(FP), R6
#endif
BNE R6, check
RET