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-prefixes=X86,X86-NOSSE
3 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+sse | FileCheck %s --check-prefixes=X86,X86-SSE1
4 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefixes=X86,X86-SSE2
5 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefixes=X86,X86-SSE41
7 ; This tests codegen time inlining/optimization of memcmp
10 @.str = private constant [513 x i8] c"01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901\00", align 1
12 declare dso_local i32 @memcmp(ptr, ptr, i32)
14 define i32 @length0(ptr %X, ptr %Y) nounwind {
17 ; X86-NEXT: xorl %eax, %eax
19 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 0) nounwind
23 define i1 @length0_eq(ptr %X, ptr %Y) nounwind {
24 ; X86-LABEL: length0_eq:
26 ; X86-NEXT: movb $1, %al
28 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 0) nounwind
29 %c = icmp eq i32 %m, 0
33 define i1 @length0_lt(ptr %X, ptr %Y) nounwind {
34 ; X86-LABEL: length0_lt:
36 ; X86-NEXT: xorl %eax, %eax
38 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 0) nounwind
39 %c = icmp slt i32 %m, 0
43 define i32 @length2(ptr %X, ptr %Y) nounwind {
46 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
47 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
48 ; X86-NEXT: movzwl (%ecx), %ecx
49 ; X86-NEXT: movzwl (%eax), %edx
50 ; X86-NEXT: rolw $8, %cx
51 ; X86-NEXT: rolw $8, %dx
52 ; X86-NEXT: movzwl %cx, %eax
53 ; X86-NEXT: movzwl %dx, %ecx
54 ; X86-NEXT: subl %ecx, %eax
56 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 2) nounwind
60 define i32 @length2_const(ptr %X, ptr %Y) nounwind {
61 ; X86-LABEL: length2_const:
63 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
64 ; X86-NEXT: movzwl (%eax), %eax
65 ; X86-NEXT: rolw $8, %ax
66 ; X86-NEXT: movzwl %ax, %eax
67 ; X86-NEXT: addl $-12594, %eax # imm = 0xCECE
69 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i32 2) nounwind
73 define i1 @length2_gt_const(ptr %X, ptr %Y) nounwind {
74 ; X86-LABEL: length2_gt_const:
76 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
77 ; X86-NEXT: movzwl (%eax), %eax
78 ; X86-NEXT: rolw $8, %ax
79 ; X86-NEXT: movzwl %ax, %eax
80 ; X86-NEXT: addl $-12594, %eax # imm = 0xCECE
81 ; X86-NEXT: testl %eax, %eax
84 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i32 2) nounwind
85 %c = icmp sgt i32 %m, 0
89 define i1 @length2_eq(ptr %X, ptr %Y) nounwind {
90 ; X86-LABEL: length2_eq:
92 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
93 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
94 ; X86-NEXT: movzwl (%ecx), %ecx
95 ; X86-NEXT: cmpw (%eax), %cx
98 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 2) nounwind
99 %c = icmp eq i32 %m, 0
103 define i1 @length2_lt(ptr %X, ptr %Y) nounwind {
104 ; X86-LABEL: length2_lt:
106 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
107 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
108 ; X86-NEXT: movzwl (%ecx), %ecx
109 ; X86-NEXT: movzwl (%eax), %edx
110 ; X86-NEXT: rolw $8, %cx
111 ; X86-NEXT: rolw $8, %dx
112 ; X86-NEXT: movzwl %cx, %eax
113 ; X86-NEXT: movzwl %dx, %ecx
114 ; X86-NEXT: subl %ecx, %eax
115 ; X86-NEXT: shrl $31, %eax
116 ; X86-NEXT: # kill: def $al killed $al killed $eax
118 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 2) nounwind
119 %c = icmp slt i32 %m, 0
123 define i1 @length2_gt(ptr %X, ptr %Y) nounwind {
124 ; X86-LABEL: length2_gt:
126 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
127 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
128 ; X86-NEXT: movzwl (%ecx), %ecx
129 ; X86-NEXT: movzwl (%eax), %eax
130 ; X86-NEXT: rolw $8, %cx
131 ; X86-NEXT: rolw $8, %ax
132 ; X86-NEXT: movzwl %cx, %ecx
133 ; X86-NEXT: movzwl %ax, %eax
134 ; X86-NEXT: subl %eax, %ecx
135 ; X86-NEXT: testl %ecx, %ecx
138 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 2) nounwind
139 %c = icmp sgt i32 %m, 0
143 define i1 @length2_eq_const(ptr %X) nounwind {
144 ; X86-LABEL: length2_eq_const:
146 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
147 ; X86-NEXT: movzwl (%eax), %eax
148 ; X86-NEXT: cmpl $12849, %eax # imm = 0x3231
149 ; X86-NEXT: setne %al
151 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i32 2) nounwind
152 %c = icmp ne i32 %m, 0
156 define i1 @length2_eq_nobuiltin_attr(ptr %X, ptr %Y) nounwind {
157 ; X86-LABEL: length2_eq_nobuiltin_attr:
160 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
161 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
162 ; X86-NEXT: calll memcmp
163 ; X86-NEXT: addl $12, %esp
164 ; X86-NEXT: testl %eax, %eax
167 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 2) nounwind nobuiltin
168 %c = icmp eq i32 %m, 0
172 define i32 @length3(ptr %X, ptr %Y) nounwind {
173 ; X86-LABEL: length3:
175 ; X86-NEXT: pushl %esi
176 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
177 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
178 ; X86-NEXT: movzwl (%eax), %edx
179 ; X86-NEXT: movzwl (%ecx), %esi
180 ; X86-NEXT: rolw $8, %dx
181 ; X86-NEXT: rolw $8, %si
182 ; X86-NEXT: cmpw %si, %dx
183 ; X86-NEXT: jne .LBB11_3
184 ; X86-NEXT: # %bb.1: # %loadbb1
185 ; X86-NEXT: movzbl 2(%eax), %eax
186 ; X86-NEXT: movzbl 2(%ecx), %ecx
187 ; X86-NEXT: subl %ecx, %eax
188 ; X86-NEXT: popl %esi
190 ; X86-NEXT: .LBB11_3: # %res_block
191 ; X86-NEXT: xorl %eax, %eax
192 ; X86-NEXT: cmpw %si, %dx
193 ; X86-NEXT: sbbl %eax, %eax
194 ; X86-NEXT: orl $1, %eax
195 ; X86-NEXT: popl %esi
197 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 3) nounwind
201 define i1 @length3_eq(ptr %X, ptr %Y) nounwind {
202 ; X86-LABEL: length3_eq:
204 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
205 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
206 ; X86-NEXT: movzwl (%ecx), %edx
207 ; X86-NEXT: xorw (%eax), %dx
208 ; X86-NEXT: movzbl 2(%ecx), %ecx
209 ; X86-NEXT: xorb 2(%eax), %cl
210 ; X86-NEXT: movzbl %cl, %eax
211 ; X86-NEXT: orw %dx, %ax
212 ; X86-NEXT: setne %al
214 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 3) nounwind
215 %c = icmp ne i32 %m, 0
219 define i32 @length4(ptr %X, ptr %Y) nounwind {
220 ; X86-LABEL: length4:
222 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
223 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
224 ; X86-NEXT: movl (%ecx), %ecx
225 ; X86-NEXT: movl (%eax), %edx
226 ; X86-NEXT: bswapl %ecx
227 ; X86-NEXT: bswapl %edx
228 ; X86-NEXT: xorl %eax, %eax
229 ; X86-NEXT: cmpl %edx, %ecx
231 ; X86-NEXT: sbbl $0, %eax
233 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 4) nounwind
237 define i1 @length4_eq(ptr %X, ptr %Y) nounwind {
238 ; X86-LABEL: length4_eq:
240 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
241 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
242 ; X86-NEXT: movl (%ecx), %ecx
243 ; X86-NEXT: cmpl (%eax), %ecx
244 ; X86-NEXT: setne %al
246 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 4) nounwind
247 %c = icmp ne i32 %m, 0
251 define i1 @length4_lt(ptr %X, ptr %Y) nounwind {
252 ; X86-LABEL: length4_lt:
254 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
255 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
256 ; X86-NEXT: movl (%ecx), %ecx
257 ; X86-NEXT: movl (%eax), %edx
258 ; X86-NEXT: bswapl %ecx
259 ; X86-NEXT: bswapl %edx
260 ; X86-NEXT: xorl %eax, %eax
261 ; X86-NEXT: cmpl %edx, %ecx
263 ; X86-NEXT: sbbl $0, %eax
264 ; X86-NEXT: shrl $31, %eax
265 ; X86-NEXT: # kill: def $al killed $al killed $eax
267 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 4) nounwind
268 %c = icmp slt i32 %m, 0
272 define i1 @length4_gt(ptr %X, ptr %Y) nounwind {
273 ; X86-LABEL: length4_gt:
275 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
276 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
277 ; X86-NEXT: movl (%ecx), %ecx
278 ; X86-NEXT: movl (%eax), %eax
279 ; X86-NEXT: bswapl %ecx
280 ; X86-NEXT: bswapl %eax
281 ; X86-NEXT: xorl %edx, %edx
282 ; X86-NEXT: cmpl %eax, %ecx
284 ; X86-NEXT: sbbl $0, %edx
285 ; X86-NEXT: testl %edx, %edx
288 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 4) nounwind
289 %c = icmp sgt i32 %m, 0
293 define i1 @length4_eq_const(ptr %X) nounwind {
294 ; X86-LABEL: length4_eq_const:
296 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
297 ; X86-NEXT: cmpl $875770417, (%eax) # imm = 0x34333231
300 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i32 4) nounwind
301 %c = icmp eq i32 %m, 0
305 define i32 @length5(ptr %X, ptr %Y) nounwind {
306 ; X86-LABEL: length5:
308 ; X86-NEXT: pushl %esi
309 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
310 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
311 ; X86-NEXT: movl (%eax), %edx
312 ; X86-NEXT: movl (%ecx), %esi
313 ; X86-NEXT: bswapl %edx
314 ; X86-NEXT: bswapl %esi
315 ; X86-NEXT: cmpl %esi, %edx
316 ; X86-NEXT: jne .LBB18_3
317 ; X86-NEXT: # %bb.1: # %loadbb1
318 ; X86-NEXT: movzbl 4(%eax), %eax
319 ; X86-NEXT: movzbl 4(%ecx), %ecx
320 ; X86-NEXT: subl %ecx, %eax
321 ; X86-NEXT: popl %esi
323 ; X86-NEXT: .LBB18_3: # %res_block
324 ; X86-NEXT: xorl %eax, %eax
325 ; X86-NEXT: cmpl %esi, %edx
326 ; X86-NEXT: sbbl %eax, %eax
327 ; X86-NEXT: orl $1, %eax
328 ; X86-NEXT: popl %esi
330 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 5) nounwind
334 define i1 @length5_eq(ptr %X, ptr %Y) nounwind {
335 ; X86-LABEL: length5_eq:
337 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
338 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
339 ; X86-NEXT: movl (%ecx), %edx
340 ; X86-NEXT: xorl (%eax), %edx
341 ; X86-NEXT: movzbl 4(%ecx), %ecx
342 ; X86-NEXT: xorb 4(%eax), %cl
343 ; X86-NEXT: movzbl %cl, %eax
344 ; X86-NEXT: orl %edx, %eax
345 ; X86-NEXT: setne %al
347 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 5) nounwind
348 %c = icmp ne i32 %m, 0
352 define i1 @length5_lt(ptr %X, ptr %Y) nounwind {
353 ; X86-LABEL: length5_lt:
355 ; X86-NEXT: pushl %esi
356 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
357 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
358 ; X86-NEXT: movl (%eax), %edx
359 ; X86-NEXT: movl (%ecx), %esi
360 ; X86-NEXT: bswapl %edx
361 ; X86-NEXT: bswapl %esi
362 ; X86-NEXT: cmpl %esi, %edx
363 ; X86-NEXT: jne .LBB20_3
364 ; X86-NEXT: # %bb.1: # %loadbb1
365 ; X86-NEXT: movzbl 4(%eax), %eax
366 ; X86-NEXT: movzbl 4(%ecx), %ecx
367 ; X86-NEXT: subl %ecx, %eax
368 ; X86-NEXT: jmp .LBB20_2
369 ; X86-NEXT: .LBB20_3: # %res_block
370 ; X86-NEXT: xorl %eax, %eax
371 ; X86-NEXT: cmpl %esi, %edx
372 ; X86-NEXT: sbbl %eax, %eax
373 ; X86-NEXT: orl $1, %eax
374 ; X86-NEXT: .LBB20_2: # %endblock
375 ; X86-NEXT: shrl $31, %eax
376 ; X86-NEXT: # kill: def $al killed $al killed $eax
377 ; X86-NEXT: popl %esi
379 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 5) nounwind
380 %c = icmp slt i32 %m, 0
384 define i32 @length7(ptr %X, ptr %Y) nounwind {
385 ; X86-LABEL: length7:
387 ; X86-NEXT: pushl %esi
388 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
389 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
390 ; X86-NEXT: movl (%esi), %ecx
391 ; X86-NEXT: movl (%eax), %edx
392 ; X86-NEXT: bswapl %ecx
393 ; X86-NEXT: bswapl %edx
394 ; X86-NEXT: cmpl %edx, %ecx
395 ; X86-NEXT: jne .LBB21_2
396 ; X86-NEXT: # %bb.1: # %loadbb1
397 ; X86-NEXT: movl 3(%esi), %ecx
398 ; X86-NEXT: movl 3(%eax), %edx
399 ; X86-NEXT: bswapl %ecx
400 ; X86-NEXT: bswapl %edx
401 ; X86-NEXT: xorl %eax, %eax
402 ; X86-NEXT: cmpl %edx, %ecx
403 ; X86-NEXT: je .LBB21_3
404 ; X86-NEXT: .LBB21_2: # %res_block
405 ; X86-NEXT: xorl %eax, %eax
406 ; X86-NEXT: cmpl %edx, %ecx
407 ; X86-NEXT: sbbl %eax, %eax
408 ; X86-NEXT: orl $1, %eax
409 ; X86-NEXT: .LBB21_3: # %endblock
410 ; X86-NEXT: popl %esi
412 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 7) nounwind
416 define i1 @length7_lt(ptr %X, ptr %Y) nounwind {
417 ; X86-LABEL: length7_lt:
419 ; X86-NEXT: pushl %esi
420 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
421 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
422 ; X86-NEXT: movl (%esi), %ecx
423 ; X86-NEXT: movl (%eax), %edx
424 ; X86-NEXT: bswapl %ecx
425 ; X86-NEXT: bswapl %edx
426 ; X86-NEXT: cmpl %edx, %ecx
427 ; X86-NEXT: jne .LBB22_2
428 ; X86-NEXT: # %bb.1: # %loadbb1
429 ; X86-NEXT: movl 3(%esi), %ecx
430 ; X86-NEXT: movl 3(%eax), %edx
431 ; X86-NEXT: bswapl %ecx
432 ; X86-NEXT: bswapl %edx
433 ; X86-NEXT: xorl %eax, %eax
434 ; X86-NEXT: cmpl %edx, %ecx
435 ; X86-NEXT: je .LBB22_3
436 ; X86-NEXT: .LBB22_2: # %res_block
437 ; X86-NEXT: xorl %eax, %eax
438 ; X86-NEXT: cmpl %edx, %ecx
439 ; X86-NEXT: sbbl %eax, %eax
440 ; X86-NEXT: orl $1, %eax
441 ; X86-NEXT: .LBB22_3: # %endblock
442 ; X86-NEXT: shrl $31, %eax
443 ; X86-NEXT: # kill: def $al killed $al killed $eax
444 ; X86-NEXT: popl %esi
446 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 7) nounwind
447 %c = icmp slt i32 %m, 0
451 define i1 @length7_eq(ptr %X, ptr %Y) nounwind {
452 ; X86-LABEL: length7_eq:
454 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
455 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
456 ; X86-NEXT: movl (%ecx), %edx
457 ; X86-NEXT: movl 3(%ecx), %ecx
458 ; X86-NEXT: xorl (%eax), %edx
459 ; X86-NEXT: xorl 3(%eax), %ecx
460 ; X86-NEXT: orl %edx, %ecx
461 ; X86-NEXT: setne %al
463 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 7) nounwind
464 %c = icmp ne i32 %m, 0
468 define i32 @length8(ptr %X, ptr %Y) nounwind {
469 ; X86-LABEL: length8:
471 ; X86-NEXT: pushl %esi
472 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
473 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
474 ; X86-NEXT: movl (%esi), %ecx
475 ; X86-NEXT: movl (%eax), %edx
476 ; X86-NEXT: bswapl %ecx
477 ; X86-NEXT: bswapl %edx
478 ; X86-NEXT: cmpl %edx, %ecx
479 ; X86-NEXT: jne .LBB24_2
480 ; X86-NEXT: # %bb.1: # %loadbb1
481 ; X86-NEXT: movl 4(%esi), %ecx
482 ; X86-NEXT: movl 4(%eax), %edx
483 ; X86-NEXT: bswapl %ecx
484 ; X86-NEXT: bswapl %edx
485 ; X86-NEXT: xorl %eax, %eax
486 ; X86-NEXT: cmpl %edx, %ecx
487 ; X86-NEXT: je .LBB24_3
488 ; X86-NEXT: .LBB24_2: # %res_block
489 ; X86-NEXT: xorl %eax, %eax
490 ; X86-NEXT: cmpl %edx, %ecx
491 ; X86-NEXT: sbbl %eax, %eax
492 ; X86-NEXT: orl $1, %eax
493 ; X86-NEXT: .LBB24_3: # %endblock
494 ; X86-NEXT: popl %esi
496 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 8) nounwind
500 define i1 @length8_eq(ptr %X, ptr %Y) nounwind {
501 ; X86-LABEL: length8_eq:
503 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
504 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
505 ; X86-NEXT: movl (%ecx), %edx
506 ; X86-NEXT: movl 4(%ecx), %ecx
507 ; X86-NEXT: xorl (%eax), %edx
508 ; X86-NEXT: xorl 4(%eax), %ecx
509 ; X86-NEXT: orl %edx, %ecx
512 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 8) nounwind
513 %c = icmp eq i32 %m, 0
517 define i1 @length8_eq_const(ptr %X) nounwind {
518 ; X86-LABEL: length8_eq_const:
520 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
521 ; X86-NEXT: movl $858927408, %ecx # imm = 0x33323130
522 ; X86-NEXT: xorl (%eax), %ecx
523 ; X86-NEXT: movl $926299444, %edx # imm = 0x37363534
524 ; X86-NEXT: xorl 4(%eax), %edx
525 ; X86-NEXT: orl %ecx, %edx
526 ; X86-NEXT: setne %al
528 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 8) nounwind
529 %c = icmp ne i32 %m, 0
533 define i1 @length9_eq(ptr %X, ptr %Y) nounwind {
534 ; X86-LABEL: length9_eq:
537 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
538 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
539 ; X86-NEXT: calll memcmp
540 ; X86-NEXT: addl $12, %esp
541 ; X86-NEXT: testl %eax, %eax
544 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 9) nounwind
545 %c = icmp eq i32 %m, 0
549 define i1 @length10_eq(ptr %X, ptr %Y) nounwind {
550 ; X86-LABEL: length10_eq:
552 ; X86-NEXT: pushl $10
553 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
554 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
555 ; X86-NEXT: calll memcmp
556 ; X86-NEXT: addl $12, %esp
557 ; X86-NEXT: testl %eax, %eax
560 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 10) nounwind
561 %c = icmp eq i32 %m, 0
565 define i1 @length11_eq(ptr %X, ptr %Y) nounwind {
566 ; X86-LABEL: length11_eq:
568 ; X86-NEXT: pushl $11
569 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
570 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
571 ; X86-NEXT: calll memcmp
572 ; X86-NEXT: addl $12, %esp
573 ; X86-NEXT: testl %eax, %eax
576 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 11) nounwind
577 %c = icmp eq i32 %m, 0
581 define i1 @length12_eq(ptr %X, ptr %Y) nounwind {
582 ; X86-LABEL: length12_eq:
584 ; X86-NEXT: pushl $12
585 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
586 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
587 ; X86-NEXT: calll memcmp
588 ; X86-NEXT: addl $12, %esp
589 ; X86-NEXT: testl %eax, %eax
590 ; X86-NEXT: setne %al
592 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 12) nounwind
593 %c = icmp ne i32 %m, 0
597 define i32 @length12(ptr %X, ptr %Y) nounwind {
598 ; X86-LABEL: length12:
600 ; X86-NEXT: pushl $12
601 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
602 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
603 ; X86-NEXT: calll memcmp
604 ; X86-NEXT: addl $12, %esp
606 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 12) nounwind
610 define i1 @length13_eq(ptr %X, ptr %Y) nounwind {
611 ; X86-LABEL: length13_eq:
613 ; X86-NEXT: pushl $13
614 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
615 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
616 ; X86-NEXT: calll memcmp
617 ; X86-NEXT: addl $12, %esp
618 ; X86-NEXT: testl %eax, %eax
621 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 13) nounwind
622 %c = icmp eq i32 %m, 0
626 define i1 @length14_eq(ptr %X, ptr %Y) nounwind {
627 ; X86-LABEL: length14_eq:
629 ; X86-NEXT: pushl $14
630 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
631 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
632 ; X86-NEXT: calll memcmp
633 ; X86-NEXT: addl $12, %esp
634 ; X86-NEXT: testl %eax, %eax
637 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 14) nounwind
638 %c = icmp eq i32 %m, 0
642 define i32 @length15(ptr %X, ptr %Y) nounwind {
643 ; X86-LABEL: length15:
645 ; X86-NEXT: pushl $15
646 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
647 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
648 ; X86-NEXT: calll memcmp
649 ; X86-NEXT: addl $12, %esp
651 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 15) nounwind
655 define i1 @length15_lt(ptr %X, ptr %Y) nounwind {
656 ; X86-LABEL: length15_lt:
658 ; X86-NEXT: pushl $15
659 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
660 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
661 ; X86-NEXT: calll memcmp
662 ; X86-NEXT: addl $12, %esp
663 ; X86-NEXT: shrl $31, %eax
664 ; X86-NEXT: # kill: def $al killed $al killed $eax
666 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 15) nounwind
667 %c = icmp slt i32 %m, 0
671 define i32 @length15_const(ptr %X, ptr %Y) nounwind {
672 ; X86-LABEL: length15_const:
674 ; X86-NEXT: pushl $15
675 ; X86-NEXT: pushl $.L.str+1
676 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
677 ; X86-NEXT: calll memcmp
678 ; X86-NEXT: addl $12, %esp
680 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i32 15) nounwind
684 define i1 @length15_eq(ptr %X, ptr %Y) nounwind {
685 ; X86-LABEL: length15_eq:
687 ; X86-NEXT: pushl $15
688 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
689 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
690 ; X86-NEXT: calll memcmp
691 ; X86-NEXT: addl $12, %esp
692 ; X86-NEXT: testl %eax, %eax
695 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 15) nounwind
696 %c = icmp eq i32 %m, 0
700 define i1 @length15_gt_const(ptr %X, ptr %Y) nounwind {
701 ; X86-LABEL: length15_gt_const:
703 ; X86-NEXT: pushl $15
704 ; X86-NEXT: pushl $.L.str+1
705 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
706 ; X86-NEXT: calll memcmp
707 ; X86-NEXT: addl $12, %esp
708 ; X86-NEXT: testl %eax, %eax
711 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i32 15) nounwind
712 %c = icmp sgt i32 %m, 0
716 ; PR33329 - https://bugs.llvm.org/show_bug.cgi?id=33329
718 define i32 @length16(ptr %X, ptr %Y) nounwind {
719 ; X86-LABEL: length16:
721 ; X86-NEXT: pushl $16
722 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
723 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
724 ; X86-NEXT: calll memcmp
725 ; X86-NEXT: addl $12, %esp
727 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 16) nounwind
731 define i1 @length16_eq(ptr %x, ptr %y) nounwind {
732 ; X86-NOSSE-LABEL: length16_eq:
733 ; X86-NOSSE: # %bb.0:
734 ; X86-NOSSE-NEXT: pushl $16
735 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
736 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
737 ; X86-NOSSE-NEXT: calll memcmp
738 ; X86-NOSSE-NEXT: addl $12, %esp
739 ; X86-NOSSE-NEXT: testl %eax, %eax
740 ; X86-NOSSE-NEXT: setne %al
741 ; X86-NOSSE-NEXT: retl
743 ; X86-SSE1-LABEL: length16_eq:
745 ; X86-SSE1-NEXT: pushl $16
746 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
747 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
748 ; X86-SSE1-NEXT: calll memcmp
749 ; X86-SSE1-NEXT: addl $12, %esp
750 ; X86-SSE1-NEXT: testl %eax, %eax
751 ; X86-SSE1-NEXT: setne %al
752 ; X86-SSE1-NEXT: retl
754 ; X86-SSE2-LABEL: length16_eq:
756 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
757 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
758 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
759 ; X86-SSE2-NEXT: movdqu (%eax), %xmm1
760 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm1
761 ; X86-SSE2-NEXT: pmovmskb %xmm1, %eax
762 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
763 ; X86-SSE2-NEXT: setne %al
764 ; X86-SSE2-NEXT: retl
766 ; X86-SSE41-LABEL: length16_eq:
767 ; X86-SSE41: # %bb.0:
768 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
769 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
770 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
771 ; X86-SSE41-NEXT: movdqu (%eax), %xmm1
772 ; X86-SSE41-NEXT: pxor %xmm0, %xmm1
773 ; X86-SSE41-NEXT: ptest %xmm1, %xmm1
774 ; X86-SSE41-NEXT: setne %al
775 ; X86-SSE41-NEXT: retl
776 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 16) nounwind
777 %cmp = icmp ne i32 %call, 0
781 define i1 @length16_lt(ptr %x, ptr %y) nounwind {
782 ; X86-LABEL: length16_lt:
784 ; X86-NEXT: pushl $16
785 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
786 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
787 ; X86-NEXT: calll memcmp
788 ; X86-NEXT: addl $12, %esp
789 ; X86-NEXT: shrl $31, %eax
790 ; X86-NEXT: # kill: def $al killed $al killed $eax
792 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 16) nounwind
793 %cmp = icmp slt i32 %call, 0
797 define i1 @length16_gt(ptr %x, ptr %y) nounwind {
798 ; X86-LABEL: length16_gt:
800 ; X86-NEXT: pushl $16
801 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
802 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
803 ; X86-NEXT: calll memcmp
804 ; X86-NEXT: addl $12, %esp
805 ; X86-NEXT: testl %eax, %eax
808 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 16) nounwind
809 %cmp = icmp sgt i32 %call, 0
813 define i1 @length16_eq_const(ptr %X) nounwind {
814 ; X86-NOSSE-LABEL: length16_eq_const:
815 ; X86-NOSSE: # %bb.0:
816 ; X86-NOSSE-NEXT: pushl $16
817 ; X86-NOSSE-NEXT: pushl $.L.str
818 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
819 ; X86-NOSSE-NEXT: calll memcmp
820 ; X86-NOSSE-NEXT: addl $12, %esp
821 ; X86-NOSSE-NEXT: testl %eax, %eax
822 ; X86-NOSSE-NEXT: sete %al
823 ; X86-NOSSE-NEXT: retl
825 ; X86-SSE1-LABEL: length16_eq_const:
827 ; X86-SSE1-NEXT: pushl $16
828 ; X86-SSE1-NEXT: pushl $.L.str
829 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
830 ; X86-SSE1-NEXT: calll memcmp
831 ; X86-SSE1-NEXT: addl $12, %esp
832 ; X86-SSE1-NEXT: testl %eax, %eax
833 ; X86-SSE1-NEXT: sete %al
834 ; X86-SSE1-NEXT: retl
836 ; X86-SSE2-LABEL: length16_eq_const:
838 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
839 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
840 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
841 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
842 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
843 ; X86-SSE2-NEXT: sete %al
844 ; X86-SSE2-NEXT: retl
846 ; X86-SSE41-LABEL: length16_eq_const:
847 ; X86-SSE41: # %bb.0:
848 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
849 ; X86-SSE41-NEXT: movdqu (%eax), %xmm0
850 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
851 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
852 ; X86-SSE41-NEXT: sete %al
853 ; X86-SSE41-NEXT: retl
854 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 16) nounwind
855 %c = icmp eq i32 %m, 0
859 ; PR33914 - https://bugs.llvm.org/show_bug.cgi?id=33914
861 define i32 @length24(ptr %X, ptr %Y) nounwind {
862 ; X86-LABEL: length24:
864 ; X86-NEXT: pushl $24
865 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
866 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
867 ; X86-NEXT: calll memcmp
868 ; X86-NEXT: addl $12, %esp
870 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 24) nounwind
874 define i1 @length24_eq(ptr %x, ptr %y) nounwind {
875 ; X86-NOSSE-LABEL: length24_eq:
876 ; X86-NOSSE: # %bb.0:
877 ; X86-NOSSE-NEXT: pushl $24
878 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
879 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
880 ; X86-NOSSE-NEXT: calll memcmp
881 ; X86-NOSSE-NEXT: addl $12, %esp
882 ; X86-NOSSE-NEXT: testl %eax, %eax
883 ; X86-NOSSE-NEXT: sete %al
884 ; X86-NOSSE-NEXT: retl
886 ; X86-SSE1-LABEL: length24_eq:
888 ; X86-SSE1-NEXT: pushl $24
889 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
890 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
891 ; X86-SSE1-NEXT: calll memcmp
892 ; X86-SSE1-NEXT: addl $12, %esp
893 ; X86-SSE1-NEXT: testl %eax, %eax
894 ; X86-SSE1-NEXT: sete %al
895 ; X86-SSE1-NEXT: retl
897 ; X86-SSE2-LABEL: length24_eq:
899 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
900 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
901 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
902 ; X86-SSE2-NEXT: movdqu 8(%ecx), %xmm1
903 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
904 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
905 ; X86-SSE2-NEXT: movdqu 8(%eax), %xmm0
906 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
907 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
908 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
909 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
910 ; X86-SSE2-NEXT: sete %al
911 ; X86-SSE2-NEXT: retl
913 ; X86-SSE41-LABEL: length24_eq:
914 ; X86-SSE41: # %bb.0:
915 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
916 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
917 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
918 ; X86-SSE41-NEXT: movdqu 8(%ecx), %xmm1
919 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
920 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
921 ; X86-SSE41-NEXT: movdqu 8(%eax), %xmm0
922 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
923 ; X86-SSE41-NEXT: por %xmm2, %xmm0
924 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
925 ; X86-SSE41-NEXT: sete %al
926 ; X86-SSE41-NEXT: retl
927 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 24) nounwind
928 %cmp = icmp eq i32 %call, 0
932 define i1 @length24_lt(ptr %x, ptr %y) nounwind {
933 ; X86-LABEL: length24_lt:
935 ; X86-NEXT: pushl $24
936 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
937 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
938 ; X86-NEXT: calll memcmp
939 ; X86-NEXT: addl $12, %esp
940 ; X86-NEXT: shrl $31, %eax
941 ; X86-NEXT: # kill: def $al killed $al killed $eax
943 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 24) nounwind
944 %cmp = icmp slt i32 %call, 0
948 define i1 @length24_gt(ptr %x, ptr %y) nounwind {
949 ; X86-LABEL: length24_gt:
951 ; X86-NEXT: pushl $24
952 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
953 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
954 ; X86-NEXT: calll memcmp
955 ; X86-NEXT: addl $12, %esp
956 ; X86-NEXT: testl %eax, %eax
959 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 24) nounwind
960 %cmp = icmp sgt i32 %call, 0
964 define i1 @length24_eq_const(ptr %X) nounwind {
965 ; X86-NOSSE-LABEL: length24_eq_const:
966 ; X86-NOSSE: # %bb.0:
967 ; X86-NOSSE-NEXT: pushl $24
968 ; X86-NOSSE-NEXT: pushl $.L.str
969 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
970 ; X86-NOSSE-NEXT: calll memcmp
971 ; X86-NOSSE-NEXT: addl $12, %esp
972 ; X86-NOSSE-NEXT: testl %eax, %eax
973 ; X86-NOSSE-NEXT: setne %al
974 ; X86-NOSSE-NEXT: retl
976 ; X86-SSE1-LABEL: length24_eq_const:
978 ; X86-SSE1-NEXT: pushl $24
979 ; X86-SSE1-NEXT: pushl $.L.str
980 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
981 ; X86-SSE1-NEXT: calll memcmp
982 ; X86-SSE1-NEXT: addl $12, %esp
983 ; X86-SSE1-NEXT: testl %eax, %eax
984 ; X86-SSE1-NEXT: setne %al
985 ; X86-SSE1-NEXT: retl
987 ; X86-SSE2-LABEL: length24_eq_const:
989 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
990 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
991 ; X86-SSE2-NEXT: movdqu 8(%eax), %xmm1
992 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
993 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
994 ; X86-SSE2-NEXT: pand %xmm1, %xmm0
995 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
996 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
997 ; X86-SSE2-NEXT: setne %al
998 ; X86-SSE2-NEXT: retl
1000 ; X86-SSE41-LABEL: length24_eq_const:
1001 ; X86-SSE41: # %bb.0:
1002 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1003 ; X86-SSE41-NEXT: movdqu (%eax), %xmm0
1004 ; X86-SSE41-NEXT: movdqu 8(%eax), %xmm1
1005 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1006 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1007 ; X86-SSE41-NEXT: por %xmm1, %xmm0
1008 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1009 ; X86-SSE41-NEXT: setne %al
1010 ; X86-SSE41-NEXT: retl
1011 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 24) nounwind
1012 %c = icmp ne i32 %m, 0
1016 define i32 @length31(ptr %X, ptr %Y) nounwind {
1017 ; X86-LABEL: length31:
1019 ; X86-NEXT: pushl $31
1020 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1021 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1022 ; X86-NEXT: calll memcmp
1023 ; X86-NEXT: addl $12, %esp
1025 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 31) nounwind
1029 define i1 @length31_eq(ptr %x, ptr %y) nounwind {
1030 ; X86-NOSSE-LABEL: length31_eq:
1031 ; X86-NOSSE: # %bb.0:
1032 ; X86-NOSSE-NEXT: pushl $31
1033 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1034 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1035 ; X86-NOSSE-NEXT: calll memcmp
1036 ; X86-NOSSE-NEXT: addl $12, %esp
1037 ; X86-NOSSE-NEXT: testl %eax, %eax
1038 ; X86-NOSSE-NEXT: sete %al
1039 ; X86-NOSSE-NEXT: retl
1041 ; X86-SSE1-LABEL: length31_eq:
1042 ; X86-SSE1: # %bb.0:
1043 ; X86-SSE1-NEXT: pushl $31
1044 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1045 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1046 ; X86-SSE1-NEXT: calll memcmp
1047 ; X86-SSE1-NEXT: addl $12, %esp
1048 ; X86-SSE1-NEXT: testl %eax, %eax
1049 ; X86-SSE1-NEXT: sete %al
1050 ; X86-SSE1-NEXT: retl
1052 ; X86-SSE2-LABEL: length31_eq:
1053 ; X86-SSE2: # %bb.0:
1054 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1055 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
1056 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
1057 ; X86-SSE2-NEXT: movdqu 15(%ecx), %xmm1
1058 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
1059 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
1060 ; X86-SSE2-NEXT: movdqu 15(%eax), %xmm0
1061 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
1062 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1063 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1064 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1065 ; X86-SSE2-NEXT: sete %al
1066 ; X86-SSE2-NEXT: retl
1068 ; X86-SSE41-LABEL: length31_eq:
1069 ; X86-SSE41: # %bb.0:
1070 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1071 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
1072 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
1073 ; X86-SSE41-NEXT: movdqu 15(%ecx), %xmm1
1074 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
1075 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
1076 ; X86-SSE41-NEXT: movdqu 15(%eax), %xmm0
1077 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
1078 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1079 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1080 ; X86-SSE41-NEXT: sete %al
1081 ; X86-SSE41-NEXT: retl
1082 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 31) nounwind
1083 %cmp = icmp eq i32 %call, 0
1087 define i1 @length31_lt(ptr %x, ptr %y) nounwind {
1088 ; X86-LABEL: length31_lt:
1090 ; X86-NEXT: pushl $31
1091 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1092 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1093 ; X86-NEXT: calll memcmp
1094 ; X86-NEXT: addl $12, %esp
1095 ; X86-NEXT: shrl $31, %eax
1096 ; X86-NEXT: # kill: def $al killed $al killed $eax
1098 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 31) nounwind
1099 %cmp = icmp slt i32 %call, 0
1103 define i1 @length31_gt(ptr %x, ptr %y) nounwind {
1104 ; X86-LABEL: length31_gt:
1106 ; X86-NEXT: pushl $31
1107 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1108 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1109 ; X86-NEXT: calll memcmp
1110 ; X86-NEXT: addl $12, %esp
1111 ; X86-NEXT: testl %eax, %eax
1112 ; X86-NEXT: setg %al
1114 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 31) nounwind
1115 %cmp = icmp sgt i32 %call, 0
1119 define i1 @length31_eq_prefer128(ptr %x, ptr %y) nounwind "prefer-vector-width"="128" {
1120 ; X86-NOSSE-LABEL: length31_eq_prefer128:
1121 ; X86-NOSSE: # %bb.0:
1122 ; X86-NOSSE-NEXT: pushl $31
1123 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1124 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1125 ; X86-NOSSE-NEXT: calll memcmp
1126 ; X86-NOSSE-NEXT: addl $12, %esp
1127 ; X86-NOSSE-NEXT: testl %eax, %eax
1128 ; X86-NOSSE-NEXT: sete %al
1129 ; X86-NOSSE-NEXT: retl
1131 ; X86-SSE1-LABEL: length31_eq_prefer128:
1132 ; X86-SSE1: # %bb.0:
1133 ; X86-SSE1-NEXT: pushl $31
1134 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1135 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1136 ; X86-SSE1-NEXT: calll memcmp
1137 ; X86-SSE1-NEXT: addl $12, %esp
1138 ; X86-SSE1-NEXT: testl %eax, %eax
1139 ; X86-SSE1-NEXT: sete %al
1140 ; X86-SSE1-NEXT: retl
1142 ; X86-SSE2-LABEL: length31_eq_prefer128:
1143 ; X86-SSE2: # %bb.0:
1144 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1145 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
1146 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
1147 ; X86-SSE2-NEXT: movdqu 15(%ecx), %xmm1
1148 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
1149 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
1150 ; X86-SSE2-NEXT: movdqu 15(%eax), %xmm0
1151 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
1152 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1153 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1154 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1155 ; X86-SSE2-NEXT: sete %al
1156 ; X86-SSE2-NEXT: retl
1158 ; X86-SSE41-LABEL: length31_eq_prefer128:
1159 ; X86-SSE41: # %bb.0:
1160 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1161 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
1162 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
1163 ; X86-SSE41-NEXT: movdqu 15(%ecx), %xmm1
1164 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
1165 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
1166 ; X86-SSE41-NEXT: movdqu 15(%eax), %xmm0
1167 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
1168 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1169 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1170 ; X86-SSE41-NEXT: sete %al
1171 ; X86-SSE41-NEXT: retl
1172 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 31) nounwind
1173 %cmp = icmp eq i32 %call, 0
1177 define i1 @length31_eq_const(ptr %X) nounwind {
1178 ; X86-NOSSE-LABEL: length31_eq_const:
1179 ; X86-NOSSE: # %bb.0:
1180 ; X86-NOSSE-NEXT: pushl $31
1181 ; X86-NOSSE-NEXT: pushl $.L.str
1182 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1183 ; X86-NOSSE-NEXT: calll memcmp
1184 ; X86-NOSSE-NEXT: addl $12, %esp
1185 ; X86-NOSSE-NEXT: testl %eax, %eax
1186 ; X86-NOSSE-NEXT: setne %al
1187 ; X86-NOSSE-NEXT: retl
1189 ; X86-SSE1-LABEL: length31_eq_const:
1190 ; X86-SSE1: # %bb.0:
1191 ; X86-SSE1-NEXT: pushl $31
1192 ; X86-SSE1-NEXT: pushl $.L.str
1193 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1194 ; X86-SSE1-NEXT: calll memcmp
1195 ; X86-SSE1-NEXT: addl $12, %esp
1196 ; X86-SSE1-NEXT: testl %eax, %eax
1197 ; X86-SSE1-NEXT: setne %al
1198 ; X86-SSE1-NEXT: retl
1200 ; X86-SSE2-LABEL: length31_eq_const:
1201 ; X86-SSE2: # %bb.0:
1202 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1203 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
1204 ; X86-SSE2-NEXT: movdqu 15(%eax), %xmm1
1205 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1206 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1207 ; X86-SSE2-NEXT: pand %xmm1, %xmm0
1208 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1209 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1210 ; X86-SSE2-NEXT: setne %al
1211 ; X86-SSE2-NEXT: retl
1213 ; X86-SSE41-LABEL: length31_eq_const:
1214 ; X86-SSE41: # %bb.0:
1215 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1216 ; X86-SSE41-NEXT: movdqu (%eax), %xmm0
1217 ; X86-SSE41-NEXT: movdqu 15(%eax), %xmm1
1218 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1219 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1220 ; X86-SSE41-NEXT: por %xmm1, %xmm0
1221 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1222 ; X86-SSE41-NEXT: setne %al
1223 ; X86-SSE41-NEXT: retl
1224 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 31) nounwind
1225 %c = icmp ne i32 %m, 0
1229 define i32 @length32(ptr %X, ptr %Y) nounwind {
1230 ; X86-LABEL: length32:
1232 ; X86-NEXT: pushl $32
1233 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1234 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1235 ; X86-NEXT: calll memcmp
1236 ; X86-NEXT: addl $12, %esp
1238 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 32) nounwind
1242 ; PR33325 - https://bugs.llvm.org/show_bug.cgi?id=33325
1244 define i1 @length32_eq(ptr %x, ptr %y) nounwind {
1245 ; X86-NOSSE-LABEL: length32_eq:
1246 ; X86-NOSSE: # %bb.0:
1247 ; X86-NOSSE-NEXT: pushl $32
1248 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1249 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1250 ; X86-NOSSE-NEXT: calll memcmp
1251 ; X86-NOSSE-NEXT: addl $12, %esp
1252 ; X86-NOSSE-NEXT: testl %eax, %eax
1253 ; X86-NOSSE-NEXT: sete %al
1254 ; X86-NOSSE-NEXT: retl
1256 ; X86-SSE1-LABEL: length32_eq:
1257 ; X86-SSE1: # %bb.0:
1258 ; X86-SSE1-NEXT: pushl $32
1259 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1260 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1261 ; X86-SSE1-NEXT: calll memcmp
1262 ; X86-SSE1-NEXT: addl $12, %esp
1263 ; X86-SSE1-NEXT: testl %eax, %eax
1264 ; X86-SSE1-NEXT: sete %al
1265 ; X86-SSE1-NEXT: retl
1267 ; X86-SSE2-LABEL: length32_eq:
1268 ; X86-SSE2: # %bb.0:
1269 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1270 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
1271 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
1272 ; X86-SSE2-NEXT: movdqu 16(%ecx), %xmm1
1273 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
1274 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
1275 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm0
1276 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
1277 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1278 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1279 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1280 ; X86-SSE2-NEXT: sete %al
1281 ; X86-SSE2-NEXT: retl
1283 ; X86-SSE41-LABEL: length32_eq:
1284 ; X86-SSE41: # %bb.0:
1285 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1286 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
1287 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
1288 ; X86-SSE41-NEXT: movdqu 16(%ecx), %xmm1
1289 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
1290 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
1291 ; X86-SSE41-NEXT: movdqu 16(%eax), %xmm0
1292 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
1293 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1294 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1295 ; X86-SSE41-NEXT: sete %al
1296 ; X86-SSE41-NEXT: retl
1297 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 32) nounwind
1298 %cmp = icmp eq i32 %call, 0
1302 define i1 @length32_lt(ptr %x, ptr %y) nounwind {
1303 ; X86-LABEL: length32_lt:
1305 ; X86-NEXT: pushl $32
1306 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1307 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1308 ; X86-NEXT: calll memcmp
1309 ; X86-NEXT: addl $12, %esp
1310 ; X86-NEXT: shrl $31, %eax
1311 ; X86-NEXT: # kill: def $al killed $al killed $eax
1313 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 32) nounwind
1314 %cmp = icmp slt i32 %call, 0
1318 define i1 @length32_gt(ptr %x, ptr %y) nounwind {
1319 ; X86-LABEL: length32_gt:
1321 ; X86-NEXT: pushl $32
1322 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1323 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1324 ; X86-NEXT: calll memcmp
1325 ; X86-NEXT: addl $12, %esp
1326 ; X86-NEXT: testl %eax, %eax
1327 ; X86-NEXT: setg %al
1329 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 32) nounwind
1330 %cmp = icmp sgt i32 %call, 0
1334 define i1 @length32_eq_prefer128(ptr %x, ptr %y) nounwind "prefer-vector-width"="128" {
1335 ; X86-NOSSE-LABEL: length32_eq_prefer128:
1336 ; X86-NOSSE: # %bb.0:
1337 ; X86-NOSSE-NEXT: pushl $32
1338 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1339 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1340 ; X86-NOSSE-NEXT: calll memcmp
1341 ; X86-NOSSE-NEXT: addl $12, %esp
1342 ; X86-NOSSE-NEXT: testl %eax, %eax
1343 ; X86-NOSSE-NEXT: sete %al
1344 ; X86-NOSSE-NEXT: retl
1346 ; X86-SSE1-LABEL: length32_eq_prefer128:
1347 ; X86-SSE1: # %bb.0:
1348 ; X86-SSE1-NEXT: pushl $32
1349 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1350 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1351 ; X86-SSE1-NEXT: calll memcmp
1352 ; X86-SSE1-NEXT: addl $12, %esp
1353 ; X86-SSE1-NEXT: testl %eax, %eax
1354 ; X86-SSE1-NEXT: sete %al
1355 ; X86-SSE1-NEXT: retl
1357 ; X86-SSE2-LABEL: length32_eq_prefer128:
1358 ; X86-SSE2: # %bb.0:
1359 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1360 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
1361 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
1362 ; X86-SSE2-NEXT: movdqu 16(%ecx), %xmm1
1363 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
1364 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
1365 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm0
1366 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
1367 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1368 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1369 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1370 ; X86-SSE2-NEXT: sete %al
1371 ; X86-SSE2-NEXT: retl
1373 ; X86-SSE41-LABEL: length32_eq_prefer128:
1374 ; X86-SSE41: # %bb.0:
1375 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1376 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
1377 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
1378 ; X86-SSE41-NEXT: movdqu 16(%ecx), %xmm1
1379 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
1380 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
1381 ; X86-SSE41-NEXT: movdqu 16(%eax), %xmm0
1382 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
1383 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1384 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1385 ; X86-SSE41-NEXT: sete %al
1386 ; X86-SSE41-NEXT: retl
1387 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 32) nounwind
1388 %cmp = icmp eq i32 %call, 0
1392 define i1 @length32_eq_const(ptr %X) nounwind {
1393 ; X86-NOSSE-LABEL: length32_eq_const:
1394 ; X86-NOSSE: # %bb.0:
1395 ; X86-NOSSE-NEXT: pushl $32
1396 ; X86-NOSSE-NEXT: pushl $.L.str
1397 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1398 ; X86-NOSSE-NEXT: calll memcmp
1399 ; X86-NOSSE-NEXT: addl $12, %esp
1400 ; X86-NOSSE-NEXT: testl %eax, %eax
1401 ; X86-NOSSE-NEXT: setne %al
1402 ; X86-NOSSE-NEXT: retl
1404 ; X86-SSE1-LABEL: length32_eq_const:
1405 ; X86-SSE1: # %bb.0:
1406 ; X86-SSE1-NEXT: pushl $32
1407 ; X86-SSE1-NEXT: pushl $.L.str
1408 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1409 ; X86-SSE1-NEXT: calll memcmp
1410 ; X86-SSE1-NEXT: addl $12, %esp
1411 ; X86-SSE1-NEXT: testl %eax, %eax
1412 ; X86-SSE1-NEXT: setne %al
1413 ; X86-SSE1-NEXT: retl
1415 ; X86-SSE2-LABEL: length32_eq_const:
1416 ; X86-SSE2: # %bb.0:
1417 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1418 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
1419 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm1
1420 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1421 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1422 ; X86-SSE2-NEXT: pand %xmm1, %xmm0
1423 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1424 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1425 ; X86-SSE2-NEXT: setne %al
1426 ; X86-SSE2-NEXT: retl
1428 ; X86-SSE41-LABEL: length32_eq_const:
1429 ; X86-SSE41: # %bb.0:
1430 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1431 ; X86-SSE41-NEXT: movdqu (%eax), %xmm0
1432 ; X86-SSE41-NEXT: movdqu 16(%eax), %xmm1
1433 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1434 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1435 ; X86-SSE41-NEXT: por %xmm1, %xmm0
1436 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1437 ; X86-SSE41-NEXT: setne %al
1438 ; X86-SSE41-NEXT: retl
1439 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 32) nounwind
1440 %c = icmp ne i32 %m, 0
1444 define i32 @length48(ptr %X, ptr %Y) nounwind {
1445 ; X86-LABEL: length48:
1447 ; X86-NEXT: pushl $48
1448 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1449 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1450 ; X86-NEXT: calll memcmp
1451 ; X86-NEXT: addl $12, %esp
1453 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 48) nounwind
1457 define i1 @length48_eq(ptr %x, ptr %y) nounwind {
1458 ; X86-LABEL: length48_eq:
1460 ; X86-NEXT: pushl $48
1461 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1462 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1463 ; X86-NEXT: calll memcmp
1464 ; X86-NEXT: addl $12, %esp
1465 ; X86-NEXT: testl %eax, %eax
1466 ; X86-NEXT: sete %al
1468 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 48) nounwind
1469 %cmp = icmp eq i32 %call, 0
1473 define i1 @length48_lt(ptr %x, ptr %y) nounwind {
1474 ; X86-LABEL: length48_lt:
1476 ; X86-NEXT: pushl $48
1477 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1478 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1479 ; X86-NEXT: calll memcmp
1480 ; X86-NEXT: addl $12, %esp
1481 ; X86-NEXT: shrl $31, %eax
1482 ; X86-NEXT: # kill: def $al killed $al killed $eax
1484 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 48) nounwind
1485 %cmp = icmp slt i32 %call, 0
1489 define i1 @length48_gt(ptr %x, ptr %y) nounwind {
1490 ; X86-LABEL: length48_gt:
1492 ; X86-NEXT: pushl $48
1493 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1494 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1495 ; X86-NEXT: calll memcmp
1496 ; X86-NEXT: addl $12, %esp
1497 ; X86-NEXT: testl %eax, %eax
1498 ; X86-NEXT: setg %al
1500 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 48) nounwind
1501 %cmp = icmp sgt i32 %call, 0
1505 define i1 @length48_eq_prefer128(ptr %x, ptr %y) nounwind "prefer-vector-width"="128" {
1506 ; X86-LABEL: length48_eq_prefer128:
1508 ; X86-NEXT: pushl $48
1509 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1510 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1511 ; X86-NEXT: calll memcmp
1512 ; X86-NEXT: addl $12, %esp
1513 ; X86-NEXT: testl %eax, %eax
1514 ; X86-NEXT: sete %al
1516 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 48) nounwind
1517 %cmp = icmp eq i32 %call, 0
1521 define i1 @length48_eq_const(ptr %X) nounwind {
1522 ; X86-LABEL: length48_eq_const:
1524 ; X86-NEXT: pushl $48
1525 ; X86-NEXT: pushl $.L.str
1526 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1527 ; X86-NEXT: calll memcmp
1528 ; X86-NEXT: addl $12, %esp
1529 ; X86-NEXT: testl %eax, %eax
1530 ; X86-NEXT: setne %al
1532 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 48) nounwind
1533 %c = icmp ne i32 %m, 0
1537 define i32 @length63(ptr %X, ptr %Y) nounwind {
1538 ; X86-LABEL: length63:
1540 ; X86-NEXT: pushl $63
1541 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1542 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1543 ; X86-NEXT: calll memcmp
1544 ; X86-NEXT: addl $12, %esp
1546 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 63) nounwind
1550 define i1 @length63_eq(ptr %x, ptr %y) nounwind {
1551 ; X86-LABEL: length63_eq:
1553 ; X86-NEXT: pushl $63
1554 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1555 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1556 ; X86-NEXT: calll memcmp
1557 ; X86-NEXT: addl $12, %esp
1558 ; X86-NEXT: testl %eax, %eax
1559 ; X86-NEXT: setne %al
1561 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 63) nounwind
1562 %cmp = icmp ne i32 %call, 0
1566 define i1 @length63_lt(ptr %x, ptr %y) nounwind {
1567 ; X86-LABEL: length63_lt:
1569 ; X86-NEXT: pushl $63
1570 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1571 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1572 ; X86-NEXT: calll memcmp
1573 ; X86-NEXT: addl $12, %esp
1574 ; X86-NEXT: shrl $31, %eax
1575 ; X86-NEXT: # kill: def $al killed $al killed $eax
1577 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 63) nounwind
1578 %cmp = icmp slt i32 %call, 0
1582 define i1 @length63_gt(ptr %x, ptr %y) nounwind {
1583 ; X86-LABEL: length63_gt:
1585 ; X86-NEXT: pushl $63
1586 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1587 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1588 ; X86-NEXT: calll memcmp
1589 ; X86-NEXT: addl $12, %esp
1590 ; X86-NEXT: testl %eax, %eax
1591 ; X86-NEXT: setg %al
1593 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 63) nounwind
1594 %cmp = icmp sgt i32 %call, 0
1598 define i1 @length63_eq_const(ptr %X) nounwind {
1599 ; X86-LABEL: length63_eq_const:
1601 ; X86-NEXT: pushl $63
1602 ; X86-NEXT: pushl $.L.str
1603 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1604 ; X86-NEXT: calll memcmp
1605 ; X86-NEXT: addl $12, %esp
1606 ; X86-NEXT: testl %eax, %eax
1607 ; X86-NEXT: sete %al
1609 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 63) nounwind
1610 %c = icmp eq i32 %m, 0
1614 define i32 @length64(ptr %X, ptr %Y) nounwind {
1615 ; X86-LABEL: length64:
1617 ; X86-NEXT: pushl $64
1618 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1619 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1620 ; X86-NEXT: calll memcmp
1621 ; X86-NEXT: addl $12, %esp
1623 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 64) nounwind
1627 define i1 @length64_eq(ptr %x, ptr %y) nounwind {
1628 ; X86-LABEL: length64_eq:
1630 ; X86-NEXT: pushl $64
1631 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1632 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1633 ; X86-NEXT: calll memcmp
1634 ; X86-NEXT: addl $12, %esp
1635 ; X86-NEXT: testl %eax, %eax
1636 ; X86-NEXT: setne %al
1638 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 64) nounwind
1639 %cmp = icmp ne i32 %call, 0
1643 define i1 @length64_lt(ptr %x, ptr %y) nounwind {
1644 ; X86-LABEL: length64_lt:
1646 ; X86-NEXT: pushl $64
1647 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1648 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1649 ; X86-NEXT: calll memcmp
1650 ; X86-NEXT: addl $12, %esp
1651 ; X86-NEXT: shrl $31, %eax
1652 ; X86-NEXT: # kill: def $al killed $al killed $eax
1654 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 64) nounwind
1655 %cmp = icmp slt i32 %call, 0
1659 define i1 @length64_gt(ptr %x, ptr %y) nounwind {
1660 ; X86-LABEL: length64_gt:
1662 ; X86-NEXT: pushl $64
1663 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1664 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1665 ; X86-NEXT: calll memcmp
1666 ; X86-NEXT: addl $12, %esp
1667 ; X86-NEXT: testl %eax, %eax
1668 ; X86-NEXT: setg %al
1670 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 64) nounwind
1671 %cmp = icmp sgt i32 %call, 0
1675 define i1 @length64_eq_const(ptr %X) nounwind {
1676 ; X86-LABEL: length64_eq_const:
1678 ; X86-NEXT: pushl $64
1679 ; X86-NEXT: pushl $.L.str
1680 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1681 ; X86-NEXT: calll memcmp
1682 ; X86-NEXT: addl $12, %esp
1683 ; X86-NEXT: testl %eax, %eax
1684 ; X86-NEXT: sete %al
1686 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 64) nounwind
1687 %c = icmp eq i32 %m, 0
1691 define i32 @length96(ptr %X, ptr %Y) nounwind {
1692 ; X86-LABEL: length96:
1694 ; X86-NEXT: pushl $96
1695 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1696 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1697 ; X86-NEXT: calll memcmp
1698 ; X86-NEXT: addl $12, %esp
1700 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 96) nounwind
1704 define i1 @length96_eq(ptr %x, ptr %y) nounwind {
1705 ; X86-LABEL: length96_eq:
1707 ; X86-NEXT: pushl $96
1708 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1709 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1710 ; X86-NEXT: calll memcmp
1711 ; X86-NEXT: addl $12, %esp
1712 ; X86-NEXT: testl %eax, %eax
1713 ; X86-NEXT: setne %al
1715 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 96) nounwind
1716 %cmp = icmp ne i32 %call, 0
1720 define i1 @length96_lt(ptr %x, ptr %y) nounwind {
1721 ; X86-LABEL: length96_lt:
1723 ; X86-NEXT: pushl $96
1724 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1725 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1726 ; X86-NEXT: calll memcmp
1727 ; X86-NEXT: addl $12, %esp
1728 ; X86-NEXT: shrl $31, %eax
1729 ; X86-NEXT: # kill: def $al killed $al killed $eax
1731 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 96) nounwind
1732 %cmp = icmp slt i32 %call, 0
1736 define i1 @length96_gt(ptr %x, ptr %y) nounwind {
1737 ; X86-LABEL: length96_gt:
1739 ; X86-NEXT: pushl $96
1740 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1741 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1742 ; X86-NEXT: calll memcmp
1743 ; X86-NEXT: addl $12, %esp
1744 ; X86-NEXT: testl %eax, %eax
1745 ; X86-NEXT: setg %al
1747 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 96) nounwind
1748 %cmp = icmp sgt i32 %call, 0
1752 define i1 @length96_eq_const(ptr %X) nounwind {
1753 ; X86-LABEL: length96_eq_const:
1755 ; X86-NEXT: pushl $96
1756 ; X86-NEXT: pushl $.L.str
1757 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1758 ; X86-NEXT: calll memcmp
1759 ; X86-NEXT: addl $12, %esp
1760 ; X86-NEXT: testl %eax, %eax
1761 ; X86-NEXT: sete %al
1763 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 96) nounwind
1764 %c = icmp eq i32 %m, 0
1768 define i32 @length127(ptr %X, ptr %Y) nounwind {
1769 ; X86-LABEL: length127:
1771 ; X86-NEXT: pushl $127
1772 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1773 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1774 ; X86-NEXT: calll memcmp
1775 ; X86-NEXT: addl $12, %esp
1777 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 127) nounwind
1781 define i1 @length127_eq(ptr %x, ptr %y) nounwind {
1782 ; X86-LABEL: length127_eq:
1784 ; X86-NEXT: pushl $127
1785 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1786 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1787 ; X86-NEXT: calll memcmp
1788 ; X86-NEXT: addl $12, %esp
1789 ; X86-NEXT: testl %eax, %eax
1790 ; X86-NEXT: setne %al
1792 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 127) nounwind
1793 %cmp = icmp ne i32 %call, 0
1797 define i1 @length127_lt(ptr %x, ptr %y) nounwind {
1798 ; X86-LABEL: length127_lt:
1800 ; X86-NEXT: pushl $127
1801 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1802 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1803 ; X86-NEXT: calll memcmp
1804 ; X86-NEXT: addl $12, %esp
1805 ; X86-NEXT: shrl $31, %eax
1806 ; X86-NEXT: # kill: def $al killed $al killed $eax
1808 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 127) nounwind
1809 %cmp = icmp slt i32 %call, 0
1813 define i1 @length127_gt(ptr %x, ptr %y) nounwind {
1814 ; X86-LABEL: length127_gt:
1816 ; X86-NEXT: pushl $127
1817 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1818 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1819 ; X86-NEXT: calll memcmp
1820 ; X86-NEXT: addl $12, %esp
1821 ; X86-NEXT: testl %eax, %eax
1822 ; X86-NEXT: setg %al
1824 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 127) nounwind
1825 %cmp = icmp sgt i32 %call, 0
1829 define i1 @length127_eq_const(ptr %X) nounwind {
1830 ; X86-LABEL: length127_eq_const:
1832 ; X86-NEXT: pushl $127
1833 ; X86-NEXT: pushl $.L.str
1834 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1835 ; X86-NEXT: calll memcmp
1836 ; X86-NEXT: addl $12, %esp
1837 ; X86-NEXT: testl %eax, %eax
1838 ; X86-NEXT: sete %al
1840 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 127) nounwind
1841 %c = icmp eq i32 %m, 0
1845 define i32 @length128(ptr %X, ptr %Y) nounwind {
1846 ; X86-LABEL: length128:
1848 ; X86-NEXT: pushl $128
1849 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1850 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1851 ; X86-NEXT: calll memcmp
1852 ; X86-NEXT: addl $12, %esp
1854 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 128) nounwind
1858 define i1 @length128_eq(ptr %x, ptr %y) nounwind {
1859 ; X86-LABEL: length128_eq:
1861 ; X86-NEXT: pushl $128
1862 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1863 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1864 ; X86-NEXT: calll memcmp
1865 ; X86-NEXT: addl $12, %esp
1866 ; X86-NEXT: testl %eax, %eax
1867 ; X86-NEXT: setne %al
1869 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 128) nounwind
1870 %cmp = icmp ne i32 %call, 0
1874 define i1 @length128_lt(ptr %x, ptr %y) nounwind {
1875 ; X86-LABEL: length128_lt:
1877 ; X86-NEXT: pushl $128
1878 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1879 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1880 ; X86-NEXT: calll memcmp
1881 ; X86-NEXT: addl $12, %esp
1882 ; X86-NEXT: shrl $31, %eax
1883 ; X86-NEXT: # kill: def $al killed $al killed $eax
1885 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 128) nounwind
1886 %cmp = icmp slt i32 %call, 0
1890 define i1 @length128_gt(ptr %x, ptr %y) nounwind {
1891 ; X86-LABEL: length128_gt:
1893 ; X86-NEXT: pushl $128
1894 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1895 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1896 ; X86-NEXT: calll memcmp
1897 ; X86-NEXT: addl $12, %esp
1898 ; X86-NEXT: testl %eax, %eax
1899 ; X86-NEXT: setg %al
1901 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 128) nounwind
1902 %cmp = icmp sgt i32 %call, 0
1906 define i1 @length128_eq_const(ptr %X) nounwind {
1907 ; X86-LABEL: length128_eq_const:
1909 ; X86-NEXT: pushl $128
1910 ; X86-NEXT: pushl $.L.str
1911 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1912 ; X86-NEXT: calll memcmp
1913 ; X86-NEXT: addl $12, %esp
1914 ; X86-NEXT: testl %eax, %eax
1915 ; X86-NEXT: sete %al
1917 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 128) nounwind
1918 %c = icmp eq i32 %m, 0
1922 define i32 @length192(ptr %X, ptr %Y) nounwind {
1923 ; X86-LABEL: length192:
1925 ; X86-NEXT: pushl $192
1926 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1927 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1928 ; X86-NEXT: calll memcmp
1929 ; X86-NEXT: addl $12, %esp
1931 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 192) nounwind
1935 define i1 @length192_eq(ptr %x, ptr %y) nounwind {
1936 ; X86-LABEL: length192_eq:
1938 ; X86-NEXT: pushl $192
1939 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1940 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1941 ; X86-NEXT: calll memcmp
1942 ; X86-NEXT: addl $12, %esp
1943 ; X86-NEXT: testl %eax, %eax
1944 ; X86-NEXT: setne %al
1946 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 192) nounwind
1947 %cmp = icmp ne i32 %call, 0
1951 define i1 @length192_lt(ptr %x, ptr %y) nounwind {
1952 ; X86-LABEL: length192_lt:
1954 ; X86-NEXT: pushl $192
1955 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1956 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1957 ; X86-NEXT: calll memcmp
1958 ; X86-NEXT: addl $12, %esp
1959 ; X86-NEXT: shrl $31, %eax
1960 ; X86-NEXT: # kill: def $al killed $al killed $eax
1962 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 192) nounwind
1963 %cmp = icmp slt i32 %call, 0
1967 define i1 @length192_gt(ptr %x, ptr %y) nounwind {
1968 ; X86-LABEL: length192_gt:
1970 ; X86-NEXT: pushl $192
1971 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1972 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1973 ; X86-NEXT: calll memcmp
1974 ; X86-NEXT: addl $12, %esp
1975 ; X86-NEXT: testl %eax, %eax
1976 ; X86-NEXT: setg %al
1978 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 192) nounwind
1979 %cmp = icmp sgt i32 %call, 0
1983 define i1 @length192_eq_const(ptr %X) nounwind {
1984 ; X86-LABEL: length192_eq_const:
1986 ; X86-NEXT: pushl $192
1987 ; X86-NEXT: pushl $.L.str
1988 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1989 ; X86-NEXT: calll memcmp
1990 ; X86-NEXT: addl $12, %esp
1991 ; X86-NEXT: testl %eax, %eax
1992 ; X86-NEXT: sete %al
1994 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 192) nounwind
1995 %c = icmp eq i32 %m, 0
1999 define i32 @length255(ptr %X, ptr %Y) nounwind {
2000 ; X86-LABEL: length255:
2002 ; X86-NEXT: pushl $255
2003 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2004 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2005 ; X86-NEXT: calll memcmp
2006 ; X86-NEXT: addl $12, %esp
2008 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 255) nounwind
2012 define i1 @length255_eq(ptr %x, ptr %y) nounwind {
2013 ; X86-LABEL: length255_eq:
2015 ; X86-NEXT: pushl $255
2016 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2017 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2018 ; X86-NEXT: calll memcmp
2019 ; X86-NEXT: addl $12, %esp
2020 ; X86-NEXT: testl %eax, %eax
2021 ; X86-NEXT: setne %al
2023 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 255) nounwind
2024 %cmp = icmp ne i32 %call, 0
2028 define i1 @length255_lt(ptr %x, ptr %y) nounwind {
2029 ; X86-LABEL: length255_lt:
2031 ; X86-NEXT: pushl $255
2032 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2033 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2034 ; X86-NEXT: calll memcmp
2035 ; X86-NEXT: addl $12, %esp
2036 ; X86-NEXT: shrl $31, %eax
2037 ; X86-NEXT: # kill: def $al killed $al killed $eax
2039 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 255) nounwind
2040 %cmp = icmp slt i32 %call, 0
2044 define i1 @length255_gt(ptr %x, ptr %y) nounwind {
2045 ; X86-LABEL: length255_gt:
2047 ; X86-NEXT: pushl $255
2048 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2049 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2050 ; X86-NEXT: calll memcmp
2051 ; X86-NEXT: addl $12, %esp
2052 ; X86-NEXT: testl %eax, %eax
2053 ; X86-NEXT: setg %al
2055 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 255) nounwind
2056 %cmp = icmp sgt i32 %call, 0
2060 define i1 @length255_eq_const(ptr %X) nounwind {
2061 ; X86-LABEL: length255_eq_const:
2063 ; X86-NEXT: pushl $255
2064 ; X86-NEXT: pushl $.L.str
2065 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2066 ; X86-NEXT: calll memcmp
2067 ; X86-NEXT: addl $12, %esp
2068 ; X86-NEXT: testl %eax, %eax
2069 ; X86-NEXT: sete %al
2071 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 255) nounwind
2072 %c = icmp eq i32 %m, 0
2076 define i32 @length256(ptr %X, ptr %Y) nounwind {
2077 ; X86-LABEL: length256:
2079 ; X86-NEXT: pushl $256 # imm = 0x100
2080 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2081 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2082 ; X86-NEXT: calll memcmp
2083 ; X86-NEXT: addl $12, %esp
2085 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 256) nounwind
2089 define i1 @length256_eq(ptr %x, ptr %y) nounwind {
2090 ; X86-LABEL: length256_eq:
2092 ; X86-NEXT: pushl $256 # imm = 0x100
2093 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2094 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2095 ; X86-NEXT: calll memcmp
2096 ; X86-NEXT: addl $12, %esp
2097 ; X86-NEXT: testl %eax, %eax
2098 ; X86-NEXT: setne %al
2100 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 256) nounwind
2101 %cmp = icmp ne i32 %call, 0
2105 define i1 @length256_lt(ptr %x, ptr %y) nounwind {
2106 ; X86-LABEL: length256_lt:
2108 ; X86-NEXT: pushl $256 # imm = 0x100
2109 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2110 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2111 ; X86-NEXT: calll memcmp
2112 ; X86-NEXT: addl $12, %esp
2113 ; X86-NEXT: shrl $31, %eax
2114 ; X86-NEXT: # kill: def $al killed $al killed $eax
2116 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 256) nounwind
2117 %cmp = icmp slt i32 %call, 0
2121 define i1 @length256_gt(ptr %x, ptr %y) nounwind {
2122 ; X86-LABEL: length256_gt:
2124 ; X86-NEXT: pushl $256 # imm = 0x100
2125 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2126 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2127 ; X86-NEXT: calll memcmp
2128 ; X86-NEXT: addl $12, %esp
2129 ; X86-NEXT: testl %eax, %eax
2130 ; X86-NEXT: setg %al
2132 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 256) nounwind
2133 %cmp = icmp sgt i32 %call, 0
2137 define i1 @length256_eq_const(ptr %X) nounwind {
2138 ; X86-LABEL: length256_eq_const:
2140 ; X86-NEXT: pushl $256 # imm = 0x100
2141 ; X86-NEXT: pushl $.L.str
2142 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2143 ; X86-NEXT: calll memcmp
2144 ; X86-NEXT: addl $12, %esp
2145 ; X86-NEXT: testl %eax, %eax
2146 ; X86-NEXT: sete %al
2148 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 256) nounwind
2149 %c = icmp eq i32 %m, 0
2153 define i32 @length384(ptr %X, ptr %Y) nounwind {
2154 ; X86-LABEL: length384:
2156 ; X86-NEXT: pushl $384 # imm = 0x180
2157 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2158 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2159 ; X86-NEXT: calll memcmp
2160 ; X86-NEXT: addl $12, %esp
2162 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 384) nounwind
2166 define i1 @length384_eq(ptr %x, ptr %y) nounwind {
2167 ; X86-LABEL: length384_eq:
2169 ; X86-NEXT: pushl $384 # imm = 0x180
2170 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2171 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2172 ; X86-NEXT: calll memcmp
2173 ; X86-NEXT: addl $12, %esp
2174 ; X86-NEXT: testl %eax, %eax
2175 ; X86-NEXT: setne %al
2177 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 384) nounwind
2178 %cmp = icmp ne i32 %call, 0
2182 define i1 @length384_lt(ptr %x, ptr %y) nounwind {
2183 ; X86-LABEL: length384_lt:
2185 ; X86-NEXT: pushl $384 # imm = 0x180
2186 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2187 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2188 ; X86-NEXT: calll memcmp
2189 ; X86-NEXT: addl $12, %esp
2190 ; X86-NEXT: shrl $31, %eax
2191 ; X86-NEXT: # kill: def $al killed $al killed $eax
2193 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 384) nounwind
2194 %cmp = icmp slt i32 %call, 0
2198 define i1 @length384_gt(ptr %x, ptr %y) nounwind {
2199 ; X86-LABEL: length384_gt:
2201 ; X86-NEXT: pushl $384 # imm = 0x180
2202 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2203 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2204 ; X86-NEXT: calll memcmp
2205 ; X86-NEXT: addl $12, %esp
2206 ; X86-NEXT: testl %eax, %eax
2207 ; X86-NEXT: setg %al
2209 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 384) nounwind
2210 %cmp = icmp sgt i32 %call, 0
2214 define i1 @length384_eq_const(ptr %X) nounwind {
2215 ; X86-LABEL: length384_eq_const:
2217 ; X86-NEXT: pushl $384 # imm = 0x180
2218 ; X86-NEXT: pushl $.L.str
2219 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2220 ; X86-NEXT: calll memcmp
2221 ; X86-NEXT: addl $12, %esp
2222 ; X86-NEXT: testl %eax, %eax
2223 ; X86-NEXT: sete %al
2225 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 384) nounwind
2226 %c = icmp eq i32 %m, 0
2230 define i32 @length511(ptr %X, ptr %Y) nounwind {
2231 ; X86-LABEL: length511:
2233 ; X86-NEXT: pushl $511 # imm = 0x1FF
2234 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2235 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2236 ; X86-NEXT: calll memcmp
2237 ; X86-NEXT: addl $12, %esp
2239 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 511) nounwind
2243 define i1 @length511_eq(ptr %x, ptr %y) nounwind {
2244 ; X86-LABEL: length511_eq:
2246 ; X86-NEXT: pushl $511 # imm = 0x1FF
2247 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2248 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2249 ; X86-NEXT: calll memcmp
2250 ; X86-NEXT: addl $12, %esp
2251 ; X86-NEXT: testl %eax, %eax
2252 ; X86-NEXT: setne %al
2254 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 511) nounwind
2255 %cmp = icmp ne i32 %call, 0
2259 define i1 @length511_lt(ptr %x, ptr %y) nounwind {
2260 ; X86-LABEL: length511_lt:
2262 ; X86-NEXT: pushl $511 # imm = 0x1FF
2263 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2264 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2265 ; X86-NEXT: calll memcmp
2266 ; X86-NEXT: addl $12, %esp
2267 ; X86-NEXT: shrl $31, %eax
2268 ; X86-NEXT: # kill: def $al killed $al killed $eax
2270 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 511) nounwind
2271 %cmp = icmp slt i32 %call, 0
2275 define i1 @length511_gt(ptr %x, ptr %y) nounwind {
2276 ; X86-LABEL: length511_gt:
2278 ; X86-NEXT: pushl $511 # imm = 0x1FF
2279 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2280 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2281 ; X86-NEXT: calll memcmp
2282 ; X86-NEXT: addl $12, %esp
2283 ; X86-NEXT: testl %eax, %eax
2284 ; X86-NEXT: setg %al
2286 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 511) nounwind
2287 %cmp = icmp sgt i32 %call, 0
2291 define i1 @length511_eq_const(ptr %X) nounwind {
2292 ; X86-LABEL: length511_eq_const:
2294 ; X86-NEXT: pushl $511 # imm = 0x1FF
2295 ; X86-NEXT: pushl $.L.str
2296 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2297 ; X86-NEXT: calll memcmp
2298 ; X86-NEXT: addl $12, %esp
2299 ; X86-NEXT: testl %eax, %eax
2300 ; X86-NEXT: sete %al
2302 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 511) nounwind
2303 %c = icmp eq i32 %m, 0
2307 define i32 @length512(ptr %X, ptr %Y) nounwind {
2308 ; X86-LABEL: length512:
2310 ; X86-NEXT: pushl $512 # imm = 0x200
2311 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2312 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2313 ; X86-NEXT: calll memcmp
2314 ; X86-NEXT: addl $12, %esp
2316 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 512) nounwind
2320 define i1 @length512_eq(ptr %x, ptr %y) nounwind {
2321 ; X86-LABEL: length512_eq:
2323 ; X86-NEXT: pushl $512 # imm = 0x200
2324 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2325 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2326 ; X86-NEXT: calll memcmp
2327 ; X86-NEXT: addl $12, %esp
2328 ; X86-NEXT: testl %eax, %eax
2329 ; X86-NEXT: setne %al
2331 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 512) nounwind
2332 %cmp = icmp ne i32 %call, 0
2336 define i1 @length512_lt(ptr %x, ptr %y) nounwind {
2337 ; X86-LABEL: length512_lt:
2339 ; X86-NEXT: pushl $512 # imm = 0x200
2340 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2341 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2342 ; X86-NEXT: calll memcmp
2343 ; X86-NEXT: addl $12, %esp
2344 ; X86-NEXT: shrl $31, %eax
2345 ; X86-NEXT: # kill: def $al killed $al killed $eax
2347 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 512) nounwind
2348 %cmp = icmp slt i32 %call, 0
2352 define i1 @length512_gt(ptr %x, ptr %y) nounwind {
2353 ; X86-LABEL: length512_gt:
2355 ; X86-NEXT: pushl $512 # imm = 0x200
2356 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2357 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2358 ; X86-NEXT: calll memcmp
2359 ; X86-NEXT: addl $12, %esp
2360 ; X86-NEXT: testl %eax, %eax
2361 ; X86-NEXT: setg %al
2363 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 512) nounwind
2364 %cmp = icmp sgt i32 %call, 0
2368 define i1 @length512_eq_const(ptr %X) nounwind {
2369 ; X86-LABEL: length512_eq_const:
2371 ; X86-NEXT: pushl $512 # imm = 0x200
2372 ; X86-NEXT: pushl $.L.str
2373 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2374 ; X86-NEXT: calll memcmp
2375 ; X86-NEXT: addl $12, %esp
2376 ; X86-NEXT: testl %eax, %eax
2377 ; X86-NEXT: sete %al
2379 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 512) nounwind
2380 %c = icmp eq i32 %m, 0
2384 ; This checks that we do not do stupid things with huge sizes.
2385 define i32 @huge_length(ptr %X, ptr %Y) nounwind {
2386 ; X86-LABEL: huge_length:
2388 ; X86-NEXT: pushl $-1
2389 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2390 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2391 ; X86-NEXT: calll memcmp
2392 ; X86-NEXT: addl $12, %esp
2394 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 9223372036854775807) nounwind
2398 define i1 @huge_length_eq(ptr %X, ptr %Y) nounwind {
2399 ; X86-LABEL: huge_length_eq:
2401 ; X86-NEXT: pushl $-1
2402 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2403 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2404 ; X86-NEXT: calll memcmp
2405 ; X86-NEXT: addl $12, %esp
2406 ; X86-NEXT: testl %eax, %eax
2407 ; X86-NEXT: sete %al
2409 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 9223372036854775807) nounwind
2410 %c = icmp eq i32 %m, 0
2414 ; This checks non-constant sizes.
2415 define i32 @nonconst_length(ptr %X, ptr %Y, i32 %size) nounwind {
2416 ; X86-LABEL: nonconst_length:
2418 ; X86-NEXT: jmp memcmp # TAILCALL
2419 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 %size) nounwind
2423 define i1 @nonconst_length_eq(ptr %X, ptr %Y, i32 %size) nounwind {
2424 ; X86-LABEL: nonconst_length_eq:
2426 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2427 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2428 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2429 ; X86-NEXT: calll memcmp
2430 ; X86-NEXT: addl $12, %esp
2431 ; X86-NEXT: testl %eax, %eax
2432 ; X86-NEXT: sete %al
2434 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 %size) nounwind
2435 %c = icmp eq i32 %m, 0