aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mkduff.go
diff options
context:
space:
mode:
authorXiaodong Liu <liuxiaodong@loongson.cn>2022-05-19 20:01:10 +0800
committerGopher Robot <gobot@golang.org>2022-05-19 19:13:17 +0000
commit96a10b9c8469110a0aa30ea2185ca55f4aefef99 (patch)
treedae84b7d60bbf011a6107cfaaff5f38256e75b49 /src/runtime/mkduff.go
parent2a5114f49af42c1df293e64841b28c22a84211f0 (diff)
downloadgo-96a10b9c8469110a0aa30ea2185ca55f4aefef99.tar.xz
runtime: implement duffzero/duffcopy for linux/loong64
Contributors to the loong64 port are: Weining Lu <luweining@loongson.cn> Lei Wang <wanglei@loongson.cn> Lingqin Gong <gonglingqin@loongson.cn> Xiaolin Zhao <zhaoxiaolin@loongson.cn> Meidan Li <limeidan@loongson.cn> Xiaojuan Zhai <zhaixiaojuan@loongson.cn> Qiyuan Pu <puqiyuan@loongson.cn> Guoqi Chen <chenguoqi@loongson.cn> This port has been updated to Go 1.15.6: https://github.com/loongson/go Updates #46229 Change-Id: Ida040e76dc8172f60e6aee1ea2b5bce13ab3581e Reviewed-on: https://go-review.googlesource.com/c/go/+/368077 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/mkduff.go')
-rw-r--r--src/runtime/mkduff.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/runtime/mkduff.go b/src/runtime/mkduff.go
index f1e4ed75d0..6b42b8524b 100644
--- a/src/runtime/mkduff.go
+++ b/src/runtime/mkduff.go
@@ -36,6 +36,7 @@ func main() {
gen("386", notags, zero386, copy386)
gen("arm", notags, zeroARM, copyARM)
gen("arm64", notags, zeroARM64, copyARM64)
+ gen("loong64", notags, zeroLOONG64, copyLOONG64)
gen("ppc64x", tagsPPC64x, zeroPPC64x, copyPPC64x)
gen("mips64x", tagsMIPS64x, zeroMIPS64x, copyMIPS64x)
gen("riscv64", notags, zeroRISCV64, copyRISCV64)
@@ -176,6 +177,30 @@ func copyARM64(w io.Writer) {
fmt.Fprintln(w, "\tRET")
}
+func zeroLOONG64(w io.Writer) {
+ // R0: always zero
+ // R19 (aka REGRT1): ptr to memory to be zeroed - 8
+ // On return, R19 points to the last zeroed dword.
+ fmt.Fprintln(w, "TEXT runtime·duffzero(SB), NOSPLIT|NOFRAME, $0-0")
+ for i := 0; i < 128; i++ {
+ fmt.Fprintln(w, "\tMOVV\tR0, 8(R19)")
+ fmt.Fprintln(w, "\tADDV\t$8, R19")
+ }
+ fmt.Fprintln(w, "\tRET")
+}
+
+func copyLOONG64(w io.Writer) {
+ fmt.Fprintln(w, "TEXT runtime·duffcopy(SB), NOSPLIT|NOFRAME, $0-0")
+ for i := 0; i < 128; i++ {
+ fmt.Fprintln(w, "\tMOVV\t(R19), R30")
+ fmt.Fprintln(w, "\tADDV\t$8, R19")
+ fmt.Fprintln(w, "\tMOVV\tR30, (R20)")
+ fmt.Fprintln(w, "\tADDV\t$8, R20")
+ fmt.Fprintln(w)
+ }
+ fmt.Fprintln(w, "\tRET")
+}
+
func tagsPPC64x(w io.Writer) {
fmt.Fprintln(w)
fmt.Fprintln(w, "//go:build ppc64 || ppc64le")