clarify the purpose of this project
[nyanglibc.git] / string / strcpy.s
blob1190ebf97cb3f22e0f5e7d46269fd5a0b85bd067
1 .text
2 .globl strcpy
3 .type strcpy,@function
4 .align 1<<4
5 strcpy:
6 movq %rsi, %rcx
7 andl $7, %ecx
8 movq %rdi, %rdx
9 jz 5f
10 neg %ecx
11 addl $8,%ecx
13 movb (%rsi), %al
14 testb %al, %al
15 movb %al, (%rdx)
16 jz 4f
17 incq %rsi
18 incq %rdx
19 decl %ecx
20 jnz 0b
22 movq $0xfefefefefefefeff,%r8
23 .p2align 4
25 movq (%rsi), %rax
26 addq $8, %rsi
27 movq %rax, %r9
28 addq %r8, %r9
29 jnc 3f
30 xorq %rax, %r9
31 orq %r8, %r9
32 incq %r9
33 jnz 3f
34 movq %rax, (%rdx)
35 addq $8, %rdx
36 movq (%rsi), %rax
37 addq $8, %rsi
38 movq %rax, %r9
39 addq %r8, %r9
40 jnc 3f
41 xorq %rax, %r9
42 orq %r8, %r9
43 incq %r9
44 jnz 3f
45 movq %rax, (%rdx)
46 addq $8, %rdx
47 movq (%rsi), %rax
48 addq $8, %rsi
49 movq %rax, %r9
50 addq %r8, %r9
51 jnc 3f
52 xorq %rax, %r9
53 orq %r8, %r9
54 incq %r9
55 jnz 3f
56 movq %rax, (%rdx)
57 addq $8, %rdx
58 movq (%rsi), %rax
59 addq $8, %rsi
60 movq %rax, %r9
61 addq %r8, %r9
62 jnc 3f
63 xorq %rax, %r9
64 orq %r8, %r9
65 incq %r9
66 jnz 3f
67 movq %rax, (%rdx)
68 addq $8, %rdx
69 jmp 1b
70 .p2align 4
72 movb %al, (%rdx)
73 testb %al, %al
74 jz 4f
75 incq %rdx
76 movb %ah, (%rdx)
77 testb %ah, %ah
78 jz 4f
79 incq %rdx
80 shrq $16, %rax
81 jmp 3b
83 movq %rdi, %rax
84 retq
85 .size strcpy,.-strcpy