1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=cmov | FileCheck %s --check-prefix=X86 --check-prefix=X86-NOSSE
3 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=X86 --check-prefix=X86-SSE2
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=X64 --check-prefix=X64-SSE2
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx2 | FileCheck %s --check-prefix=X64 --check-prefix=X64-AVX2
7 ; This tests codegen time inlining/optimization of memcmp
10 @.str = private constant [65 x i8] c"0123456789012345678901234567890123456789012345678901234567890123\00", align 1
12 declare i32 @memcmp(i8*, i8*, i64)
14 define i32 @length2(i8* %X, i8* %Y) nounwind minsize {
19 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
20 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
21 ; X86-NEXT: calll memcmp
22 ; X86-NEXT: addl $16, %esp
29 ; X64-NEXT: jmp memcmp # TAILCALL
30 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 2) nounwind
34 define i1 @length2_eq(i8* %X, i8* %Y) nounwind minsize {
35 ; X86-LABEL: length2_eq:
37 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
38 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
39 ; X86-NEXT: movzwl (%ecx), %ecx
40 ; X86-NEXT: cmpw (%eax), %cx
44 ; X64-LABEL: length2_eq:
46 ; X64-NEXT: movzwl (%rdi), %eax
47 ; X64-NEXT: cmpw (%rsi), %ax
50 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 2) nounwind
51 %c = icmp eq i32 %m, 0
55 define i1 @length2_eq_const(i8* %X) nounwind minsize {
56 ; X86-LABEL: length2_eq_const:
58 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
59 ; X86-NEXT: cmpw $12849, (%eax) # imm = 0x3231
63 ; X64-LABEL: length2_eq_const:
65 ; X64-NEXT: cmpw $12849, (%rdi) # imm = 0x3231
68 %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 1), i64 2) nounwind
69 %c = icmp ne i32 %m, 0
73 define i1 @length2_eq_nobuiltin_attr(i8* %X, i8* %Y) nounwind minsize {
74 ; X86-LABEL: length2_eq_nobuiltin_attr:
78 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
79 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
80 ; X86-NEXT: calll memcmp
81 ; X86-NEXT: addl $16, %esp
82 ; X86-NEXT: testl %eax, %eax
86 ; X64-LABEL: length2_eq_nobuiltin_attr:
88 ; X64-NEXT: pushq %rax
91 ; X64-NEXT: callq memcmp
92 ; X64-NEXT: testl %eax, %eax
96 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 2) nounwind nobuiltin
97 %c = icmp eq i32 %m, 0
101 define i32 @length3(i8* %X, i8* %Y) nounwind minsize {
102 ; X86-LABEL: length3:
106 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
107 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
108 ; X86-NEXT: calll memcmp
109 ; X86-NEXT: addl $16, %esp
112 ; X64-LABEL: length3:
115 ; X64-NEXT: popq %rdx
116 ; X64-NEXT: jmp memcmp # TAILCALL
117 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 3) nounwind
121 define i1 @length3_eq(i8* %X, i8* %Y) nounwind minsize {
122 ; X86-LABEL: length3_eq:
126 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
127 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
128 ; X86-NEXT: calll memcmp
129 ; X86-NEXT: addl $16, %esp
130 ; X86-NEXT: testl %eax, %eax
131 ; X86-NEXT: setne %al
134 ; X64-LABEL: length3_eq:
136 ; X64-NEXT: pushq %rax
138 ; X64-NEXT: popq %rdx
139 ; X64-NEXT: callq memcmp
140 ; X64-NEXT: testl %eax, %eax
141 ; X64-NEXT: setne %al
142 ; X64-NEXT: popq %rcx
144 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 3) nounwind
145 %c = icmp ne i32 %m, 0
149 define i32 @length4(i8* %X, i8* %Y) nounwind minsize {
150 ; X86-LABEL: length4:
154 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
155 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
156 ; X86-NEXT: calll memcmp
157 ; X86-NEXT: addl $16, %esp
160 ; X64-LABEL: length4:
163 ; X64-NEXT: popq %rdx
164 ; X64-NEXT: jmp memcmp # TAILCALL
165 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 4) nounwind
169 define i1 @length4_eq(i8* %X, i8* %Y) nounwind minsize {
170 ; X86-LABEL: length4_eq:
172 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
173 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
174 ; X86-NEXT: movl (%ecx), %ecx
175 ; X86-NEXT: cmpl (%eax), %ecx
176 ; X86-NEXT: setne %al
179 ; X64-LABEL: length4_eq:
181 ; X64-NEXT: movl (%rdi), %eax
182 ; X64-NEXT: cmpl (%rsi), %eax
183 ; X64-NEXT: setne %al
185 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 4) nounwind
186 %c = icmp ne i32 %m, 0
190 define i1 @length4_eq_const(i8* %X) nounwind minsize {
191 ; X86-LABEL: length4_eq_const:
193 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
194 ; X86-NEXT: cmpl $875770417, (%eax) # imm = 0x34333231
198 ; X64-LABEL: length4_eq_const:
200 ; X64-NEXT: cmpl $875770417, (%rdi) # imm = 0x34333231
203 %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 1), i64 4) nounwind
204 %c = icmp eq i32 %m, 0
208 define i32 @length5(i8* %X, i8* %Y) nounwind minsize {
209 ; X86-LABEL: length5:
213 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
214 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
215 ; X86-NEXT: calll memcmp
216 ; X86-NEXT: addl $16, %esp
219 ; X64-LABEL: length5:
222 ; X64-NEXT: popq %rdx
223 ; X64-NEXT: jmp memcmp # TAILCALL
224 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 5) nounwind
228 define i1 @length5_eq(i8* %X, i8* %Y) nounwind minsize {
229 ; X86-LABEL: length5_eq:
233 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
234 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
235 ; X86-NEXT: calll memcmp
236 ; X86-NEXT: addl $16, %esp
237 ; X86-NEXT: testl %eax, %eax
238 ; X86-NEXT: setne %al
241 ; X64-LABEL: length5_eq:
243 ; X64-NEXT: pushq %rax
245 ; X64-NEXT: popq %rdx
246 ; X64-NEXT: callq memcmp
247 ; X64-NEXT: testl %eax, %eax
248 ; X64-NEXT: setne %al
249 ; X64-NEXT: popq %rcx
251 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 5) nounwind
252 %c = icmp ne i32 %m, 0
256 define i32 @length8(i8* %X, i8* %Y) nounwind minsize {
257 ; X86-LABEL: length8:
261 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
262 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
263 ; X86-NEXT: calll memcmp
264 ; X86-NEXT: addl $16, %esp
267 ; X64-LABEL: length8:
270 ; X64-NEXT: popq %rdx
271 ; X64-NEXT: jmp memcmp # TAILCALL
272 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 8) nounwind
276 define i1 @length8_eq(i8* %X, i8* %Y) nounwind minsize {
277 ; X86-LABEL: length8_eq:
281 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
282 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
283 ; X86-NEXT: calll memcmp
284 ; X86-NEXT: addl $16, %esp
285 ; X86-NEXT: testl %eax, %eax
289 ; X64-LABEL: length8_eq:
291 ; X64-NEXT: movq (%rdi), %rax
292 ; X64-NEXT: cmpq (%rsi), %rax
295 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 8) nounwind
296 %c = icmp eq i32 %m, 0
300 define i1 @length8_eq_const(i8* %X) nounwind minsize {
301 ; X86-LABEL: length8_eq_const:
305 ; X86-NEXT: pushl $.L.str
306 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
307 ; X86-NEXT: calll memcmp
308 ; X86-NEXT: addl $16, %esp
309 ; X86-NEXT: testl %eax, %eax
310 ; X86-NEXT: setne %al
313 ; X64-LABEL: length8_eq_const:
315 ; X64-NEXT: movabsq $3978425819141910832, %rax # imm = 0x3736353433323130
316 ; X64-NEXT: cmpq %rax, (%rdi)
317 ; X64-NEXT: setne %al
319 %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 0), i64 8) nounwind
320 %c = icmp ne i32 %m, 0
324 define i1 @length12_eq(i8* %X, i8* %Y) nounwind minsize {
325 ; X86-LABEL: length12_eq:
328 ; X86-NEXT: pushl $12
329 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
330 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
331 ; X86-NEXT: calll memcmp
332 ; X86-NEXT: addl $16, %esp
333 ; X86-NEXT: testl %eax, %eax
334 ; X86-NEXT: setne %al
337 ; X64-LABEL: length12_eq:
339 ; X64-NEXT: pushq %rax
340 ; X64-NEXT: pushq $12
341 ; X64-NEXT: popq %rdx
342 ; X64-NEXT: callq memcmp
343 ; X64-NEXT: testl %eax, %eax
344 ; X64-NEXT: setne %al
345 ; X64-NEXT: popq %rcx
347 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 12) nounwind
348 %c = icmp ne i32 %m, 0
352 define i32 @length12(i8* %X, i8* %Y) nounwind minsize {
353 ; X86-LABEL: length12:
356 ; X86-NEXT: pushl $12
357 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
358 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
359 ; X86-NEXT: calll memcmp
360 ; X86-NEXT: addl $16, %esp
363 ; X64-LABEL: length12:
365 ; X64-NEXT: pushq $12
366 ; X64-NEXT: popq %rdx
367 ; X64-NEXT: jmp memcmp # TAILCALL
368 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 12) nounwind
372 ; PR33329 - https://bugs.llvm.org/show_bug.cgi?id=33329
374 define i32 @length16(i8* %X, i8* %Y) nounwind minsize {
375 ; X86-LABEL: length16:
378 ; X86-NEXT: pushl $16
379 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
380 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
381 ; X86-NEXT: calll memcmp
382 ; X86-NEXT: addl $16, %esp
385 ; X64-LABEL: length16:
387 ; X64-NEXT: pushq $16
388 ; X64-NEXT: popq %rdx
389 ; X64-NEXT: jmp memcmp # TAILCALL
390 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 16) nounwind
394 define i1 @length16_eq(i8* %x, i8* %y) nounwind minsize {
395 ; X86-NOSSE-LABEL: length16_eq:
396 ; X86-NOSSE: # %bb.0:
397 ; X86-NOSSE-NEXT: pushl $0
398 ; X86-NOSSE-NEXT: pushl $16
399 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
400 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
401 ; X86-NOSSE-NEXT: calll memcmp
402 ; X86-NOSSE-NEXT: addl $16, %esp
403 ; X86-NOSSE-NEXT: testl %eax, %eax
404 ; X86-NOSSE-NEXT: setne %al
405 ; X86-NOSSE-NEXT: retl
407 ; X86-SSE2-LABEL: length16_eq:
409 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
410 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
411 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
412 ; X86-SSE2-NEXT: movdqu (%eax), %xmm1
413 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm1
414 ; X86-SSE2-NEXT: pmovmskb %xmm1, %eax
415 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
416 ; X86-SSE2-NEXT: setne %al
417 ; X86-SSE2-NEXT: retl
419 ; X64-SSE2-LABEL: length16_eq:
421 ; X64-SSE2-NEXT: movdqu (%rsi), %xmm0
422 ; X64-SSE2-NEXT: movdqu (%rdi), %xmm1
423 ; X64-SSE2-NEXT: pcmpeqb %xmm0, %xmm1
424 ; X64-SSE2-NEXT: pmovmskb %xmm1, %eax
425 ; X64-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
426 ; X64-SSE2-NEXT: setne %al
427 ; X64-SSE2-NEXT: retq
429 ; X64-AVX2-LABEL: length16_eq:
431 ; X64-AVX2-NEXT: vmovdqu (%rdi), %xmm0
432 ; X64-AVX2-NEXT: vpcmpeqb (%rsi), %xmm0, %xmm0
433 ; X64-AVX2-NEXT: vpmovmskb %xmm0, %eax
434 ; X64-AVX2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
435 ; X64-AVX2-NEXT: setne %al
436 ; X64-AVX2-NEXT: retq
437 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 16) nounwind
438 %cmp = icmp ne i32 %call, 0
442 define i1 @length16_eq_const(i8* %X) nounwind minsize {
443 ; X86-NOSSE-LABEL: length16_eq_const:
444 ; X86-NOSSE: # %bb.0:
445 ; X86-NOSSE-NEXT: pushl $0
446 ; X86-NOSSE-NEXT: pushl $16
447 ; X86-NOSSE-NEXT: pushl $.L.str
448 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
449 ; X86-NOSSE-NEXT: calll memcmp
450 ; X86-NOSSE-NEXT: addl $16, %esp
451 ; X86-NOSSE-NEXT: testl %eax, %eax
452 ; X86-NOSSE-NEXT: sete %al
453 ; X86-NOSSE-NEXT: retl
455 ; X86-SSE2-LABEL: length16_eq_const:
457 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
458 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
459 ; X86-SSE2-NEXT: pcmpeqb {{\.LCPI.*}}, %xmm0
460 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
461 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
462 ; X86-SSE2-NEXT: sete %al
463 ; X86-SSE2-NEXT: retl
465 ; X64-SSE2-LABEL: length16_eq_const:
467 ; X64-SSE2-NEXT: movdqu (%rdi), %xmm0
468 ; X64-SSE2-NEXT: pcmpeqb {{.*}}(%rip), %xmm0
469 ; X64-SSE2-NEXT: pmovmskb %xmm0, %eax
470 ; X64-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
471 ; X64-SSE2-NEXT: sete %al
472 ; X64-SSE2-NEXT: retq
474 ; X64-AVX2-LABEL: length16_eq_const:
476 ; X64-AVX2-NEXT: vmovdqu (%rdi), %xmm0
477 ; X64-AVX2-NEXT: vpcmpeqb {{.*}}(%rip), %xmm0, %xmm0
478 ; X64-AVX2-NEXT: vpmovmskb %xmm0, %eax
479 ; X64-AVX2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
480 ; X64-AVX2-NEXT: sete %al
481 ; X64-AVX2-NEXT: retq
482 %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 0), i64 16) nounwind
483 %c = icmp eq i32 %m, 0
487 ; PR33914 - https://bugs.llvm.org/show_bug.cgi?id=33914
489 define i32 @length24(i8* %X, i8* %Y) nounwind minsize {
490 ; X86-LABEL: length24:
493 ; X86-NEXT: pushl $24
494 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
495 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
496 ; X86-NEXT: calll memcmp
497 ; X86-NEXT: addl $16, %esp
500 ; X64-LABEL: length24:
502 ; X64-NEXT: pushq $24
503 ; X64-NEXT: popq %rdx
504 ; X64-NEXT: jmp memcmp # TAILCALL
505 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 24) nounwind
509 define i1 @length24_eq(i8* %x, i8* %y) nounwind minsize {
510 ; X86-LABEL: length24_eq:
513 ; X86-NEXT: pushl $24
514 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
515 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
516 ; X86-NEXT: calll memcmp
517 ; X86-NEXT: addl $16, %esp
518 ; X86-NEXT: testl %eax, %eax
522 ; X64-LABEL: length24_eq:
524 ; X64-NEXT: pushq %rax
525 ; X64-NEXT: pushq $24
526 ; X64-NEXT: popq %rdx
527 ; X64-NEXT: callq memcmp
528 ; X64-NEXT: testl %eax, %eax
530 ; X64-NEXT: popq %rcx
532 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 24) nounwind
533 %cmp = icmp eq i32 %call, 0
537 define i1 @length24_eq_const(i8* %X) nounwind minsize {
538 ; X86-LABEL: length24_eq_const:
541 ; X86-NEXT: pushl $24
542 ; X86-NEXT: pushl $.L.str
543 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
544 ; X86-NEXT: calll memcmp
545 ; X86-NEXT: addl $16, %esp
546 ; X86-NEXT: testl %eax, %eax
547 ; X86-NEXT: setne %al
550 ; X64-LABEL: length24_eq_const:
552 ; X64-NEXT: pushq %rax
553 ; X64-NEXT: pushq $24
554 ; X64-NEXT: popq %rdx
555 ; X64-NEXT: movl $.L.str, %esi
556 ; X64-NEXT: callq memcmp
557 ; X64-NEXT: testl %eax, %eax
558 ; X64-NEXT: setne %al
559 ; X64-NEXT: popq %rcx
561 %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 0), i64 24) nounwind
562 %c = icmp ne i32 %m, 0
566 define i32 @length32(i8* %X, i8* %Y) nounwind minsize {
567 ; X86-LABEL: length32:
570 ; X86-NEXT: pushl $32
571 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
572 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
573 ; X86-NEXT: calll memcmp
574 ; X86-NEXT: addl $16, %esp
577 ; X64-LABEL: length32:
579 ; X64-NEXT: pushq $32
580 ; X64-NEXT: popq %rdx
581 ; X64-NEXT: jmp memcmp # TAILCALL
582 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 32) nounwind
586 ; PR33325 - https://bugs.llvm.org/show_bug.cgi?id=33325
588 define i1 @length32_eq(i8* %x, i8* %y) nounwind minsize {
589 ; X86-LABEL: length32_eq:
592 ; X86-NEXT: pushl $32
593 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
594 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
595 ; X86-NEXT: calll memcmp
596 ; X86-NEXT: addl $16, %esp
597 ; X86-NEXT: testl %eax, %eax
601 ; X64-SSE2-LABEL: length32_eq:
603 ; X64-SSE2-NEXT: pushq %rax
604 ; X64-SSE2-NEXT: pushq $32
605 ; X64-SSE2-NEXT: popq %rdx
606 ; X64-SSE2-NEXT: callq memcmp
607 ; X64-SSE2-NEXT: testl %eax, %eax
608 ; X64-SSE2-NEXT: sete %al
609 ; X64-SSE2-NEXT: popq %rcx
610 ; X64-SSE2-NEXT: retq
612 ; X64-AVX2-LABEL: length32_eq:
614 ; X64-AVX2-NEXT: vmovdqu (%rdi), %ymm0
615 ; X64-AVX2-NEXT: vpcmpeqb (%rsi), %ymm0, %ymm0
616 ; X64-AVX2-NEXT: vpmovmskb %ymm0, %eax
617 ; X64-AVX2-NEXT: cmpl $-1, %eax
618 ; X64-AVX2-NEXT: sete %al
619 ; X64-AVX2-NEXT: vzeroupper
620 ; X64-AVX2-NEXT: retq
621 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 32) nounwind
622 %cmp = icmp eq i32 %call, 0
626 define i1 @length32_eq_const(i8* %X) nounwind minsize {
627 ; X86-LABEL: length32_eq_const:
630 ; X86-NEXT: pushl $32
631 ; X86-NEXT: pushl $.L.str
632 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
633 ; X86-NEXT: calll memcmp
634 ; X86-NEXT: addl $16, %esp
635 ; X86-NEXT: testl %eax, %eax
636 ; X86-NEXT: setne %al
639 ; X64-SSE2-LABEL: length32_eq_const:
641 ; X64-SSE2-NEXT: pushq %rax
642 ; X64-SSE2-NEXT: pushq $32
643 ; X64-SSE2-NEXT: popq %rdx
644 ; X64-SSE2-NEXT: movl $.L.str, %esi
645 ; X64-SSE2-NEXT: callq memcmp
646 ; X64-SSE2-NEXT: testl %eax, %eax
647 ; X64-SSE2-NEXT: setne %al
648 ; X64-SSE2-NEXT: popq %rcx
649 ; X64-SSE2-NEXT: retq
651 ; X64-AVX2-LABEL: length32_eq_const:
653 ; X64-AVX2-NEXT: vmovdqu (%rdi), %ymm0
654 ; X64-AVX2-NEXT: vpcmpeqb {{.*}}(%rip), %ymm0, %ymm0
655 ; X64-AVX2-NEXT: vpmovmskb %ymm0, %eax
656 ; X64-AVX2-NEXT: cmpl $-1, %eax
657 ; X64-AVX2-NEXT: setne %al
658 ; X64-AVX2-NEXT: vzeroupper
659 ; X64-AVX2-NEXT: retq
660 %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 0), i64 32) nounwind
661 %c = icmp ne i32 %m, 0
665 define i32 @length64(i8* %X, i8* %Y) nounwind minsize {
666 ; X86-LABEL: length64:
669 ; X86-NEXT: pushl $64
670 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
671 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
672 ; X86-NEXT: calll memcmp
673 ; X86-NEXT: addl $16, %esp
676 ; X64-LABEL: length64:
678 ; X64-NEXT: pushq $64
679 ; X64-NEXT: popq %rdx
680 ; X64-NEXT: jmp memcmp # TAILCALL
681 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 64) nounwind
685 define i1 @length64_eq(i8* %x, i8* %y) nounwind minsize {
686 ; X86-LABEL: length64_eq:
689 ; X86-NEXT: pushl $64
690 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
691 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
692 ; X86-NEXT: calll memcmp
693 ; X86-NEXT: addl $16, %esp
694 ; X86-NEXT: testl %eax, %eax
695 ; X86-NEXT: setne %al
698 ; X64-LABEL: length64_eq:
700 ; X64-NEXT: pushq %rax
701 ; X64-NEXT: pushq $64
702 ; X64-NEXT: popq %rdx
703 ; X64-NEXT: callq memcmp
704 ; X64-NEXT: testl %eax, %eax
705 ; X64-NEXT: setne %al
706 ; X64-NEXT: popq %rcx
708 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 64) nounwind
709 %cmp = icmp ne i32 %call, 0
713 define i1 @length64_eq_const(i8* %X) nounwind minsize {
714 ; X86-LABEL: length64_eq_const:
717 ; X86-NEXT: pushl $64
718 ; X86-NEXT: pushl $.L.str
719 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
720 ; X86-NEXT: calll memcmp
721 ; X86-NEXT: addl $16, %esp
722 ; X86-NEXT: testl %eax, %eax
726 ; X64-LABEL: length64_eq_const:
728 ; X64-NEXT: pushq %rax
729 ; X64-NEXT: pushq $64
730 ; X64-NEXT: popq %rdx
731 ; X64-NEXT: movl $.L.str, %esi
732 ; X64-NEXT: callq memcmp
733 ; X64-NEXT: testl %eax, %eax
735 ; X64-NEXT: popq %rcx
737 %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 0), i64 64) nounwind
738 %c = icmp eq i32 %m, 0