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

View as plain text