about summary refs log tree commit diff
path: root/src/string/i386
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-08-11 21:33:13 -0400
committerRich Felker <dalias@aerifal.cx>2012-08-11 21:33:13 -0400
commitaaa9eb5101e3a748218fb9373dd9655b50582da2 (patch)
tree3b756d667add7460ff46739c965b380c00471166 /src/string/i386
parent036eaa24cf573c69982ba18dd427de68f6eeba2a (diff)
downloadmusl-aaa9eb5101e3a748218fb9373dd9655b50582da2.tar.gz
musl-aaa9eb5101e3a748218fb9373dd9655b50582da2.tar.xz
musl-aaa9eb5101e3a748218fb9373dd9655b50582da2.zip
memcpy asm for i386 and x86_64
Diffstat (limited to 'src/string/i386')
-rw-r--r--src/string/i386/memcpy.s29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/string/i386/memcpy.s b/src/string/i386/memcpy.s
new file mode 100644
index 00000000..b2977c89
--- /dev/null
+++ b/src/string/i386/memcpy.s
@@ -0,0 +1,29 @@
+.global memcpy
+.type memcpy,@function
+memcpy:
+	push %esi
+	push %edi
+	mov 12(%esp),%edi
+	mov 16(%esp),%esi
+	mov 20(%esp),%ecx
+	mov %edi,%eax
+	cmp $4,%ecx
+	jc 1f
+	test $3,%edi
+	jz 1f
+2:	movsb
+	dec %ecx
+	test $3,%edi
+	jnz 2b
+1:	mov %ecx,%edx
+	shr $2,%ecx
+	rep
+	movsl
+	and $3,%edx
+	jz 1f
+2:	movsb
+	dec %edx
+	jnz 2b
+1:	pop %edi
+	pop %esi
+	ret