summaryrefslogtreecommitdiff
path: root/src/string/x86_64/memcpy.s
diff options
context:
space:
mode:
authorVladimir Azarov <avm@intermediate-node.net>2024-10-01 15:47:05 +0200
committerVladimir Azarov <avm@intermediate-node.net>2024-10-01 15:47:05 +0200
commit4abab5ad6c8465a7528ccdd5f49367da05f78bbd (patch)
treeebf009bf1376a5a223a915bc27cbbd791a1316bc /src/string/x86_64/memcpy.s
Initial version
Diffstat (limited to 'src/string/x86_64/memcpy.s')
-rw-r--r--src/string/x86_64/memcpy.s25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/string/x86_64/memcpy.s b/src/string/x86_64/memcpy.s
new file mode 100644
index 0000000..3d960ef
--- /dev/null
+++ b/src/string/x86_64/memcpy.s
@@ -0,0 +1,25 @@
+.global memcpy
+.global __memcpy_fwd
+.hidden __memcpy_fwd
+.type memcpy,@function
+memcpy:
+__memcpy_fwd:
+ mov %rdi,%rax
+ cmp $8,%rdx
+ jc 1f
+ test $7,%edi
+ jz 1f
+2: movsb
+ dec %rdx
+ test $7,%edi
+ jnz 2b
+1: mov %rdx,%rcx
+ shr $3,%rcx
+ rep
+ movsq
+ and $7,%edx
+ jz 1f
+2: movsb
+ dec %edx
+ jnz 2b
+1: ret