1 /* memcpy with SSSE3 and REP string.
2 Copyright (C) 2010-2014 Free Software Foundation, Inc.
3 Contributed by Intel Corporation.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
22 #if !defined NOT_IN_libc \
24 || defined USE_AS_MEMMOVE \
25 || !defined USE_MULTIARCH)
27 #include "asm-syntax.h"
30 # define MEMCPY __memcpy_ssse3_rep
31 # define MEMCPY_CHK __memcpy_chk_ssse3_rep
44 #define CFI_PUSH(REG) \
45 cfi_adjust_cfa_offset (4); \
46 cfi_rel_offset (REG, 0)
48 #define CFI_POP(REG) \
49 cfi_adjust_cfa_offset (-4); \
52 #define PUSH(REG) pushl REG; CFI_PUSH (REG)
53 #define POP(REG) popl REG; CFI_POP (REG)
56 # define PARMS 8 /* Preserve EBX. */
57 # define ENTRANCE PUSH (%ebx);
58 # define RETURN_END POP (%ebx); ret
59 # define RETURN RETURN_END; CFI_PUSH (%ebx)
60 # define JMPTBL(I, B) I - B
62 /* Load an entry in a jump table into EBX and branch to it. TABLE is a
63 jump table with relative offsets. INDEX is a register contains the
64 index into the jump table. SCALE is the scale of INDEX. */
65 # define BRANCH_TO_JMPTBL_ENTRY(TABLE, INDEX, SCALE) \
66 /* We first load PC into EBX. */ \
68 /* Get the address of the jump table. */ \
69 addl $(TABLE - .), %ebx; \
70 /* Get the entry and convert the relative offset to the \
71 absolute address. */ \
72 addl (%ebx,INDEX,SCALE), %ebx; \
73 /* We loaded the jump table. Go. */ \
76 # define BRANCH_TO_JMPTBL_ENTRY_VALUE(TABLE) \
77 addl $(TABLE - .), %ebx
79 # define BRANCH_TO_JMPTBL_ENTRY_TAIL(TABLE, INDEX, SCALE) \
80 addl (%ebx,INDEX,SCALE), %ebx; \
81 /* We loaded the jump table. Go. */ \
86 # define RETURN_END ret
87 # define RETURN RETURN_END
88 # define JMPTBL(I, B) I
90 /* Branch to an entry in a jump table. TABLE is a jump table with
91 absolute offsets. INDEX is a register contains the index into the
92 jump table. SCALE is the scale of INDEX. */
93 # define BRANCH_TO_JMPTBL_ENTRY(TABLE, INDEX, SCALE) \
94 jmp *TABLE(,INDEX,SCALE)
96 # define BRANCH_TO_JMPTBL_ENTRY_VALUE(TABLE)
98 # define BRANCH_TO_JMPTBL_ENTRY_TAIL(TABLE, INDEX, SCALE) \
99 jmp *TABLE(,INDEX,SCALE)
102 .section .text.ssse3,"ax",@progbits
103 #if !defined USE_AS_BCOPY
107 jb HIDDEN_JUMPTARGET (__chk_fail)
114 movl DEST(%esp), %edx
116 #ifdef USE_AS_MEMMOVE
119 je L(fwd_write_0bytes)
121 jb L(bk_write_less48bytes)
132 L(fwd_write_less32bytes):
133 #ifndef USE_AS_MEMMOVE
139 BRANCH_TO_JMPTBL_ENTRY (L(table_48bytes_fwd), %ecx, 4)
140 #ifndef USE_AS_MEMMOVE
142 BRANCH_TO_JMPTBL_ENTRY (L(table_48_bytes_bwd), %ecx, 4)
146 /* ECX > 32 and EDX is 4 byte aligned. */
160 #ifdef SHARED_CACHE_SIZE_HALF
161 cmp $SHARED_CACHE_SIZE_HALF, %ecx
165 add $_GLOBAL_OFFSET_TABLE_, %ebx
166 cmp __x86_shared_cache_size_half@GOTOFF(%ebx), %ecx
168 cmp __x86_shared_cache_size_half, %ecx
177 BRANCH_TO_JMPTBL_ENTRY (L(shl_table), %edi, 4)
187 movdqa (%eax, %edi), %xmm0
188 movdqa 16(%eax, %edi), %xmm1
190 movdqa %xmm0, (%edx, %edi)
191 movdqa %xmm1, 16(%edx, %edi)
195 movdqa (%eax, %edi), %xmm0
196 movdqa 16(%eax, %edi), %xmm1
198 movdqa %xmm0, (%edx, %edi)
199 movdqa %xmm1, 16(%edx, %edi)
203 movdqa (%eax, %edi), %xmm0
204 movdqa 16(%eax, %edi), %xmm1
206 movdqa %xmm0, (%edx, %edi)
207 movdqa %xmm1, 16(%edx, %edi)
211 movdqa (%eax, %edi), %xmm0
212 movdqa 16(%eax, %edi), %xmm1
214 movdqa %xmm0, (%edx, %edi)
215 movdqa %xmm1, 16(%edx, %edi)
224 BRANCH_TO_JMPTBL_ENTRY (L(table_48bytes_fwd), %ecx, 4)
230 #ifdef DATA_CACHE_SIZE_HALF
231 cmp $DATA_CACHE_SIZE_HALF, %ecx
235 add $_GLOBAL_OFFSET_TABLE_, %ebx
236 mov __x86_data_cache_size_half@GOTOFF(%ebx), %edi
238 mov __x86_data_cache_size_half, %edi
245 jae L(shl_0_gobble_mem_start)
248 L(shl_0_gobble_cache_loop):
250 movaps 0x10(%eax), %xmm1
251 movaps 0x20(%eax), %xmm2
252 movaps 0x30(%eax), %xmm3
253 movaps 0x40(%eax), %xmm4
254 movaps 0x50(%eax), %xmm5
255 movaps 0x60(%eax), %xmm6
256 movaps 0x70(%eax), %xmm7
260 movaps %xmm1, 0x10(%edx)
261 movaps %xmm2, 0x20(%edx)
262 movaps %xmm3, 0x30(%edx)
263 movaps %xmm4, 0x40(%edx)
264 movaps %xmm5, 0x50(%edx)
265 movaps %xmm6, 0x60(%edx)
266 movaps %xmm7, 0x70(%edx)
269 jae L(shl_0_gobble_cache_loop)
272 jb L(shl_0_cache_less_64bytes)
276 movdqa 0x10(%eax), %xmm1
279 movdqa %xmm1, 0x10(%edx)
281 movdqa 0x20(%eax), %xmm0
282 movdqa 0x30(%eax), %xmm1
285 movdqa %xmm0, 0x20(%edx)
286 movdqa %xmm1, 0x30(%edx)
288 L(shl_0_cache_less_64bytes):
290 jb L(shl_0_cache_less_32bytes)
293 movdqa 0x10(%eax), %xmm1
296 movdqa %xmm1, 0x10(%edx)
298 L(shl_0_cache_less_32bytes):
300 jb L(shl_0_cache_less_16bytes)
306 L(shl_0_cache_less_16bytes):
311 BRANCH_TO_JMPTBL_ENTRY (L(table_48bytes_fwd), %ecx, 4)
316 L(shl_0_gobble_mem_start):
318 je L(copy_page_by_rep)
320 L(shl_0_gobble_mem_loop):
321 prefetchnta 0x1c0(%eax)
322 prefetchnta 0x280(%eax)
323 prefetchnta 0x1c0(%edx)
324 prefetchnta 0x280(%edx)
327 movaps 0x10(%eax), %xmm1
328 movaps 0x20(%eax), %xmm2
329 movaps 0x30(%eax), %xmm3
330 movaps 0x40(%eax), %xmm4
331 movaps 0x50(%eax), %xmm5
332 movaps 0x60(%eax), %xmm6
333 movaps 0x70(%eax), %xmm7
337 movaps %xmm1, 0x10(%edx)
338 movaps %xmm2, 0x20(%edx)
339 movaps %xmm3, 0x30(%edx)
340 movaps %xmm4, 0x40(%edx)
341 movaps %xmm5, 0x50(%edx)
342 movaps %xmm6, 0x60(%edx)
343 movaps %xmm7, 0x70(%edx)
346 jae L(shl_0_gobble_mem_loop)
349 jb L(shl_0_mem_less_64bytes)
353 movdqa 0x10(%eax), %xmm1
356 movdqa %xmm1, 0x10(%edx)
358 movdqa 0x20(%eax), %xmm0
359 movdqa 0x30(%eax), %xmm1
362 movdqa %xmm0, 0x20(%edx)
363 movdqa %xmm1, 0x30(%edx)
365 L(shl_0_mem_less_64bytes):
367 jb L(shl_0_mem_less_32bytes)
370 movdqa 0x10(%eax), %xmm1
373 movdqa %xmm1, 0x10(%edx)
375 L(shl_0_mem_less_32bytes):
377 jb L(shl_0_mem_less_16bytes)
383 L(shl_0_mem_less_16bytes):
388 BRANCH_TO_JMPTBL_ENTRY (L(table_48bytes_fwd), %ecx, 4)
394 BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
403 movdqa 16(%eax, %edi), %xmm2
405 movdqa 32(%eax, %edi), %xmm3
407 palignr $1, %xmm2, %xmm3
408 palignr $1, %xmm1, %xmm2
410 movdqa %xmm2, -32(%edx, %edi)
411 movdqa %xmm3, -16(%edx, %edi)
415 movdqa 16(%eax, %edi), %xmm2
417 movdqa 32(%eax, %edi), %xmm3
419 palignr $1, %xmm2, %xmm3
420 palignr $1, %xmm4, %xmm2
422 movdqa %xmm2, -32(%edx, %edi)
423 movdqa %xmm3, -16(%edx, %edi)
431 lea 1(%edi, %eax), %eax
433 BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
439 BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
448 movdqa 16(%eax, %edi), %xmm2
450 movdqa 32(%eax, %edi), %xmm3
452 palignr $2, %xmm2, %xmm3
453 palignr $2, %xmm1, %xmm2
455 movdqa %xmm2, -32(%edx, %edi)
456 movdqa %xmm3, -16(%edx, %edi)
460 movdqa 16(%eax, %edi), %xmm2
462 movdqa 32(%eax, %edi), %xmm3
464 palignr $2, %xmm2, %xmm3
465 palignr $2, %xmm4, %xmm2
467 movdqa %xmm2, -32(%edx, %edi)
468 movdqa %xmm3, -16(%edx, %edi)
476 lea 2(%edi, %eax), %eax
478 BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
484 BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
493 movdqa 16(%eax, %edi), %xmm2
495 movdqa 32(%eax, %edi), %xmm3
497 palignr $3, %xmm2, %xmm3
498 palignr $3, %xmm1, %xmm2
500 movdqa %xmm2, -32(%edx, %edi)
501 movdqa %xmm3, -16(%edx, %edi)
505 movdqa 16(%eax, %edi), %xmm2
507 movdqa 32(%eax, %edi), %xmm3
509 palignr $3, %xmm2, %xmm3
510 palignr $3, %xmm4, %xmm2
512 movdqa %xmm2, -32(%edx, %edi)
513 movdqa %xmm3, -16(%edx, %edi)
521 lea 3(%edi, %eax), %eax
523 BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
529 BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
538 movdqa 16(%eax, %edi), %xmm2
540 movdqa 32(%eax, %edi), %xmm3
542 palignr $4, %xmm2, %xmm3
543 palignr $4, %xmm1, %xmm2
545 movdqa %xmm2, -32(%edx, %edi)
546 movdqa %xmm3, -16(%edx, %edi)
550 movdqa 16(%eax, %edi), %xmm2
552 movdqa 32(%eax, %edi), %xmm3
554 palignr $4, %xmm2, %xmm3
555 palignr $4, %xmm4, %xmm2
557 movdqa %xmm2, -32(%edx, %edi)
558 movdqa %xmm3, -16(%edx, %edi)
566 lea 4(%edi, %eax), %eax
568 BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
574 BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
583 movdqa 16(%eax, %edi), %xmm2
585 movdqa 32(%eax, %edi), %xmm3
587 palignr $5, %xmm2, %xmm3
588 palignr $5, %xmm1, %xmm2
590 movdqa %xmm2, -32(%edx, %edi)
591 movdqa %xmm3, -16(%edx, %edi)
595 movdqa 16(%eax, %edi), %xmm2
597 movdqa 32(%eax, %edi), %xmm3
599 palignr $5, %xmm2, %xmm3
600 palignr $5, %xmm4, %xmm2
602 movdqa %xmm2, -32(%edx, %edi)
603 movdqa %xmm3, -16(%edx, %edi)
611 lea 5(%edi, %eax), %eax
613 BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
619 BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
628 movdqa 16(%eax, %edi), %xmm2
630 movdqa 32(%eax, %edi), %xmm3
632 palignr $6, %xmm2, %xmm3
633 palignr $6, %xmm1, %xmm2
635 movdqa %xmm2, -32(%edx, %edi)
636 movdqa %xmm3, -16(%edx, %edi)
640 movdqa 16(%eax, %edi), %xmm2
642 movdqa 32(%eax, %edi), %xmm3
644 palignr $6, %xmm2, %xmm3
645 palignr $6, %xmm4, %xmm2
647 movdqa %xmm2, -32(%edx, %edi)
648 movdqa %xmm3, -16(%edx, %edi)
656 lea 6(%edi, %eax), %eax
658 BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
664 BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
673 movdqa 16(%eax, %edi), %xmm2
675 movdqa 32(%eax, %edi), %xmm3
677 palignr $7, %xmm2, %xmm3
678 palignr $7, %xmm1, %xmm2
680 movdqa %xmm2, -32(%edx, %edi)
681 movdqa %xmm3, -16(%edx, %edi)
685 movdqa 16(%eax, %edi), %xmm2
687 movdqa 32(%eax, %edi), %xmm3
689 palignr $7, %xmm2, %xmm3
690 palignr $7, %xmm4, %xmm2
692 movdqa %xmm2, -32(%edx, %edi)
693 movdqa %xmm3, -16(%edx, %edi)
701 lea 7(%edi, %eax), %eax
703 BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
709 BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
718 movdqa 16(%eax, %edi), %xmm2
720 movdqa 32(%eax, %edi), %xmm3
722 palignr $8, %xmm2, %xmm3
723 palignr $8, %xmm1, %xmm2
725 movdqa %xmm2, -32(%edx, %edi)
726 movdqa %xmm3, -16(%edx, %edi)
730 movdqa 16(%eax, %edi), %xmm2
732 movdqa 32(%eax, %edi), %xmm3
734 palignr $8, %xmm2, %xmm3
735 palignr $8, %xmm4, %xmm2
737 movdqa %xmm2, -32(%edx, %edi)
738 movdqa %xmm3, -16(%edx, %edi)
746 lea 8(%edi, %eax), %eax
748 BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
754 BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
763 movdqa 16(%eax, %edi), %xmm2
765 movdqa 32(%eax, %edi), %xmm3
767 palignr $9, %xmm2, %xmm3
768 palignr $9, %xmm1, %xmm2
770 movdqa %xmm2, -32(%edx, %edi)
771 movdqa %xmm3, -16(%edx, %edi)
775 movdqa 16(%eax, %edi), %xmm2
777 movdqa 32(%eax, %edi), %xmm3
779 palignr $9, %xmm2, %xmm3
780 palignr $9, %xmm4, %xmm2
782 movdqa %xmm2, -32(%edx, %edi)
783 movdqa %xmm3, -16(%edx, %edi)
791 lea 9(%edi, %eax), %eax
793 BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
799 BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
808 movdqa 16(%eax, %edi), %xmm2
810 movdqa 32(%eax, %edi), %xmm3
812 palignr $10, %xmm2, %xmm3
813 palignr $10, %xmm1, %xmm2
815 movdqa %xmm2, -32(%edx, %edi)
816 movdqa %xmm3, -16(%edx, %edi)
820 movdqa 16(%eax, %edi), %xmm2
822 movdqa 32(%eax, %edi), %xmm3
824 palignr $10, %xmm2, %xmm3
825 palignr $10, %xmm4, %xmm2
827 movdqa %xmm2, -32(%edx, %edi)
828 movdqa %xmm3, -16(%edx, %edi)
836 lea 10(%edi, %eax), %eax
838 BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
844 BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
853 movdqa 16(%eax, %edi), %xmm2
855 movdqa 32(%eax, %edi), %xmm3
857 palignr $11, %xmm2, %xmm3
858 palignr $11, %xmm1, %xmm2
860 movdqa %xmm2, -32(%edx, %edi)
861 movdqa %xmm3, -16(%edx, %edi)
865 movdqa 16(%eax, %edi), %xmm2
867 movdqa 32(%eax, %edi), %xmm3
869 palignr $11, %xmm2, %xmm3
870 palignr $11, %xmm4, %xmm2
872 movdqa %xmm2, -32(%edx, %edi)
873 movdqa %xmm3, -16(%edx, %edi)
881 lea 11(%edi, %eax), %eax
883 BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
889 BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
898 movdqa 16(%eax, %edi), %xmm2
900 movdqa 32(%eax, %edi), %xmm3
902 palignr $12, %xmm2, %xmm3
903 palignr $12, %xmm1, %xmm2
905 movdqa %xmm2, -32(%edx, %edi)
906 movdqa %xmm3, -16(%edx, %edi)
910 movdqa 16(%eax, %edi), %xmm2
912 movdqa 32(%eax, %edi), %xmm3
914 palignr $12, %xmm2, %xmm3
915 palignr $12, %xmm4, %xmm2
917 movdqa %xmm2, -32(%edx, %edi)
918 movdqa %xmm3, -16(%edx, %edi)
926 lea 12(%edi, %eax), %eax
928 BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
934 BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
943 movdqa 16(%eax, %edi), %xmm2
945 movdqa 32(%eax, %edi), %xmm3
947 palignr $13, %xmm2, %xmm3
948 palignr $13, %xmm1, %xmm2
950 movdqa %xmm2, -32(%edx, %edi)
951 movdqa %xmm3, -16(%edx, %edi)
955 movdqa 16(%eax, %edi), %xmm2
957 movdqa 32(%eax, %edi), %xmm3
959 palignr $13, %xmm2, %xmm3
960 palignr $13, %xmm4, %xmm2
962 movdqa %xmm2, -32(%edx, %edi)
963 movdqa %xmm3, -16(%edx, %edi)
971 lea 13(%edi, %eax), %eax
973 BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
979 BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
988 movdqa 16(%eax, %edi), %xmm2
990 movdqa 32(%eax, %edi), %xmm3
992 palignr $14, %xmm2, %xmm3
993 palignr $14, %xmm1, %xmm2
995 movdqa %xmm2, -32(%edx, %edi)
996 movdqa %xmm3, -16(%edx, %edi)
1000 movdqa 16(%eax, %edi), %xmm2
1002 movdqa 32(%eax, %edi), %xmm3
1004 palignr $14, %xmm2, %xmm3
1005 palignr $14, %xmm4, %xmm2
1007 movdqa %xmm2, -32(%edx, %edi)
1008 movdqa %xmm3, -16(%edx, %edi)
1016 lea 14(%edi, %eax), %eax
1018 BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
1024 BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
1026 movaps (%eax), %xmm1
1029 movdqu %xmm0, (%esi)
1033 movdqa 16(%eax, %edi), %xmm2
1035 movdqa 32(%eax, %edi), %xmm3
1037 palignr $15, %xmm2, %xmm3
1038 palignr $15, %xmm1, %xmm2
1040 movdqa %xmm2, -32(%edx, %edi)
1041 movdqa %xmm3, -16(%edx, %edi)
1045 movdqa 16(%eax, %edi), %xmm2
1047 movdqa 32(%eax, %edi), %xmm3
1049 palignr $15, %xmm2, %xmm3
1050 palignr $15, %xmm4, %xmm2
1052 movdqa %xmm2, -32(%edx, %edi)
1053 movdqa %xmm3, -16(%edx, %edi)
1061 lea 15(%edi, %eax), %eax
1063 BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
1067 L(fwd_write_44bytes):
1068 movl -44(%eax), %ecx
1069 movl %ecx, -44(%edx)
1070 L(fwd_write_40bytes):
1071 movl -40(%eax), %ecx
1072 movl %ecx, -40(%edx)
1073 L(fwd_write_36bytes):
1074 movl -36(%eax), %ecx
1075 movl %ecx, -36(%edx)
1076 L(fwd_write_32bytes):
1077 movl -32(%eax), %ecx
1078 movl %ecx, -32(%edx)
1079 L(fwd_write_28bytes):
1080 movl -28(%eax), %ecx
1081 movl %ecx, -28(%edx)
1082 L(fwd_write_24bytes):
1083 movl -24(%eax), %ecx
1084 movl %ecx, -24(%edx)
1085 L(fwd_write_20bytes):
1086 movl -20(%eax), %ecx
1087 movl %ecx, -20(%edx)
1088 L(fwd_write_16bytes):
1089 movl -16(%eax), %ecx
1090 movl %ecx, -16(%edx)
1091 L(fwd_write_12bytes):
1092 movl -12(%eax), %ecx
1093 movl %ecx, -12(%edx)
1094 L(fwd_write_8bytes):
1097 L(fwd_write_4bytes):
1100 L(fwd_write_0bytes):
1101 #ifndef USE_AS_BCOPY
1102 # ifdef USE_AS_MEMPCPY
1105 movl DEST(%esp), %eax
1111 L(fwd_write_5bytes):
1116 #ifndef USE_AS_BCOPY
1117 # ifdef USE_AS_MEMPCPY
1120 movl DEST(%esp), %eax
1126 L(fwd_write_45bytes):
1127 movl -45(%eax), %ecx
1128 movl %ecx, -45(%edx)
1129 L(fwd_write_41bytes):
1130 movl -41(%eax), %ecx
1131 movl %ecx, -41(%edx)
1132 L(fwd_write_37bytes):
1133 movl -37(%eax), %ecx
1134 movl %ecx, -37(%edx)
1135 L(fwd_write_33bytes):
1136 movl -33(%eax), %ecx
1137 movl %ecx, -33(%edx)
1138 L(fwd_write_29bytes):
1139 movl -29(%eax), %ecx
1140 movl %ecx, -29(%edx)
1141 L(fwd_write_25bytes):
1142 movl -25(%eax), %ecx
1143 movl %ecx, -25(%edx)
1144 L(fwd_write_21bytes):
1145 movl -21(%eax), %ecx
1146 movl %ecx, -21(%edx)
1147 L(fwd_write_17bytes):
1148 movl -17(%eax), %ecx
1149 movl %ecx, -17(%edx)
1150 L(fwd_write_13bytes):
1151 movl -13(%eax), %ecx
1152 movl %ecx, -13(%edx)
1153 L(fwd_write_9bytes):
1158 L(fwd_write_1bytes):
1159 movzbl -1(%eax), %ecx
1161 #ifndef USE_AS_BCOPY
1162 # ifdef USE_AS_MEMPCPY
1165 movl DEST(%esp), %eax
1171 L(fwd_write_46bytes):
1172 movl -46(%eax), %ecx
1173 movl %ecx, -46(%edx)
1174 L(fwd_write_42bytes):
1175 movl -42(%eax), %ecx
1176 movl %ecx, -42(%edx)
1177 L(fwd_write_38bytes):
1178 movl -38(%eax), %ecx
1179 movl %ecx, -38(%edx)
1180 L(fwd_write_34bytes):
1181 movl -34(%eax), %ecx
1182 movl %ecx, -34(%edx)
1183 L(fwd_write_30bytes):
1184 movl -30(%eax), %ecx
1185 movl %ecx, -30(%edx)
1186 L(fwd_write_26bytes):
1187 movl -26(%eax), %ecx
1188 movl %ecx, -26(%edx)
1189 L(fwd_write_22bytes):
1190 movl -22(%eax), %ecx
1191 movl %ecx, -22(%edx)
1192 L(fwd_write_18bytes):
1193 movl -18(%eax), %ecx
1194 movl %ecx, -18(%edx)
1195 L(fwd_write_14bytes):
1196 movl -14(%eax), %ecx
1197 movl %ecx, -14(%edx)
1198 L(fwd_write_10bytes):
1199 movl -10(%eax), %ecx
1200 movl %ecx, -10(%edx)
1201 L(fwd_write_6bytes):
1204 L(fwd_write_2bytes):
1205 movzwl -2(%eax), %ecx
1207 #ifndef USE_AS_BCOPY
1208 # ifdef USE_AS_MEMPCPY
1211 movl DEST(%esp), %eax
1217 L(fwd_write_47bytes):
1218 movl -47(%eax), %ecx
1219 movl %ecx, -47(%edx)
1220 L(fwd_write_43bytes):
1221 movl -43(%eax), %ecx
1222 movl %ecx, -43(%edx)
1223 L(fwd_write_39bytes):
1224 movl -39(%eax), %ecx
1225 movl %ecx, -39(%edx)
1226 L(fwd_write_35bytes):
1227 movl -35(%eax), %ecx
1228 movl %ecx, -35(%edx)
1229 L(fwd_write_31bytes):
1230 movl -31(%eax), %ecx
1231 movl %ecx, -31(%edx)
1232 L(fwd_write_27bytes):
1233 movl -27(%eax), %ecx
1234 movl %ecx, -27(%edx)
1235 L(fwd_write_23bytes):
1236 movl -23(%eax), %ecx
1237 movl %ecx, -23(%edx)
1238 L(fwd_write_19bytes):
1239 movl -19(%eax), %ecx
1240 movl %ecx, -19(%edx)
1241 L(fwd_write_15bytes):
1242 movl -15(%eax), %ecx
1243 movl %ecx, -15(%edx)
1244 L(fwd_write_11bytes):
1245 movl -11(%eax), %ecx
1246 movl %ecx, -11(%edx)
1247 L(fwd_write_7bytes):
1250 L(fwd_write_3bytes):
1251 movzwl -3(%eax), %ecx
1252 movzbl -1(%eax), %eax
1255 #ifndef USE_AS_BCOPY
1256 # ifdef USE_AS_MEMPCPY
1259 movl DEST(%esp), %eax
1268 movdqu (%eax), %xmm1
1269 movdqu %xmm0, (%esi)
1270 movntdq %xmm1, (%edx)
1275 je L(copy_page_by_rep)
1276 L(large_page_loop_init):
1281 prefetchnta 0x1c0(%eax)
1282 prefetchnta 0x280(%eax)
1283 movdqu (%eax), %xmm0
1284 movdqu 0x10(%eax), %xmm1
1285 movdqu 0x20(%eax), %xmm2
1286 movdqu 0x30(%eax), %xmm3
1287 movdqu 0x40(%eax), %xmm4
1288 movdqu 0x50(%eax), %xmm5
1289 movdqu 0x60(%eax), %xmm6
1290 movdqu 0x70(%eax), %xmm7
1291 lea 0x80(%eax), %eax
1294 movntdq %xmm0, (%edx)
1295 movntdq %xmm1, 0x10(%edx)
1296 movntdq %xmm2, 0x20(%edx)
1297 movntdq %xmm3, 0x30(%edx)
1298 movntdq %xmm4, 0x40(%edx)
1299 movntdq %xmm5, 0x50(%edx)
1300 movntdq %xmm6, 0x60(%edx)
1301 movntdq %xmm7, 0x70(%edx)
1302 lea 0x80(%edx), %edx
1303 jae L(large_page_loop)
1306 jb L(large_page_less_64bytes)
1308 movdqu (%eax), %xmm0
1309 movdqu 0x10(%eax), %xmm1
1310 movdqu 0x20(%eax), %xmm2
1311 movdqu 0x30(%eax), %xmm3
1312 lea 0x40(%eax), %eax
1314 movntdq %xmm0, (%edx)
1315 movntdq %xmm1, 0x10(%edx)
1316 movntdq %xmm2, 0x20(%edx)
1317 movntdq %xmm3, 0x30(%edx)
1318 lea 0x40(%edx), %edx
1320 L(large_page_less_64bytes):
1322 jb L(large_page_less_32bytes)
1323 movdqu (%eax), %xmm0
1324 movdqu 0x10(%eax), %xmm1
1325 lea 0x20(%eax), %eax
1326 movntdq %xmm0, (%edx)
1327 movntdq %xmm1, 0x10(%edx)
1328 lea 0x20(%edx), %edx
1330 L(large_page_less_32bytes):
1334 BRANCH_TO_JMPTBL_ENTRY (L(table_48bytes_fwd), %ecx, 4)
1339 L(copy_page_by_rep):
1346 jz L(copy_page_by_rep_exit)
1348 jb L(copy_page_by_rep_left_1)
1354 jz L(copy_page_by_rep_exit)
1355 L(copy_page_by_rep_left_1):
1358 L(copy_page_by_rep_exit):
1361 #ifndef USE_AS_BCOPY
1362 movl DEST(%esp), %eax
1363 # ifdef USE_AS_MEMPCPY
1364 movl LEN(%esp), %ecx
1371 L(bk_write_44bytes):
1374 L(bk_write_40bytes):
1377 L(bk_write_36bytes):
1380 L(bk_write_32bytes):
1383 L(bk_write_28bytes):
1386 L(bk_write_24bytes):
1389 L(bk_write_20bytes):
1392 L(bk_write_16bytes):
1395 L(bk_write_12bytes):
1405 #ifndef USE_AS_BCOPY
1406 movl DEST(%esp), %eax
1407 # ifdef USE_AS_MEMPCPY
1408 movl LEN(%esp), %ecx
1415 L(bk_write_45bytes):
1418 L(bk_write_41bytes):
1421 L(bk_write_37bytes):
1424 L(bk_write_33bytes):
1427 L(bk_write_29bytes):
1430 L(bk_write_25bytes):
1433 L(bk_write_21bytes):
1436 L(bk_write_17bytes):
1439 L(bk_write_13bytes):
1451 #ifndef USE_AS_BCOPY
1452 movl DEST(%esp), %eax
1453 # ifdef USE_AS_MEMPCPY
1454 movl LEN(%esp), %ecx
1461 L(bk_write_46bytes):
1464 L(bk_write_42bytes):
1467 L(bk_write_38bytes):
1470 L(bk_write_34bytes):
1473 L(bk_write_30bytes):
1476 L(bk_write_26bytes):
1479 L(bk_write_22bytes):
1482 L(bk_write_18bytes):
1485 L(bk_write_14bytes):
1488 L(bk_write_10bytes):
1497 #ifndef USE_AS_BCOPY
1498 movl DEST(%esp), %eax
1499 # ifdef USE_AS_MEMPCPY
1500 movl LEN(%esp), %ecx
1507 L(bk_write_47bytes):
1510 L(bk_write_43bytes):
1513 L(bk_write_39bytes):
1516 L(bk_write_35bytes):
1519 L(bk_write_31bytes):
1522 L(bk_write_27bytes):
1525 L(bk_write_23bytes):
1528 L(bk_write_19bytes):
1531 L(bk_write_15bytes):
1534 L(bk_write_11bytes):
1541 movzwl 1(%eax), %ecx
1545 #ifndef USE_AS_BCOPY
1546 movl DEST(%esp), %eax
1547 # ifdef USE_AS_MEMPCPY
1548 movl LEN(%esp), %ecx
1555 .pushsection .rodata.ssse3,"a",@progbits
1557 L(table_48bytes_fwd):
1558 .int JMPTBL (L(fwd_write_0bytes), L(table_48bytes_fwd))
1559 .int JMPTBL (L(fwd_write_1bytes), L(table_48bytes_fwd))
1560 .int JMPTBL (L(fwd_write_2bytes), L(table_48bytes_fwd))
1561 .int JMPTBL (L(fwd_write_3bytes), L(table_48bytes_fwd))
1562 .int JMPTBL (L(fwd_write_4bytes), L(table_48bytes_fwd))
1563 .int JMPTBL (L(fwd_write_5bytes), L(table_48bytes_fwd))
1564 .int JMPTBL (L(fwd_write_6bytes), L(table_48bytes_fwd))
1565 .int JMPTBL (L(fwd_write_7bytes), L(table_48bytes_fwd))
1566 .int JMPTBL (L(fwd_write_8bytes), L(table_48bytes_fwd))
1567 .int JMPTBL (L(fwd_write_9bytes), L(table_48bytes_fwd))
1568 .int JMPTBL (L(fwd_write_10bytes), L(table_48bytes_fwd))
1569 .int JMPTBL (L(fwd_write_11bytes), L(table_48bytes_fwd))
1570 .int JMPTBL (L(fwd_write_12bytes), L(table_48bytes_fwd))
1571 .int JMPTBL (L(fwd_write_13bytes), L(table_48bytes_fwd))
1572 .int JMPTBL (L(fwd_write_14bytes), L(table_48bytes_fwd))
1573 .int JMPTBL (L(fwd_write_15bytes), L(table_48bytes_fwd))
1574 .int JMPTBL (L(fwd_write_16bytes), L(table_48bytes_fwd))
1575 .int JMPTBL (L(fwd_write_17bytes), L(table_48bytes_fwd))
1576 .int JMPTBL (L(fwd_write_18bytes), L(table_48bytes_fwd))
1577 .int JMPTBL (L(fwd_write_19bytes), L(table_48bytes_fwd))
1578 .int JMPTBL (L(fwd_write_20bytes), L(table_48bytes_fwd))
1579 .int JMPTBL (L(fwd_write_21bytes), L(table_48bytes_fwd))
1580 .int JMPTBL (L(fwd_write_22bytes), L(table_48bytes_fwd))
1581 .int JMPTBL (L(fwd_write_23bytes), L(table_48bytes_fwd))
1582 .int JMPTBL (L(fwd_write_24bytes), L(table_48bytes_fwd))
1583 .int JMPTBL (L(fwd_write_25bytes), L(table_48bytes_fwd))
1584 .int JMPTBL (L(fwd_write_26bytes), L(table_48bytes_fwd))
1585 .int JMPTBL (L(fwd_write_27bytes), L(table_48bytes_fwd))
1586 .int JMPTBL (L(fwd_write_28bytes), L(table_48bytes_fwd))
1587 .int JMPTBL (L(fwd_write_29bytes), L(table_48bytes_fwd))
1588 .int JMPTBL (L(fwd_write_30bytes), L(table_48bytes_fwd))
1589 .int JMPTBL (L(fwd_write_31bytes), L(table_48bytes_fwd))
1590 .int JMPTBL (L(fwd_write_32bytes), L(table_48bytes_fwd))
1591 .int JMPTBL (L(fwd_write_33bytes), L(table_48bytes_fwd))
1592 .int JMPTBL (L(fwd_write_34bytes), L(table_48bytes_fwd))
1593 .int JMPTBL (L(fwd_write_35bytes), L(table_48bytes_fwd))
1594 .int JMPTBL (L(fwd_write_36bytes), L(table_48bytes_fwd))
1595 .int JMPTBL (L(fwd_write_37bytes), L(table_48bytes_fwd))
1596 .int JMPTBL (L(fwd_write_38bytes), L(table_48bytes_fwd))
1597 .int JMPTBL (L(fwd_write_39bytes), L(table_48bytes_fwd))
1598 .int JMPTBL (L(fwd_write_40bytes), L(table_48bytes_fwd))
1599 .int JMPTBL (L(fwd_write_41bytes), L(table_48bytes_fwd))
1600 .int JMPTBL (L(fwd_write_42bytes), L(table_48bytes_fwd))
1601 .int JMPTBL (L(fwd_write_43bytes), L(table_48bytes_fwd))
1602 .int JMPTBL (L(fwd_write_44bytes), L(table_48bytes_fwd))
1603 .int JMPTBL (L(fwd_write_45bytes), L(table_48bytes_fwd))
1604 .int JMPTBL (L(fwd_write_46bytes), L(table_48bytes_fwd))
1605 .int JMPTBL (L(fwd_write_47bytes), L(table_48bytes_fwd))
1609 .int JMPTBL (L(shl_0), L(shl_table))
1610 .int JMPTBL (L(shl_1), L(shl_table))
1611 .int JMPTBL (L(shl_2), L(shl_table))
1612 .int JMPTBL (L(shl_3), L(shl_table))
1613 .int JMPTBL (L(shl_4), L(shl_table))
1614 .int JMPTBL (L(shl_5), L(shl_table))
1615 .int JMPTBL (L(shl_6), L(shl_table))
1616 .int JMPTBL (L(shl_7), L(shl_table))
1617 .int JMPTBL (L(shl_8), L(shl_table))
1618 .int JMPTBL (L(shl_9), L(shl_table))
1619 .int JMPTBL (L(shl_10), L(shl_table))
1620 .int JMPTBL (L(shl_11), L(shl_table))
1621 .int JMPTBL (L(shl_12), L(shl_table))
1622 .int JMPTBL (L(shl_13), L(shl_table))
1623 .int JMPTBL (L(shl_14), L(shl_table))
1624 .int JMPTBL (L(shl_15), L(shl_table))
1627 L(table_48_bytes_bwd):
1628 .int JMPTBL (L(bk_write_0bytes), L(table_48_bytes_bwd))
1629 .int JMPTBL (L(bk_write_1bytes), L(table_48_bytes_bwd))
1630 .int JMPTBL (L(bk_write_2bytes), L(table_48_bytes_bwd))
1631 .int JMPTBL (L(bk_write_3bytes), L(table_48_bytes_bwd))
1632 .int JMPTBL (L(bk_write_4bytes), L(table_48_bytes_bwd))
1633 .int JMPTBL (L(bk_write_5bytes), L(table_48_bytes_bwd))
1634 .int JMPTBL (L(bk_write_6bytes), L(table_48_bytes_bwd))
1635 .int JMPTBL (L(bk_write_7bytes), L(table_48_bytes_bwd))
1636 .int JMPTBL (L(bk_write_8bytes), L(table_48_bytes_bwd))
1637 .int JMPTBL (L(bk_write_9bytes), L(table_48_bytes_bwd))
1638 .int JMPTBL (L(bk_write_10bytes), L(table_48_bytes_bwd))
1639 .int JMPTBL (L(bk_write_11bytes), L(table_48_bytes_bwd))
1640 .int JMPTBL (L(bk_write_12bytes), L(table_48_bytes_bwd))
1641 .int JMPTBL (L(bk_write_13bytes), L(table_48_bytes_bwd))
1642 .int JMPTBL (L(bk_write_14bytes), L(table_48_bytes_bwd))
1643 .int JMPTBL (L(bk_write_15bytes), L(table_48_bytes_bwd))
1644 .int JMPTBL (L(bk_write_16bytes), L(table_48_bytes_bwd))
1645 .int JMPTBL (L(bk_write_17bytes), L(table_48_bytes_bwd))
1646 .int JMPTBL (L(bk_write_18bytes), L(table_48_bytes_bwd))
1647 .int JMPTBL (L(bk_write_19bytes), L(table_48_bytes_bwd))
1648 .int JMPTBL (L(bk_write_20bytes), L(table_48_bytes_bwd))
1649 .int JMPTBL (L(bk_write_21bytes), L(table_48_bytes_bwd))
1650 .int JMPTBL (L(bk_write_22bytes), L(table_48_bytes_bwd))
1651 .int JMPTBL (L(bk_write_23bytes), L(table_48_bytes_bwd))
1652 .int JMPTBL (L(bk_write_24bytes), L(table_48_bytes_bwd))
1653 .int JMPTBL (L(bk_write_25bytes), L(table_48_bytes_bwd))
1654 .int JMPTBL (L(bk_write_26bytes), L(table_48_bytes_bwd))
1655 .int JMPTBL (L(bk_write_27bytes), L(table_48_bytes_bwd))
1656 .int JMPTBL (L(bk_write_28bytes), L(table_48_bytes_bwd))
1657 .int JMPTBL (L(bk_write_29bytes), L(table_48_bytes_bwd))
1658 .int JMPTBL (L(bk_write_30bytes), L(table_48_bytes_bwd))
1659 .int JMPTBL (L(bk_write_31bytes), L(table_48_bytes_bwd))
1660 .int JMPTBL (L(bk_write_32bytes), L(table_48_bytes_bwd))
1661 .int JMPTBL (L(bk_write_33bytes), L(table_48_bytes_bwd))
1662 .int JMPTBL (L(bk_write_34bytes), L(table_48_bytes_bwd))
1663 .int JMPTBL (L(bk_write_35bytes), L(table_48_bytes_bwd))
1664 .int JMPTBL (L(bk_write_36bytes), L(table_48_bytes_bwd))
1665 .int JMPTBL (L(bk_write_37bytes), L(table_48_bytes_bwd))
1666 .int JMPTBL (L(bk_write_38bytes), L(table_48_bytes_bwd))
1667 .int JMPTBL (L(bk_write_39bytes), L(table_48_bytes_bwd))
1668 .int JMPTBL (L(bk_write_40bytes), L(table_48_bytes_bwd))
1669 .int JMPTBL (L(bk_write_41bytes), L(table_48_bytes_bwd))
1670 .int JMPTBL (L(bk_write_42bytes), L(table_48_bytes_bwd))
1671 .int JMPTBL (L(bk_write_43bytes), L(table_48_bytes_bwd))
1672 .int JMPTBL (L(bk_write_44bytes), L(table_48_bytes_bwd))
1673 .int JMPTBL (L(bk_write_45bytes), L(table_48_bytes_bwd))
1674 .int JMPTBL (L(bk_write_46bytes), L(table_48_bytes_bwd))
1675 .int JMPTBL (L(bk_write_47bytes), L(table_48_bytes_bwd))
1679 #ifdef USE_AS_MEMMOVE
1691 jae L(bk_write_more64bytes)
1693 L(bk_write_64bytesless):
1695 jb L(bk_write_less32bytes)
1697 L(bk_write_more32bytes):
1698 /* Copy 32 bytes at a time. */
1704 movl -12(%esi), %eax
1705 movl %eax, -12(%edx)
1706 movl -16(%esi), %eax
1707 movl %eax, -16(%edx)
1708 movl -20(%esi), %eax
1709 movl %eax, -20(%edx)
1710 movl -24(%esi), %eax
1711 movl %eax, -24(%edx)
1712 movl -28(%esi), %eax
1713 movl %eax, -28(%edx)
1714 movl -32(%esi), %eax
1715 movl %eax, -32(%edx)
1719 L(bk_write_less32bytes):
1724 L(bk_write_less48bytes):
1725 BRANCH_TO_JMPTBL_ENTRY (L(table_48_bytes_bwd), %ecx, 4)
1731 jbe L(bk_write_less32bytes)
1733 /* We get here only if (EDX & 3 ) != 0 so if (EDX & 1) ==0,
1734 then (EDX & 2) must be != 0. */
1754 L(bk_write_more64bytes):
1755 /* Check alignment of last byte. */
1757 jz L(bk_ssse3_cpy_pre)
1759 /* EDX is aligned 4 bytes, but not 16 bytes. */
1768 jz L(bk_ssse3_cpy_pre)
1777 jz L(bk_ssse3_cpy_pre)
1785 L(bk_ssse3_cpy_pre):
1787 jb L(bk_write_more32bytes)
1793 movdqu 0x30(%esi), %xmm3
1794 movdqa %xmm3, 0x30(%edx)
1795 movdqu 0x20(%esi), %xmm2
1796 movdqa %xmm2, 0x20(%edx)
1797 movdqu 0x10(%esi), %xmm1
1798 movdqa %xmm1, 0x10(%edx)
1799 movdqu (%esi), %xmm0
1800 movdqa %xmm0, (%edx)
1803 jmp L(bk_write_64bytesless)