Home | History | Annotate | Download | only in runtime
      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 runtimememmove(void*, void*, uintptr)
     10 TEXT runtimememmove(SB), NOSPLIT, $-8-24
     11 	MOVD	to+0(FP), R3
     12 	MOVD	from+8(FP), R4
     13 	MOVD	n+16(FP), R5
     14 	CMP	R5, $0
     15 	BNE	check
     16 	RET
     17 
     18 check:
     19 	CMP	R3, R4
     20 	BGT	backward
     21 
     22 	SUB	$1, R3
     23 	ADD	R3, R5
     24 	SUB	$1, R4
     25 loop:
     26 	MOVBU	1(R4), R6
     27 	MOVBU	R6, 1(R3)
     28 	CMP	R3, R5
     29 	BNE	loop
     30 	RET
     31 
     32 backward:
     33 	ADD	R5, R4
     34 	ADD	R3, R5
     35 loop1:
     36 	MOVBU	-1(R4), R6
     37 	MOVBU	R6, -1(R5)
     38 	CMP	R3, R5
     39 	BNE	loop1
     40 	RET
     41