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=avx | FileCheck %s --check-prefix=X64 --check-prefix=X64-AVX --check-prefix=X64-AVX1
6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx2 | FileCheck %s --check-prefix=X64 --check-prefix=X64-AVX --check-prefix=X64-AVX2
8 ; This tests codegen time inlining/optimization of memcmp
11 @.str = private constant [65 x i8] c"0123456789012345678901234567890123456789012345678901234567890123\00", align 1
13 declare i32 @memcmp(i8*, i8*, i64)
14 declare i32 @bcmp(i8*, i8*, i64)
16 define i32 @length2(i8* %X, i8* %Y) nounwind optsize {
19 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
20 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
21 ; X86-NEXT: movzwl (%ecx), %ecx
22 ; X86-NEXT: movzwl (%eax), %edx
23 ; X86-NEXT: rolw $8, %cx
24 ; X86-NEXT: rolw $8, %dx
25 ; X86-NEXT: movzwl %cx, %eax
26 ; X86-NEXT: movzwl %dx, %ecx
27 ; X86-NEXT: subl %ecx, %eax
32 ; X64-NEXT: movzwl (%rdi), %eax
33 ; X64-NEXT: movzwl (%rsi), %ecx
34 ; X64-NEXT: rolw $8, %ax
35 ; X64-NEXT: rolw $8, %cx
36 ; X64-NEXT: movzwl %ax, %eax
37 ; X64-NEXT: movzwl %cx, %ecx
38 ; X64-NEXT: subl %ecx, %eax
40 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 2) nounwind
44 define i1 @length2_eq(i8* %X, i8* %Y) nounwind optsize {
45 ; X86-LABEL: length2_eq:
47 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
48 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
49 ; X86-NEXT: movzwl (%ecx), %ecx
50 ; X86-NEXT: cmpw (%eax), %cx
54 ; X64-LABEL: length2_eq:
56 ; X64-NEXT: movzwl (%rdi), %eax
57 ; X64-NEXT: cmpw (%rsi), %ax
60 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 2) nounwind
61 %c = icmp eq i32 %m, 0
65 define i1 @length2_eq_const(i8* %X) nounwind optsize {
66 ; X86-LABEL: length2_eq_const:
68 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
69 ; X86-NEXT: movzwl (%eax), %eax
70 ; X86-NEXT: cmpl $12849, %eax # imm = 0x3231
74 ; X64-LABEL: length2_eq_const:
76 ; X64-NEXT: movzwl (%rdi), %eax
77 ; X64-NEXT: cmpl $12849, %eax # imm = 0x3231
80 %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 1), i64 2) nounwind
81 %c = icmp ne i32 %m, 0
85 define i1 @length2_eq_nobuiltin_attr(i8* %X, i8* %Y) nounwind optsize {
86 ; X86-LABEL: length2_eq_nobuiltin_attr:
90 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
91 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
92 ; X86-NEXT: calll memcmp
93 ; X86-NEXT: addl $16, %esp
94 ; X86-NEXT: testl %eax, %eax
98 ; X64-LABEL: length2_eq_nobuiltin_attr:
100 ; X64-NEXT: pushq %rax
101 ; X64-NEXT: movl $2, %edx
102 ; X64-NEXT: callq memcmp
103 ; X64-NEXT: testl %eax, %eax
105 ; X64-NEXT: popq %rcx
107 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 2) nounwind nobuiltin
108 %c = icmp eq i32 %m, 0
112 define i32 @length3(i8* %X, i8* %Y) nounwind optsize {
113 ; X86-LABEL: length3:
114 ; X86: # %bb.0: # %loadbb
115 ; X86-NEXT: pushl %esi
116 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
117 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
118 ; X86-NEXT: movzwl (%eax), %edx
119 ; X86-NEXT: movzwl (%ecx), %esi
120 ; X86-NEXT: rolw $8, %dx
121 ; X86-NEXT: rolw $8, %si
122 ; X86-NEXT: cmpw %si, %dx
123 ; X86-NEXT: jne .LBB4_1
124 ; X86-NEXT: # %bb.2: # %loadbb1
125 ; X86-NEXT: movzbl 2(%eax), %eax
126 ; X86-NEXT: movzbl 2(%ecx), %ecx
127 ; X86-NEXT: subl %ecx, %eax
128 ; X86-NEXT: jmp .LBB4_3
129 ; X86-NEXT: .LBB4_1: # %res_block
130 ; X86-NEXT: setae %al
131 ; X86-NEXT: movzbl %al, %eax
132 ; X86-NEXT: leal -1(%eax,%eax), %eax
133 ; X86-NEXT: .LBB4_3: # %endblock
134 ; X86-NEXT: popl %esi
137 ; X64-LABEL: length3:
138 ; X64: # %bb.0: # %loadbb
139 ; X64-NEXT: movzwl (%rdi), %eax
140 ; X64-NEXT: movzwl (%rsi), %ecx
141 ; X64-NEXT: rolw $8, %ax
142 ; X64-NEXT: rolw $8, %cx
143 ; X64-NEXT: cmpw %cx, %ax
144 ; X64-NEXT: jne .LBB4_1
145 ; X64-NEXT: # %bb.2: # %loadbb1
146 ; X64-NEXT: movzbl 2(%rdi), %eax
147 ; X64-NEXT: movzbl 2(%rsi), %ecx
148 ; X64-NEXT: subl %ecx, %eax
150 ; X64-NEXT: .LBB4_1: # %res_block
151 ; X64-NEXT: setae %al
152 ; X64-NEXT: movzbl %al, %eax
153 ; X64-NEXT: leal -1(%rax,%rax), %eax
155 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 3) nounwind
159 define i1 @length3_eq(i8* %X, i8* %Y) nounwind optsize {
160 ; X86-LABEL: length3_eq:
162 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
163 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
164 ; X86-NEXT: movzwl (%ecx), %edx
165 ; X86-NEXT: xorw (%eax), %dx
166 ; X86-NEXT: movb 2(%ecx), %cl
167 ; X86-NEXT: xorb 2(%eax), %cl
168 ; X86-NEXT: movzbl %cl, %eax
169 ; X86-NEXT: orw %dx, %ax
170 ; X86-NEXT: setne %al
173 ; X64-LABEL: length3_eq:
175 ; X64-NEXT: movzwl (%rdi), %eax
176 ; X64-NEXT: xorw (%rsi), %ax
177 ; X64-NEXT: movb 2(%rdi), %cl
178 ; X64-NEXT: xorb 2(%rsi), %cl
179 ; X64-NEXT: movzbl %cl, %ecx
180 ; X64-NEXT: orw %ax, %cx
181 ; X64-NEXT: setne %al
183 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 3) nounwind
184 %c = icmp ne i32 %m, 0
188 define i32 @length4(i8* %X, i8* %Y) nounwind optsize {
189 ; X86-LABEL: length4:
191 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
192 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
193 ; X86-NEXT: movl (%ecx), %ecx
194 ; X86-NEXT: movl (%eax), %edx
195 ; X86-NEXT: bswapl %ecx
196 ; X86-NEXT: bswapl %edx
197 ; X86-NEXT: xorl %eax, %eax
198 ; X86-NEXT: cmpl %edx, %ecx
200 ; X86-NEXT: sbbl $0, %eax
203 ; X64-LABEL: length4:
205 ; X64-NEXT: movl (%rdi), %ecx
206 ; X64-NEXT: movl (%rsi), %edx
207 ; X64-NEXT: bswapl %ecx
208 ; X64-NEXT: bswapl %edx
209 ; X64-NEXT: xorl %eax, %eax
210 ; X64-NEXT: cmpl %edx, %ecx
212 ; X64-NEXT: sbbl $0, %eax
214 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 4) nounwind
218 define i1 @length4_eq(i8* %X, i8* %Y) nounwind optsize {
219 ; X86-LABEL: length4_eq:
221 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
222 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
223 ; X86-NEXT: movl (%ecx), %ecx
224 ; X86-NEXT: cmpl (%eax), %ecx
225 ; X86-NEXT: setne %al
228 ; X64-LABEL: length4_eq:
230 ; X64-NEXT: movl (%rdi), %eax
231 ; X64-NEXT: cmpl (%rsi), %eax
232 ; X64-NEXT: setne %al
234 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 4) nounwind
235 %c = icmp ne i32 %m, 0
239 define i1 @length4_eq_const(i8* %X) nounwind optsize {
240 ; X86-LABEL: length4_eq_const:
242 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
243 ; X86-NEXT: cmpl $875770417, (%eax) # imm = 0x34333231
247 ; X64-LABEL: length4_eq_const:
249 ; X64-NEXT: cmpl $875770417, (%rdi) # imm = 0x34333231
252 %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 1), i64 4) nounwind
253 %c = icmp eq i32 %m, 0
257 define i32 @length5(i8* %X, i8* %Y) nounwind optsize {
258 ; X86-LABEL: length5:
259 ; X86: # %bb.0: # %loadbb
260 ; X86-NEXT: pushl %esi
261 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
262 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
263 ; X86-NEXT: movl (%eax), %edx
264 ; X86-NEXT: movl (%ecx), %esi
265 ; X86-NEXT: bswapl %edx
266 ; X86-NEXT: bswapl %esi
267 ; X86-NEXT: cmpl %esi, %edx
268 ; X86-NEXT: jne .LBB9_1
269 ; X86-NEXT: # %bb.2: # %loadbb1
270 ; X86-NEXT: movzbl 4(%eax), %eax
271 ; X86-NEXT: movzbl 4(%ecx), %ecx
272 ; X86-NEXT: subl %ecx, %eax
273 ; X86-NEXT: jmp .LBB9_3
274 ; X86-NEXT: .LBB9_1: # %res_block
275 ; X86-NEXT: setae %al
276 ; X86-NEXT: movzbl %al, %eax
277 ; X86-NEXT: leal -1(%eax,%eax), %eax
278 ; X86-NEXT: .LBB9_3: # %endblock
279 ; X86-NEXT: popl %esi
282 ; X64-LABEL: length5:
283 ; X64: # %bb.0: # %loadbb
284 ; X64-NEXT: movl (%rdi), %eax
285 ; X64-NEXT: movl (%rsi), %ecx
286 ; X64-NEXT: bswapl %eax
287 ; X64-NEXT: bswapl %ecx
288 ; X64-NEXT: cmpl %ecx, %eax
289 ; X64-NEXT: jne .LBB9_1
290 ; X64-NEXT: # %bb.2: # %loadbb1
291 ; X64-NEXT: movzbl 4(%rdi), %eax
292 ; X64-NEXT: movzbl 4(%rsi), %ecx
293 ; X64-NEXT: subl %ecx, %eax
295 ; X64-NEXT: .LBB9_1: # %res_block
296 ; X64-NEXT: setae %al
297 ; X64-NEXT: movzbl %al, %eax
298 ; X64-NEXT: leal -1(%rax,%rax), %eax
300 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 5) nounwind
304 define i1 @length5_eq(i8* %X, i8* %Y) nounwind optsize {
305 ; X86-LABEL: length5_eq:
307 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
308 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
309 ; X86-NEXT: movl (%ecx), %edx
310 ; X86-NEXT: xorl (%eax), %edx
311 ; X86-NEXT: movb 4(%ecx), %cl
312 ; X86-NEXT: xorb 4(%eax), %cl
313 ; X86-NEXT: movzbl %cl, %eax
314 ; X86-NEXT: orl %edx, %eax
315 ; X86-NEXT: setne %al
318 ; X64-LABEL: length5_eq:
320 ; X64-NEXT: movl (%rdi), %eax
321 ; X64-NEXT: xorl (%rsi), %eax
322 ; X64-NEXT: movb 4(%rdi), %cl
323 ; X64-NEXT: xorb 4(%rsi), %cl
324 ; X64-NEXT: movzbl %cl, %ecx
325 ; X64-NEXT: orl %eax, %ecx
326 ; X64-NEXT: setne %al
328 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 5) nounwind
329 %c = icmp ne i32 %m, 0
333 define i32 @length8(i8* %X, i8* %Y) nounwind optsize {
334 ; X86-LABEL: length8:
336 ; X86-NEXT: pushl %esi
337 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
338 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
339 ; X86-NEXT: movl (%esi), %ecx
340 ; X86-NEXT: movl (%eax), %edx
341 ; X86-NEXT: bswapl %ecx
342 ; X86-NEXT: bswapl %edx
343 ; X86-NEXT: cmpl %edx, %ecx
344 ; X86-NEXT: jne .LBB11_2
345 ; X86-NEXT: # %bb.1: # %loadbb1
346 ; X86-NEXT: movl 4(%esi), %ecx
347 ; X86-NEXT: movl 4(%eax), %edx
348 ; X86-NEXT: bswapl %ecx
349 ; X86-NEXT: bswapl %edx
350 ; X86-NEXT: xorl %eax, %eax
351 ; X86-NEXT: cmpl %edx, %ecx
352 ; X86-NEXT: je .LBB11_3
353 ; X86-NEXT: .LBB11_2: # %res_block
354 ; X86-NEXT: xorl %eax, %eax
355 ; X86-NEXT: cmpl %edx, %ecx
356 ; X86-NEXT: setae %al
357 ; X86-NEXT: leal -1(%eax,%eax), %eax
358 ; X86-NEXT: .LBB11_3: # %endblock
359 ; X86-NEXT: popl %esi
362 ; X64-LABEL: length8:
364 ; X64-NEXT: movq (%rdi), %rcx
365 ; X64-NEXT: movq (%rsi), %rdx
366 ; X64-NEXT: bswapq %rcx
367 ; X64-NEXT: bswapq %rdx
368 ; X64-NEXT: xorl %eax, %eax
369 ; X64-NEXT: cmpq %rdx, %rcx
371 ; X64-NEXT: sbbl $0, %eax
373 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 8) nounwind
377 define i1 @length8_eq(i8* %X, i8* %Y) nounwind optsize {
378 ; X86-LABEL: length8_eq:
380 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
381 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
382 ; X86-NEXT: movl (%ecx), %edx
383 ; X86-NEXT: movl 4(%ecx), %ecx
384 ; X86-NEXT: xorl (%eax), %edx
385 ; X86-NEXT: xorl 4(%eax), %ecx
386 ; X86-NEXT: orl %edx, %ecx
390 ; X64-LABEL: length8_eq:
392 ; X64-NEXT: movq (%rdi), %rax
393 ; X64-NEXT: cmpq (%rsi), %rax
396 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 8) nounwind
397 %c = icmp eq i32 %m, 0
401 define i1 @length8_eq_const(i8* %X) nounwind optsize {
402 ; X86-LABEL: length8_eq_const:
404 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
405 ; X86-NEXT: movl $858927408, %ecx # imm = 0x33323130
406 ; X86-NEXT: xorl (%eax), %ecx
407 ; X86-NEXT: movl $926299444, %edx # imm = 0x37363534
408 ; X86-NEXT: xorl 4(%eax), %edx
409 ; X86-NEXT: orl %ecx, %edx
410 ; X86-NEXT: setne %al
413 ; X64-LABEL: length8_eq_const:
415 ; X64-NEXT: movabsq $3978425819141910832, %rax # imm = 0x3736353433323130
416 ; X64-NEXT: cmpq %rax, (%rdi)
417 ; X64-NEXT: setne %al
419 %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 0), i64 8) nounwind
420 %c = icmp ne i32 %m, 0
424 define i1 @length12_eq(i8* %X, i8* %Y) nounwind optsize {
425 ; X86-LABEL: length12_eq:
428 ; X86-NEXT: pushl $12
429 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
430 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
431 ; X86-NEXT: calll memcmp
432 ; X86-NEXT: addl $16, %esp
433 ; X86-NEXT: testl %eax, %eax
434 ; X86-NEXT: setne %al
437 ; X64-LABEL: length12_eq:
439 ; X64-NEXT: movq (%rdi), %rax
440 ; X64-NEXT: xorq (%rsi), %rax
441 ; X64-NEXT: movl 8(%rdi), %ecx
442 ; X64-NEXT: xorl 8(%rsi), %ecx
443 ; X64-NEXT: orq %rax, %rcx
444 ; X64-NEXT: setne %al
446 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 12) nounwind
447 %c = icmp ne i32 %m, 0
451 define i32 @length12(i8* %X, i8* %Y) nounwind optsize {
452 ; X86-LABEL: length12:
455 ; X86-NEXT: pushl $12
456 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
457 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
458 ; X86-NEXT: calll memcmp
459 ; X86-NEXT: addl $16, %esp
462 ; X64-LABEL: length12:
464 ; X64-NEXT: movq (%rdi), %rcx
465 ; X64-NEXT: movq (%rsi), %rdx
466 ; X64-NEXT: bswapq %rcx
467 ; X64-NEXT: bswapq %rdx
468 ; X64-NEXT: cmpq %rdx, %rcx
469 ; X64-NEXT: jne .LBB15_2
470 ; X64-NEXT: # %bb.1: # %loadbb1
471 ; X64-NEXT: movl 8(%rdi), %ecx
472 ; X64-NEXT: movl 8(%rsi), %edx
473 ; X64-NEXT: bswapl %ecx
474 ; X64-NEXT: bswapl %edx
475 ; X64-NEXT: xorl %eax, %eax
476 ; X64-NEXT: cmpq %rdx, %rcx
477 ; X64-NEXT: je .LBB15_3
478 ; X64-NEXT: .LBB15_2: # %res_block
479 ; X64-NEXT: xorl %eax, %eax
480 ; X64-NEXT: cmpq %rdx, %rcx
481 ; X64-NEXT: setae %al
482 ; X64-NEXT: leal -1(%rax,%rax), %eax
483 ; X64-NEXT: .LBB15_3: # %endblock
485 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 12) nounwind
489 ; PR33329 - https://bugs.llvm.org/show_bug.cgi?id=33329
491 define i32 @length16(i8* %X, i8* %Y) nounwind optsize {
492 ; X86-LABEL: length16:
495 ; X86-NEXT: pushl $16
496 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
497 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
498 ; X86-NEXT: calll memcmp
499 ; X86-NEXT: addl $16, %esp
502 ; X64-LABEL: length16:
504 ; X64-NEXT: movq (%rdi), %rcx
505 ; X64-NEXT: movq (%rsi), %rdx
506 ; X64-NEXT: bswapq %rcx
507 ; X64-NEXT: bswapq %rdx
508 ; X64-NEXT: cmpq %rdx, %rcx
509 ; X64-NEXT: jne .LBB16_2
510 ; X64-NEXT: # %bb.1: # %loadbb1
511 ; X64-NEXT: movq 8(%rdi), %rcx
512 ; X64-NEXT: movq 8(%rsi), %rdx
513 ; X64-NEXT: bswapq %rcx
514 ; X64-NEXT: bswapq %rdx
515 ; X64-NEXT: xorl %eax, %eax
516 ; X64-NEXT: cmpq %rdx, %rcx
517 ; X64-NEXT: je .LBB16_3
518 ; X64-NEXT: .LBB16_2: # %res_block
519 ; X64-NEXT: xorl %eax, %eax
520 ; X64-NEXT: cmpq %rdx, %rcx
521 ; X64-NEXT: setae %al
522 ; X64-NEXT: leal -1(%rax,%rax), %eax
523 ; X64-NEXT: .LBB16_3: # %endblock
525 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 16) nounwind
529 define i1 @length16_eq(i8* %x, i8* %y) nounwind optsize {
530 ; X86-NOSSE-LABEL: length16_eq:
531 ; X86-NOSSE: # %bb.0:
532 ; X86-NOSSE-NEXT: pushl $0
533 ; X86-NOSSE-NEXT: pushl $16
534 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
535 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
536 ; X86-NOSSE-NEXT: calll memcmp
537 ; X86-NOSSE-NEXT: addl $16, %esp
538 ; X86-NOSSE-NEXT: testl %eax, %eax
539 ; X86-NOSSE-NEXT: setne %al
540 ; X86-NOSSE-NEXT: retl
542 ; X86-SSE2-LABEL: length16_eq:
544 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
545 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
546 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
547 ; X86-SSE2-NEXT: movdqu (%eax), %xmm1
548 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm1
549 ; X86-SSE2-NEXT: pmovmskb %xmm1, %eax
550 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
551 ; X86-SSE2-NEXT: setne %al
552 ; X86-SSE2-NEXT: retl
554 ; X64-SSE2-LABEL: length16_eq:
556 ; X64-SSE2-NEXT: movdqu (%rdi), %xmm0
557 ; X64-SSE2-NEXT: movdqu (%rsi), %xmm1
558 ; X64-SSE2-NEXT: pcmpeqb %xmm0, %xmm1
559 ; X64-SSE2-NEXT: pmovmskb %xmm1, %eax
560 ; X64-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
561 ; X64-SSE2-NEXT: setne %al
562 ; X64-SSE2-NEXT: retq
564 ; X64-AVX-LABEL: length16_eq:
566 ; X64-AVX-NEXT: vmovdqu (%rdi), %xmm0
567 ; X64-AVX-NEXT: vpxor (%rsi), %xmm0, %xmm0
568 ; X64-AVX-NEXT: vptest %xmm0, %xmm0
569 ; X64-AVX-NEXT: setne %al
571 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 16) nounwind
572 %cmp = icmp ne i32 %call, 0
576 define i1 @length16_eq_const(i8* %X) nounwind optsize {
577 ; X86-NOSSE-LABEL: length16_eq_const:
578 ; X86-NOSSE: # %bb.0:
579 ; X86-NOSSE-NEXT: pushl $0
580 ; X86-NOSSE-NEXT: pushl $16
581 ; X86-NOSSE-NEXT: pushl $.L.str
582 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
583 ; X86-NOSSE-NEXT: calll memcmp
584 ; X86-NOSSE-NEXT: addl $16, %esp
585 ; X86-NOSSE-NEXT: testl %eax, %eax
586 ; X86-NOSSE-NEXT: sete %al
587 ; X86-NOSSE-NEXT: retl
589 ; X86-SSE2-LABEL: length16_eq_const:
591 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
592 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
593 ; X86-SSE2-NEXT: pcmpeqb {{\.LCPI.*}}, %xmm0
594 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
595 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
596 ; X86-SSE2-NEXT: sete %al
597 ; X86-SSE2-NEXT: retl
599 ; X64-SSE2-LABEL: length16_eq_const:
601 ; X64-SSE2-NEXT: movdqu (%rdi), %xmm0
602 ; X64-SSE2-NEXT: pcmpeqb {{.*}}(%rip), %xmm0
603 ; X64-SSE2-NEXT: pmovmskb %xmm0, %eax
604 ; X64-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
605 ; X64-SSE2-NEXT: sete %al
606 ; X64-SSE2-NEXT: retq
608 ; X64-AVX-LABEL: length16_eq_const:
610 ; X64-AVX-NEXT: vmovdqu (%rdi), %xmm0
611 ; X64-AVX-NEXT: vpxor {{.*}}(%rip), %xmm0, %xmm0
612 ; X64-AVX-NEXT: vptest %xmm0, %xmm0
613 ; X64-AVX-NEXT: sete %al
615 %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 0), i64 16) nounwind
616 %c = icmp eq i32 %m, 0
620 ; PR33914 - https://bugs.llvm.org/show_bug.cgi?id=33914
622 define i32 @length24(i8* %X, i8* %Y) nounwind optsize {
623 ; X86-LABEL: length24:
626 ; X86-NEXT: pushl $24
627 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
628 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
629 ; X86-NEXT: calll memcmp
630 ; X86-NEXT: addl $16, %esp
633 ; X64-LABEL: length24:
635 ; X64-NEXT: movl $24, %edx
636 ; X64-NEXT: jmp memcmp # TAILCALL
637 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 24) nounwind
641 define i1 @length24_eq(i8* %x, i8* %y) nounwind optsize {
642 ; X86-NOSSE-LABEL: length24_eq:
643 ; X86-NOSSE: # %bb.0:
644 ; X86-NOSSE-NEXT: pushl $0
645 ; X86-NOSSE-NEXT: pushl $24
646 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
647 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
648 ; X86-NOSSE-NEXT: calll memcmp
649 ; X86-NOSSE-NEXT: addl $16, %esp
650 ; X86-NOSSE-NEXT: testl %eax, %eax
651 ; X86-NOSSE-NEXT: sete %al
652 ; X86-NOSSE-NEXT: retl
654 ; X86-SSE2-LABEL: length24_eq:
656 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
657 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
658 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
659 ; X86-SSE2-NEXT: movdqu 8(%ecx), %xmm1
660 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
661 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
662 ; X86-SSE2-NEXT: movdqu 8(%eax), %xmm0
663 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
664 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
665 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
666 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
667 ; X86-SSE2-NEXT: sete %al
668 ; X86-SSE2-NEXT: retl
670 ; X64-SSE2-LABEL: length24_eq:
672 ; X64-SSE2-NEXT: movdqu (%rdi), %xmm0
673 ; X64-SSE2-NEXT: movdqu (%rsi), %xmm1
674 ; X64-SSE2-NEXT: pcmpeqb %xmm0, %xmm1
675 ; X64-SSE2-NEXT: movq {{.*#+}} xmm0 = mem[0],zero
676 ; X64-SSE2-NEXT: movq {{.*#+}} xmm2 = mem[0],zero
677 ; X64-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
678 ; X64-SSE2-NEXT: pand %xmm1, %xmm2
679 ; X64-SSE2-NEXT: pmovmskb %xmm2, %eax
680 ; X64-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
681 ; X64-SSE2-NEXT: sete %al
682 ; X64-SSE2-NEXT: retq
684 ; X64-AVX-LABEL: length24_eq:
686 ; X64-AVX-NEXT: vmovdqu (%rdi), %xmm0
687 ; X64-AVX-NEXT: vmovq 16(%rdi), %xmm1
688 ; X64-AVX-NEXT: vmovq 16(%rsi), %xmm2
689 ; X64-AVX-NEXT: vpxor %xmm2, %xmm1, %xmm1
690 ; X64-AVX-NEXT: vpxor (%rsi), %xmm0, %xmm0
691 ; X64-AVX-NEXT: vpor %xmm1, %xmm0, %xmm0
692 ; X64-AVX-NEXT: vptest %xmm0, %xmm0
693 ; X64-AVX-NEXT: sete %al
695 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 24) nounwind
696 %cmp = icmp eq i32 %call, 0
700 define i1 @length24_eq_const(i8* %X) nounwind optsize {
701 ; X86-NOSSE-LABEL: length24_eq_const:
702 ; X86-NOSSE: # %bb.0:
703 ; X86-NOSSE-NEXT: pushl $0
704 ; X86-NOSSE-NEXT: pushl $24
705 ; X86-NOSSE-NEXT: pushl $.L.str
706 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
707 ; X86-NOSSE-NEXT: calll memcmp
708 ; X86-NOSSE-NEXT: addl $16, %esp
709 ; X86-NOSSE-NEXT: testl %eax, %eax
710 ; X86-NOSSE-NEXT: setne %al
711 ; X86-NOSSE-NEXT: retl
713 ; X86-SSE2-LABEL: length24_eq_const:
715 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
716 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
717 ; X86-SSE2-NEXT: movdqu 8(%eax), %xmm1
718 ; X86-SSE2-NEXT: pcmpeqb {{\.LCPI.*}}, %xmm1
719 ; X86-SSE2-NEXT: pcmpeqb {{\.LCPI.*}}, %xmm0
720 ; X86-SSE2-NEXT: pand %xmm1, %xmm0
721 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
722 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
723 ; X86-SSE2-NEXT: setne %al
724 ; X86-SSE2-NEXT: retl
726 ; X64-SSE2-LABEL: length24_eq_const:
728 ; X64-SSE2-NEXT: movdqu (%rdi), %xmm0
729 ; X64-SSE2-NEXT: movq {{.*#+}} xmm1 = mem[0],zero
730 ; X64-SSE2-NEXT: pcmpeqb {{.*}}(%rip), %xmm1
731 ; X64-SSE2-NEXT: pcmpeqb {{.*}}(%rip), %xmm0
732 ; X64-SSE2-NEXT: pand %xmm1, %xmm0
733 ; X64-SSE2-NEXT: pmovmskb %xmm0, %eax
734 ; X64-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
735 ; X64-SSE2-NEXT: setne %al
736 ; X64-SSE2-NEXT: retq
738 ; X64-AVX-LABEL: length24_eq_const:
740 ; X64-AVX-NEXT: vmovdqu (%rdi), %xmm0
741 ; X64-AVX-NEXT: vmovq 16(%rdi), %xmm1
742 ; X64-AVX-NEXT: vpxor {{.*}}(%rip), %xmm1, %xmm1
743 ; X64-AVX-NEXT: vpxor {{.*}}(%rip), %xmm0, %xmm0
744 ; X64-AVX-NEXT: vpor %xmm1, %xmm0, %xmm0
745 ; X64-AVX-NEXT: vptest %xmm0, %xmm0
746 ; X64-AVX-NEXT: setne %al
748 %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 0), i64 24) nounwind
749 %c = icmp ne i32 %m, 0
753 define i32 @length32(i8* %X, i8* %Y) nounwind optsize {
754 ; X86-LABEL: length32:
757 ; X86-NEXT: pushl $32
758 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
759 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
760 ; X86-NEXT: calll memcmp
761 ; X86-NEXT: addl $16, %esp
764 ; X64-LABEL: length32:
766 ; X64-NEXT: movl $32, %edx
767 ; X64-NEXT: jmp memcmp # TAILCALL
768 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 32) nounwind
772 ; PR33325 - https://bugs.llvm.org/show_bug.cgi?id=33325
774 define i1 @length32_eq(i8* %x, i8* %y) nounwind optsize {
775 ; X86-NOSSE-LABEL: length32_eq:
776 ; X86-NOSSE: # %bb.0:
777 ; X86-NOSSE-NEXT: pushl $0
778 ; X86-NOSSE-NEXT: pushl $32
779 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
780 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
781 ; X86-NOSSE-NEXT: calll memcmp
782 ; X86-NOSSE-NEXT: addl $16, %esp
783 ; X86-NOSSE-NEXT: testl %eax, %eax
784 ; X86-NOSSE-NEXT: sete %al
785 ; X86-NOSSE-NEXT: retl
787 ; X86-SSE2-LABEL: length32_eq:
789 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
790 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
791 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
792 ; X86-SSE2-NEXT: movdqu 16(%ecx), %xmm1
793 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
794 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
795 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm0
796 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
797 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
798 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
799 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
800 ; X86-SSE2-NEXT: sete %al
801 ; X86-SSE2-NEXT: retl
803 ; X64-SSE2-LABEL: length32_eq:
805 ; X64-SSE2-NEXT: movdqu (%rdi), %xmm0
806 ; X64-SSE2-NEXT: movdqu 16(%rdi), %xmm1
807 ; X64-SSE2-NEXT: movdqu (%rsi), %xmm2
808 ; X64-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
809 ; X64-SSE2-NEXT: movdqu 16(%rsi), %xmm0
810 ; X64-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
811 ; X64-SSE2-NEXT: pand %xmm2, %xmm0
812 ; X64-SSE2-NEXT: pmovmskb %xmm0, %eax
813 ; X64-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
814 ; X64-SSE2-NEXT: sete %al
815 ; X64-SSE2-NEXT: retq
817 ; X64-AVX1-LABEL: length32_eq:
819 ; X64-AVX1-NEXT: vmovdqu (%rdi), %xmm0
820 ; X64-AVX1-NEXT: vmovdqu 16(%rdi), %xmm1
821 ; X64-AVX1-NEXT: vpxor 16(%rsi), %xmm1, %xmm1
822 ; X64-AVX1-NEXT: vpxor (%rsi), %xmm0, %xmm0
823 ; X64-AVX1-NEXT: vpor %xmm1, %xmm0, %xmm0
824 ; X64-AVX1-NEXT: vptest %xmm0, %xmm0
825 ; X64-AVX1-NEXT: sete %al
826 ; X64-AVX1-NEXT: retq
828 ; X64-AVX2-LABEL: length32_eq:
830 ; X64-AVX2-NEXT: vmovdqu (%rdi), %ymm0
831 ; X64-AVX2-NEXT: vpxor (%rsi), %ymm0, %ymm0
832 ; X64-AVX2-NEXT: vptest %ymm0, %ymm0
833 ; X64-AVX2-NEXT: sete %al
834 ; X64-AVX2-NEXT: vzeroupper
835 ; X64-AVX2-NEXT: retq
836 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 32) nounwind
837 %cmp = icmp eq i32 %call, 0
841 define i1 @length32_eq_const(i8* %X) nounwind optsize {
842 ; X86-NOSSE-LABEL: length32_eq_const:
843 ; X86-NOSSE: # %bb.0:
844 ; X86-NOSSE-NEXT: pushl $0
845 ; X86-NOSSE-NEXT: pushl $32
846 ; X86-NOSSE-NEXT: pushl $.L.str
847 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
848 ; X86-NOSSE-NEXT: calll memcmp
849 ; X86-NOSSE-NEXT: addl $16, %esp
850 ; X86-NOSSE-NEXT: testl %eax, %eax
851 ; X86-NOSSE-NEXT: setne %al
852 ; X86-NOSSE-NEXT: retl
854 ; X86-SSE2-LABEL: length32_eq_const:
856 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
857 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
858 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm1
859 ; X86-SSE2-NEXT: pcmpeqb {{\.LCPI.*}}, %xmm1
860 ; X86-SSE2-NEXT: pcmpeqb {{\.LCPI.*}}, %xmm0
861 ; X86-SSE2-NEXT: pand %xmm1, %xmm0
862 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
863 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
864 ; X86-SSE2-NEXT: setne %al
865 ; X86-SSE2-NEXT: retl
867 ; X64-SSE2-LABEL: length32_eq_const:
869 ; X64-SSE2-NEXT: movdqu (%rdi), %xmm0
870 ; X64-SSE2-NEXT: movdqu 16(%rdi), %xmm1
871 ; X64-SSE2-NEXT: pcmpeqb {{.*}}(%rip), %xmm1
872 ; X64-SSE2-NEXT: pcmpeqb {{.*}}(%rip), %xmm0
873 ; X64-SSE2-NEXT: pand %xmm1, %xmm0
874 ; X64-SSE2-NEXT: pmovmskb %xmm0, %eax
875 ; X64-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
876 ; X64-SSE2-NEXT: setne %al
877 ; X64-SSE2-NEXT: retq
879 ; X64-AVX1-LABEL: length32_eq_const:
881 ; X64-AVX1-NEXT: vmovdqu (%rdi), %xmm0
882 ; X64-AVX1-NEXT: vmovdqu 16(%rdi), %xmm1
883 ; X64-AVX1-NEXT: vpxor {{.*}}(%rip), %xmm1, %xmm1
884 ; X64-AVX1-NEXT: vpxor {{.*}}(%rip), %xmm0, %xmm0
885 ; X64-AVX1-NEXT: vpor %xmm1, %xmm0, %xmm0
886 ; X64-AVX1-NEXT: vptest %xmm0, %xmm0
887 ; X64-AVX1-NEXT: setne %al
888 ; X64-AVX1-NEXT: retq
890 ; X64-AVX2-LABEL: length32_eq_const:
892 ; X64-AVX2-NEXT: vmovdqu (%rdi), %ymm0
893 ; X64-AVX2-NEXT: vpxor {{.*}}(%rip), %ymm0, %ymm0
894 ; X64-AVX2-NEXT: vptest %ymm0, %ymm0
895 ; X64-AVX2-NEXT: setne %al
896 ; X64-AVX2-NEXT: vzeroupper
897 ; X64-AVX2-NEXT: retq
898 %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 0), i64 32) nounwind
899 %c = icmp ne i32 %m, 0
903 define i32 @length64(i8* %X, i8* %Y) nounwind optsize {
904 ; X86-LABEL: length64:
907 ; X86-NEXT: pushl $64
908 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
909 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
910 ; X86-NEXT: calll memcmp
911 ; X86-NEXT: addl $16, %esp
914 ; X64-LABEL: length64:
916 ; X64-NEXT: movl $64, %edx
917 ; X64-NEXT: jmp memcmp # TAILCALL
918 %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 64) nounwind
922 define i1 @length64_eq(i8* %x, i8* %y) nounwind optsize {
923 ; X86-LABEL: length64_eq:
926 ; X86-NEXT: pushl $64
927 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
928 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
929 ; X86-NEXT: calll memcmp
930 ; X86-NEXT: addl $16, %esp
931 ; X86-NEXT: testl %eax, %eax
932 ; X86-NEXT: setne %al
935 ; X64-SSE2-LABEL: length64_eq:
937 ; X64-SSE2-NEXT: pushq %rax
938 ; X64-SSE2-NEXT: movl $64, %edx
939 ; X64-SSE2-NEXT: callq memcmp
940 ; X64-SSE2-NEXT: testl %eax, %eax
941 ; X64-SSE2-NEXT: setne %al
942 ; X64-SSE2-NEXT: popq %rcx
943 ; X64-SSE2-NEXT: retq
945 ; X64-AVX1-LABEL: length64_eq:
947 ; X64-AVX1-NEXT: pushq %rax
948 ; X64-AVX1-NEXT: movl $64, %edx
949 ; X64-AVX1-NEXT: callq memcmp
950 ; X64-AVX1-NEXT: testl %eax, %eax
951 ; X64-AVX1-NEXT: setne %al
952 ; X64-AVX1-NEXT: popq %rcx
953 ; X64-AVX1-NEXT: retq
955 ; X64-AVX2-LABEL: length64_eq:
957 ; X64-AVX2-NEXT: vmovdqu (%rdi), %ymm0
958 ; X64-AVX2-NEXT: vmovdqu 32(%rdi), %ymm1
959 ; X64-AVX2-NEXT: vpxor 32(%rsi), %ymm1, %ymm1
960 ; X64-AVX2-NEXT: vpxor (%rsi), %ymm0, %ymm0
961 ; X64-AVX2-NEXT: vpor %ymm1, %ymm0, %ymm0
962 ; X64-AVX2-NEXT: vptest %ymm0, %ymm0
963 ; X64-AVX2-NEXT: setne %al
964 ; X64-AVX2-NEXT: vzeroupper
965 ; X64-AVX2-NEXT: retq
966 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 64) nounwind
967 %cmp = icmp ne i32 %call, 0
971 define i1 @length64_eq_const(i8* %X) nounwind optsize {
972 ; X86-LABEL: length64_eq_const:
975 ; X86-NEXT: pushl $64
976 ; X86-NEXT: pushl $.L.str
977 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
978 ; X86-NEXT: calll memcmp
979 ; X86-NEXT: addl $16, %esp
980 ; X86-NEXT: testl %eax, %eax
984 ; X64-SSE2-LABEL: length64_eq_const:
986 ; X64-SSE2-NEXT: pushq %rax
987 ; X64-SSE2-NEXT: movl $.L.str, %esi
988 ; X64-SSE2-NEXT: movl $64, %edx
989 ; X64-SSE2-NEXT: callq memcmp
990 ; X64-SSE2-NEXT: testl %eax, %eax
991 ; X64-SSE2-NEXT: sete %al
992 ; X64-SSE2-NEXT: popq %rcx
993 ; X64-SSE2-NEXT: retq
995 ; X64-AVX1-LABEL: length64_eq_const:
997 ; X64-AVX1-NEXT: pushq %rax
998 ; X64-AVX1-NEXT: movl $.L.str, %esi
999 ; X64-AVX1-NEXT: movl $64, %edx
1000 ; X64-AVX1-NEXT: callq memcmp
1001 ; X64-AVX1-NEXT: testl %eax, %eax
1002 ; X64-AVX1-NEXT: sete %al
1003 ; X64-AVX1-NEXT: popq %rcx
1004 ; X64-AVX1-NEXT: retq
1006 ; X64-AVX2-LABEL: length64_eq_const:
1007 ; X64-AVX2: # %bb.0:
1008 ; X64-AVX2-NEXT: vmovdqu (%rdi), %ymm0
1009 ; X64-AVX2-NEXT: vmovdqu 32(%rdi), %ymm1
1010 ; X64-AVX2-NEXT: vpxor {{.*}}(%rip), %ymm1, %ymm1
1011 ; X64-AVX2-NEXT: vpxor {{.*}}(%rip), %ymm0, %ymm0
1012 ; X64-AVX2-NEXT: vpor %ymm1, %ymm0, %ymm0
1013 ; X64-AVX2-NEXT: vptest %ymm0, %ymm0
1014 ; X64-AVX2-NEXT: sete %al
1015 ; X64-AVX2-NEXT: vzeroupper
1016 ; X64-AVX2-NEXT: retq
1017 %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 0), i64 64) nounwind
1018 %c = icmp eq i32 %m, 0
1022 define i32 @bcmp_length2(i8* %X, i8* %Y) nounwind optsize {
1023 ; X86-LABEL: bcmp_length2:
1025 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1026 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1027 ; X86-NEXT: movzwl (%ecx), %ecx
1028 ; X86-NEXT: movzwl (%eax), %edx
1029 ; X86-NEXT: rolw $8, %cx
1030 ; X86-NEXT: rolw $8, %dx
1031 ; X86-NEXT: movzwl %cx, %eax
1032 ; X86-NEXT: movzwl %dx, %ecx
1033 ; X86-NEXT: subl %ecx, %eax
1036 ; X64-LABEL: bcmp_length2:
1038 ; X64-NEXT: movzwl (%rdi), %eax
1039 ; X64-NEXT: movzwl (%rsi), %ecx
1040 ; X64-NEXT: rolw $8, %ax
1041 ; X64-NEXT: rolw $8, %cx
1042 ; X64-NEXT: movzwl %ax, %eax
1043 ; X64-NEXT: movzwl %cx, %ecx
1044 ; X64-NEXT: subl %ecx, %eax
1046 %m = tail call i32 @bcmp(i8* %X, i8* %Y, i64 2) nounwind