ref: 2bf74b8f25a89c8a49e96e5e44ffd72f495e4930
parent: 3e8a232eae0fa165d8045f73657d5259e3ad078c
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Jan 26 18:33:11 EST 2016
Actually move %rdx to %rcx before comparing it. We want to check for the overlap based on the count, not on random junk.
--- a/lib/std/memops-impl+posixy-x64.s
+++ b/lib/std/memops-impl+posixy-x64.s
@@ -7,6 +7,7 @@
_std$memblit:
std$memblit:
cmpq %rdi,%rsi
+ movq %rdx,%rcx
jz .done
jg .fwdcpy
movq %rsi,%rax
@@ -14,7 +15,6 @@
cmpq %rax,%rcx
jg .revcpy
.fwdcpy:
- movq %rdx,%rcx
shrq $3,%rcx
rep movsq
movq %rdx,%rcx
@@ -23,7 +23,6 @@
jmp .done
.revcpy:
std
- movq %rdx,%rcx
leaq -1(%rdx,%rsi),%rsi
leaq -1(%rdx,%rdi),%rdi
rep movsb