summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/amd64
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-06-30 15:34:22 +0200
committerOndřej Surý <ondrej@sury.org>2011-06-30 15:34:22 +0200
commitd39f5aa373a4422f7a5f3ee764fb0f6b0b719d61 (patch)
tree1833f8b72a4b3a8f00d0d143b079a8fcad01c6ae /src/pkg/runtime/amd64
parent8652e6c371b8905498d3d314491d36c58d5f68d5 (diff)
downloadgolang-upstream/58.tar.gz
Imported Upstream version 58upstream/58
Diffstat (limited to 'src/pkg/runtime/amd64')
-rw-r--r--src/pkg/runtime/amd64/memmove.s12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/pkg/runtime/amd64/memmove.s b/src/pkg/runtime/amd64/memmove.s
index 9966b0ba7..fc9573f72 100644
--- a/src/pkg/runtime/amd64/memmove.s
+++ b/src/pkg/runtime/amd64/memmove.s
@@ -33,7 +33,6 @@ TEXT runtime·memmove(SB), 7, $0
/*
* check and set for backwards
- * should we look closer for overlap?
*/
CMPQ SI, DI
JLS back
@@ -41,6 +40,7 @@ TEXT runtime·memmove(SB), 7, $0
/*
* forward copy loop
*/
+forward:
MOVQ BX, CX
SHRQ $3, CX
ANDQ $7, BX
@@ -51,11 +51,19 @@ TEXT runtime·memmove(SB), 7, $0
MOVQ to+0(FP),AX
RET
+back:
+/*
+ * check overlap
+ */
+ MOVQ SI, CX
+ ADDQ BX, CX
+ CMPQ CX, DI
+ JLS forward
+
/*
* whole thing backwards has
* adjusted addresses
*/
-back:
ADDQ BX, DI
ADDQ BX, SI
STD