From: Rich Felker Date: Sun, 12 Aug 2012 01:33:13 +0000 (-0400) Subject: memcpy asm for i386 and x86_64 X-Git-Tag: v0.9.4~17 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=aaa9eb5101e3a748218fb9373dd9655b50582da2;p=oweals%2Fmusl.git memcpy asm for i386 and x86_64 --- 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 diff --git a/src/string/x86_64/memcpy.s b/src/string/x86_64/memcpy.s new file mode 100644 index 00000000..1282dc3b --- /dev/null +++ b/src/string/x86_64/memcpy.s @@ -0,0 +1,22 @@ +.global memcpy +.type memcpy,@function +memcpy: + 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