24
24
#ifdef USE_AS_STRNCMP
25
25
/* Since the counter, %r11, is unsigned, we branch to strcmp_exitz
26
26
if the new counter > the old one or is 0. */
27
#define UPDATE_STRNCMP_COUNTER \
28
/* calculate left number to compare */ \
29
lea -16(%rcx, %r11), %r9; \
31
jb LABEL(strcmp_exitz_sse4_2); \
33
je LABEL(strcmp_exitz_sse4_2); \
36
#define STRCMP_SSE42 __strncmp_sse42
37
#define STRCMP_SSSE3 __strncmp_ssse3
38
#define STRCMP_SSE2 __strncmp_sse2
39
#define __GI_STRCMP __GI_strncmp
27
# define UPDATE_STRNCMP_COUNTER \
28
/* calculate left number to compare */ \
29
lea -16(%rcx, %r11), %r9; \
31
jb LABEL(strcmp_exitz_sse4_2); \
33
je LABEL(strcmp_exitz_sse4_2); \
36
# define STRCMP_SSE42 __strncmp_sse42
37
# define STRCMP_SSSE3 __strncmp_ssse3
38
# define STRCMP_SSE2 __strncmp_sse2
39
# define __GI_STRCMP __GI_strncmp
40
#elif defined USE_AS_STRCASECMP_L
41
# include "locale-defines.h"
43
# define UPDATE_STRNCMP_COUNTER
45
# define STRCMP_SSE42 __strcasecmp_l_sse42
46
# define STRCMP_SSSE3 __strcasecmp_l_ssse3
47
# define STRCMP_SSE2 __strcasecmp_l_sse2
48
# define __GI_STRCMP __GI___strcasecmp_l
49
#elif defined USE_AS_STRNCASECMP_L
50
# include "locale-defines.h"
52
/* Since the counter, %r11, is unsigned, we branch to strcmp_exitz
53
if the new counter > the old one or is 0. */
54
# define UPDATE_STRNCMP_COUNTER \
55
/* calculate left number to compare */ \
56
lea -16(%rcx, %r11), %r9; \
58
jb LABEL(strcmp_exitz_sse4_2); \
60
je LABEL(strcmp_exitz_sse4_2); \
63
# define STRCMP_SSE42 __strncasecmp_l_sse42
64
# define STRCMP_SSSE3 __strncasecmp_l_ssse3
65
# define STRCMP_SSE2 __strncasecmp_l_sse2
66
# define __GI_STRCMP __GI___strncasecmp_l
41
#define UPDATE_STRNCMP_COUNTER
44
#define STRCMP_SSE42 __strcmp_sse42
45
#define STRCMP_SSSE3 __strcmp_ssse3
46
#define STRCMP_SSE2 __strcmp_sse2
47
#define __GI_STRCMP __GI_strcmp
68
# define UPDATE_STRNCMP_COUNTER
70
# define STRCMP strcmp
71
# define STRCMP_SSE42 __strcmp_sse42
72
# define STRCMP_SSSE3 __strcmp_ssse3
73
# define STRCMP_SSE2 __strcmp_sse2
74
# define __GI_STRCMP __GI_strcmp
79
# define LABEL(l) L(l)
55
82
/* Define multiple versions only for the definition in libc. Don't
103
# ifdef USE_AS_STRCASECMP_L
105
.type __strcasecmp, @gnu_indirect_function
106
cmpl $0, __cpu_features+KIND_OFFSET(%rip)
108
call __init_cpu_features
110
leaq __strcasecmp_sse42(%rip), %rax
111
testl $bit_SSE4_2, __cpu_features+CPUID_OFFSET+index_SSE4_2(%rip)
113
leaq __strcasecmp_ssse3(%rip), %rax
114
testl $bit_SSSE3, __cpu_features+CPUID_OFFSET+index_SSSE3(%rip)
116
leaq __strcasecmp_sse2(%rip), %rax
119
weak_alias (__strcasecmp, strcasecmp)
121
# ifdef USE_AS_STRNCASECMP_L
123
.type __strncasecmp, @gnu_indirect_function
124
cmpl $0, __cpu_features+KIND_OFFSET(%rip)
126
call __init_cpu_features
128
leaq __strncasecmp_sse42(%rip), %rax
129
testl $bit_SSE4_2, __cpu_features+CPUID_OFFSET+index_SSE4_2(%rip)
131
leaq __strncasecmp_ssse3(%rip), %rax
132
testl $bit_SSSE3, __cpu_features+CPUID_OFFSET+index_SSSE3(%rip)
134
leaq __strncasecmp_sse2(%rip), %rax
137
weak_alias (__strncasecmp, strncasecmp)
78
142
| _SIDD_CMP_EQUAL_EACH
102
166
/* Put all SSE 4.2 functions together. */
103
167
.section .text.sse4.2,"ax",@progbits
105
169
.type STRCMP_SSE42, @function
170
# ifdef USE_AS_STRCASECMP_L
171
ENTRY (__strcasecmp_sse42)
172
movq __libc_tsd_LOCALE@gottpoff(%rip),%rax
175
// XXX 5 byte should be before the function
177
.byte 0x0f,0x1f,0x44,0x00,0x00
178
END (__strcasecmp_sse42)
179
/* FALLTHROUGH to strcasecmp_l. */
181
# ifdef USE_AS_STRNCASECMP_L
182
ENTRY (__strncasecmp_sse42)
183
movq __libc_tsd_LOCALE@gottpoff(%rip),%rax
186
// XXX 5 byte should be before the function
188
.byte 0x0f,0x1f,0x44,0x00,0x00
189
END (__strncasecmp_sse42)
190
/* FALLTHROUGH to strncasecmp_l. */
111
198
* This implementation uses SSE to compare up to 16 bytes at a time.
113
#ifdef USE_AS_STRNCMP
200
# ifdef USE_AS_STRCASECMP_L
201
/* We have to fall back on the C implementation for locales
202
with encodings not matching ASCII for single bytes. */
203
# if LOCALE_T___LOCALES != 0 || LC_CTYPE != 0
204
movq LOCALE_T___LOCALES+LC_CTYPE*8(%rdx), %rax
208
testl $0, LOCALE_DATA_VALUES+_NL_CTYPE_NONASCII_CASE*SIZEOF_VALUES(%rax)
209
jne __strcasecmp_l_nonascii
211
# ifdef USE_AS_STRNCASECMP_L
212
/* We have to fall back on the C implementation for locales
213
with encodings not matching ASCII for single bytes. */
214
# if LOCALE_T___LOCALES != 0 || LC_CTYPE != 0
215
movq LOCALE_T___LOCALES+LC_CTYPE*8(%rcx), %rax
219
testl $0, LOCALE_DATA_VALUES+_NL_CTYPE_NONASCII_CASE*SIZEOF_VALUES(%rax)
220
jne __strncasecmp_l_nonascii
223
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
115
225
je LABEL(strcmp_exitz_sse4_2)
117
227
je LABEL(Byte0_sse4_2)
122
232
/* Use 64bit AND here to avoid long NOP padding. */
123
233
and $0x3f, %rcx /* rsi alignment in cache line */
124
234
and $0x3f, %rax /* rdi alignment in cache line */
235
# if defined USE_AS_STRCASECMP_L || defined USE_AS_STRNCASECMP_L
236
.section .rodata.cst16,"aM",@progbits,16
239
.quad 0x4040404040404040
240
.quad 0x4040404040404040
242
.quad 0x5b5b5b5b5b5b5b5b
243
.quad 0x5b5b5b5b5b5b5b5b
245
.quad 0x2020202020202020
246
.quad 0x2020202020202020
248
movdqa .Lbelowupper_sse4(%rip), %xmm4
249
# define UCLOW_reg %xmm4
250
movdqa .Ltopupper_sse4(%rip), %xmm5
251
# define UCHIGH_reg %xmm5
252
movdqa .Ltouppermask_sse4(%rip), %xmm6
253
# define LCQWORD_reg %xmm6
126
256
ja LABEL(crosscache_sse4_2)/* rsi: 16-byte load will cross cache line */
128
258
ja LABEL(crosscache_sse4_2)/* rdi: 16-byte load will cross cache line */
129
259
movdqu (%rdi), %xmm1
130
260
movdqu (%rsi), %xmm2
261
# if defined USE_AS_STRCASECMP_L || defined USE_AS_STRNCASECMP_L
262
# define TOLOWER(reg1, reg2) \
263
movdqa reg1, %xmm7; \
264
movdqa UCHIGH_reg, %xmm8; \
265
movdqa reg2, %xmm9; \
266
movdqa UCHIGH_reg, %xmm10; \
267
pcmpgtb UCLOW_reg, %xmm7; \
268
pcmpgtb reg1, %xmm8; \
269
pcmpgtb UCLOW_reg, %xmm9; \
270
pcmpgtb reg2, %xmm10; \
272
pand %xmm10, %xmm9; \
273
pand LCQWORD_reg, %xmm7; \
274
pand LCQWORD_reg, %xmm9; \
277
TOLOWER (%xmm1, %xmm2)
279
# define TOLOWER(reg1, reg2)
131
281
pxor %xmm0, %xmm0 /* clear %xmm0 for null char checks */
132
282
pcmpeqb %xmm1, %xmm0 /* Any null chars? */
133
283
pcmpeqb %xmm2, %xmm1 /* compare first 16 bytes for equality */
135
285
pmovmskb %xmm1, %edx
136
286
sub $0xffff, %edx /* if first 16 bytes are same, edx == 0xffff */
137
287
jnz LABEL(less16bytes_sse4_2)/* If not, find different value or null char */
138
#ifdef USE_AS_STRNCMP
288
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
140
290
jbe LABEL(strcmp_exitz_sse4_2)/* finish comparision */
142
292
add $16, %rsi /* prepare to search next 16 bytes */
143
293
add $16, %rdi /* prepare to search next 16 bytes */
180
330
movdqa (%rsi), %xmm1
181
331
pxor %xmm0, %xmm0 /* clear %xmm0 for null char check */
182
332
pcmpeqb %xmm1, %xmm0 /* Any null chars? */
333
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
183
334
pcmpeqb (%rdi), %xmm1 /* compare 16 bytes for equality */
337
TOLOWER (%xmm1, %xmm2)
338
pcmpeqb %xmm2, %xmm1 /* compare 16 bytes for equality */
184
340
psubb %xmm0, %xmm1 /* packed sub of comparison results*/
185
341
pmovmskb %xmm1, %r9d
186
342
shr %cl, %edx /* adjust 0xffff for offset */
205
361
LABEL(ashr_0_use_sse4_2):
206
362
movdqa (%rdi,%rdx), %xmm0
363
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
207
364
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
366
movdqa (%rsi,%rdx), %xmm1
367
TOLOWER (%xmm0, %xmm1)
368
pcmpistri $0x1a, %xmm1, %xmm0
208
370
lea 16(%rdx), %rdx
209
371
jbe LABEL(ashr_0_use_sse4_2_exit)
210
#ifdef USE_AS_STRNCMP
372
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
212
374
jbe LABEL(strcmp_exitz_sse4_2)
215
377
movdqa (%rdi,%rdx), %xmm0
378
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
216
379
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
381
movdqa (%rsi,%rdx), %xmm1
382
TOLOWER (%xmm0, %xmm1)
383
pcmpistri $0x1a, %xmm1, %xmm0
217
385
lea 16(%rdx), %rdx
218
386
jbe LABEL(ashr_0_use_sse4_2_exit)
219
#ifdef USE_AS_STRNCMP
387
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
221
389
jbe LABEL(strcmp_exitz_sse4_2)
223
391
jmp LABEL(ashr_0_use_sse4_2)
227
395
LABEL(ashr_0_use_sse4_2_exit):
228
396
jnc LABEL(strcmp_exitz_sse4_2)
229
#ifdef USE_AS_STRNCMP
397
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
231
399
jbe LABEL(strcmp_exitz_sse4_2)
233
401
lea -16(%rdx, %rcx), %rcx
234
402
movzbl (%rdi, %rcx), %eax
235
403
movzbl (%rsi, %rcx), %edx
404
# if defined USE_AS_STRCASECMP_L || defined USE_AS_STRNCASECMP_L
405
leaq _nl_C_LC_CTYPE_tolower+128*4(%rip), %rcx
406
movl (%rcx,%rax,4), %eax
407
movl (%rcx,%rdx,4), %edx
243
415
* The following cases will be handled by ashr_1
244
* rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
416
* rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
245
417
* n(15) n -15 0(15 +(n-15) - n) ashr_1
282
455
movdqa (%rdi, %rdx), %xmm0
283
456
palignr $1, -16(%rdi, %rdx), %xmm0
457
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
284
458
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
460
movdqa (%rsi,%rdx), %xmm1
461
TOLOWER (%xmm0, %xmm1)
462
pcmpistri $0x1a, %xmm1, %xmm0
285
464
jbe LABEL(use_sse4_2_exit)
286
#ifdef USE_AS_STRNCMP
465
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
288
467
jbe LABEL(strcmp_exitz_sse4_2)
295
474
movdqa (%rdi, %rdx), %xmm0
296
475
palignr $1, -16(%rdi, %rdx), %xmm0
476
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
297
477
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
479
movdqa (%rsi,%rdx), %xmm1
480
TOLOWER (%xmm0, %xmm1)
481
pcmpistri $0x1a, %xmm1, %xmm0
298
483
jbe LABEL(use_sse4_2_exit)
299
#ifdef USE_AS_STRNCMP
484
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
301
486
jbe LABEL(strcmp_exitz_sse4_2)
304
489
jmp LABEL(loop_ashr_1_use_sse4_2)
361
547
movdqa (%rdi, %rdx), %xmm0
362
548
palignr $2, -16(%rdi, %rdx), %xmm0
549
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
363
550
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
552
movdqa (%rsi,%rdx), %xmm1
553
TOLOWER (%xmm0, %xmm1)
554
pcmpistri $0x1a, %xmm1, %xmm0
364
556
jbe LABEL(use_sse4_2_exit)
365
#ifdef USE_AS_STRNCMP
557
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
367
559
jbe LABEL(strcmp_exitz_sse4_2)
374
566
movdqa (%rdi, %rdx), %xmm0
375
567
palignr $2, -16(%rdi, %rdx), %xmm0
568
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
376
569
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
571
movdqa (%rsi,%rdx), %xmm1
572
TOLOWER (%xmm0, %xmm1)
573
pcmpistri $0x1a, %xmm1, %xmm0
377
575
jbe LABEL(use_sse4_2_exit)
378
#ifdef USE_AS_STRNCMP
576
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
380
578
jbe LABEL(strcmp_exitz_sse4_2)
383
581
jmp LABEL(loop_ashr_2_use_sse4_2)
440
639
movdqa (%rdi, %rdx), %xmm0
441
640
palignr $3, -16(%rdi, %rdx), %xmm0
641
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
442
642
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
644
movdqa (%rsi,%rdx), %xmm1
645
TOLOWER (%xmm0, %xmm1)
646
pcmpistri $0x1a, %xmm1, %xmm0
443
648
jbe LABEL(use_sse4_2_exit)
444
#ifdef USE_AS_STRNCMP
649
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
446
651
jbe LABEL(strcmp_exitz_sse4_2)
453
658
movdqa (%rdi, %rdx), %xmm0
454
659
palignr $3, -16(%rdi, %rdx), %xmm0
660
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
455
661
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
663
movdqa (%rsi,%rdx), %xmm1
664
TOLOWER (%xmm0, %xmm1)
665
pcmpistri $0x1a, %xmm1, %xmm0
456
667
jbe LABEL(use_sse4_2_exit)
457
#ifdef USE_AS_STRNCMP
668
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
459
670
jbe LABEL(strcmp_exitz_sse4_2)
462
673
jmp LABEL(loop_ashr_3_use_sse4_2)
520
732
movdqa (%rdi, %rdx), %xmm0
521
733
palignr $4, -16(%rdi, %rdx), %xmm0
734
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
522
735
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
737
movdqa (%rsi,%rdx), %xmm1
738
TOLOWER (%xmm0, %xmm1)
739
pcmpistri $0x1a, %xmm1, %xmm0
523
741
jbe LABEL(use_sse4_2_exit)
524
#ifdef USE_AS_STRNCMP
742
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
526
744
jbe LABEL(strcmp_exitz_sse4_2)
533
751
movdqa (%rdi, %rdx), %xmm0
534
752
palignr $4, -16(%rdi, %rdx), %xmm0
753
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
535
754
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
756
movdqa (%rsi,%rdx), %xmm1
757
TOLOWER (%xmm0, %xmm1)
758
pcmpistri $0x1a, %xmm1, %xmm0
536
760
jbe LABEL(use_sse4_2_exit)
537
#ifdef USE_AS_STRNCMP
761
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
539
763
jbe LABEL(strcmp_exitz_sse4_2)
542
766
jmp LABEL(loop_ashr_4_use_sse4_2)
600
825
movdqa (%rdi, %rdx), %xmm0
601
826
palignr $5, -16(%rdi, %rdx), %xmm0
827
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
602
828
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
830
movdqa (%rsi,%rdx), %xmm1
831
TOLOWER (%xmm0, %xmm1)
832
pcmpistri $0x1a, %xmm1, %xmm0
603
834
jbe LABEL(use_sse4_2_exit)
604
#ifdef USE_AS_STRNCMP
835
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
606
837
jbe LABEL(strcmp_exitz_sse4_2)
613
844
movdqa (%rdi, %rdx), %xmm0
615
846
palignr $5, -16(%rdi, %rdx), %xmm0
847
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
616
848
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
850
movdqa (%rsi,%rdx), %xmm1
851
TOLOWER (%xmm0, %xmm1)
852
pcmpistri $0x1a, %xmm1, %xmm0
617
854
jbe LABEL(use_sse4_2_exit)
618
#ifdef USE_AS_STRNCMP
855
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
620
857
jbe LABEL(strcmp_exitz_sse4_2)
623
860
jmp LABEL(loop_ashr_5_use_sse4_2)
681
919
movdqa (%rdi, %rdx), %xmm0
682
920
palignr $6, -16(%rdi, %rdx), %xmm0
683
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
921
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
922
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
924
movdqa (%rsi,%rdx), %xmm1
925
TOLOWER (%xmm0, %xmm1)
926
pcmpistri $0x1a, %xmm1, %xmm0
684
928
jbe LABEL(use_sse4_2_exit)
685
#ifdef USE_AS_STRNCMP
929
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
687
931
jbe LABEL(strcmp_exitz_sse4_2)
694
938
movdqa (%rdi, %rdx), %xmm0
695
939
palignr $6, -16(%rdi, %rdx), %xmm0
696
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
940
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
941
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
943
movdqa (%rsi,%rdx), %xmm1
944
TOLOWER (%xmm0, %xmm1)
945
pcmpistri $0x1a, %xmm1, %xmm0
697
947
jbe LABEL(use_sse4_2_exit)
698
#ifdef USE_AS_STRNCMP
948
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
700
950
jbe LABEL(strcmp_exitz_sse4_2)
703
953
jmp LABEL(loop_ashr_6_use_sse4_2)
761
1012
movdqa (%rdi, %rdx), %xmm0
762
1013
palignr $7, -16(%rdi, %rdx), %xmm0
1014
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
763
1015
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
1017
movdqa (%rsi,%rdx), %xmm1
1018
TOLOWER (%xmm0, %xmm1)
1019
pcmpistri $0x1a, %xmm1, %xmm0
764
1021
jbe LABEL(use_sse4_2_exit)
765
#ifdef USE_AS_STRNCMP
1022
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
767
1024
jbe LABEL(strcmp_exitz_sse4_2)
774
1031
movdqa (%rdi, %rdx), %xmm0
775
1032
palignr $7, -16(%rdi, %rdx), %xmm0
1033
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
776
1034
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
1036
movdqa (%rsi,%rdx), %xmm1
1037
TOLOWER (%xmm0, %xmm1)
1038
pcmpistri $0x1a, %xmm1, %xmm0
777
1040
jbe LABEL(use_sse4_2_exit)
778
#ifdef USE_AS_STRNCMP
1041
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
780
1043
jbe LABEL(strcmp_exitz_sse4_2)
783
1046
jmp LABEL(loop_ashr_7_use_sse4_2)
841
1105
movdqa (%rdi, %rdx), %xmm0
842
1106
palignr $8, -16(%rdi, %rdx), %xmm0
843
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
1107
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
1108
pcmpistri $0x1a, (%rsi,%rdx), %xmm0
1110
movdqa (%rsi,%rdx), %xmm1
1111
TOLOWER (%xmm0, %xmm1)
1112
pcmpistri $0x1a, %xmm1, %xmm0
844
1114
jbe LABEL(use_sse4_2_exit)
845
#ifdef USE_AS_STRNCMP
1115
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
847
1117
jbe LABEL(strcmp_exitz_sse4_2)
854
1124
movdqa (%rdi, %rdx), %xmm0
855
1125
palignr $8, -16(%rdi, %rdx), %xmm0
856
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
1126
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
1127
pcmpistri $0x1a, (%rsi,%rdx), %xmm0
1129
movdqa (%rsi,%rdx), %xmm1
1130
TOLOWER (%xmm0, %xmm1)
1131
pcmpistri $0x1a, %xmm1, %xmm0
857
1133
jbe LABEL(use_sse4_2_exit)
858
#ifdef USE_AS_STRNCMP
1134
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
860
1136
jbe LABEL(strcmp_exitz_sse4_2)
863
1139
jmp LABEL(loop_ashr_8_use_sse4_2)
921
1198
movdqa (%rdi, %rdx), %xmm0
923
1200
palignr $9, -16(%rdi, %rdx), %xmm0
924
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
1201
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
1202
pcmpistri $0x1a, (%rsi,%rdx), %xmm0
1204
movdqa (%rsi,%rdx), %xmm1
1205
TOLOWER (%xmm0, %xmm1)
1206
pcmpistri $0x1a, %xmm1, %xmm0
925
1208
jbe LABEL(use_sse4_2_exit)
926
#ifdef USE_AS_STRNCMP
1209
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
928
1211
jbe LABEL(strcmp_exitz_sse4_2)
935
1218
movdqa (%rdi, %rdx), %xmm0
936
1219
palignr $9, -16(%rdi, %rdx), %xmm0
937
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
1220
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
1221
pcmpistri $0x1a, (%rsi,%rdx), %xmm0
1223
movdqa (%rsi,%rdx), %xmm1
1224
TOLOWER (%xmm0, %xmm1)
1225
pcmpistri $0x1a, %xmm1, %xmm0
938
1227
jbe LABEL(use_sse4_2_exit)
939
#ifdef USE_AS_STRNCMP
1228
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
941
1230
jbe LABEL(strcmp_exitz_sse4_2)
944
1233
jmp LABEL(loop_ashr_9_use_sse4_2)
1002
1292
movdqa (%rdi, %rdx), %xmm0
1003
1293
palignr $10, -16(%rdi, %rdx), %xmm0
1004
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
1294
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
1295
pcmpistri $0x1a, (%rsi,%rdx), %xmm0
1297
movdqa (%rsi,%rdx), %xmm1
1298
TOLOWER (%xmm0, %xmm1)
1299
pcmpistri $0x1a, %xmm1, %xmm0
1005
1301
jbe LABEL(use_sse4_2_exit)
1006
#ifdef USE_AS_STRNCMP
1302
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
1008
1304
jbe LABEL(strcmp_exitz_sse4_2)
1015
1311
movdqa (%rdi, %rdx), %xmm0
1016
1312
palignr $10, -16(%rdi, %rdx), %xmm0
1017
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
1313
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
1314
pcmpistri $0x1a, (%rsi,%rdx), %xmm0
1316
movdqa (%rsi,%rdx), %xmm1
1317
TOLOWER (%xmm0, %xmm1)
1318
pcmpistri $0x1a, %xmm1, %xmm0
1018
1320
jbe LABEL(use_sse4_2_exit)
1019
#ifdef USE_AS_STRNCMP
1321
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
1021
1323
jbe LABEL(strcmp_exitz_sse4_2)
1024
1326
jmp LABEL(loop_ashr_10_use_sse4_2)
1082
1385
movdqa (%rdi, %rdx), %xmm0
1083
1386
palignr $11, -16(%rdi, %rdx), %xmm0
1084
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
1387
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
1388
pcmpistri $0x1a, (%rsi,%rdx), %xmm0
1390
movdqa (%rsi,%rdx), %xmm1
1391
TOLOWER (%xmm0, %xmm1)
1392
pcmpistri $0x1a, %xmm1, %xmm0
1085
1394
jbe LABEL(use_sse4_2_exit)
1086
#ifdef USE_AS_STRNCMP
1395
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
1088
1397
jbe LABEL(strcmp_exitz_sse4_2)
1095
1404
movdqa (%rdi, %rdx), %xmm0
1096
1405
palignr $11, -16(%rdi, %rdx), %xmm0
1097
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
1406
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
1407
pcmpistri $0x1a, (%rsi,%rdx), %xmm0
1409
movdqa (%rsi,%rdx), %xmm1
1410
TOLOWER (%xmm0, %xmm1)
1411
pcmpistri $0x1a, %xmm1, %xmm0
1098
1413
jbe LABEL(use_sse4_2_exit)
1099
#ifdef USE_AS_STRNCMP
1414
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
1101
1416
jbe LABEL(strcmp_exitz_sse4_2)
1104
1419
jmp LABEL(loop_ashr_11_use_sse4_2)
1162
1478
movdqa (%rdi, %rdx), %xmm0
1163
1479
palignr $12, -16(%rdi, %rdx), %xmm0
1164
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
1480
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
1481
pcmpistri $0x1a, (%rsi,%rdx), %xmm0
1483
movdqa (%rsi,%rdx), %xmm1
1484
TOLOWER (%xmm0, %xmm1)
1485
pcmpistri $0x1a, %xmm1, %xmm0
1165
1487
jbe LABEL(use_sse4_2_exit)
1166
#ifdef USE_AS_STRNCMP
1488
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
1168
1490
jbe LABEL(strcmp_exitz_sse4_2)
1175
1497
movdqa (%rdi, %rdx), %xmm0
1176
1498
palignr $12, -16(%rdi, %rdx), %xmm0
1177
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
1499
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
1500
pcmpistri $0x1a, (%rsi,%rdx), %xmm0
1502
movdqa (%rsi,%rdx), %xmm1
1503
TOLOWER (%xmm0, %xmm1)
1504
pcmpistri $0x1a, %xmm1, %xmm0
1178
1506
jbe LABEL(use_sse4_2_exit)
1179
#ifdef USE_AS_STRNCMP
1507
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
1181
1509
jbe LABEL(strcmp_exitz_sse4_2)
1184
1512
jmp LABEL(loop_ashr_12_use_sse4_2)
1243
1572
movdqa (%rdi, %rdx), %xmm0
1244
1573
palignr $13, -16(%rdi, %rdx), %xmm0
1245
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
1574
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
1575
pcmpistri $0x1a, (%rsi,%rdx), %xmm0
1577
movdqa (%rsi,%rdx), %xmm1
1578
TOLOWER (%xmm0, %xmm1)
1579
pcmpistri $0x1a, %xmm1, %xmm0
1246
1581
jbe LABEL(use_sse4_2_exit)
1247
#ifdef USE_AS_STRNCMP
1582
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
1249
1584
jbe LABEL(strcmp_exitz_sse4_2)
1256
1591
movdqa (%rdi, %rdx), %xmm0
1257
1592
palignr $13, -16(%rdi, %rdx), %xmm0
1258
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
1593
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
1594
pcmpistri $0x1a, (%rsi,%rdx), %xmm0
1596
movdqa (%rsi,%rdx), %xmm1
1597
TOLOWER (%xmm0, %xmm1)
1598
pcmpistri $0x1a, %xmm1, %xmm0
1259
1600
jbe LABEL(use_sse4_2_exit)
1260
#ifdef USE_AS_STRNCMP
1601
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
1262
1603
jbe LABEL(strcmp_exitz_sse4_2)
1265
1606
jmp LABEL(loop_ashr_13_use_sse4_2)
1324
1666
movdqa (%rdi, %rdx), %xmm0
1325
1667
palignr $14, -16(%rdi, %rdx), %xmm0
1326
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
1668
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
1669
pcmpistri $0x1a, (%rsi,%rdx), %xmm0
1671
movdqa (%rsi,%rdx), %xmm1
1672
TOLOWER (%xmm0, %xmm1)
1673
pcmpistri $0x1a, %xmm1, %xmm0
1327
1675
jbe LABEL(use_sse4_2_exit)
1328
#ifdef USE_AS_STRNCMP
1676
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
1330
1678
jbe LABEL(strcmp_exitz_sse4_2)
1337
1685
movdqa (%rdi, %rdx), %xmm0
1338
1686
palignr $14, -16(%rdi, %rdx), %xmm0
1339
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
1687
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
1688
pcmpistri $0x1a, (%rsi,%rdx), %xmm0
1690
movdqa (%rsi,%rdx), %xmm1
1691
TOLOWER (%xmm0, %xmm1)
1692
pcmpistri $0x1a, %xmm1, %xmm0
1340
1694
jbe LABEL(use_sse4_2_exit)
1341
#ifdef USE_AS_STRNCMP
1695
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
1343
1697
jbe LABEL(strcmp_exitz_sse4_2)
1346
1700
jmp LABEL(loop_ashr_14_use_sse4_2)
1407
1762
movdqa (%rdi, %rdx), %xmm0
1408
1763
palignr $15, -16(%rdi, %rdx), %xmm0
1409
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
1764
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
1765
pcmpistri $0x1a, (%rsi,%rdx), %xmm0
1767
movdqa (%rsi,%rdx), %xmm1
1768
TOLOWER (%xmm0, %xmm1)
1769
pcmpistri $0x1a, %xmm1, %xmm0
1410
1771
jbe LABEL(use_sse4_2_exit)
1411
#ifdef USE_AS_STRNCMP
1772
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
1413
1774
jbe LABEL(strcmp_exitz_sse4_2)
1420
1781
movdqa (%rdi, %rdx), %xmm0
1421
1782
palignr $15, -16(%rdi, %rdx), %xmm0
1422
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
1783
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
1784
pcmpistri $0x1a, (%rsi,%rdx), %xmm0
1786
movdqa (%rsi,%rdx), %xmm1
1787
TOLOWER (%xmm0, %xmm1)
1788
pcmpistri $0x1a, %xmm1, %xmm0
1423
1790
jbe LABEL(use_sse4_2_exit)
1424
#ifdef USE_AS_STRNCMP
1791
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
1426
1793
jbe LABEL(strcmp_exitz_sse4_2)
1429
1796
jmp LABEL(loop_ashr_15_use_sse4_2)
1434
1801
movdqa -16(%rdi, %rdx), %xmm0
1435
1802
psrldq $15, %xmm0
1436
1803
pcmpistri $0x3a,%xmm0, %xmm0
1437
#ifdef USE_AS_STRNCMP
1804
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
1439
1806
jae LABEL(nibble_ashr_use_sse4_2_exit)
1442
1809
ja LABEL(loop_ashr_15_use_sse4_2)
1444
1811
LABEL(nibble_ashr_use_sse4_2_exit):
1812
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
1445
1813
pcmpistri $0x1a,(%rsi,%rdx), %xmm0
1815
movdqa (%rsi,%rdx), %xmm1
1816
TOLOWER (%xmm0, %xmm1)
1817
pcmpistri $0x1a, %xmm1, %xmm0
1447
1820
LABEL(use_sse4_2_exit):
1448
1821
jnc LABEL(strcmp_exitz_sse4_2)
1449
#ifdef USE_AS_STRNCMP
1822
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
1451
1824
jbe LABEL(strcmp_exitz_sse4_2)
1454
1827
lea -16(%rdi, %r9), %rdi
1455
1828
movzbl (%rdi, %rdx), %eax
1473
1852
LABEL(less16bytes_sse4_2):
1474
1853
bsf %rdx, %rdx /* find and store bit index in %rdx */
1476
#ifdef USE_AS_STRNCMP
1855
# if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
1478
1857
jbe LABEL(strcmp_exitz_sse4_2)
1480
1859
movzbl (%rsi, %rdx), %ecx
1481
1860
movzbl (%rdi, %rdx), %eax
1862
# if defined USE_AS_STRCASECMP_L || defined USE_AS_STRNCASECMP_L
1863
leaq _nl_C_LC_CTYPE_tolower+128*4(%rip), %rdx
1864
movl (%rdx,%rcx,4), %ecx
1865
movl (%rdx,%rax,4), %eax
1529
1926
# define END(name) \
1530
1927
cfi_endproc; .size STRCMP_SSE2, .-STRCMP_SSE2
1929
# ifdef USE_AS_STRCASECMP_L
1930
# define ENTRY2(name) \
1931
.type __strcasecmp_sse2, @function; \
1933
__strcasecmp_sse2: cfi_startproc; \
1935
# define END2(name) \
1936
cfi_endproc; .size __strcasecmp_sse2, .-__strcasecmp_sse2
1939
# ifdef USE_AS_STRNCASECMP_L
1940
# define ENTRY2(name) \
1941
.type __strncasecmp_sse2, @function; \
1943
__strncasecmp_sse2: cfi_startproc; \
1945
# define END2(name) \
1946
cfi_endproc; .size __strncasecmp_sse2, .-__strncasecmp_sse2
1531
1949
# undef libc_hidden_builtin_def
1532
1950
/* It doesn't make sense to send libc-internal strcmp calls through a PLT.
1533
1951
The speedup we get from using SSE4.2 instruction is likely eaten away