github.com/miolini/go@v0.0.0-20160405192216-fca68c8cb408/src/runtime/memclr_ppc64x.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  // +build ppc64 ppc64le
     6  
     7  #include "textflag.h"
     8  
     9  // void runtime·memclr(void*, uintptr)
    10  TEXT runtime·memclr(SB),NOSPLIT|NOFRAME,$0-16
    11  	MOVD	ptr+0(FP), R3
    12  	MOVD	n+8(FP), R4
    13  	SRADCC	$3, R4, R6	// R6 is the number of words to zero
    14  	BEQ	bytes
    15  
    16  	SUB	$8, R3
    17  	MOVD	R6, CTR
    18  	MOVDU	R0, 8(R3)
    19  	BC	25, 0, -1(PC)	// bdnz+ $-4
    20  	ADD	$8, R3
    21  
    22  bytes:
    23  	ANDCC	$7, R4, R7	// R7 is the number of bytes to zero
    24  	BEQ	done
    25  	SUB	$1, R3
    26  	MOVD	R7, CTR
    27  	MOVBU	R0, 1(R3)
    28  	BC	25, 0, -1(PC)	// bdnz+ $-4
    29  
    30  done:
    31  	RET