...

Text file src/pkg/runtime/memclr_mipsx.s

     1	// Copyright 2016 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 mips mipsle
     6	
     7	#include "textflag.h"
     8	
     9	#ifdef GOARCH_mips
    10	#define MOVWHI  MOVWL
    11	#define MOVWLO  MOVWR
    12	#else
    13	#define MOVWHI  MOVWR
    14	#define MOVWLO  MOVWL
    15	#endif
    16	
    17	// func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
    18	TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT,$0-8
    19		MOVW	n+4(FP), R2
    20		MOVW	ptr+0(FP), R1
    21	
    22		SGTU	$4, R2, R3
    23		ADDU	R2, R1, R4
    24		BNE	R3, small_zero
    25	
    26	ptr_align:
    27		AND	$3, R1, R3
    28		BEQ	R3, setup
    29		SUBU	R1, R0, R3
    30		AND	$3, R3		// R3 contains number of bytes needed to align ptr
    31		MOVWHI	R0, 0(R1)	// MOVWHI will write zeros up to next word boundary
    32		SUBU	R3, R2
    33		ADDU	R3, R1
    34	
    35	setup:
    36		AND	$31, R2, R6
    37		AND	$3, R2, R5
    38		SUBU	R6, R4, R6	// end pointer for 32-byte chunks
    39		SUBU	R5, R4, R5	// end pointer for 4-byte chunks
    40	
    41	large:
    42		BEQ	R1, R6, words
    43		MOVW	R0, 0(R1)
    44		MOVW	R0, 4(R1)
    45		MOVW	R0, 8(R1)
    46		MOVW	R0, 12(R1)
    47		MOVW	R0, 16(R1)
    48		MOVW	R0, 20(R1)
    49		MOVW	R0, 24(R1)
    50		MOVW	R0, 28(R1)
    51		ADDU	$32, R1
    52		JMP	large
    53	
    54	words:
    55		BEQ	R1, R5, tail
    56		MOVW	R0, 0(R1)
    57		ADDU	$4, R1
    58		JMP	words
    59	
    60	tail:
    61		BEQ	R1, R4, ret
    62		MOVWLO	R0, -1(R4)
    63	
    64	ret:
    65		RET
    66	
    67	small_zero:
    68		BEQ	R1, R4, ret
    69		MOVB	R0, 0(R1)
    70		ADDU	$1, R1
    71		JMP	small_zero

View as plain text