github.com/rsc/go@v0.0.0-20150416155037-e040fd465409/src/runtime/memclr_plan9_386.s (about)

     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  // void runtime·memclr(void*, uintptr)
     8  TEXT runtime·memclr(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  	JBE	_3or4
    20  	CMPL	BX, $8
    21  	JBE	_5through8
    22  	CMPL	BX, $16
    23  	JBE	_9through16
    24  	MOVL	BX, CX
    25  	SHRL	$2, CX
    26  	REP
    27  	STOSL
    28  	ANDL	$3, BX
    29  	JNE	tail
    30  	RET
    31  
    32  _1or2:
    33  	MOVB	AX, (DI)
    34  	MOVB	AX, -1(DI)(BX*1)
    35  	RET
    36  _0:
    37  	RET
    38  _3or4:
    39  	MOVW	AX, (DI)
    40  	MOVW	AX, -2(DI)(BX*1)
    41  	RET
    42  _5through8:
    43  	MOVL	AX, (DI)
    44  	MOVL	AX, -4(DI)(BX*1)
    45  	RET
    46  _9through16:
    47  	MOVL	AX, (DI)
    48  	MOVL	AX, 4(DI)
    49  	MOVL	AX, -8(DI)(BX*1)
    50  	MOVL	AX, -4(DI)(BX*1)
    51  	RET