...

Text file src/runtime/memclr_plan9_386.s

     1	// Copyright 2014 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	#include "textflag.h"
     6	
     7	// func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
     8	TEXT runtime·memclrNoHeapPointers(SB), NOSPLIT, $0-8
     9		MOVL	ptr+0(FP), DI
    10		MOVL	n+4(FP), BX
    11		XORL	AX, AX
    12	
    13	tail:
    14		TESTL	BX, BX
    15		JEQ	_0
    16		CMPL	BX, $2
    17		JBE	_1or2
    18		CMPL	BX, $4
    19		JB	_3
    20		JE	_4
    21		CMPL	BX, $8
    22		JBE	_5through8
    23		CMPL	BX, $16
    24		JBE	_9through16
    25		MOVL	BX, CX
    26		SHRL	$2, CX
    27		REP
    28		STOSL
    29		ANDL	$3, BX
    30		JNE	tail
    31		RET
    32	
    33	_1or2:
    34		MOVB	AX, (DI)
    35		MOVB	AX, -1(DI)(BX*1)
    36		RET
    37	_0:
    38		RET
    39	_3:
    40		MOVW	AX, (DI)
    41		MOVB	AX, 2(DI)
    42		RET
    43	_4:
    44		// We need a separate case for 4 to make sure we clear pointers atomically.
    45		MOVL	AX, (DI)
    46		RET
    47	_5through8:
    48		MOVL	AX, (DI)
    49		MOVL	AX, -4(DI)(BX*1)
    50		RET
    51	_9through16:
    52		MOVL	AX, (DI)
    53		MOVL	AX, 4(DI)
    54		MOVL	AX, -8(DI)(BX*1)
    55		MOVL	AX, -4(DI)(BX*1)
    56		RET

View as plain text