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), %eax
258 ; X86-NEXT: bswapl %ecx
259 ; X86-NEXT: bswapl %eax
260 ; X86-NEXT: cmpl %eax, %ecx
263 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 4) nounwind
264 %c = icmp slt i32 %m, 0
268 define i1 @length4_gt(ptr %X, ptr %Y) nounwind {
269 ; X86-LABEL: length4_gt:
271 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
272 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
273 ; X86-NEXT: movl (%ecx), %ecx
274 ; X86-NEXT: movl (%eax), %eax
275 ; X86-NEXT: bswapl %ecx
276 ; X86-NEXT: bswapl %eax
277 ; X86-NEXT: cmpl %eax, %ecx
280 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 4) nounwind
281 %c = icmp sgt i32 %m, 0
285 define i1 @length4_eq_const(ptr %X) nounwind {
286 ; X86-LABEL: length4_eq_const:
288 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
289 ; X86-NEXT: cmpl $875770417, (%eax) # imm = 0x34333231
292 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i32 4) nounwind
293 %c = icmp eq i32 %m, 0
297 define i32 @length5(ptr %X, ptr %Y) nounwind {
298 ; X86-LABEL: length5:
300 ; X86-NEXT: pushl %esi
301 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
302 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
303 ; X86-NEXT: movl (%eax), %edx
304 ; X86-NEXT: movl (%ecx), %esi
305 ; X86-NEXT: bswapl %edx
306 ; X86-NEXT: bswapl %esi
307 ; X86-NEXT: cmpl %esi, %edx
308 ; X86-NEXT: jne .LBB18_3
309 ; X86-NEXT: # %bb.1: # %loadbb1
310 ; X86-NEXT: movzbl 4(%eax), %eax
311 ; X86-NEXT: movzbl 4(%ecx), %ecx
312 ; X86-NEXT: subl %ecx, %eax
313 ; X86-NEXT: popl %esi
315 ; X86-NEXT: .LBB18_3: # %res_block
316 ; X86-NEXT: xorl %eax, %eax
317 ; X86-NEXT: cmpl %esi, %edx
318 ; X86-NEXT: sbbl %eax, %eax
319 ; X86-NEXT: orl $1, %eax
320 ; X86-NEXT: popl %esi
322 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 5) nounwind
326 define i1 @length5_eq(ptr %X, ptr %Y) nounwind {
327 ; X86-LABEL: length5_eq:
329 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
330 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
331 ; X86-NEXT: movl (%ecx), %edx
332 ; X86-NEXT: xorl (%eax), %edx
333 ; X86-NEXT: movzbl 4(%ecx), %ecx
334 ; X86-NEXT: xorb 4(%eax), %cl
335 ; X86-NEXT: movzbl %cl, %eax
336 ; X86-NEXT: orl %edx, %eax
337 ; X86-NEXT: setne %al
339 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 5) nounwind
340 %c = icmp ne i32 %m, 0
344 define i1 @length5_lt(ptr %X, ptr %Y) nounwind {
345 ; X86-LABEL: length5_lt:
347 ; X86-NEXT: pushl %esi
348 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
349 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
350 ; X86-NEXT: movl (%eax), %edx
351 ; X86-NEXT: movl (%ecx), %esi
352 ; X86-NEXT: bswapl %edx
353 ; X86-NEXT: bswapl %esi
354 ; X86-NEXT: cmpl %esi, %edx
355 ; X86-NEXT: jne .LBB20_3
356 ; X86-NEXT: # %bb.1: # %loadbb1
357 ; X86-NEXT: movzbl 4(%eax), %eax
358 ; X86-NEXT: movzbl 4(%ecx), %ecx
359 ; X86-NEXT: subl %ecx, %eax
360 ; X86-NEXT: jmp .LBB20_2
361 ; X86-NEXT: .LBB20_3: # %res_block
362 ; X86-NEXT: xorl %eax, %eax
363 ; X86-NEXT: cmpl %esi, %edx
364 ; X86-NEXT: sbbl %eax, %eax
365 ; X86-NEXT: orl $1, %eax
366 ; X86-NEXT: .LBB20_2: # %endblock
367 ; X86-NEXT: shrl $31, %eax
368 ; X86-NEXT: # kill: def $al killed $al killed $eax
369 ; X86-NEXT: popl %esi
371 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 5) nounwind
372 %c = icmp slt i32 %m, 0
376 define i32 @length7(ptr %X, ptr %Y) nounwind {
377 ; X86-LABEL: length7:
379 ; X86-NEXT: pushl %esi
380 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
381 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
382 ; X86-NEXT: movl (%esi), %ecx
383 ; X86-NEXT: movl (%eax), %edx
384 ; X86-NEXT: bswapl %ecx
385 ; X86-NEXT: bswapl %edx
386 ; X86-NEXT: cmpl %edx, %ecx
387 ; X86-NEXT: jne .LBB21_2
388 ; X86-NEXT: # %bb.1: # %loadbb1
389 ; X86-NEXT: movl 3(%esi), %ecx
390 ; X86-NEXT: movl 3(%eax), %edx
391 ; X86-NEXT: bswapl %ecx
392 ; X86-NEXT: bswapl %edx
393 ; X86-NEXT: xorl %eax, %eax
394 ; X86-NEXT: cmpl %edx, %ecx
395 ; X86-NEXT: je .LBB21_3
396 ; X86-NEXT: .LBB21_2: # %res_block
397 ; X86-NEXT: xorl %eax, %eax
398 ; X86-NEXT: cmpl %edx, %ecx
399 ; X86-NEXT: sbbl %eax, %eax
400 ; X86-NEXT: orl $1, %eax
401 ; X86-NEXT: .LBB21_3: # %endblock
402 ; X86-NEXT: popl %esi
404 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 7) nounwind
408 define i1 @length7_lt(ptr %X, ptr %Y) nounwind {
409 ; X86-LABEL: length7_lt:
411 ; X86-NEXT: pushl %esi
412 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
413 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
414 ; X86-NEXT: movl (%esi), %ecx
415 ; X86-NEXT: movl (%eax), %edx
416 ; X86-NEXT: bswapl %ecx
417 ; X86-NEXT: bswapl %edx
418 ; X86-NEXT: cmpl %edx, %ecx
419 ; X86-NEXT: jne .LBB22_2
420 ; X86-NEXT: # %bb.1: # %loadbb1
421 ; X86-NEXT: movl 3(%esi), %ecx
422 ; X86-NEXT: movl 3(%eax), %edx
423 ; X86-NEXT: bswapl %ecx
424 ; X86-NEXT: bswapl %edx
425 ; X86-NEXT: xorl %eax, %eax
426 ; X86-NEXT: cmpl %edx, %ecx
427 ; X86-NEXT: je .LBB22_3
428 ; X86-NEXT: .LBB22_2: # %res_block
429 ; X86-NEXT: xorl %eax, %eax
430 ; X86-NEXT: cmpl %edx, %ecx
431 ; X86-NEXT: sbbl %eax, %eax
432 ; X86-NEXT: orl $1, %eax
433 ; X86-NEXT: .LBB22_3: # %endblock
434 ; X86-NEXT: shrl $31, %eax
435 ; X86-NEXT: # kill: def $al killed $al killed $eax
436 ; X86-NEXT: popl %esi
438 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 7) nounwind
439 %c = icmp slt i32 %m, 0
443 define i1 @length7_eq(ptr %X, ptr %Y) nounwind {
444 ; X86-LABEL: length7_eq:
446 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
447 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
448 ; X86-NEXT: movl (%ecx), %edx
449 ; X86-NEXT: movl 3(%ecx), %ecx
450 ; X86-NEXT: xorl (%eax), %edx
451 ; X86-NEXT: xorl 3(%eax), %ecx
452 ; X86-NEXT: orl %edx, %ecx
453 ; X86-NEXT: setne %al
455 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 7) nounwind
456 %c = icmp ne i32 %m, 0
460 define i32 @length8(ptr %X, ptr %Y) nounwind {
461 ; X86-LABEL: length8:
463 ; X86-NEXT: pushl %esi
464 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
465 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
466 ; X86-NEXT: movl (%esi), %ecx
467 ; X86-NEXT: movl (%eax), %edx
468 ; X86-NEXT: bswapl %ecx
469 ; X86-NEXT: bswapl %edx
470 ; X86-NEXT: cmpl %edx, %ecx
471 ; X86-NEXT: jne .LBB24_2
472 ; X86-NEXT: # %bb.1: # %loadbb1
473 ; X86-NEXT: movl 4(%esi), %ecx
474 ; X86-NEXT: movl 4(%eax), %edx
475 ; X86-NEXT: bswapl %ecx
476 ; X86-NEXT: bswapl %edx
477 ; X86-NEXT: xorl %eax, %eax
478 ; X86-NEXT: cmpl %edx, %ecx
479 ; X86-NEXT: je .LBB24_3
480 ; X86-NEXT: .LBB24_2: # %res_block
481 ; X86-NEXT: xorl %eax, %eax
482 ; X86-NEXT: cmpl %edx, %ecx
483 ; X86-NEXT: sbbl %eax, %eax
484 ; X86-NEXT: orl $1, %eax
485 ; X86-NEXT: .LBB24_3: # %endblock
486 ; X86-NEXT: popl %esi
488 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 8) nounwind
492 define i1 @length8_eq(ptr %X, ptr %Y) nounwind {
493 ; X86-LABEL: length8_eq:
495 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
496 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
497 ; X86-NEXT: movl (%ecx), %edx
498 ; X86-NEXT: movl 4(%ecx), %ecx
499 ; X86-NEXT: xorl (%eax), %edx
500 ; X86-NEXT: xorl 4(%eax), %ecx
501 ; X86-NEXT: orl %edx, %ecx
504 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 8) nounwind
505 %c = icmp eq i32 %m, 0
509 define i1 @length8_eq_const(ptr %X) nounwind {
510 ; X86-LABEL: length8_eq_const:
512 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
513 ; X86-NEXT: movl $858927408, %ecx # imm = 0x33323130
514 ; X86-NEXT: xorl (%eax), %ecx
515 ; X86-NEXT: movl $926299444, %edx # imm = 0x37363534
516 ; X86-NEXT: xorl 4(%eax), %edx
517 ; X86-NEXT: orl %ecx, %edx
518 ; X86-NEXT: setne %al
520 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 8) nounwind
521 %c = icmp ne i32 %m, 0
525 define i1 @length9_eq(ptr %X, ptr %Y) nounwind {
526 ; X86-LABEL: length9_eq:
529 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
530 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
531 ; X86-NEXT: calll memcmp
532 ; X86-NEXT: addl $12, %esp
533 ; X86-NEXT: testl %eax, %eax
536 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 9) nounwind
537 %c = icmp eq i32 %m, 0
541 define i1 @length10_eq(ptr %X, ptr %Y) nounwind {
542 ; X86-LABEL: length10_eq:
544 ; X86-NEXT: pushl $10
545 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
546 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
547 ; X86-NEXT: calll memcmp
548 ; X86-NEXT: addl $12, %esp
549 ; X86-NEXT: testl %eax, %eax
552 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 10) nounwind
553 %c = icmp eq i32 %m, 0
557 define i1 @length11_eq(ptr %X, ptr %Y) nounwind {
558 ; X86-LABEL: length11_eq:
560 ; X86-NEXT: pushl $11
561 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
562 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
563 ; X86-NEXT: calll memcmp
564 ; X86-NEXT: addl $12, %esp
565 ; X86-NEXT: testl %eax, %eax
568 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 11) nounwind
569 %c = icmp eq i32 %m, 0
573 define i1 @length12_eq(ptr %X, ptr %Y) nounwind {
574 ; X86-LABEL: length12_eq:
576 ; X86-NEXT: pushl $12
577 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
578 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
579 ; X86-NEXT: calll memcmp
580 ; X86-NEXT: addl $12, %esp
581 ; X86-NEXT: testl %eax, %eax
582 ; X86-NEXT: setne %al
584 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 12) nounwind
585 %c = icmp ne i32 %m, 0
589 define i32 @length12(ptr %X, ptr %Y) nounwind {
590 ; X86-LABEL: length12:
592 ; X86-NEXT: pushl $12
593 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
594 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
595 ; X86-NEXT: calll memcmp
596 ; X86-NEXT: addl $12, %esp
598 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 12) nounwind
602 define i1 @length13_eq(ptr %X, ptr %Y) nounwind {
603 ; X86-LABEL: length13_eq:
605 ; X86-NEXT: pushl $13
606 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
607 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
608 ; X86-NEXT: calll memcmp
609 ; X86-NEXT: addl $12, %esp
610 ; X86-NEXT: testl %eax, %eax
613 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 13) nounwind
614 %c = icmp eq i32 %m, 0
618 define i1 @length14_eq(ptr %X, ptr %Y) nounwind {
619 ; X86-LABEL: length14_eq:
621 ; X86-NEXT: pushl $14
622 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
623 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
624 ; X86-NEXT: calll memcmp
625 ; X86-NEXT: addl $12, %esp
626 ; X86-NEXT: testl %eax, %eax
629 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 14) nounwind
630 %c = icmp eq i32 %m, 0
634 define i32 @length15(ptr %X, ptr %Y) nounwind {
635 ; X86-LABEL: length15:
637 ; X86-NEXT: pushl $15
638 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
639 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
640 ; X86-NEXT: calll memcmp
641 ; X86-NEXT: addl $12, %esp
643 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 15) nounwind
647 define i1 @length15_lt(ptr %X, ptr %Y) nounwind {
648 ; X86-LABEL: length15_lt:
650 ; X86-NEXT: pushl $15
651 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
652 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
653 ; X86-NEXT: calll memcmp
654 ; X86-NEXT: addl $12, %esp
655 ; X86-NEXT: shrl $31, %eax
656 ; X86-NEXT: # kill: def $al killed $al killed $eax
658 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 15) nounwind
659 %c = icmp slt i32 %m, 0
663 define i32 @length15_const(ptr %X, ptr %Y) nounwind {
664 ; X86-LABEL: length15_const:
666 ; X86-NEXT: pushl $15
667 ; X86-NEXT: pushl $.L.str+1
668 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
669 ; X86-NEXT: calll memcmp
670 ; X86-NEXT: addl $12, %esp
672 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i32 15) nounwind
676 define i1 @length15_eq(ptr %X, ptr %Y) nounwind {
677 ; X86-LABEL: length15_eq:
679 ; X86-NEXT: pushl $15
680 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
681 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
682 ; X86-NEXT: calll memcmp
683 ; X86-NEXT: addl $12, %esp
684 ; X86-NEXT: testl %eax, %eax
687 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 15) nounwind
688 %c = icmp eq i32 %m, 0
692 define i1 @length15_gt_const(ptr %X, ptr %Y) nounwind {
693 ; X86-LABEL: length15_gt_const:
695 ; X86-NEXT: pushl $15
696 ; X86-NEXT: pushl $.L.str+1
697 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
698 ; X86-NEXT: calll memcmp
699 ; X86-NEXT: addl $12, %esp
700 ; X86-NEXT: testl %eax, %eax
703 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i32 15) nounwind
704 %c = icmp sgt i32 %m, 0
708 ; PR33329 - https://bugs.llvm.org/show_bug.cgi?id=33329
710 define i32 @length16(ptr %X, ptr %Y) nounwind {
711 ; X86-LABEL: length16:
713 ; X86-NEXT: pushl $16
714 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
715 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
716 ; X86-NEXT: calll memcmp
717 ; X86-NEXT: addl $12, %esp
719 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 16) nounwind
723 define i1 @length16_eq(ptr %x, ptr %y) nounwind {
724 ; X86-NOSSE-LABEL: length16_eq:
725 ; X86-NOSSE: # %bb.0:
726 ; X86-NOSSE-NEXT: pushl $16
727 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
728 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
729 ; X86-NOSSE-NEXT: calll memcmp
730 ; X86-NOSSE-NEXT: addl $12, %esp
731 ; X86-NOSSE-NEXT: testl %eax, %eax
732 ; X86-NOSSE-NEXT: setne %al
733 ; X86-NOSSE-NEXT: retl
735 ; X86-SSE1-LABEL: length16_eq:
737 ; X86-SSE1-NEXT: pushl $16
738 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
739 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
740 ; X86-SSE1-NEXT: calll memcmp
741 ; X86-SSE1-NEXT: addl $12, %esp
742 ; X86-SSE1-NEXT: testl %eax, %eax
743 ; X86-SSE1-NEXT: setne %al
744 ; X86-SSE1-NEXT: retl
746 ; X86-SSE2-LABEL: length16_eq:
748 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
749 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
750 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
751 ; X86-SSE2-NEXT: movdqu (%eax), %xmm1
752 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm1
753 ; X86-SSE2-NEXT: pmovmskb %xmm1, %eax
754 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
755 ; X86-SSE2-NEXT: setne %al
756 ; X86-SSE2-NEXT: retl
758 ; X86-SSE41-LABEL: length16_eq:
759 ; X86-SSE41: # %bb.0:
760 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
761 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
762 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
763 ; X86-SSE41-NEXT: movdqu (%eax), %xmm1
764 ; X86-SSE41-NEXT: pxor %xmm0, %xmm1
765 ; X86-SSE41-NEXT: ptest %xmm1, %xmm1
766 ; X86-SSE41-NEXT: setne %al
767 ; X86-SSE41-NEXT: retl
768 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 16) nounwind
769 %cmp = icmp ne i32 %call, 0
773 define i1 @length16_lt(ptr %x, ptr %y) nounwind {
774 ; X86-LABEL: length16_lt:
776 ; X86-NEXT: pushl $16
777 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
778 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
779 ; X86-NEXT: calll memcmp
780 ; X86-NEXT: addl $12, %esp
781 ; X86-NEXT: shrl $31, %eax
782 ; X86-NEXT: # kill: def $al killed $al killed $eax
784 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 16) nounwind
785 %cmp = icmp slt i32 %call, 0
789 define i1 @length16_gt(ptr %x, ptr %y) nounwind {
790 ; X86-LABEL: length16_gt:
792 ; X86-NEXT: pushl $16
793 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
794 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
795 ; X86-NEXT: calll memcmp
796 ; X86-NEXT: addl $12, %esp
797 ; X86-NEXT: testl %eax, %eax
800 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 16) nounwind
801 %cmp = icmp sgt i32 %call, 0
805 define i1 @length16_eq_const(ptr %X) nounwind {
806 ; X86-NOSSE-LABEL: length16_eq_const:
807 ; X86-NOSSE: # %bb.0:
808 ; X86-NOSSE-NEXT: pushl $16
809 ; X86-NOSSE-NEXT: pushl $.L.str
810 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
811 ; X86-NOSSE-NEXT: calll memcmp
812 ; X86-NOSSE-NEXT: addl $12, %esp
813 ; X86-NOSSE-NEXT: testl %eax, %eax
814 ; X86-NOSSE-NEXT: sete %al
815 ; X86-NOSSE-NEXT: retl
817 ; X86-SSE1-LABEL: length16_eq_const:
819 ; X86-SSE1-NEXT: pushl $16
820 ; X86-SSE1-NEXT: pushl $.L.str
821 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
822 ; X86-SSE1-NEXT: calll memcmp
823 ; X86-SSE1-NEXT: addl $12, %esp
824 ; X86-SSE1-NEXT: testl %eax, %eax
825 ; X86-SSE1-NEXT: sete %al
826 ; X86-SSE1-NEXT: retl
828 ; X86-SSE2-LABEL: length16_eq_const:
830 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
831 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
832 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
833 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
834 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
835 ; X86-SSE2-NEXT: sete %al
836 ; X86-SSE2-NEXT: retl
838 ; X86-SSE41-LABEL: length16_eq_const:
839 ; X86-SSE41: # %bb.0:
840 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
841 ; X86-SSE41-NEXT: movdqu (%eax), %xmm0
842 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
843 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
844 ; X86-SSE41-NEXT: sete %al
845 ; X86-SSE41-NEXT: retl
846 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 16) nounwind
847 %c = icmp eq i32 %m, 0
851 ; PR33914 - https://bugs.llvm.org/show_bug.cgi?id=33914
853 define i32 @length24(ptr %X, ptr %Y) nounwind {
854 ; X86-LABEL: length24:
856 ; X86-NEXT: pushl $24
857 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
858 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
859 ; X86-NEXT: calll memcmp
860 ; X86-NEXT: addl $12, %esp
862 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 24) nounwind
866 define i1 @length24_eq(ptr %x, ptr %y) nounwind {
867 ; X86-NOSSE-LABEL: length24_eq:
868 ; X86-NOSSE: # %bb.0:
869 ; X86-NOSSE-NEXT: pushl $24
870 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
871 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
872 ; X86-NOSSE-NEXT: calll memcmp
873 ; X86-NOSSE-NEXT: addl $12, %esp
874 ; X86-NOSSE-NEXT: testl %eax, %eax
875 ; X86-NOSSE-NEXT: sete %al
876 ; X86-NOSSE-NEXT: retl
878 ; X86-SSE1-LABEL: length24_eq:
880 ; X86-SSE1-NEXT: pushl $24
881 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
882 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
883 ; X86-SSE1-NEXT: calll memcmp
884 ; X86-SSE1-NEXT: addl $12, %esp
885 ; X86-SSE1-NEXT: testl %eax, %eax
886 ; X86-SSE1-NEXT: sete %al
887 ; X86-SSE1-NEXT: retl
889 ; X86-SSE2-LABEL: length24_eq:
891 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
892 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
893 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
894 ; X86-SSE2-NEXT: movdqu 8(%ecx), %xmm1
895 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
896 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
897 ; X86-SSE2-NEXT: movdqu 8(%eax), %xmm0
898 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
899 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
900 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
901 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
902 ; X86-SSE2-NEXT: sete %al
903 ; X86-SSE2-NEXT: retl
905 ; X86-SSE41-LABEL: length24_eq:
906 ; X86-SSE41: # %bb.0:
907 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
908 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
909 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
910 ; X86-SSE41-NEXT: movdqu 8(%ecx), %xmm1
911 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
912 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
913 ; X86-SSE41-NEXT: movdqu 8(%eax), %xmm0
914 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
915 ; X86-SSE41-NEXT: por %xmm2, %xmm0
916 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
917 ; X86-SSE41-NEXT: sete %al
918 ; X86-SSE41-NEXT: retl
919 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 24) nounwind
920 %cmp = icmp eq i32 %call, 0
924 define i1 @length24_lt(ptr %x, ptr %y) nounwind {
925 ; X86-LABEL: length24_lt:
927 ; X86-NEXT: pushl $24
928 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
929 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
930 ; X86-NEXT: calll memcmp
931 ; X86-NEXT: addl $12, %esp
932 ; X86-NEXT: shrl $31, %eax
933 ; X86-NEXT: # kill: def $al killed $al killed $eax
935 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 24) nounwind
936 %cmp = icmp slt i32 %call, 0
940 define i1 @length24_gt(ptr %x, ptr %y) nounwind {
941 ; X86-LABEL: length24_gt:
943 ; X86-NEXT: pushl $24
944 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
945 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
946 ; X86-NEXT: calll memcmp
947 ; X86-NEXT: addl $12, %esp
948 ; X86-NEXT: testl %eax, %eax
951 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 24) nounwind
952 %cmp = icmp sgt i32 %call, 0
956 define i1 @length24_eq_const(ptr %X) nounwind {
957 ; X86-NOSSE-LABEL: length24_eq_const:
958 ; X86-NOSSE: # %bb.0:
959 ; X86-NOSSE-NEXT: pushl $24
960 ; X86-NOSSE-NEXT: pushl $.L.str
961 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
962 ; X86-NOSSE-NEXT: calll memcmp
963 ; X86-NOSSE-NEXT: addl $12, %esp
964 ; X86-NOSSE-NEXT: testl %eax, %eax
965 ; X86-NOSSE-NEXT: setne %al
966 ; X86-NOSSE-NEXT: retl
968 ; X86-SSE1-LABEL: length24_eq_const:
970 ; X86-SSE1-NEXT: pushl $24
971 ; X86-SSE1-NEXT: pushl $.L.str
972 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
973 ; X86-SSE1-NEXT: calll memcmp
974 ; X86-SSE1-NEXT: addl $12, %esp
975 ; X86-SSE1-NEXT: testl %eax, %eax
976 ; X86-SSE1-NEXT: setne %al
977 ; X86-SSE1-NEXT: retl
979 ; X86-SSE2-LABEL: length24_eq_const:
981 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
982 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
983 ; X86-SSE2-NEXT: movdqu 8(%eax), %xmm1
984 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
985 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
986 ; X86-SSE2-NEXT: pand %xmm1, %xmm0
987 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
988 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
989 ; X86-SSE2-NEXT: setne %al
990 ; X86-SSE2-NEXT: retl
992 ; X86-SSE41-LABEL: length24_eq_const:
993 ; X86-SSE41: # %bb.0:
994 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
995 ; X86-SSE41-NEXT: movdqu (%eax), %xmm0
996 ; X86-SSE41-NEXT: movdqu 8(%eax), %xmm1
997 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
998 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
999 ; X86-SSE41-NEXT: por %xmm1, %xmm0
1000 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1001 ; X86-SSE41-NEXT: setne %al
1002 ; X86-SSE41-NEXT: retl
1003 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 24) nounwind
1004 %c = icmp ne i32 %m, 0
1008 define i32 @length31(ptr %X, ptr %Y) nounwind {
1009 ; X86-LABEL: length31:
1011 ; X86-NEXT: pushl $31
1012 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1013 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1014 ; X86-NEXT: calll memcmp
1015 ; X86-NEXT: addl $12, %esp
1017 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 31) nounwind
1021 define i1 @length31_eq(ptr %x, ptr %y) nounwind {
1022 ; X86-NOSSE-LABEL: length31_eq:
1023 ; X86-NOSSE: # %bb.0:
1024 ; X86-NOSSE-NEXT: pushl $31
1025 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1026 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1027 ; X86-NOSSE-NEXT: calll memcmp
1028 ; X86-NOSSE-NEXT: addl $12, %esp
1029 ; X86-NOSSE-NEXT: testl %eax, %eax
1030 ; X86-NOSSE-NEXT: sete %al
1031 ; X86-NOSSE-NEXT: retl
1033 ; X86-SSE1-LABEL: length31_eq:
1034 ; X86-SSE1: # %bb.0:
1035 ; X86-SSE1-NEXT: pushl $31
1036 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1037 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1038 ; X86-SSE1-NEXT: calll memcmp
1039 ; X86-SSE1-NEXT: addl $12, %esp
1040 ; X86-SSE1-NEXT: testl %eax, %eax
1041 ; X86-SSE1-NEXT: sete %al
1042 ; X86-SSE1-NEXT: retl
1044 ; X86-SSE2-LABEL: length31_eq:
1045 ; X86-SSE2: # %bb.0:
1046 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1047 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
1048 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
1049 ; X86-SSE2-NEXT: movdqu 15(%ecx), %xmm1
1050 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
1051 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
1052 ; X86-SSE2-NEXT: movdqu 15(%eax), %xmm0
1053 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
1054 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1055 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1056 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1057 ; X86-SSE2-NEXT: sete %al
1058 ; X86-SSE2-NEXT: retl
1060 ; X86-SSE41-LABEL: length31_eq:
1061 ; X86-SSE41: # %bb.0:
1062 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1063 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
1064 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
1065 ; X86-SSE41-NEXT: movdqu 15(%ecx), %xmm1
1066 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
1067 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
1068 ; X86-SSE41-NEXT: movdqu 15(%eax), %xmm0
1069 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
1070 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1071 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1072 ; X86-SSE41-NEXT: sete %al
1073 ; X86-SSE41-NEXT: retl
1074 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 31) nounwind
1075 %cmp = icmp eq i32 %call, 0
1079 define i1 @length31_lt(ptr %x, ptr %y) nounwind {
1080 ; X86-LABEL: length31_lt:
1082 ; X86-NEXT: pushl $31
1083 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1084 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1085 ; X86-NEXT: calll memcmp
1086 ; X86-NEXT: addl $12, %esp
1087 ; X86-NEXT: shrl $31, %eax
1088 ; X86-NEXT: # kill: def $al killed $al killed $eax
1090 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 31) nounwind
1091 %cmp = icmp slt i32 %call, 0
1095 define i1 @length31_gt(ptr %x, ptr %y) nounwind {
1096 ; X86-LABEL: length31_gt:
1098 ; X86-NEXT: pushl $31
1099 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1100 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1101 ; X86-NEXT: calll memcmp
1102 ; X86-NEXT: addl $12, %esp
1103 ; X86-NEXT: testl %eax, %eax
1104 ; X86-NEXT: setg %al
1106 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 31) nounwind
1107 %cmp = icmp sgt i32 %call, 0
1111 define i1 @length31_eq_prefer128(ptr %x, ptr %y) nounwind "prefer-vector-width"="128" {
1112 ; X86-NOSSE-LABEL: length31_eq_prefer128:
1113 ; X86-NOSSE: # %bb.0:
1114 ; X86-NOSSE-NEXT: pushl $31
1115 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1116 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1117 ; X86-NOSSE-NEXT: calll memcmp
1118 ; X86-NOSSE-NEXT: addl $12, %esp
1119 ; X86-NOSSE-NEXT: testl %eax, %eax
1120 ; X86-NOSSE-NEXT: sete %al
1121 ; X86-NOSSE-NEXT: retl
1123 ; X86-SSE1-LABEL: length31_eq_prefer128:
1124 ; X86-SSE1: # %bb.0:
1125 ; X86-SSE1-NEXT: pushl $31
1126 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1127 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1128 ; X86-SSE1-NEXT: calll memcmp
1129 ; X86-SSE1-NEXT: addl $12, %esp
1130 ; X86-SSE1-NEXT: testl %eax, %eax
1131 ; X86-SSE1-NEXT: sete %al
1132 ; X86-SSE1-NEXT: retl
1134 ; X86-SSE2-LABEL: length31_eq_prefer128:
1135 ; X86-SSE2: # %bb.0:
1136 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1137 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
1138 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
1139 ; X86-SSE2-NEXT: movdqu 15(%ecx), %xmm1
1140 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
1141 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
1142 ; X86-SSE2-NEXT: movdqu 15(%eax), %xmm0
1143 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
1144 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1145 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1146 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1147 ; X86-SSE2-NEXT: sete %al
1148 ; X86-SSE2-NEXT: retl
1150 ; X86-SSE41-LABEL: length31_eq_prefer128:
1151 ; X86-SSE41: # %bb.0:
1152 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1153 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
1154 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
1155 ; X86-SSE41-NEXT: movdqu 15(%ecx), %xmm1
1156 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
1157 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
1158 ; X86-SSE41-NEXT: movdqu 15(%eax), %xmm0
1159 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
1160 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1161 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1162 ; X86-SSE41-NEXT: sete %al
1163 ; X86-SSE41-NEXT: retl
1164 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 31) nounwind
1165 %cmp = icmp eq i32 %call, 0
1169 define i1 @length31_eq_const(ptr %X) nounwind {
1170 ; X86-NOSSE-LABEL: length31_eq_const:
1171 ; X86-NOSSE: # %bb.0:
1172 ; X86-NOSSE-NEXT: pushl $31
1173 ; X86-NOSSE-NEXT: pushl $.L.str
1174 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1175 ; X86-NOSSE-NEXT: calll memcmp
1176 ; X86-NOSSE-NEXT: addl $12, %esp
1177 ; X86-NOSSE-NEXT: testl %eax, %eax
1178 ; X86-NOSSE-NEXT: setne %al
1179 ; X86-NOSSE-NEXT: retl
1181 ; X86-SSE1-LABEL: length31_eq_const:
1182 ; X86-SSE1: # %bb.0:
1183 ; X86-SSE1-NEXT: pushl $31
1184 ; X86-SSE1-NEXT: pushl $.L.str
1185 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1186 ; X86-SSE1-NEXT: calll memcmp
1187 ; X86-SSE1-NEXT: addl $12, %esp
1188 ; X86-SSE1-NEXT: testl %eax, %eax
1189 ; X86-SSE1-NEXT: setne %al
1190 ; X86-SSE1-NEXT: retl
1192 ; X86-SSE2-LABEL: length31_eq_const:
1193 ; X86-SSE2: # %bb.0:
1194 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1195 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
1196 ; X86-SSE2-NEXT: movdqu 15(%eax), %xmm1
1197 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1198 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1199 ; X86-SSE2-NEXT: pand %xmm1, %xmm0
1200 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1201 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1202 ; X86-SSE2-NEXT: setne %al
1203 ; X86-SSE2-NEXT: retl
1205 ; X86-SSE41-LABEL: length31_eq_const:
1206 ; X86-SSE41: # %bb.0:
1207 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1208 ; X86-SSE41-NEXT: movdqu (%eax), %xmm0
1209 ; X86-SSE41-NEXT: movdqu 15(%eax), %xmm1
1210 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1211 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1212 ; X86-SSE41-NEXT: por %xmm1, %xmm0
1213 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1214 ; X86-SSE41-NEXT: setne %al
1215 ; X86-SSE41-NEXT: retl
1216 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 31) nounwind
1217 %c = icmp ne i32 %m, 0
1221 define i32 @length32(ptr %X, ptr %Y) nounwind {
1222 ; X86-LABEL: length32:
1224 ; X86-NEXT: pushl $32
1225 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1226 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1227 ; X86-NEXT: calll memcmp
1228 ; X86-NEXT: addl $12, %esp
1230 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 32) nounwind
1234 ; PR33325 - https://bugs.llvm.org/show_bug.cgi?id=33325
1236 define i1 @length32_eq(ptr %x, ptr %y) nounwind {
1237 ; X86-NOSSE-LABEL: length32_eq:
1238 ; X86-NOSSE: # %bb.0:
1239 ; X86-NOSSE-NEXT: pushl $32
1240 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1241 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1242 ; X86-NOSSE-NEXT: calll memcmp
1243 ; X86-NOSSE-NEXT: addl $12, %esp
1244 ; X86-NOSSE-NEXT: testl %eax, %eax
1245 ; X86-NOSSE-NEXT: sete %al
1246 ; X86-NOSSE-NEXT: retl
1248 ; X86-SSE1-LABEL: length32_eq:
1249 ; X86-SSE1: # %bb.0:
1250 ; X86-SSE1-NEXT: pushl $32
1251 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1252 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1253 ; X86-SSE1-NEXT: calll memcmp
1254 ; X86-SSE1-NEXT: addl $12, %esp
1255 ; X86-SSE1-NEXT: testl %eax, %eax
1256 ; X86-SSE1-NEXT: sete %al
1257 ; X86-SSE1-NEXT: retl
1259 ; X86-SSE2-LABEL: length32_eq:
1260 ; X86-SSE2: # %bb.0:
1261 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1262 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
1263 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
1264 ; X86-SSE2-NEXT: movdqu 16(%ecx), %xmm1
1265 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
1266 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
1267 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm0
1268 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
1269 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1270 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1271 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1272 ; X86-SSE2-NEXT: sete %al
1273 ; X86-SSE2-NEXT: retl
1275 ; X86-SSE41-LABEL: length32_eq:
1276 ; X86-SSE41: # %bb.0:
1277 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1278 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
1279 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
1280 ; X86-SSE41-NEXT: movdqu 16(%ecx), %xmm1
1281 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
1282 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
1283 ; X86-SSE41-NEXT: movdqu 16(%eax), %xmm0
1284 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
1285 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1286 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1287 ; X86-SSE41-NEXT: sete %al
1288 ; X86-SSE41-NEXT: retl
1289 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 32) nounwind
1290 %cmp = icmp eq i32 %call, 0
1294 define i1 @length32_lt(ptr %x, ptr %y) nounwind {
1295 ; X86-LABEL: length32_lt:
1297 ; X86-NEXT: pushl $32
1298 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1299 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1300 ; X86-NEXT: calll memcmp
1301 ; X86-NEXT: addl $12, %esp
1302 ; X86-NEXT: shrl $31, %eax
1303 ; X86-NEXT: # kill: def $al killed $al killed $eax
1305 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 32) nounwind
1306 %cmp = icmp slt i32 %call, 0
1310 define i1 @length32_gt(ptr %x, ptr %y) nounwind {
1311 ; X86-LABEL: length32_gt:
1313 ; X86-NEXT: pushl $32
1314 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1315 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1316 ; X86-NEXT: calll memcmp
1317 ; X86-NEXT: addl $12, %esp
1318 ; X86-NEXT: testl %eax, %eax
1319 ; X86-NEXT: setg %al
1321 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 32) nounwind
1322 %cmp = icmp sgt i32 %call, 0
1326 define i1 @length32_eq_prefer128(ptr %x, ptr %y) nounwind "prefer-vector-width"="128" {
1327 ; X86-NOSSE-LABEL: length32_eq_prefer128:
1328 ; X86-NOSSE: # %bb.0:
1329 ; X86-NOSSE-NEXT: pushl $32
1330 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1331 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1332 ; X86-NOSSE-NEXT: calll memcmp
1333 ; X86-NOSSE-NEXT: addl $12, %esp
1334 ; X86-NOSSE-NEXT: testl %eax, %eax
1335 ; X86-NOSSE-NEXT: sete %al
1336 ; X86-NOSSE-NEXT: retl
1338 ; X86-SSE1-LABEL: length32_eq_prefer128:
1339 ; X86-SSE1: # %bb.0:
1340 ; X86-SSE1-NEXT: pushl $32
1341 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1342 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1343 ; X86-SSE1-NEXT: calll memcmp
1344 ; X86-SSE1-NEXT: addl $12, %esp
1345 ; X86-SSE1-NEXT: testl %eax, %eax
1346 ; X86-SSE1-NEXT: sete %al
1347 ; X86-SSE1-NEXT: retl
1349 ; X86-SSE2-LABEL: length32_eq_prefer128:
1350 ; X86-SSE2: # %bb.0:
1351 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1352 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
1353 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
1354 ; X86-SSE2-NEXT: movdqu 16(%ecx), %xmm1
1355 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
1356 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
1357 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm0
1358 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
1359 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1360 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1361 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1362 ; X86-SSE2-NEXT: sete %al
1363 ; X86-SSE2-NEXT: retl
1365 ; X86-SSE41-LABEL: length32_eq_prefer128:
1366 ; X86-SSE41: # %bb.0:
1367 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1368 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
1369 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
1370 ; X86-SSE41-NEXT: movdqu 16(%ecx), %xmm1
1371 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
1372 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
1373 ; X86-SSE41-NEXT: movdqu 16(%eax), %xmm0
1374 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
1375 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1376 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1377 ; X86-SSE41-NEXT: sete %al
1378 ; X86-SSE41-NEXT: retl
1379 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 32) nounwind
1380 %cmp = icmp eq i32 %call, 0
1384 define i1 @length32_eq_const(ptr %X) nounwind {
1385 ; X86-NOSSE-LABEL: length32_eq_const:
1386 ; X86-NOSSE: # %bb.0:
1387 ; X86-NOSSE-NEXT: pushl $32
1388 ; X86-NOSSE-NEXT: pushl $.L.str
1389 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1390 ; X86-NOSSE-NEXT: calll memcmp
1391 ; X86-NOSSE-NEXT: addl $12, %esp
1392 ; X86-NOSSE-NEXT: testl %eax, %eax
1393 ; X86-NOSSE-NEXT: setne %al
1394 ; X86-NOSSE-NEXT: retl
1396 ; X86-SSE1-LABEL: length32_eq_const:
1397 ; X86-SSE1: # %bb.0:
1398 ; X86-SSE1-NEXT: pushl $32
1399 ; X86-SSE1-NEXT: pushl $.L.str
1400 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1401 ; X86-SSE1-NEXT: calll memcmp
1402 ; X86-SSE1-NEXT: addl $12, %esp
1403 ; X86-SSE1-NEXT: testl %eax, %eax
1404 ; X86-SSE1-NEXT: setne %al
1405 ; X86-SSE1-NEXT: retl
1407 ; X86-SSE2-LABEL: length32_eq_const:
1408 ; X86-SSE2: # %bb.0:
1409 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1410 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
1411 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm1
1412 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1413 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1414 ; X86-SSE2-NEXT: pand %xmm1, %xmm0
1415 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1416 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1417 ; X86-SSE2-NEXT: setne %al
1418 ; X86-SSE2-NEXT: retl
1420 ; X86-SSE41-LABEL: length32_eq_const:
1421 ; X86-SSE41: # %bb.0:
1422 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1423 ; X86-SSE41-NEXT: movdqu (%eax), %xmm0
1424 ; X86-SSE41-NEXT: movdqu 16(%eax), %xmm1
1425 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1426 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1427 ; X86-SSE41-NEXT: por %xmm1, %xmm0
1428 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1429 ; X86-SSE41-NEXT: setne %al
1430 ; X86-SSE41-NEXT: retl
1431 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 32) nounwind
1432 %c = icmp ne i32 %m, 0
1436 define i32 @length48(ptr %X, ptr %Y) nounwind {
1437 ; X86-LABEL: length48:
1439 ; X86-NEXT: pushl $48
1440 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1441 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1442 ; X86-NEXT: calll memcmp
1443 ; X86-NEXT: addl $12, %esp
1445 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 48) nounwind
1449 define i1 @length48_eq(ptr %x, ptr %y) nounwind {
1450 ; X86-LABEL: length48_eq:
1452 ; X86-NEXT: pushl $48
1453 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1454 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1455 ; X86-NEXT: calll memcmp
1456 ; X86-NEXT: addl $12, %esp
1457 ; X86-NEXT: testl %eax, %eax
1458 ; X86-NEXT: sete %al
1460 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 48) nounwind
1461 %cmp = icmp eq i32 %call, 0
1465 define i1 @length48_lt(ptr %x, ptr %y) nounwind {
1466 ; X86-LABEL: length48_lt:
1468 ; X86-NEXT: pushl $48
1469 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1470 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1471 ; X86-NEXT: calll memcmp
1472 ; X86-NEXT: addl $12, %esp
1473 ; X86-NEXT: shrl $31, %eax
1474 ; X86-NEXT: # kill: def $al killed $al killed $eax
1476 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 48) nounwind
1477 %cmp = icmp slt i32 %call, 0
1481 define i1 @length48_gt(ptr %x, ptr %y) nounwind {
1482 ; X86-LABEL: length48_gt:
1484 ; X86-NEXT: pushl $48
1485 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1486 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1487 ; X86-NEXT: calll memcmp
1488 ; X86-NEXT: addl $12, %esp
1489 ; X86-NEXT: testl %eax, %eax
1490 ; X86-NEXT: setg %al
1492 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 48) nounwind
1493 %cmp = icmp sgt i32 %call, 0
1497 define i1 @length48_eq_prefer128(ptr %x, ptr %y) nounwind "prefer-vector-width"="128" {
1498 ; X86-LABEL: length48_eq_prefer128:
1500 ; X86-NEXT: pushl $48
1501 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1502 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1503 ; X86-NEXT: calll memcmp
1504 ; X86-NEXT: addl $12, %esp
1505 ; X86-NEXT: testl %eax, %eax
1506 ; X86-NEXT: sete %al
1508 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 48) nounwind
1509 %cmp = icmp eq i32 %call, 0
1513 define i1 @length48_eq_const(ptr %X) nounwind {
1514 ; X86-LABEL: length48_eq_const:
1516 ; X86-NEXT: pushl $48
1517 ; X86-NEXT: pushl $.L.str
1518 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1519 ; X86-NEXT: calll memcmp
1520 ; X86-NEXT: addl $12, %esp
1521 ; X86-NEXT: testl %eax, %eax
1522 ; X86-NEXT: setne %al
1524 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 48) nounwind
1525 %c = icmp ne i32 %m, 0
1529 define i32 @length63(ptr %X, ptr %Y) nounwind {
1530 ; X86-LABEL: length63:
1532 ; X86-NEXT: pushl $63
1533 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1534 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1535 ; X86-NEXT: calll memcmp
1536 ; X86-NEXT: addl $12, %esp
1538 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 63) nounwind
1542 define i1 @length63_eq(ptr %x, ptr %y) nounwind {
1543 ; X86-LABEL: length63_eq:
1545 ; X86-NEXT: pushl $63
1546 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1547 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1548 ; X86-NEXT: calll memcmp
1549 ; X86-NEXT: addl $12, %esp
1550 ; X86-NEXT: testl %eax, %eax
1551 ; X86-NEXT: setne %al
1553 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 63) nounwind
1554 %cmp = icmp ne i32 %call, 0
1558 define i1 @length63_lt(ptr %x, ptr %y) nounwind {
1559 ; X86-LABEL: length63_lt:
1561 ; X86-NEXT: pushl $63
1562 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1563 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1564 ; X86-NEXT: calll memcmp
1565 ; X86-NEXT: addl $12, %esp
1566 ; X86-NEXT: shrl $31, %eax
1567 ; X86-NEXT: # kill: def $al killed $al killed $eax
1569 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 63) nounwind
1570 %cmp = icmp slt i32 %call, 0
1574 define i1 @length63_gt(ptr %x, ptr %y) nounwind {
1575 ; X86-LABEL: length63_gt:
1577 ; X86-NEXT: pushl $63
1578 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1579 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1580 ; X86-NEXT: calll memcmp
1581 ; X86-NEXT: addl $12, %esp
1582 ; X86-NEXT: testl %eax, %eax
1583 ; X86-NEXT: setg %al
1585 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 63) nounwind
1586 %cmp = icmp sgt i32 %call, 0
1590 define i1 @length63_eq_const(ptr %X) nounwind {
1591 ; X86-LABEL: length63_eq_const:
1593 ; X86-NEXT: pushl $63
1594 ; X86-NEXT: pushl $.L.str
1595 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1596 ; X86-NEXT: calll memcmp
1597 ; X86-NEXT: addl $12, %esp
1598 ; X86-NEXT: testl %eax, %eax
1599 ; X86-NEXT: sete %al
1601 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 63) nounwind
1602 %c = icmp eq i32 %m, 0
1606 define i32 @length64(ptr %X, ptr %Y) nounwind {
1607 ; X86-LABEL: length64:
1609 ; X86-NEXT: pushl $64
1610 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1611 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1612 ; X86-NEXT: calll memcmp
1613 ; X86-NEXT: addl $12, %esp
1615 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 64) nounwind
1619 define i1 @length64_eq(ptr %x, ptr %y) nounwind {
1620 ; X86-LABEL: length64_eq:
1622 ; X86-NEXT: pushl $64
1623 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1624 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1625 ; X86-NEXT: calll memcmp
1626 ; X86-NEXT: addl $12, %esp
1627 ; X86-NEXT: testl %eax, %eax
1628 ; X86-NEXT: setne %al
1630 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 64) nounwind
1631 %cmp = icmp ne i32 %call, 0
1635 define i1 @length64_lt(ptr %x, ptr %y) nounwind {
1636 ; X86-LABEL: length64_lt:
1638 ; X86-NEXT: pushl $64
1639 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1640 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1641 ; X86-NEXT: calll memcmp
1642 ; X86-NEXT: addl $12, %esp
1643 ; X86-NEXT: shrl $31, %eax
1644 ; X86-NEXT: # kill: def $al killed $al killed $eax
1646 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 64) nounwind
1647 %cmp = icmp slt i32 %call, 0
1651 define i1 @length64_gt(ptr %x, ptr %y) nounwind {
1652 ; X86-LABEL: length64_gt:
1654 ; X86-NEXT: pushl $64
1655 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1656 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1657 ; X86-NEXT: calll memcmp
1658 ; X86-NEXT: addl $12, %esp
1659 ; X86-NEXT: testl %eax, %eax
1660 ; X86-NEXT: setg %al
1662 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 64) nounwind
1663 %cmp = icmp sgt i32 %call, 0
1667 define i1 @length64_eq_const(ptr %X) nounwind {
1668 ; X86-LABEL: length64_eq_const:
1670 ; X86-NEXT: pushl $64
1671 ; X86-NEXT: pushl $.L.str
1672 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1673 ; X86-NEXT: calll memcmp
1674 ; X86-NEXT: addl $12, %esp
1675 ; X86-NEXT: testl %eax, %eax
1676 ; X86-NEXT: sete %al
1678 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 64) nounwind
1679 %c = icmp eq i32 %m, 0
1683 define i32 @length96(ptr %X, ptr %Y) nounwind {
1684 ; X86-LABEL: length96:
1686 ; X86-NEXT: pushl $96
1687 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1688 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1689 ; X86-NEXT: calll memcmp
1690 ; X86-NEXT: addl $12, %esp
1692 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 96) nounwind
1696 define i1 @length96_eq(ptr %x, ptr %y) nounwind {
1697 ; X86-LABEL: length96_eq:
1699 ; X86-NEXT: pushl $96
1700 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1701 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1702 ; X86-NEXT: calll memcmp
1703 ; X86-NEXT: addl $12, %esp
1704 ; X86-NEXT: testl %eax, %eax
1705 ; X86-NEXT: setne %al
1707 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 96) nounwind
1708 %cmp = icmp ne i32 %call, 0
1712 define i1 @length96_lt(ptr %x, ptr %y) nounwind {
1713 ; X86-LABEL: length96_lt:
1715 ; X86-NEXT: pushl $96
1716 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1717 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1718 ; X86-NEXT: calll memcmp
1719 ; X86-NEXT: addl $12, %esp
1720 ; X86-NEXT: shrl $31, %eax
1721 ; X86-NEXT: # kill: def $al killed $al killed $eax
1723 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 96) nounwind
1724 %cmp = icmp slt i32 %call, 0
1728 define i1 @length96_gt(ptr %x, ptr %y) nounwind {
1729 ; X86-LABEL: length96_gt:
1731 ; X86-NEXT: pushl $96
1732 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1733 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1734 ; X86-NEXT: calll memcmp
1735 ; X86-NEXT: addl $12, %esp
1736 ; X86-NEXT: testl %eax, %eax
1737 ; X86-NEXT: setg %al
1739 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 96) nounwind
1740 %cmp = icmp sgt i32 %call, 0
1744 define i1 @length96_eq_const(ptr %X) nounwind {
1745 ; X86-LABEL: length96_eq_const:
1747 ; X86-NEXT: pushl $96
1748 ; X86-NEXT: pushl $.L.str
1749 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1750 ; X86-NEXT: calll memcmp
1751 ; X86-NEXT: addl $12, %esp
1752 ; X86-NEXT: testl %eax, %eax
1753 ; X86-NEXT: sete %al
1755 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 96) nounwind
1756 %c = icmp eq i32 %m, 0
1760 define i32 @length127(ptr %X, ptr %Y) nounwind {
1761 ; X86-LABEL: length127:
1763 ; X86-NEXT: pushl $127
1764 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1765 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1766 ; X86-NEXT: calll memcmp
1767 ; X86-NEXT: addl $12, %esp
1769 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 127) nounwind
1773 define i1 @length127_eq(ptr %x, ptr %y) nounwind {
1774 ; X86-LABEL: length127_eq:
1776 ; X86-NEXT: pushl $127
1777 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1778 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1779 ; X86-NEXT: calll memcmp
1780 ; X86-NEXT: addl $12, %esp
1781 ; X86-NEXT: testl %eax, %eax
1782 ; X86-NEXT: setne %al
1784 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 127) nounwind
1785 %cmp = icmp ne i32 %call, 0
1789 define i1 @length127_lt(ptr %x, ptr %y) nounwind {
1790 ; X86-LABEL: length127_lt:
1792 ; X86-NEXT: pushl $127
1793 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1794 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1795 ; X86-NEXT: calll memcmp
1796 ; X86-NEXT: addl $12, %esp
1797 ; X86-NEXT: shrl $31, %eax
1798 ; X86-NEXT: # kill: def $al killed $al killed $eax
1800 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 127) nounwind
1801 %cmp = icmp slt i32 %call, 0
1805 define i1 @length127_gt(ptr %x, ptr %y) nounwind {
1806 ; X86-LABEL: length127_gt:
1808 ; X86-NEXT: pushl $127
1809 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1810 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1811 ; X86-NEXT: calll memcmp
1812 ; X86-NEXT: addl $12, %esp
1813 ; X86-NEXT: testl %eax, %eax
1814 ; X86-NEXT: setg %al
1816 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 127) nounwind
1817 %cmp = icmp sgt i32 %call, 0
1821 define i1 @length127_eq_const(ptr %X) nounwind {
1822 ; X86-LABEL: length127_eq_const:
1824 ; X86-NEXT: pushl $127
1825 ; X86-NEXT: pushl $.L.str
1826 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1827 ; X86-NEXT: calll memcmp
1828 ; X86-NEXT: addl $12, %esp
1829 ; X86-NEXT: testl %eax, %eax
1830 ; X86-NEXT: sete %al
1832 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 127) nounwind
1833 %c = icmp eq i32 %m, 0
1837 define i32 @length128(ptr %X, ptr %Y) nounwind {
1838 ; X86-LABEL: length128:
1840 ; X86-NEXT: pushl $128
1841 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1842 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1843 ; X86-NEXT: calll memcmp
1844 ; X86-NEXT: addl $12, %esp
1846 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 128) nounwind
1850 define i1 @length128_eq(ptr %x, ptr %y) nounwind {
1851 ; X86-LABEL: length128_eq:
1853 ; X86-NEXT: pushl $128
1854 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1855 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1856 ; X86-NEXT: calll memcmp
1857 ; X86-NEXT: addl $12, %esp
1858 ; X86-NEXT: testl %eax, %eax
1859 ; X86-NEXT: setne %al
1861 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 128) nounwind
1862 %cmp = icmp ne i32 %call, 0
1866 define i1 @length128_lt(ptr %x, ptr %y) nounwind {
1867 ; X86-LABEL: length128_lt:
1869 ; X86-NEXT: pushl $128
1870 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1871 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1872 ; X86-NEXT: calll memcmp
1873 ; X86-NEXT: addl $12, %esp
1874 ; X86-NEXT: shrl $31, %eax
1875 ; X86-NEXT: # kill: def $al killed $al killed $eax
1877 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 128) nounwind
1878 %cmp = icmp slt i32 %call, 0
1882 define i1 @length128_gt(ptr %x, ptr %y) nounwind {
1883 ; X86-LABEL: length128_gt:
1885 ; X86-NEXT: pushl $128
1886 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1887 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1888 ; X86-NEXT: calll memcmp
1889 ; X86-NEXT: addl $12, %esp
1890 ; X86-NEXT: testl %eax, %eax
1891 ; X86-NEXT: setg %al
1893 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 128) nounwind
1894 %cmp = icmp sgt i32 %call, 0
1898 define i1 @length128_eq_const(ptr %X) nounwind {
1899 ; X86-LABEL: length128_eq_const:
1901 ; X86-NEXT: pushl $128
1902 ; X86-NEXT: pushl $.L.str
1903 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1904 ; X86-NEXT: calll memcmp
1905 ; X86-NEXT: addl $12, %esp
1906 ; X86-NEXT: testl %eax, %eax
1907 ; X86-NEXT: sete %al
1909 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 128) nounwind
1910 %c = icmp eq i32 %m, 0
1914 define i32 @length192(ptr %X, ptr %Y) nounwind {
1915 ; X86-LABEL: length192:
1917 ; X86-NEXT: pushl $192
1918 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1919 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1920 ; X86-NEXT: calll memcmp
1921 ; X86-NEXT: addl $12, %esp
1923 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 192) nounwind
1927 define i1 @length192_eq(ptr %x, ptr %y) nounwind {
1928 ; X86-LABEL: length192_eq:
1930 ; X86-NEXT: pushl $192
1931 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1932 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1933 ; X86-NEXT: calll memcmp
1934 ; X86-NEXT: addl $12, %esp
1935 ; X86-NEXT: testl %eax, %eax
1936 ; X86-NEXT: setne %al
1938 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 192) nounwind
1939 %cmp = icmp ne i32 %call, 0
1943 define i1 @length192_lt(ptr %x, ptr %y) nounwind {
1944 ; X86-LABEL: length192_lt:
1946 ; X86-NEXT: pushl $192
1947 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1948 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1949 ; X86-NEXT: calll memcmp
1950 ; X86-NEXT: addl $12, %esp
1951 ; X86-NEXT: shrl $31, %eax
1952 ; X86-NEXT: # kill: def $al killed $al killed $eax
1954 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 192) nounwind
1955 %cmp = icmp slt i32 %call, 0
1959 define i1 @length192_gt(ptr %x, ptr %y) nounwind {
1960 ; X86-LABEL: length192_gt:
1962 ; X86-NEXT: pushl $192
1963 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1964 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1965 ; X86-NEXT: calll memcmp
1966 ; X86-NEXT: addl $12, %esp
1967 ; X86-NEXT: testl %eax, %eax
1968 ; X86-NEXT: setg %al
1970 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 192) nounwind
1971 %cmp = icmp sgt i32 %call, 0
1975 define i1 @length192_eq_const(ptr %X) nounwind {
1976 ; X86-LABEL: length192_eq_const:
1978 ; X86-NEXT: pushl $192
1979 ; X86-NEXT: pushl $.L.str
1980 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1981 ; X86-NEXT: calll memcmp
1982 ; X86-NEXT: addl $12, %esp
1983 ; X86-NEXT: testl %eax, %eax
1984 ; X86-NEXT: sete %al
1986 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 192) nounwind
1987 %c = icmp eq i32 %m, 0
1991 define i32 @length255(ptr %X, ptr %Y) nounwind {
1992 ; X86-LABEL: length255:
1994 ; X86-NEXT: pushl $255
1995 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1996 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1997 ; X86-NEXT: calll memcmp
1998 ; X86-NEXT: addl $12, %esp
2000 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 255) nounwind
2004 define i1 @length255_eq(ptr %x, ptr %y) nounwind {
2005 ; X86-LABEL: length255_eq:
2007 ; X86-NEXT: pushl $255
2008 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2009 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2010 ; X86-NEXT: calll memcmp
2011 ; X86-NEXT: addl $12, %esp
2012 ; X86-NEXT: testl %eax, %eax
2013 ; X86-NEXT: setne %al
2015 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 255) nounwind
2016 %cmp = icmp ne i32 %call, 0
2020 define i1 @length255_lt(ptr %x, ptr %y) nounwind {
2021 ; X86-LABEL: length255_lt:
2023 ; X86-NEXT: pushl $255
2024 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2025 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2026 ; X86-NEXT: calll memcmp
2027 ; X86-NEXT: addl $12, %esp
2028 ; X86-NEXT: shrl $31, %eax
2029 ; X86-NEXT: # kill: def $al killed $al killed $eax
2031 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 255) nounwind
2032 %cmp = icmp slt i32 %call, 0
2036 define i1 @length255_gt(ptr %x, ptr %y) nounwind {
2037 ; X86-LABEL: length255_gt:
2039 ; X86-NEXT: pushl $255
2040 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2041 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2042 ; X86-NEXT: calll memcmp
2043 ; X86-NEXT: addl $12, %esp
2044 ; X86-NEXT: testl %eax, %eax
2045 ; X86-NEXT: setg %al
2047 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 255) nounwind
2048 %cmp = icmp sgt i32 %call, 0
2052 define i1 @length255_eq_const(ptr %X) nounwind {
2053 ; X86-LABEL: length255_eq_const:
2055 ; X86-NEXT: pushl $255
2056 ; X86-NEXT: pushl $.L.str
2057 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2058 ; X86-NEXT: calll memcmp
2059 ; X86-NEXT: addl $12, %esp
2060 ; X86-NEXT: testl %eax, %eax
2061 ; X86-NEXT: sete %al
2063 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 255) nounwind
2064 %c = icmp eq i32 %m, 0
2068 define i32 @length256(ptr %X, ptr %Y) nounwind {
2069 ; X86-LABEL: length256:
2071 ; X86-NEXT: pushl $256 # imm = 0x100
2072 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2073 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2074 ; X86-NEXT: calll memcmp
2075 ; X86-NEXT: addl $12, %esp
2077 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 256) nounwind
2081 define i1 @length256_eq(ptr %x, ptr %y) nounwind {
2082 ; X86-LABEL: length256_eq:
2084 ; X86-NEXT: pushl $256 # imm = 0x100
2085 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2086 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2087 ; X86-NEXT: calll memcmp
2088 ; X86-NEXT: addl $12, %esp
2089 ; X86-NEXT: testl %eax, %eax
2090 ; X86-NEXT: setne %al
2092 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 256) nounwind
2093 %cmp = icmp ne i32 %call, 0
2097 define i1 @length256_lt(ptr %x, ptr %y) nounwind {
2098 ; X86-LABEL: length256_lt:
2100 ; X86-NEXT: pushl $256 # imm = 0x100
2101 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2102 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2103 ; X86-NEXT: calll memcmp
2104 ; X86-NEXT: addl $12, %esp
2105 ; X86-NEXT: shrl $31, %eax
2106 ; X86-NEXT: # kill: def $al killed $al killed $eax
2108 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 256) nounwind
2109 %cmp = icmp slt i32 %call, 0
2113 define i1 @length256_gt(ptr %x, ptr %y) nounwind {
2114 ; X86-LABEL: length256_gt:
2116 ; X86-NEXT: pushl $256 # imm = 0x100
2117 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2118 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2119 ; X86-NEXT: calll memcmp
2120 ; X86-NEXT: addl $12, %esp
2121 ; X86-NEXT: testl %eax, %eax
2122 ; X86-NEXT: setg %al
2124 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 256) nounwind
2125 %cmp = icmp sgt i32 %call, 0
2129 define i1 @length256_eq_const(ptr %X) nounwind {
2130 ; X86-LABEL: length256_eq_const:
2132 ; X86-NEXT: pushl $256 # imm = 0x100
2133 ; X86-NEXT: pushl $.L.str
2134 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2135 ; X86-NEXT: calll memcmp
2136 ; X86-NEXT: addl $12, %esp
2137 ; X86-NEXT: testl %eax, %eax
2138 ; X86-NEXT: sete %al
2140 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 256) nounwind
2141 %c = icmp eq i32 %m, 0
2145 define i32 @length384(ptr %X, ptr %Y) nounwind {
2146 ; X86-LABEL: length384:
2148 ; X86-NEXT: pushl $384 # imm = 0x180
2149 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2150 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2151 ; X86-NEXT: calll memcmp
2152 ; X86-NEXT: addl $12, %esp
2154 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 384) nounwind
2158 define i1 @length384_eq(ptr %x, ptr %y) nounwind {
2159 ; X86-LABEL: length384_eq:
2161 ; X86-NEXT: pushl $384 # imm = 0x180
2162 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2163 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2164 ; X86-NEXT: calll memcmp
2165 ; X86-NEXT: addl $12, %esp
2166 ; X86-NEXT: testl %eax, %eax
2167 ; X86-NEXT: setne %al
2169 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 384) nounwind
2170 %cmp = icmp ne i32 %call, 0
2174 define i1 @length384_lt(ptr %x, ptr %y) nounwind {
2175 ; X86-LABEL: length384_lt:
2177 ; X86-NEXT: pushl $384 # imm = 0x180
2178 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2179 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2180 ; X86-NEXT: calll memcmp
2181 ; X86-NEXT: addl $12, %esp
2182 ; X86-NEXT: shrl $31, %eax
2183 ; X86-NEXT: # kill: def $al killed $al killed $eax
2185 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 384) nounwind
2186 %cmp = icmp slt i32 %call, 0
2190 define i1 @length384_gt(ptr %x, ptr %y) nounwind {
2191 ; X86-LABEL: length384_gt:
2193 ; X86-NEXT: pushl $384 # imm = 0x180
2194 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2195 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2196 ; X86-NEXT: calll memcmp
2197 ; X86-NEXT: addl $12, %esp
2198 ; X86-NEXT: testl %eax, %eax
2199 ; X86-NEXT: setg %al
2201 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 384) nounwind
2202 %cmp = icmp sgt i32 %call, 0
2206 define i1 @length384_eq_const(ptr %X) nounwind {
2207 ; X86-LABEL: length384_eq_const:
2209 ; X86-NEXT: pushl $384 # imm = 0x180
2210 ; X86-NEXT: pushl $.L.str
2211 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2212 ; X86-NEXT: calll memcmp
2213 ; X86-NEXT: addl $12, %esp
2214 ; X86-NEXT: testl %eax, %eax
2215 ; X86-NEXT: sete %al
2217 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 384) nounwind
2218 %c = icmp eq i32 %m, 0
2222 define i32 @length511(ptr %X, ptr %Y) nounwind {
2223 ; X86-LABEL: length511:
2225 ; X86-NEXT: pushl $511 # imm = 0x1FF
2226 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2227 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2228 ; X86-NEXT: calll memcmp
2229 ; X86-NEXT: addl $12, %esp
2231 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 511) nounwind
2235 define i1 @length511_eq(ptr %x, ptr %y) nounwind {
2236 ; X86-LABEL: length511_eq:
2238 ; X86-NEXT: pushl $511 # imm = 0x1FF
2239 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2240 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2241 ; X86-NEXT: calll memcmp
2242 ; X86-NEXT: addl $12, %esp
2243 ; X86-NEXT: testl %eax, %eax
2244 ; X86-NEXT: setne %al
2246 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 511) nounwind
2247 %cmp = icmp ne i32 %call, 0
2251 define i1 @length511_lt(ptr %x, ptr %y) nounwind {
2252 ; X86-LABEL: length511_lt:
2254 ; X86-NEXT: pushl $511 # imm = 0x1FF
2255 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2256 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2257 ; X86-NEXT: calll memcmp
2258 ; X86-NEXT: addl $12, %esp
2259 ; X86-NEXT: shrl $31, %eax
2260 ; X86-NEXT: # kill: def $al killed $al killed $eax
2262 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 511) nounwind
2263 %cmp = icmp slt i32 %call, 0
2267 define i1 @length511_gt(ptr %x, ptr %y) nounwind {
2268 ; X86-LABEL: length511_gt:
2270 ; X86-NEXT: pushl $511 # imm = 0x1FF
2271 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2272 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2273 ; X86-NEXT: calll memcmp
2274 ; X86-NEXT: addl $12, %esp
2275 ; X86-NEXT: testl %eax, %eax
2276 ; X86-NEXT: setg %al
2278 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 511) nounwind
2279 %cmp = icmp sgt i32 %call, 0
2283 define i1 @length511_eq_const(ptr %X) nounwind {
2284 ; X86-LABEL: length511_eq_const:
2286 ; X86-NEXT: pushl $511 # imm = 0x1FF
2287 ; X86-NEXT: pushl $.L.str
2288 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2289 ; X86-NEXT: calll memcmp
2290 ; X86-NEXT: addl $12, %esp
2291 ; X86-NEXT: testl %eax, %eax
2292 ; X86-NEXT: sete %al
2294 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 511) nounwind
2295 %c = icmp eq i32 %m, 0
2299 define i32 @length512(ptr %X, ptr %Y) nounwind {
2300 ; X86-LABEL: length512:
2302 ; X86-NEXT: pushl $512 # imm = 0x200
2303 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2304 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2305 ; X86-NEXT: calll memcmp
2306 ; X86-NEXT: addl $12, %esp
2308 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 512) nounwind
2312 define i1 @length512_eq(ptr %x, ptr %y) nounwind {
2313 ; X86-LABEL: length512_eq:
2315 ; X86-NEXT: pushl $512 # imm = 0x200
2316 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2317 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2318 ; X86-NEXT: calll memcmp
2319 ; X86-NEXT: addl $12, %esp
2320 ; X86-NEXT: testl %eax, %eax
2321 ; X86-NEXT: setne %al
2323 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 512) nounwind
2324 %cmp = icmp ne i32 %call, 0
2328 define i1 @length512_lt(ptr %x, ptr %y) nounwind {
2329 ; X86-LABEL: length512_lt:
2331 ; X86-NEXT: pushl $512 # imm = 0x200
2332 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2333 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2334 ; X86-NEXT: calll memcmp
2335 ; X86-NEXT: addl $12, %esp
2336 ; X86-NEXT: shrl $31, %eax
2337 ; X86-NEXT: # kill: def $al killed $al killed $eax
2339 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 512) nounwind
2340 %cmp = icmp slt i32 %call, 0
2344 define i1 @length512_gt(ptr %x, ptr %y) nounwind {
2345 ; X86-LABEL: length512_gt:
2347 ; X86-NEXT: pushl $512 # imm = 0x200
2348 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2349 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2350 ; X86-NEXT: calll memcmp
2351 ; X86-NEXT: addl $12, %esp
2352 ; X86-NEXT: testl %eax, %eax
2353 ; X86-NEXT: setg %al
2355 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 512) nounwind
2356 %cmp = icmp sgt i32 %call, 0
2360 define i1 @length512_eq_const(ptr %X) nounwind {
2361 ; X86-LABEL: length512_eq_const:
2363 ; X86-NEXT: pushl $512 # imm = 0x200
2364 ; X86-NEXT: pushl $.L.str
2365 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2366 ; X86-NEXT: calll memcmp
2367 ; X86-NEXT: addl $12, %esp
2368 ; X86-NEXT: testl %eax, %eax
2369 ; X86-NEXT: sete %al
2371 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 512) nounwind
2372 %c = icmp eq i32 %m, 0
2376 ; This checks that we do not do stupid things with huge sizes.
2377 define i32 @huge_length(ptr %X, ptr %Y) nounwind {
2378 ; X86-LABEL: huge_length:
2380 ; X86-NEXT: pushl $-1
2381 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2382 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2383 ; X86-NEXT: calll memcmp
2384 ; X86-NEXT: addl $12, %esp
2386 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 9223372036854775807) nounwind
2390 define i1 @huge_length_eq(ptr %X, ptr %Y) nounwind {
2391 ; X86-LABEL: huge_length_eq:
2393 ; X86-NEXT: pushl $-1
2394 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2395 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2396 ; X86-NEXT: calll memcmp
2397 ; X86-NEXT: addl $12, %esp
2398 ; X86-NEXT: testl %eax, %eax
2399 ; X86-NEXT: sete %al
2401 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 9223372036854775807) nounwind
2402 %c = icmp eq i32 %m, 0
2406 ; This checks non-constant sizes.
2407 define i32 @nonconst_length(ptr %X, ptr %Y, i32 %size) nounwind {
2408 ; X86-LABEL: nonconst_length:
2410 ; X86-NEXT: jmp memcmp # TAILCALL
2411 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 %size) nounwind
2415 define i1 @nonconst_length_eq(ptr %X, ptr %Y, i32 %size) nounwind {
2416 ; X86-LABEL: nonconst_length_eq:
2418 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2419 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2420 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2421 ; X86-NEXT: calll memcmp
2422 ; X86-NEXT: addl $12, %esp
2423 ; X86-NEXT: testl %eax, %eax
2424 ; X86-NEXT: sete %al
2426 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 %size) nounwind
2427 %c = icmp eq i32 %m, 0