summaryrefslogtreecommitdiff
path: root/src/runtime/memmove_power64x.s
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-10-29 11:45:01 -0400
committerRuss Cox <rsc@golang.org>2014-10-29 11:45:01 -0400
commitcc517ca5f7183e7f5d91bf75897b23cc0f4ed04f (patch)
treede12ff4332f39303ab2a6dbfa735071249ea1188 /src/runtime/memmove_power64x.s
parent7d8c40f1a65329094210933bca66b8862b0c28b8 (diff)
parent05d42f8a61328aa7ea55887f601286b597caf0da (diff)
downloadgo-cc517ca5f7183e7f5d91bf75897b23cc0f4ed04f.tar.gz
[dev.power64] all: merge default (dd5014ed9b01) into dev.power64
Still passes on amd64. LGTM=austin R=austin CC=golang-codereviews https://codereview.appspot.com/165110043
Diffstat (limited to 'src/runtime/memmove_power64x.s')
-rw-r--r--src/runtime/memmove_power64x.s40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/runtime/memmove_power64x.s b/src/runtime/memmove_power64x.s
new file mode 100644
index 000000000..2b04d8319
--- /dev/null
+++ b/src/runtime/memmove_power64x.s
@@ -0,0 +1,40 @@
+// Copyright 2014 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build power64 power64le
+
+#include "textflag.h"
+
+// void runtime·memmove(void*, void*, uintptr)
+TEXT runtime·memmove(SB), NOSPLIT, $-8-24
+ MOVD to+0(FP), R3
+ MOVD from+8(FP), R4
+ MOVD n+16(FP), R5
+ CMP R5, $0
+ BNE check
+ RETURN
+
+check:
+ CMP R3, R4
+ BGT backward
+
+ SUB $1, R3
+ ADD R3, R5
+ SUB $1, R4
+loop:
+ MOVBU 1(R4), R6
+ MOVBU R6, 1(R3)
+ CMP R3, R5
+ BNE loop
+ RETURN
+
+backward:
+ ADD R5, R4
+ ADD R3, R5
+loop1:
+ MOVBU -1(R4), R6
+ MOVBU R6, -1(R5)
+ CMP R3, R5
+ BNE loop1
+ RETURN