aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/memclr_mips64x.s
diff options
context:
space:
mode:
authorYao Zhang <lunaria21@gmail.com>2015-09-10 11:25:58 -0400
committerMinux Ma <minux@golang.org>2015-11-12 04:46:17 +0000
commit424738e43ec3c775f7d0c36a90791eaca5dd85d1 (patch)
treee2018a202e7a1c028b350f798939992441eab068 /src/runtime/memclr_mips64x.s
parentb4501ac4a59d78f59b92f00cc4ba1e364298a44d (diff)
downloadgo-424738e43ec3c775f7d0c36a90791eaca5dd85d1.tar.gz
go-424738e43ec3c775f7d0c36a90791eaca5dd85d1.zip
runtime: added assembly part of linux/mips64{,le} support
Change-Id: I9e94027ef66c88007107de2b2b75c3d7cf1352af Reviewed-on: https://go-review.googlesource.com/14467 Reviewed-by: Minux Ma <minux@golang.org>
Diffstat (limited to 'src/runtime/memclr_mips64x.s')
-rw-r--r--src/runtime/memclr_mips64x.s42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/runtime/memclr_mips64x.s b/src/runtime/memclr_mips64x.s
new file mode 100644
index 0000000000..30a4af3c94
--- /dev/null
+++ b/src/runtime/memclr_mips64x.s
@@ -0,0 +1,42 @@
+// Copyright 2015 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build mips64 mips64le
+
+#include "textflag.h"
+
+// void runtime·memclr(void*, uintptr)
+TEXT runtime·memclr(SB),NOSPLIT,$0-16
+ MOVV ptr+0(FP), R1
+ MOVV n+8(FP), R2
+ ADDV R1, R2, R4
+
+ // if less than 8 bytes, do one byte at a time
+ SGTU $8, R2, R3
+ BNE R3, out
+
+ // do one byte at a time until 8-aligned
+ AND $7, R1, R3
+ BEQ R3, words
+ MOVB R0, (R1)
+ ADDV $1, R1
+ JMP -4(PC)
+
+words:
+ // do 8 bytes at a time if there is room
+ ADDV $-7, R4, R2
+
+ SGTU R2, R1, R3
+ BEQ R3, out
+ MOVV R0, (R1)
+ ADDV $8, R1
+ JMP -4(PC)
+
+out:
+ BEQ R1, R4, done
+ MOVB R0, (R1)
+ ADDV $1, R1
+ JMP -3(PC)
+done:
+ RET