1 /* Highly optimized version for x86-64.
2 Copyright (C) 1999, 2000, 2002, 2003, 2005, 2009, 2010
3 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5 Based on i686 version contributed by Ulrich Drepper
6 <drepper@cygnus.com>, 1999.
7 Updated with SSE2 support contributed by Intel Corporation.
9 The GNU C Library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
14 The GNU C Library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public
20 License along with the GNU C Library; if not, write to the Free
21 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
25 #include "asm-syntax.h"
29 #undef UPDATE_STRNCMP_COUNTER
36 /* The simplified code below is not set up to handle strncmp() so far.
37 Should this become necessary it has to be implemented. For now
38 just report the problem. */
40 # error "strncmp not implemented so far"
43 /* Since the counter, %r11, is unsigned, we branch to strcmp_exitz
44 if the new counter > the old one or is 0. */
45 # define UPDATE_STRNCMP_COUNTER \
46 /* calculate left number to compare */ \
47 lea -16(%rcx, %r11), %r9; \
49 jb LABEL(strcmp_exitz); \
51 je LABEL(strcmp_exitz); \
54 #elif defined USE_AS_STRCASECMP_L
55 # include "locale-defines.h"
57 /* No support for strcasecmp outside libc so far since it is not needed. */
59 # error "strcasecmp_l not implemented so far"
62 # define UPDATE_STRNCMP_COUNTER
64 # define UPDATE_STRNCMP_COUNTER
66 # define STRCMP strcmp
73 .section .text.ssse3,"ax",@progbits
76 #ifdef USE_AS_STRCASECMP_L
78 movq __libc_tsd_LOCALE@gottpoff(%rip),%rax
82 .byte 0x0f,0x1f,0x44,0x00,0x00
84 weak_alias (__strcasecmp, strcasecmp)
85 libc_hidden_def (__strcasecmp)
86 /* FALLTHROUGH to strcasecmp_l. */
89 ENTRY (BP_SYM (STRCMP))
91 /* Simple version since we can't use SSE registers in ld.so. */
92 L(oop): movb (%rdi), %al
103 L(neq): movl $1, %eax
107 END (BP_SYM (STRCMP))
108 #else /* NOT_IN_libc */
109 # ifdef USE_AS_STRCASECMP_L
110 /* We have to fall back on the C implementation for locales
111 with encodings not matching ASCII for single bytes. */
112 # if LOCALE_T___LOCALES != 0 || LC_CTYPE != 0
113 movq LOCALE_T___LOCALES+LC_CTYPE*8(%rdx), %rax
117 testl $0, LOCALE_DATA_VALUES+_NL_CTYPE_NONASCII_CASE*SIZEOF_VALUES(%rax)
118 jne __strcasecmp_l_nonascii
122 * This implementation uses SSE to compare up to 16 bytes at a time.
124 # ifdef USE_AS_STRNCMP
126 je LABEL(strcmp_exitz)
133 /* Use 64bit AND here to avoid long NOP padding. */
134 and $0x3f, %rcx /* rsi alignment in cache line */
135 and $0x3f, %rax /* rdi alignment in cache line */
136 # ifdef USE_AS_STRCASECMP_L
137 .section .rodata.cst16,"aM",@progbits,16
140 .quad 0x4040404040404040
141 .quad 0x4040404040404040
143 .quad 0x5b5b5b5b5b5b5b5b
144 .quad 0x5b5b5b5b5b5b5b5b
146 .quad 0x2020202020202020
147 .quad 0x2020202020202020
149 movdqa .Lbelowupper(%rip), %xmm5
150 # define UCLOW_reg %xmm5
151 movdqa .Ltopupper(%rip), %xmm6
152 # define UCHIGH_reg %xmm6
153 movdqa .Ltouppermask(%rip), %xmm7
154 # define LCQWORD_reg %xmm7
157 ja LABEL(crosscache) /* rsi: 16-byte load will cross cache line */
159 ja LABEL(crosscache) /* rdi: 16-byte load will cross cache line */
162 movhpd 8(%rdi), %xmm1
163 movhpd 8(%rsi), %xmm2
164 # ifdef USE_AS_STRCASECMP_L
165 # define TOLOWER(reg1, reg2) \
166 movdqa reg1, %xmm8; \
167 movdqa UCHIGH_reg, %xmm9; \
168 movdqa reg2, %xmm10; \
169 movdqa UCHIGH_reg, %xmm11; \
170 pcmpgtb UCLOW_reg, %xmm8; \
171 pcmpgtb reg1, %xmm9; \
172 pcmpgtb UCLOW_reg, %xmm10; \
173 pcmpgtb reg2, %xmm11; \
175 pand %xmm11, %xmm10; \
176 pand LCQWORD_reg, %xmm8; \
177 pand LCQWORD_reg, %xmm10; \
180 TOLOWER (%xmm1, %xmm2)
182 # define TOLOWER(reg1, reg2)
184 pxor %xmm0, %xmm0 /* clear %xmm0 for null char checks */
185 pcmpeqb %xmm1, %xmm0 /* Any null chars? */
186 pcmpeqb %xmm2, %xmm1 /* compare first 16 bytes for equality */
187 psubb %xmm0, %xmm1 /* packed sub of comparison results*/
189 sub $0xffff, %edx /* if first 16 bytes are same, edx == 0xffff */
190 jnz LABEL(less16bytes) /* If not, find different value or null char */
191 # ifdef USE_AS_STRNCMP
193 jbe LABEL(strcmp_exitz) /* finish comparision */
195 add $16, %rsi /* prepare to search next 16 bytes */
196 add $16, %rdi /* prepare to search next 16 bytes */
199 * Determine source and destination string offsets from 16-byte alignment.
200 * Use relative offset difference between the two to determine which case
205 and $0xfffffffffffffff0, %rsi /* force %rsi is 16 byte aligned */
206 and $0xfffffffffffffff0, %rdi /* force %rdi is 16 byte aligned */
207 mov $0xffff, %edx /* for equivalent offset */
209 and $0xf, %ecx /* offset of rsi */
210 and $0xf, %eax /* offset of rdi */
212 je LABEL(ashr_0) /* rsi and rdi relative offset same */
214 mov %edx, %r8d /* r8d is offset flag for exit tail */
220 lea LABEL(unaligned_table)(%rip), %r10
221 movslq (%r10, %r9,4), %r9
222 lea (%r10, %r9), %r10
223 jmp *%r10 /* jump to corresponding case */
226 * The following cases will be handled by ashr_0
227 * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
228 * n(0~15) n(0~15) 15(15+ n-n) ashr_0
234 pxor %xmm0, %xmm0 /* clear %xmm0 for null char check */
235 pcmpeqb %xmm1, %xmm0 /* Any null chars? */
236 # ifndef USE_AS_STRCASECMP_L
237 pcmpeqb (%rdi), %xmm1 /* compare 16 bytes for equality */
240 TOLOWER (%xmm1, %xmm2)
241 pcmpeqb %xmm2, %xmm1 /* compare 16 bytes for equality */
243 psubb %xmm0, %xmm1 /* packed sub of comparison results*/
245 shr %cl, %edx /* adjust 0xffff for offset */
246 shr %cl, %r9d /* adjust for 16-byte offset */
249 * edx must be the same with r9d if in left byte (16-rcx) is equal to
250 * the start from (16-rax) and no null char was seen.
252 jne LABEL(less32bytes) /* mismatch or null char */
253 UPDATE_STRNCMP_COUNTER
256 pxor %xmm0, %xmm0 /* clear xmm0, may have changed above */
259 * Now both strings are aligned at 16-byte boundary. Loop over strings
260 * checking 32-bytes per iteration.
264 movdqa (%rsi, %rcx), %xmm1
265 movdqa (%rdi, %rcx), %xmm2
266 TOLOWER (%xmm1, %xmm2)
273 jnz LABEL(exit) /* mismatch or null char seen */
275 # ifdef USE_AS_STRNCMP
277 jbe LABEL(strcmp_exitz)
280 movdqa (%rsi, %rcx), %xmm1
281 movdqa (%rdi, %rcx), %xmm2
282 TOLOWER (%xmm1, %xmm2)
290 # ifdef USE_AS_STRNCMP
292 jbe LABEL(strcmp_exitz)
295 jmp LABEL(loop_ashr_0)
298 * The following cases will be handled by ashr_1
299 * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
300 * n(15) n -15 0(15 +(n-15) - n) ashr_1
307 pcmpeqb %xmm1, %xmm0 /* Any null chars? */
308 pslldq $15, %xmm2 /* shift first string to align with second */
309 TOLOWER (%xmm1, %xmm2)
310 pcmpeqb %xmm1, %xmm2 /* compare 16 bytes for equality */
311 psubb %xmm0, %xmm2 /* packed sub of comparison results*/
313 shr %cl, %edx /* adjust 0xffff for offset */
314 shr %cl, %r9d /* adjust for 16-byte offset */
316 jnz LABEL(less32bytes) /* mismatch or null char seen */
318 UPDATE_STRNCMP_COUNTER
321 mov $16, %rcx /* index for loads*/
322 mov $1, %r9d /* byte position left over from less32bytes case */
324 * Setup %r10 value allows us to detect crossing a page boundary.
325 * When %r10 goes positive we have crossed a page boundary and
326 * need to do a nibble.
329 and $0xfff, %r10 /* offset into 4K page */
330 sub $0x1000, %r10 /* subtract 4K pagesize */
335 jg LABEL(nibble_ashr_1) /* cross page boundary */
337 LABEL(gobble_ashr_1):
338 movdqa (%rsi, %rcx), %xmm1
339 movdqa (%rdi, %rcx), %xmm2
340 movdqa %xmm2, %xmm4 /* store for next cycle */
345 por %xmm3, %xmm2 /* merge into one 16byte value */
347 palignr $1, %xmm3, %xmm2 /* merge into one 16byte value */
349 TOLOWER (%xmm1, %xmm2)
358 # ifdef USE_AS_STRNCMP
360 jbe LABEL(strcmp_exitz)
366 jg LABEL(nibble_ashr_1) /* cross page boundary */
368 movdqa (%rsi, %rcx), %xmm1
369 movdqa (%rdi, %rcx), %xmm2
370 movdqa %xmm2, %xmm4 /* store for next cycle */
375 por %xmm3, %xmm2 /* merge into one 16byte value */
377 palignr $1, %xmm3, %xmm2 /* merge into one 16byte value */
379 TOLOWER (%xmm1, %xmm2)
388 # ifdef USE_AS_STRNCMP
390 jbe LABEL(strcmp_exitz)
394 jmp LABEL(loop_ashr_1)
397 * Nibble avoids loads across page boundary. This is to avoid a potential
398 * access into unmapped memory.
401 LABEL(nibble_ashr_1):
402 pcmpeqb %xmm3, %xmm0 /* check nibble for null char*/
405 jnz LABEL(ashr_1_exittail) /* find null char*/
407 # ifdef USE_AS_STRNCMP
409 jbe LABEL(ashr_1_exittail)
413 sub $0x1000, %r10 /* substract 4K from %r10 */
414 jmp LABEL(gobble_ashr_1)
417 * Once find null char, determine if there is a string mismatch
418 * before the null char.
421 LABEL(ashr_1_exittail):
422 movdqa (%rsi, %rcx), %xmm1
428 * The following cases will be handled by ashr_2
429 * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
430 * n(14~15) n -14 1(15 +(n-14) - n) ashr_2
439 TOLOWER (%xmm1, %xmm2)
446 jnz LABEL(less32bytes)
448 UPDATE_STRNCMP_COUNTER
451 mov $16, %rcx /* index for loads */
452 mov $2, %r9d /* byte position left over from less32bytes case */
454 * Setup %r10 value allows us to detect crossing a page boundary.
455 * When %r10 goes positive we have crossed a page boundary and
456 * need to do a nibble.
459 and $0xfff, %r10 /* offset into 4K page */
460 sub $0x1000, %r10 /* subtract 4K pagesize */
465 jg LABEL(nibble_ashr_2)
467 LABEL(gobble_ashr_2):
468 movdqa (%rsi, %rcx), %xmm1
469 movdqa (%rdi, %rcx), %xmm2
475 por %xmm3, %xmm2 /* merge into one 16byte value */
477 palignr $2, %xmm3, %xmm2 /* merge into one 16byte value */
479 TOLOWER (%xmm1, %xmm2)
488 # ifdef USE_AS_STRNCMP
490 jbe LABEL(strcmp_exitz)
497 jg LABEL(nibble_ashr_2) /* cross page boundary */
499 movdqa (%rsi, %rcx), %xmm1
500 movdqa (%rdi, %rcx), %xmm2
506 por %xmm3, %xmm2 /* merge into one 16byte value */
508 palignr $2, %xmm3, %xmm2 /* merge into one 16byte value */
510 TOLOWER (%xmm1, %xmm2)
519 # ifdef USE_AS_STRNCMP
521 jbe LABEL(strcmp_exitz)
526 jmp LABEL(loop_ashr_2)
529 LABEL(nibble_ashr_2):
530 pcmpeqb %xmm3, %xmm0 /* check nibble for null char */
533 jnz LABEL(ashr_2_exittail)
535 # ifdef USE_AS_STRNCMP
537 jbe LABEL(ashr_2_exittail)
542 jmp LABEL(gobble_ashr_2)
545 LABEL(ashr_2_exittail):
546 movdqa (%rsi, %rcx), %xmm1
552 * The following cases will be handled by ashr_3
553 * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
554 * n(13~15) n -13 2(15 +(n-13) - n) ashr_3
563 TOLOWER (%xmm1, %xmm2)
570 jnz LABEL(less32bytes)
573 UPDATE_STRNCMP_COUNTER
576 mov $16, %rcx /* index for loads */
577 mov $3, %r9d /* byte position left over from less32bytes case */
579 * Setup %r10 value allows us to detect crossing a page boundary.
580 * When %r10 goes positive we have crossed a page boundary and
581 * need to do a nibble.
584 and $0xfff, %r10 /* offset into 4K page */
585 sub $0x1000, %r10 /* subtract 4K pagesize */
590 jg LABEL(nibble_ashr_3)
592 LABEL(gobble_ashr_3):
593 movdqa (%rsi, %rcx), %xmm1
594 movdqa (%rdi, %rcx), %xmm2
600 por %xmm3, %xmm2 /* merge into one 16byte value */
602 palignr $3, %xmm3, %xmm2 /* merge into one 16byte value */
604 TOLOWER (%xmm1, %xmm2)
613 # ifdef USE_AS_STRNCMP
615 jbe LABEL(strcmp_exitz)
622 jg LABEL(nibble_ashr_3) /* cross page boundary */
624 movdqa (%rsi, %rcx), %xmm1
625 movdqa (%rdi, %rcx), %xmm2
631 por %xmm3, %xmm2 /* merge into one 16byte value */
633 palignr $3, %xmm3, %xmm2 /* merge into one 16byte value */
635 TOLOWER (%xmm1, %xmm2)
644 # ifdef USE_AS_STRNCMP
646 jbe LABEL(strcmp_exitz)
651 jmp LABEL(loop_ashr_3)
654 LABEL(nibble_ashr_3):
655 pcmpeqb %xmm3, %xmm0 /* check nibble for null char */
658 jnz LABEL(ashr_3_exittail)
660 # ifdef USE_AS_STRNCMP
662 jbe LABEL(ashr_3_exittail)
667 jmp LABEL(gobble_ashr_3)
670 LABEL(ashr_3_exittail):
671 movdqa (%rsi, %rcx), %xmm1
677 * The following cases will be handled by ashr_4
678 * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
679 * n(12~15) n -12 3(15 +(n-12) - n) ashr_4
688 TOLOWER (%xmm1, %xmm2)
695 jnz LABEL(less32bytes)
698 UPDATE_STRNCMP_COUNTER
701 mov $16, %rcx /* index for loads */
702 mov $4, %r9d /* byte position left over from less32bytes case */
704 * Setup %r10 value allows us to detect crossing a page boundary.
705 * When %r10 goes positive we have crossed a page boundary and
706 * need to do a nibble.
709 and $0xfff, %r10 /* offset into 4K page */
710 sub $0x1000, %r10 /* subtract 4K pagesize */
715 jg LABEL(nibble_ashr_4)
717 LABEL(gobble_ashr_4):
718 movdqa (%rsi, %rcx), %xmm1
719 movdqa (%rdi, %rcx), %xmm2
725 por %xmm3, %xmm2 /* merge into one 16byte value */
727 palignr $4, %xmm3, %xmm2 /* merge into one 16byte value */
729 TOLOWER (%xmm1, %xmm2)
738 # ifdef USE_AS_STRNCMP
740 jbe LABEL(strcmp_exitz)
747 jg LABEL(nibble_ashr_4) /* cross page boundary */
749 movdqa (%rsi, %rcx), %xmm1
750 movdqa (%rdi, %rcx), %xmm2
756 por %xmm3, %xmm2 /* merge into one 16byte value */
758 palignr $4, %xmm3, %xmm2 /* merge into one 16byte value */
760 TOLOWER (%xmm1, %xmm2)
769 # ifdef USE_AS_STRNCMP
771 jbe LABEL(strcmp_exitz)
776 jmp LABEL(loop_ashr_4)
779 LABEL(nibble_ashr_4):
780 pcmpeqb %xmm3, %xmm0 /* check nibble for null char */
783 jnz LABEL(ashr_4_exittail)
785 # ifdef USE_AS_STRNCMP
787 jbe LABEL(ashr_4_exittail)
792 jmp LABEL(gobble_ashr_4)
795 LABEL(ashr_4_exittail):
796 movdqa (%rsi, %rcx), %xmm1
802 * The following cases will be handled by ashr_5
803 * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
804 * n(11~15) n - 11 4(15 +(n-11) - n) ashr_5
813 TOLOWER (%xmm1, %xmm2)
820 jnz LABEL(less32bytes)
823 UPDATE_STRNCMP_COUNTER
826 mov $16, %rcx /* index for loads */
827 mov $5, %r9d /* byte position left over from less32bytes case */
829 * Setup %r10 value allows us to detect crossing a page boundary.
830 * When %r10 goes positive we have crossed a page boundary and
831 * need to do a nibble.
834 and $0xfff, %r10 /* offset into 4K page */
835 sub $0x1000, %r10 /* subtract 4K pagesize */
840 jg LABEL(nibble_ashr_5)
842 LABEL(gobble_ashr_5):
843 movdqa (%rsi, %rcx), %xmm1
844 movdqa (%rdi, %rcx), %xmm2
850 por %xmm3, %xmm2 /* merge into one 16byte value */
852 palignr $5, %xmm3, %xmm2 /* merge into one 16byte value */
854 TOLOWER (%xmm1, %xmm2)
863 # ifdef USE_AS_STRNCMP
865 jbe LABEL(strcmp_exitz)
872 jg LABEL(nibble_ashr_5) /* cross page boundary */
874 movdqa (%rsi, %rcx), %xmm1
875 movdqa (%rdi, %rcx), %xmm2
881 por %xmm3, %xmm2 /* merge into one 16byte value */
883 palignr $5, %xmm3, %xmm2 /* merge into one 16byte value */
885 TOLOWER (%xmm1, %xmm2)
894 # ifdef USE_AS_STRNCMP
896 jbe LABEL(strcmp_exitz)
901 jmp LABEL(loop_ashr_5)
904 LABEL(nibble_ashr_5):
905 pcmpeqb %xmm3, %xmm0 /* check nibble for null char */
908 jnz LABEL(ashr_5_exittail)
910 # ifdef USE_AS_STRNCMP
912 jbe LABEL(ashr_5_exittail)
917 jmp LABEL(gobble_ashr_5)
920 LABEL(ashr_5_exittail):
921 movdqa (%rsi, %rcx), %xmm1
927 * The following cases will be handled by ashr_6
928 * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
929 * n(10~15) n - 10 5(15 +(n-10) - n) ashr_6
938 TOLOWER (%xmm1, %xmm2)
945 jnz LABEL(less32bytes)
948 UPDATE_STRNCMP_COUNTER
951 mov $16, %rcx /* index for loads */
952 mov $6, %r9d /* byte position left over from less32bytes case */
954 * Setup %r10 value allows us to detect crossing a page boundary.
955 * When %r10 goes positive we have crossed a page boundary and
956 * need to do a nibble.
959 and $0xfff, %r10 /* offset into 4K page */
960 sub $0x1000, %r10 /* subtract 4K pagesize */
965 jg LABEL(nibble_ashr_6)
967 LABEL(gobble_ashr_6):
968 movdqa (%rsi, %rcx), %xmm1
969 movdqa (%rdi, %rcx), %xmm2
975 por %xmm3, %xmm2 /* merge into one 16byte value */
977 palignr $6, %xmm3, %xmm2 /* merge into one 16byte value */
979 TOLOWER (%xmm1, %xmm2)
988 # ifdef USE_AS_STRNCMP
990 jbe LABEL(strcmp_exitz)
997 jg LABEL(nibble_ashr_6) /* cross page boundary */
999 movdqa (%rsi, %rcx), %xmm1
1000 movdqa (%rdi, %rcx), %xmm2
1006 por %xmm3, %xmm2 /* merge into one 16byte value */
1008 palignr $6, %xmm3, %xmm2 /* merge into one 16byte value */
1010 TOLOWER (%xmm1, %xmm2)
1012 pcmpeqb %xmm1, %xmm0
1013 pcmpeqb %xmm2, %xmm1
1015 pmovmskb %xmm1, %edx
1019 # ifdef USE_AS_STRNCMP
1021 jbe LABEL(strcmp_exitz)
1026 jmp LABEL(loop_ashr_6)
1029 LABEL(nibble_ashr_6):
1030 pcmpeqb %xmm3, %xmm0 /* check nibble for null char */
1031 pmovmskb %xmm0, %edx
1033 jnz LABEL(ashr_6_exittail)
1035 # ifdef USE_AS_STRNCMP
1037 jbe LABEL(ashr_6_exittail)
1042 jmp LABEL(gobble_ashr_6)
1045 LABEL(ashr_6_exittail):
1046 movdqa (%rsi, %rcx), %xmm1
1049 jmp LABEL(aftertail)
1052 * The following cases will be handled by ashr_7
1053 * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
1054 * n(9~15) n - 9 6(15 +(n - 9) - n) ashr_7
1059 movdqa (%rdi), %xmm2
1060 movdqa (%rsi), %xmm1
1061 pcmpeqb %xmm1, %xmm0
1063 TOLOWER (%xmm1, %xmm2)
1064 pcmpeqb %xmm1, %xmm2
1066 pmovmskb %xmm2, %r9d
1070 jnz LABEL(less32bytes)
1071 movdqa (%rdi), %xmm3
1073 UPDATE_STRNCMP_COUNTER
1076 mov $16, %rcx /* index for loads */
1077 mov $7, %r9d /* byte position left over from less32bytes case */
1079 * Setup %r10 value allows us to detect crossing a page boundary.
1080 * When %r10 goes positive we have crossed a page boundary and
1081 * need to do a nibble.
1084 and $0xfff, %r10 /* offset into 4K page */
1085 sub $0x1000, %r10 /* subtract 4K pagesize */
1090 jg LABEL(nibble_ashr_7)
1092 LABEL(gobble_ashr_7):
1093 movdqa (%rsi, %rcx), %xmm1
1094 movdqa (%rdi, %rcx), %xmm2
1100 por %xmm3, %xmm2 /* merge into one 16byte value */
1102 palignr $7, %xmm3, %xmm2 /* merge into one 16byte value */
1104 TOLOWER (%xmm1, %xmm2)
1106 pcmpeqb %xmm1, %xmm0
1107 pcmpeqb %xmm2, %xmm1
1109 pmovmskb %xmm1, %edx
1113 # ifdef USE_AS_STRNCMP
1115 jbe LABEL(strcmp_exitz)
1122 jg LABEL(nibble_ashr_7) /* cross page boundary */
1124 movdqa (%rsi, %rcx), %xmm1
1125 movdqa (%rdi, %rcx), %xmm2
1131 por %xmm3, %xmm2 /* merge into one 16byte value */
1133 palignr $7, %xmm3, %xmm2 /* merge into one 16byte value */
1135 TOLOWER (%xmm1, %xmm2)
1137 pcmpeqb %xmm1, %xmm0
1138 pcmpeqb %xmm2, %xmm1
1140 pmovmskb %xmm1, %edx
1144 # ifdef USE_AS_STRNCMP
1146 jbe LABEL(strcmp_exitz)
1151 jmp LABEL(loop_ashr_7)
1154 LABEL(nibble_ashr_7):
1155 pcmpeqb %xmm3, %xmm0 /* check nibble for null char */
1156 pmovmskb %xmm0, %edx
1158 jnz LABEL(ashr_7_exittail)
1160 # ifdef USE_AS_STRNCMP
1162 jbe LABEL(ashr_7_exittail)
1167 jmp LABEL(gobble_ashr_7)
1170 LABEL(ashr_7_exittail):
1171 movdqa (%rsi, %rcx), %xmm1
1174 jmp LABEL(aftertail)
1177 * The following cases will be handled by ashr_8
1178 * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
1179 * n(8~15) n - 8 7(15 +(n - 8) - n) ashr_8
1184 movdqa (%rdi), %xmm2
1185 movdqa (%rsi), %xmm1
1186 pcmpeqb %xmm1, %xmm0
1188 TOLOWER (%xmm1, %xmm2)
1189 pcmpeqb %xmm1, %xmm2
1191 pmovmskb %xmm2, %r9d
1195 jnz LABEL(less32bytes)
1196 movdqa (%rdi), %xmm3
1198 UPDATE_STRNCMP_COUNTER
1201 mov $16, %rcx /* index for loads */
1202 mov $8, %r9d /* byte position left over from less32bytes case */
1204 * Setup %r10 value allows us to detect crossing a page boundary.
1205 * When %r10 goes positive we have crossed a page boundary and
1206 * need to do a nibble.
1209 and $0xfff, %r10 /* offset into 4K page */
1210 sub $0x1000, %r10 /* subtract 4K pagesize */
1215 jg LABEL(nibble_ashr_8)
1217 LABEL(gobble_ashr_8):
1218 movdqa (%rsi, %rcx), %xmm1
1219 movdqa (%rdi, %rcx), %xmm2
1225 por %xmm3, %xmm2 /* merge into one 16byte value */
1227 palignr $8, %xmm3, %xmm2 /* merge into one 16byte value */
1229 TOLOWER (%xmm1, %xmm2)
1231 pcmpeqb %xmm1, %xmm0
1232 pcmpeqb %xmm2, %xmm1
1234 pmovmskb %xmm1, %edx
1238 # ifdef USE_AS_STRNCMP
1240 jbe LABEL(strcmp_exitz)
1247 jg LABEL(nibble_ashr_8) /* cross page boundary */
1249 movdqa (%rsi, %rcx), %xmm1
1250 movdqa (%rdi, %rcx), %xmm2
1256 por %xmm3, %xmm2 /* merge into one 16byte value */
1258 palignr $8, %xmm3, %xmm2 /* merge into one 16byte value */
1260 TOLOWER (%xmm1, %xmm2)
1262 pcmpeqb %xmm1, %xmm0
1263 pcmpeqb %xmm2, %xmm1
1265 pmovmskb %xmm1, %edx
1269 # ifdef USE_AS_STRNCMP
1271 jbe LABEL(strcmp_exitz)
1276 jmp LABEL(loop_ashr_8)
1279 LABEL(nibble_ashr_8):
1280 pcmpeqb %xmm3, %xmm0 /* check nibble for null char */
1281 pmovmskb %xmm0, %edx
1283 jnz LABEL(ashr_8_exittail)
1285 # ifdef USE_AS_STRNCMP
1287 jbe LABEL(ashr_8_exittail)
1292 jmp LABEL(gobble_ashr_8)
1295 LABEL(ashr_8_exittail):
1296 movdqa (%rsi, %rcx), %xmm1
1299 jmp LABEL(aftertail)
1302 * The following cases will be handled by ashr_9
1303 * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
1304 * n(7~15) n - 7 8(15 +(n - 7) - n) ashr_9
1309 movdqa (%rdi), %xmm2
1310 movdqa (%rsi), %xmm1
1311 pcmpeqb %xmm1, %xmm0
1313 TOLOWER (%xmm1, %xmm2)
1314 pcmpeqb %xmm1, %xmm2
1316 pmovmskb %xmm2, %r9d
1320 jnz LABEL(less32bytes)
1321 movdqa (%rdi), %xmm3
1323 UPDATE_STRNCMP_COUNTER
1326 mov $16, %rcx /* index for loads */
1327 mov $9, %r9d /* byte position left over from less32bytes case */
1329 * Setup %r10 value allows us to detect crossing a page boundary.
1330 * When %r10 goes positive we have crossed a page boundary and
1331 * need to do a nibble.
1334 and $0xfff, %r10 /* offset into 4K page */
1335 sub $0x1000, %r10 /* subtract 4K pagesize */
1340 jg LABEL(nibble_ashr_9)
1342 LABEL(gobble_ashr_9):
1343 movdqa (%rsi, %rcx), %xmm1
1344 movdqa (%rdi, %rcx), %xmm2
1350 por %xmm3, %xmm2 /* merge into one 16byte value */
1352 palignr $9, %xmm3, %xmm2 /* merge into one 16byte value */
1354 TOLOWER (%xmm1, %xmm2)
1356 pcmpeqb %xmm1, %xmm0
1357 pcmpeqb %xmm2, %xmm1
1359 pmovmskb %xmm1, %edx
1363 # ifdef USE_AS_STRNCMP
1365 jbe LABEL(strcmp_exitz)
1372 jg LABEL(nibble_ashr_9) /* cross page boundary */
1374 movdqa (%rsi, %rcx), %xmm1
1375 movdqa (%rdi, %rcx), %xmm2
1381 por %xmm3, %xmm2 /* merge into one 16byte value */
1383 palignr $9, %xmm3, %xmm2 /* merge into one 16byte value */
1385 TOLOWER (%xmm1, %xmm2)
1387 pcmpeqb %xmm1, %xmm0
1388 pcmpeqb %xmm2, %xmm1
1390 pmovmskb %xmm1, %edx
1394 # ifdef USE_AS_STRNCMP
1396 jbe LABEL(strcmp_exitz)
1400 movdqa %xmm4, %xmm3 /* store for next cycle */
1401 jmp LABEL(loop_ashr_9)
1404 LABEL(nibble_ashr_9):
1405 pcmpeqb %xmm3, %xmm0 /* check nibble for null char */
1406 pmovmskb %xmm0, %edx
1408 jnz LABEL(ashr_9_exittail)
1410 # ifdef USE_AS_STRNCMP
1412 jbe LABEL(ashr_9_exittail)
1417 jmp LABEL(gobble_ashr_9)
1420 LABEL(ashr_9_exittail):
1421 movdqa (%rsi, %rcx), %xmm1
1424 jmp LABEL(aftertail)
1427 * The following cases will be handled by ashr_10
1428 * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
1429 * n(6~15) n - 6 9(15 +(n - 6) - n) ashr_10
1434 movdqa (%rdi), %xmm2
1435 movdqa (%rsi), %xmm1
1436 pcmpeqb %xmm1, %xmm0
1438 TOLOWER (%xmm1, %xmm2)
1439 pcmpeqb %xmm1, %xmm2
1441 pmovmskb %xmm2, %r9d
1445 jnz LABEL(less32bytes)
1446 movdqa (%rdi), %xmm3
1448 UPDATE_STRNCMP_COUNTER
1451 mov $16, %rcx /* index for loads */
1452 mov $10, %r9d /* byte position left over from less32bytes case */
1454 * Setup %r10 value allows us to detect crossing a page boundary.
1455 * When %r10 goes positive we have crossed a page boundary and
1456 * need to do a nibble.
1459 and $0xfff, %r10 /* offset into 4K page */
1460 sub $0x1000, %r10 /* subtract 4K pagesize */
1463 LABEL(loop_ashr_10):
1465 jg LABEL(nibble_ashr_10)
1467 LABEL(gobble_ashr_10):
1468 movdqa (%rsi, %rcx), %xmm1
1469 movdqa (%rdi, %rcx), %xmm2
1475 por %xmm3, %xmm2 /* merge into one 16byte value */
1477 palignr $10, %xmm3, %xmm2 /* merge into one 16byte value */
1479 TOLOWER (%xmm1, %xmm2)
1481 pcmpeqb %xmm1, %xmm0
1482 pcmpeqb %xmm2, %xmm1
1484 pmovmskb %xmm1, %edx
1488 # ifdef USE_AS_STRNCMP
1490 jbe LABEL(strcmp_exitz)
1497 jg LABEL(nibble_ashr_10) /* cross page boundary */
1499 movdqa (%rsi, %rcx), %xmm1
1500 movdqa (%rdi, %rcx), %xmm2
1506 por %xmm3, %xmm2 /* merge into one 16byte value */
1508 palignr $10, %xmm3, %xmm2 /* merge into one 16byte value */
1510 TOLOWER (%xmm1, %xmm2)
1512 pcmpeqb %xmm1, %xmm0
1513 pcmpeqb %xmm2, %xmm1
1515 pmovmskb %xmm1, %edx
1519 # ifdef USE_AS_STRNCMP
1521 jbe LABEL(strcmp_exitz)
1526 jmp LABEL(loop_ashr_10)
1529 LABEL(nibble_ashr_10):
1530 pcmpeqb %xmm3, %xmm0 /* check nibble for null char */
1531 pmovmskb %xmm0, %edx
1533 jnz LABEL(ashr_10_exittail)
1535 # ifdef USE_AS_STRNCMP
1537 jbe LABEL(ashr_10_exittail)
1542 jmp LABEL(gobble_ashr_10)
1545 LABEL(ashr_10_exittail):
1546 movdqa (%rsi, %rcx), %xmm1
1549 jmp LABEL(aftertail)
1552 * The following cases will be handled by ashr_11
1553 * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
1554 * n(5~15) n - 5 10(15 +(n - 5) - n) ashr_11
1559 movdqa (%rdi), %xmm2
1560 movdqa (%rsi), %xmm1
1561 pcmpeqb %xmm1, %xmm0
1563 TOLOWER (%xmm1, %xmm2)
1564 pcmpeqb %xmm1, %xmm2
1566 pmovmskb %xmm2, %r9d
1570 jnz LABEL(less32bytes)
1571 movdqa (%rdi), %xmm3
1573 UPDATE_STRNCMP_COUNTER
1576 mov $16, %rcx /* index for loads */
1577 mov $11, %r9d /* byte position left over from less32bytes case */
1579 * Setup %r10 value allows us to detect crossing a page boundary.
1580 * When %r10 goes positive we have crossed a page boundary and
1581 * need to do a nibble.
1584 and $0xfff, %r10 /* offset into 4K page */
1585 sub $0x1000, %r10 /* subtract 4K pagesize */
1588 LABEL(loop_ashr_11):
1590 jg LABEL(nibble_ashr_11)
1592 LABEL(gobble_ashr_11):
1593 movdqa (%rsi, %rcx), %xmm1
1594 movdqa (%rdi, %rcx), %xmm2
1600 por %xmm3, %xmm2 /* merge into one 16byte value */
1602 palignr $11, %xmm3, %xmm2 /* merge into one 16byte value */
1604 TOLOWER (%xmm1, %xmm2)
1606 pcmpeqb %xmm1, %xmm0
1607 pcmpeqb %xmm2, %xmm1
1609 pmovmskb %xmm1, %edx
1613 # ifdef USE_AS_STRNCMP
1615 jbe LABEL(strcmp_exitz)
1622 jg LABEL(nibble_ashr_11) /* cross page boundary */
1624 movdqa (%rsi, %rcx), %xmm1
1625 movdqa (%rdi, %rcx), %xmm2
1631 por %xmm3, %xmm2 /* merge into one 16byte value */
1633 palignr $11, %xmm3, %xmm2 /* merge into one 16byte value */
1635 TOLOWER (%xmm1, %xmm2)
1637 pcmpeqb %xmm1, %xmm0
1638 pcmpeqb %xmm2, %xmm1
1640 pmovmskb %xmm1, %edx
1644 # ifdef USE_AS_STRNCMP
1646 jbe LABEL(strcmp_exitz)
1651 jmp LABEL(loop_ashr_11)
1654 LABEL(nibble_ashr_11):
1655 pcmpeqb %xmm3, %xmm0 /* check nibble for null char */
1656 pmovmskb %xmm0, %edx
1658 jnz LABEL(ashr_11_exittail)
1660 # ifdef USE_AS_STRNCMP
1662 jbe LABEL(ashr_11_exittail)
1667 jmp LABEL(gobble_ashr_11)
1670 LABEL(ashr_11_exittail):
1671 movdqa (%rsi, %rcx), %xmm1
1674 jmp LABEL(aftertail)
1677 * The following cases will be handled by ashr_12
1678 * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
1679 * n(4~15) n - 4 11(15 +(n - 4) - n) ashr_12
1684 movdqa (%rdi), %xmm2
1685 movdqa (%rsi), %xmm1
1686 pcmpeqb %xmm1, %xmm0
1688 TOLOWER (%xmm1, %xmm2)
1689 pcmpeqb %xmm1, %xmm2
1691 pmovmskb %xmm2, %r9d
1695 jnz LABEL(less32bytes)
1696 movdqa (%rdi), %xmm3
1698 UPDATE_STRNCMP_COUNTER
1701 mov $16, %rcx /* index for loads */
1702 mov $12, %r9d /* byte position left over from less32bytes case */
1704 * Setup %r10 value allows us to detect crossing a page boundary.
1705 * When %r10 goes positive we have crossed a page boundary and
1706 * need to do a nibble.
1709 and $0xfff, %r10 /* offset into 4K page */
1710 sub $0x1000, %r10 /* subtract 4K pagesize */
1713 LABEL(loop_ashr_12):
1715 jg LABEL(nibble_ashr_12)
1717 LABEL(gobble_ashr_12):
1718 movdqa (%rsi, %rcx), %xmm1
1719 movdqa (%rdi, %rcx), %xmm2
1725 por %xmm3, %xmm2 /* merge into one 16byte value */
1727 palignr $12, %xmm3, %xmm2 /* merge into one 16byte value */
1729 TOLOWER (%xmm1, %xmm2)
1731 pcmpeqb %xmm1, %xmm0
1732 pcmpeqb %xmm2, %xmm1
1734 pmovmskb %xmm1, %edx
1738 # ifdef USE_AS_STRNCMP
1740 jbe LABEL(strcmp_exitz)
1747 jg LABEL(nibble_ashr_12) /* cross page boundary */
1749 movdqa (%rsi, %rcx), %xmm1
1750 movdqa (%rdi, %rcx), %xmm2
1756 por %xmm3, %xmm2 /* merge into one 16byte value */
1758 palignr $12, %xmm3, %xmm2 /* merge into one 16byte value */
1760 TOLOWER (%xmm1, %xmm2)
1762 pcmpeqb %xmm1, %xmm0
1763 pcmpeqb %xmm2, %xmm1
1765 pmovmskb %xmm1, %edx
1769 # ifdef USE_AS_STRNCMP
1771 jbe LABEL(strcmp_exitz)
1776 jmp LABEL(loop_ashr_12)
1779 LABEL(nibble_ashr_12):
1780 pcmpeqb %xmm3, %xmm0 /* check nibble for null char */
1781 pmovmskb %xmm0, %edx
1783 jnz LABEL(ashr_12_exittail)
1785 # ifdef USE_AS_STRNCMP
1787 jbe LABEL(ashr_12_exittail)
1792 jmp LABEL(gobble_ashr_12)
1795 LABEL(ashr_12_exittail):
1796 movdqa (%rsi, %rcx), %xmm1
1799 jmp LABEL(aftertail)
1802 * The following cases will be handled by ashr_13
1803 * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
1804 * n(3~15) n - 3 12(15 +(n - 3) - n) ashr_13
1809 movdqa (%rdi), %xmm2
1810 movdqa (%rsi), %xmm1
1811 pcmpeqb %xmm1, %xmm0
1813 TOLOWER (%xmm1, %xmm2)
1814 pcmpeqb %xmm1, %xmm2
1816 pmovmskb %xmm2, %r9d
1820 jnz LABEL(less32bytes)
1821 movdqa (%rdi), %xmm3
1823 UPDATE_STRNCMP_COUNTER
1826 mov $16, %rcx /* index for loads */
1827 mov $13, %r9d /* byte position left over from less32bytes case */
1829 * Setup %r10 value allows us to detect crossing a page boundary.
1830 * When %r10 goes positive we have crossed a page boundary and
1831 * need to do a nibble.
1834 and $0xfff, %r10 /* offset into 4K page */
1835 sub $0x1000, %r10 /* subtract 4K pagesize */
1838 LABEL(loop_ashr_13):
1840 jg LABEL(nibble_ashr_13)
1842 LABEL(gobble_ashr_13):
1843 movdqa (%rsi, %rcx), %xmm1
1844 movdqa (%rdi, %rcx), %xmm2
1850 por %xmm3, %xmm2 /* merge into one 16byte value */
1852 palignr $13, %xmm3, %xmm2 /* merge into one 16byte value */
1854 TOLOWER (%xmm1, %xmm2)
1856 pcmpeqb %xmm1, %xmm0
1857 pcmpeqb %xmm2, %xmm1
1859 pmovmskb %xmm1, %edx
1863 # ifdef USE_AS_STRNCMP
1865 jbe LABEL(strcmp_exitz)
1872 jg LABEL(nibble_ashr_13) /* cross page boundary */
1874 movdqa (%rsi, %rcx), %xmm1
1875 movdqa (%rdi, %rcx), %xmm2
1881 por %xmm3, %xmm2 /* merge into one 16byte value */
1883 palignr $13, %xmm3, %xmm2 /* merge into one 16byte value */
1885 TOLOWER (%xmm1, %xmm2)
1887 pcmpeqb %xmm1, %xmm0
1888 pcmpeqb %xmm2, %xmm1
1890 pmovmskb %xmm1, %edx
1894 # ifdef USE_AS_STRNCMP
1896 jbe LABEL(strcmp_exitz)
1901 jmp LABEL(loop_ashr_13)
1904 LABEL(nibble_ashr_13):
1905 pcmpeqb %xmm3, %xmm0 /* check nibble for null char */
1906 pmovmskb %xmm0, %edx
1908 jnz LABEL(ashr_13_exittail)
1910 # ifdef USE_AS_STRNCMP
1912 jbe LABEL(ashr_13_exittail)
1917 jmp LABEL(gobble_ashr_13)
1920 LABEL(ashr_13_exittail):
1921 movdqa (%rsi, %rcx), %xmm1
1924 jmp LABEL(aftertail)
1927 * The following cases will be handled by ashr_14
1928 * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
1929 * n(2~15) n - 2 13(15 +(n - 2) - n) ashr_14
1934 movdqa (%rdi), %xmm2
1935 movdqa (%rsi), %xmm1
1936 pcmpeqb %xmm1, %xmm0
1938 TOLOWER (%xmm1, %xmm2)
1939 pcmpeqb %xmm1, %xmm2
1941 pmovmskb %xmm2, %r9d
1945 jnz LABEL(less32bytes)
1946 movdqa (%rdi), %xmm3
1948 UPDATE_STRNCMP_COUNTER
1951 mov $16, %rcx /* index for loads */
1952 mov $14, %r9d /* byte position left over from less32bytes case */
1954 * Setup %r10 value allows us to detect crossing a page boundary.
1955 * When %r10 goes positive we have crossed a page boundary and
1956 * need to do a nibble.
1959 and $0xfff, %r10 /* offset into 4K page */
1960 sub $0x1000, %r10 /* subtract 4K pagesize */
1963 LABEL(loop_ashr_14):
1965 jg LABEL(nibble_ashr_14)
1967 LABEL(gobble_ashr_14):
1968 movdqa (%rsi, %rcx), %xmm1
1969 movdqa (%rdi, %rcx), %xmm2
1975 por %xmm3, %xmm2 /* merge into one 16byte value */
1977 palignr $14, %xmm3, %xmm2 /* merge into one 16byte value */
1979 TOLOWER (%xmm1, %xmm2)
1981 pcmpeqb %xmm1, %xmm0
1982 pcmpeqb %xmm2, %xmm1
1984 pmovmskb %xmm1, %edx
1988 # ifdef USE_AS_STRNCMP
1990 jbe LABEL(strcmp_exitz)
1997 jg LABEL(nibble_ashr_14) /* cross page boundary */
1999 movdqa (%rsi, %rcx), %xmm1
2000 movdqa (%rdi, %rcx), %xmm2
2006 por %xmm3, %xmm2 /* merge into one 16byte value */
2008 palignr $14, %xmm3, %xmm2 /* merge into one 16byte value */
2010 TOLOWER (%xmm1, %xmm2)
2012 pcmpeqb %xmm1, %xmm0
2013 pcmpeqb %xmm2, %xmm1
2015 pmovmskb %xmm1, %edx
2019 # ifdef USE_AS_STRNCMP
2021 jbe LABEL(strcmp_exitz)
2026 jmp LABEL(loop_ashr_14)
2029 LABEL(nibble_ashr_14):
2030 pcmpeqb %xmm3, %xmm0 /* check nibble for null char */
2031 pmovmskb %xmm0, %edx
2033 jnz LABEL(ashr_14_exittail)
2035 # ifdef USE_AS_STRNCMP
2037 jbe LABEL(ashr_14_exittail)
2042 jmp LABEL(gobble_ashr_14)
2045 LABEL(ashr_14_exittail):
2046 movdqa (%rsi, %rcx), %xmm1
2049 jmp LABEL(aftertail)
2052 * The following cases will be handled by ashr_15
2053 * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
2054 * n(1~15) n - 1 14(15 +(n - 1) - n) ashr_15
2059 movdqa (%rdi), %xmm2
2060 movdqa (%rsi), %xmm1
2061 pcmpeqb %xmm1, %xmm0
2063 TOLOWER (%xmm1, %xmm2)
2064 pcmpeqb %xmm1, %xmm2
2066 pmovmskb %xmm2, %r9d
2070 jnz LABEL(less32bytes)
2072 movdqa (%rdi), %xmm3
2074 UPDATE_STRNCMP_COUNTER
2077 mov $16, %rcx /* index for loads */
2078 mov $15, %r9d /* byte position left over from less32bytes case */
2080 * Setup %r10 value allows us to detect crossing a page boundary.
2081 * When %r10 goes positive we have crossed a page boundary and
2082 * need to do a nibble.
2085 and $0xfff, %r10 /* offset into 4K page */
2087 sub $0x1000, %r10 /* subtract 4K pagesize */
2090 LABEL(loop_ashr_15):
2092 jg LABEL(nibble_ashr_15)
2094 LABEL(gobble_ashr_15):
2095 movdqa (%rsi, %rcx), %xmm1
2096 movdqa (%rdi, %rcx), %xmm2
2102 por %xmm3, %xmm2 /* merge into one 16byte value */
2104 palignr $15, %xmm3, %xmm2 /* merge into one 16byte value */
2106 TOLOWER (%xmm1, %xmm2)
2108 pcmpeqb %xmm1, %xmm0
2109 pcmpeqb %xmm2, %xmm1
2111 pmovmskb %xmm1, %edx
2115 # ifdef USE_AS_STRNCMP
2117 jbe LABEL(strcmp_exitz)
2124 jg LABEL(nibble_ashr_15) /* cross page boundary */
2126 movdqa (%rsi, %rcx), %xmm1
2127 movdqa (%rdi, %rcx), %xmm2
2133 por %xmm3, %xmm2 /* merge into one 16byte value */
2135 palignr $15, %xmm3, %xmm2 /* merge into one 16byte value */
2137 TOLOWER (%xmm1, %xmm2)
2139 pcmpeqb %xmm1, %xmm0
2140 pcmpeqb %xmm2, %xmm1
2142 pmovmskb %xmm1, %edx
2146 # ifdef USE_AS_STRNCMP
2148 jbe LABEL(strcmp_exitz)
2153 jmp LABEL(loop_ashr_15)
2156 LABEL(nibble_ashr_15):
2157 pcmpeqb %xmm3, %xmm0 /* check nibble for null char */
2158 pmovmskb %xmm0, %edx
2160 jnz LABEL(ashr_15_exittail)
2162 # ifdef USE_AS_STRNCMP
2164 je LABEL(ashr_15_exittail)
2169 jmp LABEL(gobble_ashr_15)
2172 LABEL(ashr_15_exittail):
2173 movdqa (%rsi, %rcx), %xmm1
2179 TOLOWER (%xmm1, %xmm3)
2180 pcmpeqb %xmm3, %xmm1
2182 pmovmskb %xmm1, %edx
2187 lea -16(%r9, %rcx), %rax /* locate the exact offset for rdi */
2189 lea (%rdi, %rax), %rdi /* locate the exact address for first operand(rdi) */
2190 lea (%rsi, %rcx), %rsi /* locate the exact address for second operand(rsi) */
2193 xchg %rsi, %rdi /* recover original order according to flag(%r8d) */
2198 bsf %rdx, %rdx /* find and store bit index in %rdx */
2200 # ifdef USE_AS_STRNCMP
2202 jbe LABEL(strcmp_exitz)
2204 movzbl (%rsi, %rdx), %ecx
2205 movzbl (%rdi, %rdx), %eax
2207 # ifdef USE_AS_STRCASECMP_L
2208 leaq _nl_C_LC_CTYPE_tolower+128*4(%rip), %rdx
2209 movl (%rdx,%rcx,4), %ecx
2210 movl (%rdx,%rax,4), %eax
2216 LABEL(strcmp_exitz):
2227 END (BP_SYM (STRCMP))
2229 .section .rodata,"a",@progbits
2231 LABEL(unaligned_table):
2232 .int LABEL(ashr_1) - LABEL(unaligned_table)
2233 .int LABEL(ashr_2) - LABEL(unaligned_table)
2234 .int LABEL(ashr_3) - LABEL(unaligned_table)
2235 .int LABEL(ashr_4) - LABEL(unaligned_table)
2236 .int LABEL(ashr_5) - LABEL(unaligned_table)
2237 .int LABEL(ashr_6) - LABEL(unaligned_table)
2238 .int LABEL(ashr_7) - LABEL(unaligned_table)
2239 .int LABEL(ashr_8) - LABEL(unaligned_table)
2240 .int LABEL(ashr_9) - LABEL(unaligned_table)
2241 .int LABEL(ashr_10) - LABEL(unaligned_table)
2242 .int LABEL(ashr_11) - LABEL(unaligned_table)
2243 .int LABEL(ashr_12) - LABEL(unaligned_table)
2244 .int LABEL(ashr_13) - LABEL(unaligned_table)
2245 .int LABEL(ashr_14) - LABEL(unaligned_table)
2246 .int LABEL(ashr_15) - LABEL(unaligned_table)
2247 .int LABEL(ashr_0) - LABEL(unaligned_table)
2248 #endif /* NOT_IN_libc */
2249 libc_hidden_builtin_def (STRCMP)