1// Copyright 2015 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// +build mips64 mips64le
6
7#include "textflag.h"
8
9// func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
10TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT,$0-16
11	MOVV	ptr+0(FP), R1
12	MOVV	n+8(FP), R2
13	ADDV	R1, R2, R4
14
15	// if less than 8 bytes, do one byte at a time
16	SGTU	$8, R2, R3
17	BNE	R3, out
18
19	// do one byte at a time until 8-aligned
20	AND	$7, R1, R3
21	BEQ	R3, words
22	MOVB	R0, (R1)
23	ADDV	$1, R1
24	JMP	-4(PC)
25
26words:
27	// do 8 bytes at a time if there is room
28	ADDV	$-7, R4, R2
29
30	SGTU	R2, R1, R3
31	BEQ	R3, out
32	MOVV	R0, (R1)
33	ADDV	$8, R1
34	JMP	-4(PC)
35
36out:
37	BEQ	R1, R4, done
38	MOVB	R0, (R1)
39	ADDV	$1, R1
40	JMP	-3(PC)
41done:
42	RET
43