asm for memmove on i386 and x86_64
[musl] / src / string / x86_64 / memmove.s
diff --git a/src/string/x86_64/memmove.s b/src/string/x86_64/memmove.s
new file mode 100644 (file)
index 0000000..247f0ac
--- /dev/null
@@ -0,0 +1,15 @@
+.global memmove
+.type memmove,@function
+memmove:
+       mov %rdi,%rax
+       sub %rsi,%rax
+       cmp %rdx,%rax
+       jae memcpy
+       mov %rdx,%rcx
+       lea -1(%rdi,%rdx),%rdi
+       lea -1(%rsi,%rdx),%rsi
+       std
+       rep movsb
+       cld
+       lea 1(%rdi),%rax
+       ret