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: setae %al
192 ; X86-NEXT: movzbl %al, %eax
193 ; X86-NEXT: leal -1(%eax,%eax), %eax
194 ; X86-NEXT: popl %esi
196 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 3) nounwind
200 define i1 @length3_eq(ptr %X, ptr %Y) nounwind {
201 ; X86-LABEL: length3_eq:
203 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
204 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
205 ; X86-NEXT: movzwl (%ecx), %edx
206 ; X86-NEXT: xorw (%eax), %dx
207 ; X86-NEXT: movzbl 2(%ecx), %ecx
208 ; X86-NEXT: xorb 2(%eax), %cl
209 ; X86-NEXT: movzbl %cl, %eax
210 ; X86-NEXT: orw %dx, %ax
211 ; X86-NEXT: setne %al
213 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 3) nounwind
214 %c = icmp ne i32 %m, 0
218 define i32 @length4(ptr %X, ptr %Y) nounwind {
219 ; X86-LABEL: length4:
221 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
222 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
223 ; X86-NEXT: movl (%ecx), %ecx
224 ; X86-NEXT: movl (%eax), %edx
225 ; X86-NEXT: bswapl %ecx
226 ; X86-NEXT: bswapl %edx
227 ; X86-NEXT: xorl %eax, %eax
228 ; X86-NEXT: cmpl %edx, %ecx
230 ; X86-NEXT: sbbl $0, %eax
232 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 4) nounwind
236 define i1 @length4_eq(ptr %X, ptr %Y) nounwind {
237 ; X86-LABEL: length4_eq:
239 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
240 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
241 ; X86-NEXT: movl (%ecx), %ecx
242 ; X86-NEXT: cmpl (%eax), %ecx
243 ; X86-NEXT: setne %al
245 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 4) nounwind
246 %c = icmp ne i32 %m, 0
250 define i1 @length4_lt(ptr %X, ptr %Y) nounwind {
251 ; X86-LABEL: length4_lt:
253 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
254 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
255 ; X86-NEXT: movl (%ecx), %ecx
256 ; X86-NEXT: movl (%eax), %edx
257 ; X86-NEXT: bswapl %ecx
258 ; X86-NEXT: bswapl %edx
259 ; X86-NEXT: xorl %eax, %eax
260 ; X86-NEXT: cmpl %edx, %ecx
262 ; X86-NEXT: sbbl $0, %eax
263 ; X86-NEXT: shrl $31, %eax
264 ; X86-NEXT: # kill: def $al killed $al killed $eax
266 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 4) nounwind
267 %c = icmp slt i32 %m, 0
271 define i1 @length4_gt(ptr %X, ptr %Y) nounwind {
272 ; X86-LABEL: length4_gt:
274 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
275 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
276 ; X86-NEXT: movl (%ecx), %ecx
277 ; X86-NEXT: movl (%eax), %eax
278 ; X86-NEXT: bswapl %ecx
279 ; X86-NEXT: bswapl %eax
280 ; X86-NEXT: xorl %edx, %edx
281 ; X86-NEXT: cmpl %eax, %ecx
283 ; X86-NEXT: sbbl $0, %edx
284 ; X86-NEXT: testl %edx, %edx
287 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 4) nounwind
288 %c = icmp sgt i32 %m, 0
292 define i1 @length4_eq_const(ptr %X) nounwind {
293 ; X86-LABEL: length4_eq_const:
295 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
296 ; X86-NEXT: cmpl $875770417, (%eax) # imm = 0x34333231
299 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i32 4) nounwind
300 %c = icmp eq i32 %m, 0
304 define i32 @length5(ptr %X, ptr %Y) nounwind {
305 ; X86-LABEL: length5:
307 ; X86-NEXT: pushl %esi
308 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
309 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
310 ; X86-NEXT: movl (%eax), %edx
311 ; X86-NEXT: movl (%ecx), %esi
312 ; X86-NEXT: bswapl %edx
313 ; X86-NEXT: bswapl %esi
314 ; X86-NEXT: cmpl %esi, %edx
315 ; X86-NEXT: jne .LBB18_3
316 ; X86-NEXT: # %bb.1: # %loadbb1
317 ; X86-NEXT: movzbl 4(%eax), %eax
318 ; X86-NEXT: movzbl 4(%ecx), %ecx
319 ; X86-NEXT: subl %ecx, %eax
320 ; X86-NEXT: popl %esi
322 ; X86-NEXT: .LBB18_3: # %res_block
323 ; X86-NEXT: setae %al
324 ; X86-NEXT: movzbl %al, %eax
325 ; X86-NEXT: leal -1(%eax,%eax), %eax
326 ; X86-NEXT: popl %esi
328 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 5) nounwind
332 define i1 @length5_eq(ptr %X, ptr %Y) nounwind {
333 ; X86-LABEL: length5_eq:
335 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
336 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
337 ; X86-NEXT: movl (%ecx), %edx
338 ; X86-NEXT: xorl (%eax), %edx
339 ; X86-NEXT: movzbl 4(%ecx), %ecx
340 ; X86-NEXT: xorb 4(%eax), %cl
341 ; X86-NEXT: movzbl %cl, %eax
342 ; X86-NEXT: orl %edx, %eax
343 ; X86-NEXT: setne %al
345 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 5) nounwind
346 %c = icmp ne i32 %m, 0
350 define i1 @length5_lt(ptr %X, ptr %Y) nounwind {
351 ; X86-LABEL: length5_lt:
353 ; X86-NEXT: pushl %esi
354 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
355 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
356 ; X86-NEXT: movl (%eax), %edx
357 ; X86-NEXT: movl (%ecx), %esi
358 ; X86-NEXT: bswapl %edx
359 ; X86-NEXT: bswapl %esi
360 ; X86-NEXT: cmpl %esi, %edx
361 ; X86-NEXT: jne .LBB20_3
362 ; X86-NEXT: # %bb.1: # %loadbb1
363 ; X86-NEXT: movzbl 4(%eax), %eax
364 ; X86-NEXT: movzbl 4(%ecx), %ecx
365 ; X86-NEXT: subl %ecx, %eax
366 ; X86-NEXT: jmp .LBB20_2
367 ; X86-NEXT: .LBB20_3: # %res_block
368 ; X86-NEXT: setae %al
369 ; X86-NEXT: movzbl %al, %eax
370 ; X86-NEXT: leal -1(%eax,%eax), %eax
371 ; X86-NEXT: .LBB20_2: # %endblock
372 ; X86-NEXT: shrl $31, %eax
373 ; X86-NEXT: # kill: def $al killed $al killed $eax
374 ; X86-NEXT: popl %esi
376 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 5) nounwind
377 %c = icmp slt i32 %m, 0
381 define i32 @length7(ptr %X, ptr %Y) nounwind {
382 ; X86-LABEL: length7:
384 ; X86-NEXT: pushl %esi
385 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
386 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
387 ; X86-NEXT: movl (%esi), %ecx
388 ; X86-NEXT: movl (%eax), %edx
389 ; X86-NEXT: bswapl %ecx
390 ; X86-NEXT: bswapl %edx
391 ; X86-NEXT: cmpl %edx, %ecx
392 ; X86-NEXT: jne .LBB21_2
393 ; X86-NEXT: # %bb.1: # %loadbb1
394 ; X86-NEXT: movl 3(%esi), %ecx
395 ; X86-NEXT: movl 3(%eax), %edx
396 ; X86-NEXT: bswapl %ecx
397 ; X86-NEXT: bswapl %edx
398 ; X86-NEXT: xorl %eax, %eax
399 ; X86-NEXT: cmpl %edx, %ecx
400 ; X86-NEXT: je .LBB21_3
401 ; X86-NEXT: .LBB21_2: # %res_block
402 ; X86-NEXT: xorl %eax, %eax
403 ; X86-NEXT: cmpl %edx, %ecx
404 ; X86-NEXT: setae %al
405 ; X86-NEXT: leal -1(%eax,%eax), %eax
406 ; X86-NEXT: .LBB21_3: # %endblock
407 ; X86-NEXT: popl %esi
409 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 7) nounwind
413 define i1 @length7_lt(ptr %X, ptr %Y) nounwind {
414 ; X86-LABEL: length7_lt:
416 ; X86-NEXT: pushl %esi
417 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
418 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
419 ; X86-NEXT: movl (%esi), %ecx
420 ; X86-NEXT: movl (%eax), %edx
421 ; X86-NEXT: bswapl %ecx
422 ; X86-NEXT: bswapl %edx
423 ; X86-NEXT: cmpl %edx, %ecx
424 ; X86-NEXT: jne .LBB22_2
425 ; X86-NEXT: # %bb.1: # %loadbb1
426 ; X86-NEXT: movl 3(%esi), %ecx
427 ; X86-NEXT: movl 3(%eax), %edx
428 ; X86-NEXT: bswapl %ecx
429 ; X86-NEXT: bswapl %edx
430 ; X86-NEXT: xorl %eax, %eax
431 ; X86-NEXT: cmpl %edx, %ecx
432 ; X86-NEXT: je .LBB22_3
433 ; X86-NEXT: .LBB22_2: # %res_block
434 ; X86-NEXT: xorl %eax, %eax
435 ; X86-NEXT: cmpl %edx, %ecx
436 ; X86-NEXT: setae %al
437 ; X86-NEXT: leal -1(%eax,%eax), %eax
438 ; X86-NEXT: .LBB22_3: # %endblock
439 ; X86-NEXT: shrl $31, %eax
440 ; X86-NEXT: # kill: def $al killed $al killed $eax
441 ; X86-NEXT: popl %esi
443 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 7) nounwind
444 %c = icmp slt i32 %m, 0
448 define i1 @length7_eq(ptr %X, ptr %Y) nounwind {
449 ; X86-LABEL: length7_eq:
451 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
452 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
453 ; X86-NEXT: movl (%ecx), %edx
454 ; X86-NEXT: movl 3(%ecx), %ecx
455 ; X86-NEXT: xorl (%eax), %edx
456 ; X86-NEXT: xorl 3(%eax), %ecx
457 ; X86-NEXT: orl %edx, %ecx
458 ; X86-NEXT: setne %al
460 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 7) nounwind
461 %c = icmp ne i32 %m, 0
465 define i32 @length8(ptr %X, ptr %Y) nounwind {
466 ; X86-LABEL: length8:
468 ; X86-NEXT: pushl %esi
469 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
470 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
471 ; X86-NEXT: movl (%esi), %ecx
472 ; X86-NEXT: movl (%eax), %edx
473 ; X86-NEXT: bswapl %ecx
474 ; X86-NEXT: bswapl %edx
475 ; X86-NEXT: cmpl %edx, %ecx
476 ; X86-NEXT: jne .LBB24_2
477 ; X86-NEXT: # %bb.1: # %loadbb1
478 ; X86-NEXT: movl 4(%esi), %ecx
479 ; X86-NEXT: movl 4(%eax), %edx
480 ; X86-NEXT: bswapl %ecx
481 ; X86-NEXT: bswapl %edx
482 ; X86-NEXT: xorl %eax, %eax
483 ; X86-NEXT: cmpl %edx, %ecx
484 ; X86-NEXT: je .LBB24_3
485 ; X86-NEXT: .LBB24_2: # %res_block
486 ; X86-NEXT: xorl %eax, %eax
487 ; X86-NEXT: cmpl %edx, %ecx
488 ; X86-NEXT: setae %al
489 ; X86-NEXT: leal -1(%eax,%eax), %eax
490 ; X86-NEXT: .LBB24_3: # %endblock
491 ; X86-NEXT: popl %esi
493 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 8) nounwind
497 define i1 @length8_eq(ptr %X, ptr %Y) nounwind {
498 ; X86-LABEL: length8_eq:
500 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
501 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
502 ; X86-NEXT: movl (%ecx), %edx
503 ; X86-NEXT: movl 4(%ecx), %ecx
504 ; X86-NEXT: xorl (%eax), %edx
505 ; X86-NEXT: xorl 4(%eax), %ecx
506 ; X86-NEXT: orl %edx, %ecx
509 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 8) nounwind
510 %c = icmp eq i32 %m, 0
514 define i1 @length8_eq_const(ptr %X) nounwind {
515 ; X86-LABEL: length8_eq_const:
517 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
518 ; X86-NEXT: movl $858927408, %ecx # imm = 0x33323130
519 ; X86-NEXT: xorl (%eax), %ecx
520 ; X86-NEXT: movl $926299444, %edx # imm = 0x37363534
521 ; X86-NEXT: xorl 4(%eax), %edx
522 ; X86-NEXT: orl %ecx, %edx
523 ; X86-NEXT: setne %al
525 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 8) nounwind
526 %c = icmp ne i32 %m, 0
530 define i1 @length9_eq(ptr %X, ptr %Y) nounwind {
531 ; X86-LABEL: length9_eq:
534 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
535 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
536 ; X86-NEXT: calll memcmp
537 ; X86-NEXT: addl $12, %esp
538 ; X86-NEXT: testl %eax, %eax
541 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 9) nounwind
542 %c = icmp eq i32 %m, 0
546 define i1 @length10_eq(ptr %X, ptr %Y) nounwind {
547 ; X86-LABEL: length10_eq:
549 ; X86-NEXT: pushl $10
550 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
551 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
552 ; X86-NEXT: calll memcmp
553 ; X86-NEXT: addl $12, %esp
554 ; X86-NEXT: testl %eax, %eax
557 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 10) nounwind
558 %c = icmp eq i32 %m, 0
562 define i1 @length11_eq(ptr %X, ptr %Y) nounwind {
563 ; X86-LABEL: length11_eq:
565 ; X86-NEXT: pushl $11
566 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
567 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
568 ; X86-NEXT: calll memcmp
569 ; X86-NEXT: addl $12, %esp
570 ; X86-NEXT: testl %eax, %eax
573 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 11) nounwind
574 %c = icmp eq i32 %m, 0
578 define i1 @length12_eq(ptr %X, ptr %Y) nounwind {
579 ; X86-LABEL: length12_eq:
581 ; X86-NEXT: pushl $12
582 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
583 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
584 ; X86-NEXT: calll memcmp
585 ; X86-NEXT: addl $12, %esp
586 ; X86-NEXT: testl %eax, %eax
587 ; X86-NEXT: setne %al
589 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 12) nounwind
590 %c = icmp ne i32 %m, 0
594 define i32 @length12(ptr %X, ptr %Y) nounwind {
595 ; X86-LABEL: length12:
597 ; X86-NEXT: pushl $12
598 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
599 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
600 ; X86-NEXT: calll memcmp
601 ; X86-NEXT: addl $12, %esp
603 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 12) nounwind
607 define i1 @length13_eq(ptr %X, ptr %Y) nounwind {
608 ; X86-LABEL: length13_eq:
610 ; X86-NEXT: pushl $13
611 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
612 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
613 ; X86-NEXT: calll memcmp
614 ; X86-NEXT: addl $12, %esp
615 ; X86-NEXT: testl %eax, %eax
618 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 13) nounwind
619 %c = icmp eq i32 %m, 0
623 define i1 @length14_eq(ptr %X, ptr %Y) nounwind {
624 ; X86-LABEL: length14_eq:
626 ; X86-NEXT: pushl $14
627 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
628 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
629 ; X86-NEXT: calll memcmp
630 ; X86-NEXT: addl $12, %esp
631 ; X86-NEXT: testl %eax, %eax
634 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 14) nounwind
635 %c = icmp eq i32 %m, 0
639 define i32 @length15(ptr %X, ptr %Y) nounwind {
640 ; X86-LABEL: length15:
642 ; X86-NEXT: pushl $15
643 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
644 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
645 ; X86-NEXT: calll memcmp
646 ; X86-NEXT: addl $12, %esp
648 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 15) nounwind
652 define i1 @length15_lt(ptr %X, ptr %Y) nounwind {
653 ; X86-LABEL: length15_lt:
655 ; X86-NEXT: pushl $15
656 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
657 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
658 ; X86-NEXT: calll memcmp
659 ; X86-NEXT: addl $12, %esp
660 ; X86-NEXT: shrl $31, %eax
661 ; X86-NEXT: # kill: def $al killed $al killed $eax
663 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 15) nounwind
664 %c = icmp slt i32 %m, 0
668 define i32 @length15_const(ptr %X, ptr %Y) nounwind {
669 ; X86-LABEL: length15_const:
671 ; X86-NEXT: pushl $15
672 ; X86-NEXT: pushl $.L.str+1
673 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
674 ; X86-NEXT: calll memcmp
675 ; X86-NEXT: addl $12, %esp
677 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i32 15) nounwind
681 define i1 @length15_eq(ptr %X, ptr %Y) nounwind {
682 ; X86-LABEL: length15_eq:
684 ; X86-NEXT: pushl $15
685 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
686 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
687 ; X86-NEXT: calll memcmp
688 ; X86-NEXT: addl $12, %esp
689 ; X86-NEXT: testl %eax, %eax
692 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 15) nounwind
693 %c = icmp eq i32 %m, 0
697 define i1 @length15_gt_const(ptr %X, ptr %Y) nounwind {
698 ; X86-LABEL: length15_gt_const:
700 ; X86-NEXT: pushl $15
701 ; X86-NEXT: pushl $.L.str+1
702 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
703 ; X86-NEXT: calll memcmp
704 ; X86-NEXT: addl $12, %esp
705 ; X86-NEXT: testl %eax, %eax
708 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i32 15) nounwind
709 %c = icmp sgt i32 %m, 0
713 ; PR33329 - https://bugs.llvm.org/show_bug.cgi?id=33329
715 define i32 @length16(ptr %X, ptr %Y) nounwind {
716 ; X86-LABEL: length16:
718 ; X86-NEXT: pushl $16
719 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
720 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
721 ; X86-NEXT: calll memcmp
722 ; X86-NEXT: addl $12, %esp
724 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 16) nounwind
728 define i1 @length16_eq(ptr %x, ptr %y) nounwind {
729 ; X86-NOSSE-LABEL: length16_eq:
730 ; X86-NOSSE: # %bb.0:
731 ; X86-NOSSE-NEXT: pushl $16
732 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
733 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
734 ; X86-NOSSE-NEXT: calll memcmp
735 ; X86-NOSSE-NEXT: addl $12, %esp
736 ; X86-NOSSE-NEXT: testl %eax, %eax
737 ; X86-NOSSE-NEXT: setne %al
738 ; X86-NOSSE-NEXT: retl
740 ; X86-SSE1-LABEL: length16_eq:
742 ; X86-SSE1-NEXT: pushl $16
743 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
744 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
745 ; X86-SSE1-NEXT: calll memcmp
746 ; X86-SSE1-NEXT: addl $12, %esp
747 ; X86-SSE1-NEXT: testl %eax, %eax
748 ; X86-SSE1-NEXT: setne %al
749 ; X86-SSE1-NEXT: retl
751 ; X86-SSE2-LABEL: length16_eq:
753 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
754 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
755 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
756 ; X86-SSE2-NEXT: movdqu (%eax), %xmm1
757 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm1
758 ; X86-SSE2-NEXT: pmovmskb %xmm1, %eax
759 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
760 ; X86-SSE2-NEXT: setne %al
761 ; X86-SSE2-NEXT: retl
763 ; X86-SSE41-LABEL: length16_eq:
764 ; X86-SSE41: # %bb.0:
765 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
766 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
767 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
768 ; X86-SSE41-NEXT: movdqu (%eax), %xmm1
769 ; X86-SSE41-NEXT: pxor %xmm0, %xmm1
770 ; X86-SSE41-NEXT: ptest %xmm1, %xmm1
771 ; X86-SSE41-NEXT: setne %al
772 ; X86-SSE41-NEXT: retl
773 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 16) nounwind
774 %cmp = icmp ne i32 %call, 0
778 define i1 @length16_lt(ptr %x, ptr %y) nounwind {
779 ; X86-LABEL: length16_lt:
781 ; X86-NEXT: pushl $16
782 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
783 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
784 ; X86-NEXT: calll memcmp
785 ; X86-NEXT: addl $12, %esp
786 ; X86-NEXT: shrl $31, %eax
787 ; X86-NEXT: # kill: def $al killed $al killed $eax
789 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 16) nounwind
790 %cmp = icmp slt i32 %call, 0
794 define i1 @length16_gt(ptr %x, ptr %y) nounwind {
795 ; X86-LABEL: length16_gt:
797 ; X86-NEXT: pushl $16
798 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
799 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
800 ; X86-NEXT: calll memcmp
801 ; X86-NEXT: addl $12, %esp
802 ; X86-NEXT: testl %eax, %eax
805 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 16) nounwind
806 %cmp = icmp sgt i32 %call, 0
810 define i1 @length16_eq_const(ptr %X) nounwind {
811 ; X86-NOSSE-LABEL: length16_eq_const:
812 ; X86-NOSSE: # %bb.0:
813 ; X86-NOSSE-NEXT: pushl $16
814 ; X86-NOSSE-NEXT: pushl $.L.str
815 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
816 ; X86-NOSSE-NEXT: calll memcmp
817 ; X86-NOSSE-NEXT: addl $12, %esp
818 ; X86-NOSSE-NEXT: testl %eax, %eax
819 ; X86-NOSSE-NEXT: sete %al
820 ; X86-NOSSE-NEXT: retl
822 ; X86-SSE1-LABEL: length16_eq_const:
824 ; X86-SSE1-NEXT: pushl $16
825 ; X86-SSE1-NEXT: pushl $.L.str
826 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
827 ; X86-SSE1-NEXT: calll memcmp
828 ; X86-SSE1-NEXT: addl $12, %esp
829 ; X86-SSE1-NEXT: testl %eax, %eax
830 ; X86-SSE1-NEXT: sete %al
831 ; X86-SSE1-NEXT: retl
833 ; X86-SSE2-LABEL: length16_eq_const:
835 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
836 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
837 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
838 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
839 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
840 ; X86-SSE2-NEXT: sete %al
841 ; X86-SSE2-NEXT: retl
843 ; X86-SSE41-LABEL: length16_eq_const:
844 ; X86-SSE41: # %bb.0:
845 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
846 ; X86-SSE41-NEXT: movdqu (%eax), %xmm0
847 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
848 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
849 ; X86-SSE41-NEXT: sete %al
850 ; X86-SSE41-NEXT: retl
851 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 16) nounwind
852 %c = icmp eq i32 %m, 0
856 ; PR33914 - https://bugs.llvm.org/show_bug.cgi?id=33914
858 define i32 @length24(ptr %X, ptr %Y) nounwind {
859 ; X86-LABEL: length24:
861 ; X86-NEXT: pushl $24
862 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
863 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
864 ; X86-NEXT: calll memcmp
865 ; X86-NEXT: addl $12, %esp
867 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 24) nounwind
871 define i1 @length24_eq(ptr %x, ptr %y) nounwind {
872 ; X86-NOSSE-LABEL: length24_eq:
873 ; X86-NOSSE: # %bb.0:
874 ; X86-NOSSE-NEXT: pushl $24
875 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
876 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
877 ; X86-NOSSE-NEXT: calll memcmp
878 ; X86-NOSSE-NEXT: addl $12, %esp
879 ; X86-NOSSE-NEXT: testl %eax, %eax
880 ; X86-NOSSE-NEXT: sete %al
881 ; X86-NOSSE-NEXT: retl
883 ; X86-SSE1-LABEL: length24_eq:
885 ; X86-SSE1-NEXT: pushl $24
886 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
887 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
888 ; X86-SSE1-NEXT: calll memcmp
889 ; X86-SSE1-NEXT: addl $12, %esp
890 ; X86-SSE1-NEXT: testl %eax, %eax
891 ; X86-SSE1-NEXT: sete %al
892 ; X86-SSE1-NEXT: retl
894 ; X86-SSE2-LABEL: length24_eq:
896 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
897 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
898 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
899 ; X86-SSE2-NEXT: movdqu 8(%ecx), %xmm1
900 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
901 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
902 ; X86-SSE2-NEXT: movdqu 8(%eax), %xmm0
903 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
904 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
905 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
906 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
907 ; X86-SSE2-NEXT: sete %al
908 ; X86-SSE2-NEXT: retl
910 ; X86-SSE41-LABEL: length24_eq:
911 ; X86-SSE41: # %bb.0:
912 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
913 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
914 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
915 ; X86-SSE41-NEXT: movdqu 8(%ecx), %xmm1
916 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
917 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
918 ; X86-SSE41-NEXT: movdqu 8(%eax), %xmm0
919 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
920 ; X86-SSE41-NEXT: por %xmm2, %xmm0
921 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
922 ; X86-SSE41-NEXT: sete %al
923 ; X86-SSE41-NEXT: retl
924 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 24) nounwind
925 %cmp = icmp eq i32 %call, 0
929 define i1 @length24_lt(ptr %x, ptr %y) nounwind {
930 ; X86-LABEL: length24_lt:
932 ; X86-NEXT: pushl $24
933 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
934 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
935 ; X86-NEXT: calll memcmp
936 ; X86-NEXT: addl $12, %esp
937 ; X86-NEXT: shrl $31, %eax
938 ; X86-NEXT: # kill: def $al killed $al killed $eax
940 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 24) nounwind
941 %cmp = icmp slt i32 %call, 0
945 define i1 @length24_gt(ptr %x, ptr %y) nounwind {
946 ; X86-LABEL: length24_gt:
948 ; X86-NEXT: pushl $24
949 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
950 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
951 ; X86-NEXT: calll memcmp
952 ; X86-NEXT: addl $12, %esp
953 ; X86-NEXT: testl %eax, %eax
956 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 24) nounwind
957 %cmp = icmp sgt i32 %call, 0
961 define i1 @length24_eq_const(ptr %X) nounwind {
962 ; X86-NOSSE-LABEL: length24_eq_const:
963 ; X86-NOSSE: # %bb.0:
964 ; X86-NOSSE-NEXT: pushl $24
965 ; X86-NOSSE-NEXT: pushl $.L.str
966 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
967 ; X86-NOSSE-NEXT: calll memcmp
968 ; X86-NOSSE-NEXT: addl $12, %esp
969 ; X86-NOSSE-NEXT: testl %eax, %eax
970 ; X86-NOSSE-NEXT: setne %al
971 ; X86-NOSSE-NEXT: retl
973 ; X86-SSE1-LABEL: length24_eq_const:
975 ; X86-SSE1-NEXT: pushl $24
976 ; X86-SSE1-NEXT: pushl $.L.str
977 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
978 ; X86-SSE1-NEXT: calll memcmp
979 ; X86-SSE1-NEXT: addl $12, %esp
980 ; X86-SSE1-NEXT: testl %eax, %eax
981 ; X86-SSE1-NEXT: setne %al
982 ; X86-SSE1-NEXT: retl
984 ; X86-SSE2-LABEL: length24_eq_const:
986 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
987 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
988 ; X86-SSE2-NEXT: movdqu 8(%eax), %xmm1
989 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
990 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
991 ; X86-SSE2-NEXT: pand %xmm1, %xmm0
992 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
993 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
994 ; X86-SSE2-NEXT: setne %al
995 ; X86-SSE2-NEXT: retl
997 ; X86-SSE41-LABEL: length24_eq_const:
998 ; X86-SSE41: # %bb.0:
999 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1000 ; X86-SSE41-NEXT: movdqu (%eax), %xmm0
1001 ; X86-SSE41-NEXT: movdqu 8(%eax), %xmm1
1002 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1003 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1004 ; X86-SSE41-NEXT: por %xmm1, %xmm0
1005 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1006 ; X86-SSE41-NEXT: setne %al
1007 ; X86-SSE41-NEXT: retl
1008 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 24) nounwind
1009 %c = icmp ne i32 %m, 0
1013 define i32 @length31(ptr %X, ptr %Y) nounwind {
1014 ; X86-LABEL: length31:
1016 ; X86-NEXT: pushl $31
1017 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1018 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1019 ; X86-NEXT: calll memcmp
1020 ; X86-NEXT: addl $12, %esp
1022 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 31) nounwind
1026 define i1 @length31_eq(ptr %x, ptr %y) nounwind {
1027 ; X86-NOSSE-LABEL: length31_eq:
1028 ; X86-NOSSE: # %bb.0:
1029 ; X86-NOSSE-NEXT: pushl $31
1030 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1031 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1032 ; X86-NOSSE-NEXT: calll memcmp
1033 ; X86-NOSSE-NEXT: addl $12, %esp
1034 ; X86-NOSSE-NEXT: testl %eax, %eax
1035 ; X86-NOSSE-NEXT: sete %al
1036 ; X86-NOSSE-NEXT: retl
1038 ; X86-SSE1-LABEL: length31_eq:
1039 ; X86-SSE1: # %bb.0:
1040 ; X86-SSE1-NEXT: pushl $31
1041 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1042 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1043 ; X86-SSE1-NEXT: calll memcmp
1044 ; X86-SSE1-NEXT: addl $12, %esp
1045 ; X86-SSE1-NEXT: testl %eax, %eax
1046 ; X86-SSE1-NEXT: sete %al
1047 ; X86-SSE1-NEXT: retl
1049 ; X86-SSE2-LABEL: length31_eq:
1050 ; X86-SSE2: # %bb.0:
1051 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1052 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
1053 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
1054 ; X86-SSE2-NEXT: movdqu 15(%ecx), %xmm1
1055 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
1056 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
1057 ; X86-SSE2-NEXT: movdqu 15(%eax), %xmm0
1058 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
1059 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1060 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1061 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1062 ; X86-SSE2-NEXT: sete %al
1063 ; X86-SSE2-NEXT: retl
1065 ; X86-SSE41-LABEL: length31_eq:
1066 ; X86-SSE41: # %bb.0:
1067 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1068 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
1069 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
1070 ; X86-SSE41-NEXT: movdqu 15(%ecx), %xmm1
1071 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
1072 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
1073 ; X86-SSE41-NEXT: movdqu 15(%eax), %xmm0
1074 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
1075 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1076 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1077 ; X86-SSE41-NEXT: sete %al
1078 ; X86-SSE41-NEXT: retl
1079 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 31) nounwind
1080 %cmp = icmp eq i32 %call, 0
1084 define i1 @length31_lt(ptr %x, ptr %y) nounwind {
1085 ; X86-LABEL: length31_lt:
1087 ; X86-NEXT: pushl $31
1088 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1089 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1090 ; X86-NEXT: calll memcmp
1091 ; X86-NEXT: addl $12, %esp
1092 ; X86-NEXT: shrl $31, %eax
1093 ; X86-NEXT: # kill: def $al killed $al killed $eax
1095 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 31) nounwind
1096 %cmp = icmp slt i32 %call, 0
1100 define i1 @length31_gt(ptr %x, ptr %y) nounwind {
1101 ; X86-LABEL: length31_gt:
1103 ; X86-NEXT: pushl $31
1104 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1105 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1106 ; X86-NEXT: calll memcmp
1107 ; X86-NEXT: addl $12, %esp
1108 ; X86-NEXT: testl %eax, %eax
1109 ; X86-NEXT: setg %al
1111 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 31) nounwind
1112 %cmp = icmp sgt i32 %call, 0
1116 define i1 @length31_eq_prefer128(ptr %x, ptr %y) nounwind "prefer-vector-width"="128" {
1117 ; X86-NOSSE-LABEL: length31_eq_prefer128:
1118 ; X86-NOSSE: # %bb.0:
1119 ; X86-NOSSE-NEXT: pushl $31
1120 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1121 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1122 ; X86-NOSSE-NEXT: calll memcmp
1123 ; X86-NOSSE-NEXT: addl $12, %esp
1124 ; X86-NOSSE-NEXT: testl %eax, %eax
1125 ; X86-NOSSE-NEXT: sete %al
1126 ; X86-NOSSE-NEXT: retl
1128 ; X86-SSE1-LABEL: length31_eq_prefer128:
1129 ; X86-SSE1: # %bb.0:
1130 ; X86-SSE1-NEXT: pushl $31
1131 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1132 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1133 ; X86-SSE1-NEXT: calll memcmp
1134 ; X86-SSE1-NEXT: addl $12, %esp
1135 ; X86-SSE1-NEXT: testl %eax, %eax
1136 ; X86-SSE1-NEXT: sete %al
1137 ; X86-SSE1-NEXT: retl
1139 ; X86-SSE2-LABEL: length31_eq_prefer128:
1140 ; X86-SSE2: # %bb.0:
1141 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1142 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
1143 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
1144 ; X86-SSE2-NEXT: movdqu 15(%ecx), %xmm1
1145 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
1146 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
1147 ; X86-SSE2-NEXT: movdqu 15(%eax), %xmm0
1148 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
1149 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1150 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1151 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1152 ; X86-SSE2-NEXT: sete %al
1153 ; X86-SSE2-NEXT: retl
1155 ; X86-SSE41-LABEL: length31_eq_prefer128:
1156 ; X86-SSE41: # %bb.0:
1157 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1158 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
1159 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
1160 ; X86-SSE41-NEXT: movdqu 15(%ecx), %xmm1
1161 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
1162 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
1163 ; X86-SSE41-NEXT: movdqu 15(%eax), %xmm0
1164 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
1165 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1166 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1167 ; X86-SSE41-NEXT: sete %al
1168 ; X86-SSE41-NEXT: retl
1169 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 31) nounwind
1170 %cmp = icmp eq i32 %call, 0
1174 define i1 @length31_eq_const(ptr %X) nounwind {
1175 ; X86-NOSSE-LABEL: length31_eq_const:
1176 ; X86-NOSSE: # %bb.0:
1177 ; X86-NOSSE-NEXT: pushl $31
1178 ; X86-NOSSE-NEXT: pushl $.L.str
1179 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1180 ; X86-NOSSE-NEXT: calll memcmp
1181 ; X86-NOSSE-NEXT: addl $12, %esp
1182 ; X86-NOSSE-NEXT: testl %eax, %eax
1183 ; X86-NOSSE-NEXT: setne %al
1184 ; X86-NOSSE-NEXT: retl
1186 ; X86-SSE1-LABEL: length31_eq_const:
1187 ; X86-SSE1: # %bb.0:
1188 ; X86-SSE1-NEXT: pushl $31
1189 ; X86-SSE1-NEXT: pushl $.L.str
1190 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1191 ; X86-SSE1-NEXT: calll memcmp
1192 ; X86-SSE1-NEXT: addl $12, %esp
1193 ; X86-SSE1-NEXT: testl %eax, %eax
1194 ; X86-SSE1-NEXT: setne %al
1195 ; X86-SSE1-NEXT: retl
1197 ; X86-SSE2-LABEL: length31_eq_const:
1198 ; X86-SSE2: # %bb.0:
1199 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1200 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
1201 ; X86-SSE2-NEXT: movdqu 15(%eax), %xmm1
1202 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1203 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1204 ; X86-SSE2-NEXT: pand %xmm1, %xmm0
1205 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1206 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1207 ; X86-SSE2-NEXT: setne %al
1208 ; X86-SSE2-NEXT: retl
1210 ; X86-SSE41-LABEL: length31_eq_const:
1211 ; X86-SSE41: # %bb.0:
1212 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1213 ; X86-SSE41-NEXT: movdqu (%eax), %xmm0
1214 ; X86-SSE41-NEXT: movdqu 15(%eax), %xmm1
1215 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1216 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1217 ; X86-SSE41-NEXT: por %xmm1, %xmm0
1218 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1219 ; X86-SSE41-NEXT: setne %al
1220 ; X86-SSE41-NEXT: retl
1221 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 31) nounwind
1222 %c = icmp ne i32 %m, 0
1226 define i32 @length32(ptr %X, ptr %Y) nounwind {
1227 ; X86-LABEL: length32:
1229 ; X86-NEXT: pushl $32
1230 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1231 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1232 ; X86-NEXT: calll memcmp
1233 ; X86-NEXT: addl $12, %esp
1235 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 32) nounwind
1239 ; PR33325 - https://bugs.llvm.org/show_bug.cgi?id=33325
1241 define i1 @length32_eq(ptr %x, ptr %y) nounwind {
1242 ; X86-NOSSE-LABEL: length32_eq:
1243 ; X86-NOSSE: # %bb.0:
1244 ; X86-NOSSE-NEXT: pushl $32
1245 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1246 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1247 ; X86-NOSSE-NEXT: calll memcmp
1248 ; X86-NOSSE-NEXT: addl $12, %esp
1249 ; X86-NOSSE-NEXT: testl %eax, %eax
1250 ; X86-NOSSE-NEXT: sete %al
1251 ; X86-NOSSE-NEXT: retl
1253 ; X86-SSE1-LABEL: length32_eq:
1254 ; X86-SSE1: # %bb.0:
1255 ; X86-SSE1-NEXT: pushl $32
1256 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1257 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1258 ; X86-SSE1-NEXT: calll memcmp
1259 ; X86-SSE1-NEXT: addl $12, %esp
1260 ; X86-SSE1-NEXT: testl %eax, %eax
1261 ; X86-SSE1-NEXT: sete %al
1262 ; X86-SSE1-NEXT: retl
1264 ; X86-SSE2-LABEL: length32_eq:
1265 ; X86-SSE2: # %bb.0:
1266 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1267 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
1268 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
1269 ; X86-SSE2-NEXT: movdqu 16(%ecx), %xmm1
1270 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
1271 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
1272 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm0
1273 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
1274 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1275 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1276 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1277 ; X86-SSE2-NEXT: sete %al
1278 ; X86-SSE2-NEXT: retl
1280 ; X86-SSE41-LABEL: length32_eq:
1281 ; X86-SSE41: # %bb.0:
1282 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1283 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
1284 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
1285 ; X86-SSE41-NEXT: movdqu 16(%ecx), %xmm1
1286 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
1287 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
1288 ; X86-SSE41-NEXT: movdqu 16(%eax), %xmm0
1289 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
1290 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1291 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1292 ; X86-SSE41-NEXT: sete %al
1293 ; X86-SSE41-NEXT: retl
1294 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 32) nounwind
1295 %cmp = icmp eq i32 %call, 0
1299 define i1 @length32_lt(ptr %x, ptr %y) nounwind {
1300 ; X86-LABEL: length32_lt:
1302 ; X86-NEXT: pushl $32
1303 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1304 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1305 ; X86-NEXT: calll memcmp
1306 ; X86-NEXT: addl $12, %esp
1307 ; X86-NEXT: shrl $31, %eax
1308 ; X86-NEXT: # kill: def $al killed $al killed $eax
1310 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 32) nounwind
1311 %cmp = icmp slt i32 %call, 0
1315 define i1 @length32_gt(ptr %x, ptr %y) nounwind {
1316 ; X86-LABEL: length32_gt:
1318 ; X86-NEXT: pushl $32
1319 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1320 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1321 ; X86-NEXT: calll memcmp
1322 ; X86-NEXT: addl $12, %esp
1323 ; X86-NEXT: testl %eax, %eax
1324 ; X86-NEXT: setg %al
1326 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 32) nounwind
1327 %cmp = icmp sgt i32 %call, 0
1331 define i1 @length32_eq_prefer128(ptr %x, ptr %y) nounwind "prefer-vector-width"="128" {
1332 ; X86-NOSSE-LABEL: length32_eq_prefer128:
1333 ; X86-NOSSE: # %bb.0:
1334 ; X86-NOSSE-NEXT: pushl $32
1335 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1336 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1337 ; X86-NOSSE-NEXT: calll memcmp
1338 ; X86-NOSSE-NEXT: addl $12, %esp
1339 ; X86-NOSSE-NEXT: testl %eax, %eax
1340 ; X86-NOSSE-NEXT: sete %al
1341 ; X86-NOSSE-NEXT: retl
1343 ; X86-SSE1-LABEL: length32_eq_prefer128:
1344 ; X86-SSE1: # %bb.0:
1345 ; X86-SSE1-NEXT: pushl $32
1346 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1347 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1348 ; X86-SSE1-NEXT: calll memcmp
1349 ; X86-SSE1-NEXT: addl $12, %esp
1350 ; X86-SSE1-NEXT: testl %eax, %eax
1351 ; X86-SSE1-NEXT: sete %al
1352 ; X86-SSE1-NEXT: retl
1354 ; X86-SSE2-LABEL: length32_eq_prefer128:
1355 ; X86-SSE2: # %bb.0:
1356 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1357 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
1358 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
1359 ; X86-SSE2-NEXT: movdqu 16(%ecx), %xmm1
1360 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
1361 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
1362 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm0
1363 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
1364 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1365 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1366 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1367 ; X86-SSE2-NEXT: sete %al
1368 ; X86-SSE2-NEXT: retl
1370 ; X86-SSE41-LABEL: length32_eq_prefer128:
1371 ; X86-SSE41: # %bb.0:
1372 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1373 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
1374 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
1375 ; X86-SSE41-NEXT: movdqu 16(%ecx), %xmm1
1376 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
1377 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
1378 ; X86-SSE41-NEXT: movdqu 16(%eax), %xmm0
1379 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
1380 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1381 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1382 ; X86-SSE41-NEXT: sete %al
1383 ; X86-SSE41-NEXT: retl
1384 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 32) nounwind
1385 %cmp = icmp eq i32 %call, 0
1389 define i1 @length32_eq_const(ptr %X) nounwind {
1390 ; X86-NOSSE-LABEL: length32_eq_const:
1391 ; X86-NOSSE: # %bb.0:
1392 ; X86-NOSSE-NEXT: pushl $32
1393 ; X86-NOSSE-NEXT: pushl $.L.str
1394 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1395 ; X86-NOSSE-NEXT: calll memcmp
1396 ; X86-NOSSE-NEXT: addl $12, %esp
1397 ; X86-NOSSE-NEXT: testl %eax, %eax
1398 ; X86-NOSSE-NEXT: setne %al
1399 ; X86-NOSSE-NEXT: retl
1401 ; X86-SSE1-LABEL: length32_eq_const:
1402 ; X86-SSE1: # %bb.0:
1403 ; X86-SSE1-NEXT: pushl $32
1404 ; X86-SSE1-NEXT: pushl $.L.str
1405 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1406 ; X86-SSE1-NEXT: calll memcmp
1407 ; X86-SSE1-NEXT: addl $12, %esp
1408 ; X86-SSE1-NEXT: testl %eax, %eax
1409 ; X86-SSE1-NEXT: setne %al
1410 ; X86-SSE1-NEXT: retl
1412 ; X86-SSE2-LABEL: length32_eq_const:
1413 ; X86-SSE2: # %bb.0:
1414 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1415 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
1416 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm1
1417 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1418 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1419 ; X86-SSE2-NEXT: pand %xmm1, %xmm0
1420 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1421 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1422 ; X86-SSE2-NEXT: setne %al
1423 ; X86-SSE2-NEXT: retl
1425 ; X86-SSE41-LABEL: length32_eq_const:
1426 ; X86-SSE41: # %bb.0:
1427 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1428 ; X86-SSE41-NEXT: movdqu (%eax), %xmm0
1429 ; X86-SSE41-NEXT: movdqu 16(%eax), %xmm1
1430 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1431 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1432 ; X86-SSE41-NEXT: por %xmm1, %xmm0
1433 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1434 ; X86-SSE41-NEXT: setne %al
1435 ; X86-SSE41-NEXT: retl
1436 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 32) nounwind
1437 %c = icmp ne i32 %m, 0
1441 define i32 @length48(ptr %X, ptr %Y) nounwind {
1442 ; X86-LABEL: length48:
1444 ; X86-NEXT: pushl $48
1445 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1446 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1447 ; X86-NEXT: calll memcmp
1448 ; X86-NEXT: addl $12, %esp
1450 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 48) nounwind
1454 define i1 @length48_eq(ptr %x, ptr %y) nounwind {
1455 ; X86-LABEL: length48_eq:
1457 ; X86-NEXT: pushl $48
1458 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1459 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1460 ; X86-NEXT: calll memcmp
1461 ; X86-NEXT: addl $12, %esp
1462 ; X86-NEXT: testl %eax, %eax
1463 ; X86-NEXT: sete %al
1465 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 48) nounwind
1466 %cmp = icmp eq i32 %call, 0
1470 define i1 @length48_lt(ptr %x, ptr %y) nounwind {
1471 ; X86-LABEL: length48_lt:
1473 ; X86-NEXT: pushl $48
1474 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1475 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1476 ; X86-NEXT: calll memcmp
1477 ; X86-NEXT: addl $12, %esp
1478 ; X86-NEXT: shrl $31, %eax
1479 ; X86-NEXT: # kill: def $al killed $al killed $eax
1481 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 48) nounwind
1482 %cmp = icmp slt i32 %call, 0
1486 define i1 @length48_gt(ptr %x, ptr %y) nounwind {
1487 ; X86-LABEL: length48_gt:
1489 ; X86-NEXT: pushl $48
1490 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1491 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1492 ; X86-NEXT: calll memcmp
1493 ; X86-NEXT: addl $12, %esp
1494 ; X86-NEXT: testl %eax, %eax
1495 ; X86-NEXT: setg %al
1497 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 48) nounwind
1498 %cmp = icmp sgt i32 %call, 0
1502 define i1 @length48_eq_prefer128(ptr %x, ptr %y) nounwind "prefer-vector-width"="128" {
1503 ; X86-LABEL: length48_eq_prefer128:
1505 ; X86-NEXT: pushl $48
1506 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1507 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1508 ; X86-NEXT: calll memcmp
1509 ; X86-NEXT: addl $12, %esp
1510 ; X86-NEXT: testl %eax, %eax
1511 ; X86-NEXT: sete %al
1513 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 48) nounwind
1514 %cmp = icmp eq i32 %call, 0
1518 define i1 @length48_eq_const(ptr %X) nounwind {
1519 ; X86-LABEL: length48_eq_const:
1521 ; X86-NEXT: pushl $48
1522 ; X86-NEXT: pushl $.L.str
1523 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1524 ; X86-NEXT: calll memcmp
1525 ; X86-NEXT: addl $12, %esp
1526 ; X86-NEXT: testl %eax, %eax
1527 ; X86-NEXT: setne %al
1529 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 48) nounwind
1530 %c = icmp ne i32 %m, 0
1534 define i32 @length63(ptr %X, ptr %Y) nounwind {
1535 ; X86-LABEL: length63:
1537 ; X86-NEXT: pushl $63
1538 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1539 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1540 ; X86-NEXT: calll memcmp
1541 ; X86-NEXT: addl $12, %esp
1543 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 63) nounwind
1547 define i1 @length63_eq(ptr %x, ptr %y) nounwind {
1548 ; X86-LABEL: length63_eq:
1550 ; X86-NEXT: pushl $63
1551 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1552 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1553 ; X86-NEXT: calll memcmp
1554 ; X86-NEXT: addl $12, %esp
1555 ; X86-NEXT: testl %eax, %eax
1556 ; X86-NEXT: setne %al
1558 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 63) nounwind
1559 %cmp = icmp ne i32 %call, 0
1563 define i1 @length63_lt(ptr %x, ptr %y) nounwind {
1564 ; X86-LABEL: length63_lt:
1566 ; X86-NEXT: pushl $63
1567 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1568 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1569 ; X86-NEXT: calll memcmp
1570 ; X86-NEXT: addl $12, %esp
1571 ; X86-NEXT: shrl $31, %eax
1572 ; X86-NEXT: # kill: def $al killed $al killed $eax
1574 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 63) nounwind
1575 %cmp = icmp slt i32 %call, 0
1579 define i1 @length63_gt(ptr %x, ptr %y) nounwind {
1580 ; X86-LABEL: length63_gt:
1582 ; X86-NEXT: pushl $63
1583 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1584 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1585 ; X86-NEXT: calll memcmp
1586 ; X86-NEXT: addl $12, %esp
1587 ; X86-NEXT: testl %eax, %eax
1588 ; X86-NEXT: setg %al
1590 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 63) nounwind
1591 %cmp = icmp sgt i32 %call, 0
1595 define i1 @length63_eq_const(ptr %X) nounwind {
1596 ; X86-LABEL: length63_eq_const:
1598 ; X86-NEXT: pushl $63
1599 ; X86-NEXT: pushl $.L.str
1600 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1601 ; X86-NEXT: calll memcmp
1602 ; X86-NEXT: addl $12, %esp
1603 ; X86-NEXT: testl %eax, %eax
1604 ; X86-NEXT: sete %al
1606 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 63) nounwind
1607 %c = icmp eq i32 %m, 0
1611 define i32 @length64(ptr %X, ptr %Y) nounwind {
1612 ; X86-LABEL: length64:
1614 ; X86-NEXT: pushl $64
1615 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1616 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1617 ; X86-NEXT: calll memcmp
1618 ; X86-NEXT: addl $12, %esp
1620 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 64) nounwind
1624 define i1 @length64_eq(ptr %x, ptr %y) nounwind {
1625 ; X86-LABEL: length64_eq:
1627 ; X86-NEXT: pushl $64
1628 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1629 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1630 ; X86-NEXT: calll memcmp
1631 ; X86-NEXT: addl $12, %esp
1632 ; X86-NEXT: testl %eax, %eax
1633 ; X86-NEXT: setne %al
1635 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 64) nounwind
1636 %cmp = icmp ne i32 %call, 0
1640 define i1 @length64_lt(ptr %x, ptr %y) nounwind {
1641 ; X86-LABEL: length64_lt:
1643 ; X86-NEXT: pushl $64
1644 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1645 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1646 ; X86-NEXT: calll memcmp
1647 ; X86-NEXT: addl $12, %esp
1648 ; X86-NEXT: shrl $31, %eax
1649 ; X86-NEXT: # kill: def $al killed $al killed $eax
1651 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 64) nounwind
1652 %cmp = icmp slt i32 %call, 0
1656 define i1 @length64_gt(ptr %x, ptr %y) nounwind {
1657 ; X86-LABEL: length64_gt:
1659 ; X86-NEXT: pushl $64
1660 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1661 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1662 ; X86-NEXT: calll memcmp
1663 ; X86-NEXT: addl $12, %esp
1664 ; X86-NEXT: testl %eax, %eax
1665 ; X86-NEXT: setg %al
1667 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 64) nounwind
1668 %cmp = icmp sgt i32 %call, 0
1672 define i1 @length64_eq_const(ptr %X) nounwind {
1673 ; X86-LABEL: length64_eq_const:
1675 ; X86-NEXT: pushl $64
1676 ; X86-NEXT: pushl $.L.str
1677 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1678 ; X86-NEXT: calll memcmp
1679 ; X86-NEXT: addl $12, %esp
1680 ; X86-NEXT: testl %eax, %eax
1681 ; X86-NEXT: sete %al
1683 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 64) nounwind
1684 %c = icmp eq i32 %m, 0
1688 define i32 @length96(ptr %X, ptr %Y) nounwind {
1689 ; X86-LABEL: length96:
1691 ; X86-NEXT: pushl $96
1692 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1693 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1694 ; X86-NEXT: calll memcmp
1695 ; X86-NEXT: addl $12, %esp
1697 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 96) nounwind
1701 define i1 @length96_eq(ptr %x, ptr %y) nounwind {
1702 ; X86-LABEL: length96_eq:
1704 ; X86-NEXT: pushl $96
1705 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1706 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1707 ; X86-NEXT: calll memcmp
1708 ; X86-NEXT: addl $12, %esp
1709 ; X86-NEXT: testl %eax, %eax
1710 ; X86-NEXT: setne %al
1712 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 96) nounwind
1713 %cmp = icmp ne i32 %call, 0
1717 define i1 @length96_lt(ptr %x, ptr %y) nounwind {
1718 ; X86-LABEL: length96_lt:
1720 ; X86-NEXT: pushl $96
1721 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1722 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1723 ; X86-NEXT: calll memcmp
1724 ; X86-NEXT: addl $12, %esp
1725 ; X86-NEXT: shrl $31, %eax
1726 ; X86-NEXT: # kill: def $al killed $al killed $eax
1728 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 96) nounwind
1729 %cmp = icmp slt i32 %call, 0
1733 define i1 @length96_gt(ptr %x, ptr %y) nounwind {
1734 ; X86-LABEL: length96_gt:
1736 ; X86-NEXT: pushl $96
1737 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1738 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1739 ; X86-NEXT: calll memcmp
1740 ; X86-NEXT: addl $12, %esp
1741 ; X86-NEXT: testl %eax, %eax
1742 ; X86-NEXT: setg %al
1744 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 96) nounwind
1745 %cmp = icmp sgt i32 %call, 0
1749 define i1 @length96_eq_const(ptr %X) nounwind {
1750 ; X86-LABEL: length96_eq_const:
1752 ; X86-NEXT: pushl $96
1753 ; X86-NEXT: pushl $.L.str
1754 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1755 ; X86-NEXT: calll memcmp
1756 ; X86-NEXT: addl $12, %esp
1757 ; X86-NEXT: testl %eax, %eax
1758 ; X86-NEXT: sete %al
1760 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 96) nounwind
1761 %c = icmp eq i32 %m, 0
1765 define i32 @length127(ptr %X, ptr %Y) nounwind {
1766 ; X86-LABEL: length127:
1768 ; X86-NEXT: pushl $127
1769 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1770 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1771 ; X86-NEXT: calll memcmp
1772 ; X86-NEXT: addl $12, %esp
1774 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 127) nounwind
1778 define i1 @length127_eq(ptr %x, ptr %y) nounwind {
1779 ; X86-LABEL: length127_eq:
1781 ; X86-NEXT: pushl $127
1782 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1783 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1784 ; X86-NEXT: calll memcmp
1785 ; X86-NEXT: addl $12, %esp
1786 ; X86-NEXT: testl %eax, %eax
1787 ; X86-NEXT: setne %al
1789 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 127) nounwind
1790 %cmp = icmp ne i32 %call, 0
1794 define i1 @length127_lt(ptr %x, ptr %y) nounwind {
1795 ; X86-LABEL: length127_lt:
1797 ; X86-NEXT: pushl $127
1798 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1799 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1800 ; X86-NEXT: calll memcmp
1801 ; X86-NEXT: addl $12, %esp
1802 ; X86-NEXT: shrl $31, %eax
1803 ; X86-NEXT: # kill: def $al killed $al killed $eax
1805 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 127) nounwind
1806 %cmp = icmp slt i32 %call, 0
1810 define i1 @length127_gt(ptr %x, ptr %y) nounwind {
1811 ; X86-LABEL: length127_gt:
1813 ; X86-NEXT: pushl $127
1814 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1815 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1816 ; X86-NEXT: calll memcmp
1817 ; X86-NEXT: addl $12, %esp
1818 ; X86-NEXT: testl %eax, %eax
1819 ; X86-NEXT: setg %al
1821 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 127) nounwind
1822 %cmp = icmp sgt i32 %call, 0
1826 define i1 @length127_eq_const(ptr %X) nounwind {
1827 ; X86-LABEL: length127_eq_const:
1829 ; X86-NEXT: pushl $127
1830 ; X86-NEXT: pushl $.L.str
1831 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1832 ; X86-NEXT: calll memcmp
1833 ; X86-NEXT: addl $12, %esp
1834 ; X86-NEXT: testl %eax, %eax
1835 ; X86-NEXT: sete %al
1837 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 127) nounwind
1838 %c = icmp eq i32 %m, 0
1842 define i32 @length128(ptr %X, ptr %Y) nounwind {
1843 ; X86-LABEL: length128:
1845 ; X86-NEXT: pushl $128
1846 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1847 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1848 ; X86-NEXT: calll memcmp
1849 ; X86-NEXT: addl $12, %esp
1851 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 128) nounwind
1855 define i1 @length128_eq(ptr %x, ptr %y) nounwind {
1856 ; X86-LABEL: length128_eq:
1858 ; X86-NEXT: pushl $128
1859 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1860 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1861 ; X86-NEXT: calll memcmp
1862 ; X86-NEXT: addl $12, %esp
1863 ; X86-NEXT: testl %eax, %eax
1864 ; X86-NEXT: setne %al
1866 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 128) nounwind
1867 %cmp = icmp ne i32 %call, 0
1871 define i1 @length128_lt(ptr %x, ptr %y) nounwind {
1872 ; X86-LABEL: length128_lt:
1874 ; X86-NEXT: pushl $128
1875 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1876 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1877 ; X86-NEXT: calll memcmp
1878 ; X86-NEXT: addl $12, %esp
1879 ; X86-NEXT: shrl $31, %eax
1880 ; X86-NEXT: # kill: def $al killed $al killed $eax
1882 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 128) nounwind
1883 %cmp = icmp slt i32 %call, 0
1887 define i1 @length128_gt(ptr %x, ptr %y) nounwind {
1888 ; X86-LABEL: length128_gt:
1890 ; X86-NEXT: pushl $128
1891 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1892 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1893 ; X86-NEXT: calll memcmp
1894 ; X86-NEXT: addl $12, %esp
1895 ; X86-NEXT: testl %eax, %eax
1896 ; X86-NEXT: setg %al
1898 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 128) nounwind
1899 %cmp = icmp sgt i32 %call, 0
1903 define i1 @length128_eq_const(ptr %X) nounwind {
1904 ; X86-LABEL: length128_eq_const:
1906 ; X86-NEXT: pushl $128
1907 ; X86-NEXT: pushl $.L.str
1908 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1909 ; X86-NEXT: calll memcmp
1910 ; X86-NEXT: addl $12, %esp
1911 ; X86-NEXT: testl %eax, %eax
1912 ; X86-NEXT: sete %al
1914 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 128) nounwind
1915 %c = icmp eq i32 %m, 0
1919 define i32 @length192(ptr %X, ptr %Y) nounwind {
1920 ; X86-LABEL: length192:
1922 ; X86-NEXT: pushl $192
1923 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1924 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1925 ; X86-NEXT: calll memcmp
1926 ; X86-NEXT: addl $12, %esp
1928 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 192) nounwind
1932 define i1 @length192_eq(ptr %x, ptr %y) nounwind {
1933 ; X86-LABEL: length192_eq:
1935 ; X86-NEXT: pushl $192
1936 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1937 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1938 ; X86-NEXT: calll memcmp
1939 ; X86-NEXT: addl $12, %esp
1940 ; X86-NEXT: testl %eax, %eax
1941 ; X86-NEXT: setne %al
1943 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 192) nounwind
1944 %cmp = icmp ne i32 %call, 0
1948 define i1 @length192_lt(ptr %x, ptr %y) nounwind {
1949 ; X86-LABEL: length192_lt:
1951 ; X86-NEXT: pushl $192
1952 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1953 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1954 ; X86-NEXT: calll memcmp
1955 ; X86-NEXT: addl $12, %esp
1956 ; X86-NEXT: shrl $31, %eax
1957 ; X86-NEXT: # kill: def $al killed $al killed $eax
1959 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 192) nounwind
1960 %cmp = icmp slt i32 %call, 0
1964 define i1 @length192_gt(ptr %x, ptr %y) nounwind {
1965 ; X86-LABEL: length192_gt:
1967 ; X86-NEXT: pushl $192
1968 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1969 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1970 ; X86-NEXT: calll memcmp
1971 ; X86-NEXT: addl $12, %esp
1972 ; X86-NEXT: testl %eax, %eax
1973 ; X86-NEXT: setg %al
1975 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 192) nounwind
1976 %cmp = icmp sgt i32 %call, 0
1980 define i1 @length192_eq_const(ptr %X) nounwind {
1981 ; X86-LABEL: length192_eq_const:
1983 ; X86-NEXT: pushl $192
1984 ; X86-NEXT: pushl $.L.str
1985 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1986 ; X86-NEXT: calll memcmp
1987 ; X86-NEXT: addl $12, %esp
1988 ; X86-NEXT: testl %eax, %eax
1989 ; X86-NEXT: sete %al
1991 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 192) nounwind
1992 %c = icmp eq i32 %m, 0
1996 define i32 @length255(ptr %X, ptr %Y) nounwind {
1997 ; X86-LABEL: length255:
1999 ; X86-NEXT: pushl $255
2000 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2001 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2002 ; X86-NEXT: calll memcmp
2003 ; X86-NEXT: addl $12, %esp
2005 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 255) nounwind
2009 define i1 @length255_eq(ptr %x, ptr %y) nounwind {
2010 ; X86-LABEL: length255_eq:
2012 ; X86-NEXT: pushl $255
2013 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2014 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2015 ; X86-NEXT: calll memcmp
2016 ; X86-NEXT: addl $12, %esp
2017 ; X86-NEXT: testl %eax, %eax
2018 ; X86-NEXT: setne %al
2020 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 255) nounwind
2021 %cmp = icmp ne i32 %call, 0
2025 define i1 @length255_lt(ptr %x, ptr %y) nounwind {
2026 ; X86-LABEL: length255_lt:
2028 ; X86-NEXT: pushl $255
2029 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2030 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2031 ; X86-NEXT: calll memcmp
2032 ; X86-NEXT: addl $12, %esp
2033 ; X86-NEXT: shrl $31, %eax
2034 ; X86-NEXT: # kill: def $al killed $al killed $eax
2036 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 255) nounwind
2037 %cmp = icmp slt i32 %call, 0
2041 define i1 @length255_gt(ptr %x, ptr %y) nounwind {
2042 ; X86-LABEL: length255_gt:
2044 ; X86-NEXT: pushl $255
2045 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2046 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2047 ; X86-NEXT: calll memcmp
2048 ; X86-NEXT: addl $12, %esp
2049 ; X86-NEXT: testl %eax, %eax
2050 ; X86-NEXT: setg %al
2052 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 255) nounwind
2053 %cmp = icmp sgt i32 %call, 0
2057 define i1 @length255_eq_const(ptr %X) nounwind {
2058 ; X86-LABEL: length255_eq_const:
2060 ; X86-NEXT: pushl $255
2061 ; X86-NEXT: pushl $.L.str
2062 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2063 ; X86-NEXT: calll memcmp
2064 ; X86-NEXT: addl $12, %esp
2065 ; X86-NEXT: testl %eax, %eax
2066 ; X86-NEXT: sete %al
2068 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 255) nounwind
2069 %c = icmp eq i32 %m, 0
2073 define i32 @length256(ptr %X, ptr %Y) nounwind {
2074 ; X86-LABEL: length256:
2076 ; X86-NEXT: pushl $256 # imm = 0x100
2077 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2078 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2079 ; X86-NEXT: calll memcmp
2080 ; X86-NEXT: addl $12, %esp
2082 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 256) nounwind
2086 define i1 @length256_eq(ptr %x, ptr %y) nounwind {
2087 ; X86-LABEL: length256_eq:
2089 ; X86-NEXT: pushl $256 # imm = 0x100
2090 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2091 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2092 ; X86-NEXT: calll memcmp
2093 ; X86-NEXT: addl $12, %esp
2094 ; X86-NEXT: testl %eax, %eax
2095 ; X86-NEXT: setne %al
2097 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 256) nounwind
2098 %cmp = icmp ne i32 %call, 0
2102 define i1 @length256_lt(ptr %x, ptr %y) nounwind {
2103 ; X86-LABEL: length256_lt:
2105 ; X86-NEXT: pushl $256 # imm = 0x100
2106 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2107 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2108 ; X86-NEXT: calll memcmp
2109 ; X86-NEXT: addl $12, %esp
2110 ; X86-NEXT: shrl $31, %eax
2111 ; X86-NEXT: # kill: def $al killed $al killed $eax
2113 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 256) nounwind
2114 %cmp = icmp slt i32 %call, 0
2118 define i1 @length256_gt(ptr %x, ptr %y) nounwind {
2119 ; X86-LABEL: length256_gt:
2121 ; X86-NEXT: pushl $256 # imm = 0x100
2122 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2123 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2124 ; X86-NEXT: calll memcmp
2125 ; X86-NEXT: addl $12, %esp
2126 ; X86-NEXT: testl %eax, %eax
2127 ; X86-NEXT: setg %al
2129 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 256) nounwind
2130 %cmp = icmp sgt i32 %call, 0
2134 define i1 @length256_eq_const(ptr %X) nounwind {
2135 ; X86-LABEL: length256_eq_const:
2137 ; X86-NEXT: pushl $256 # imm = 0x100
2138 ; X86-NEXT: pushl $.L.str
2139 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2140 ; X86-NEXT: calll memcmp
2141 ; X86-NEXT: addl $12, %esp
2142 ; X86-NEXT: testl %eax, %eax
2143 ; X86-NEXT: sete %al
2145 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 256) nounwind
2146 %c = icmp eq i32 %m, 0
2150 define i32 @length384(ptr %X, ptr %Y) nounwind {
2151 ; X86-LABEL: length384:
2153 ; X86-NEXT: pushl $384 # imm = 0x180
2154 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2155 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2156 ; X86-NEXT: calll memcmp
2157 ; X86-NEXT: addl $12, %esp
2159 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 384) nounwind
2163 define i1 @length384_eq(ptr %x, ptr %y) nounwind {
2164 ; X86-LABEL: length384_eq:
2166 ; X86-NEXT: pushl $384 # imm = 0x180
2167 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2168 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2169 ; X86-NEXT: calll memcmp
2170 ; X86-NEXT: addl $12, %esp
2171 ; X86-NEXT: testl %eax, %eax
2172 ; X86-NEXT: setne %al
2174 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 384) nounwind
2175 %cmp = icmp ne i32 %call, 0
2179 define i1 @length384_lt(ptr %x, ptr %y) nounwind {
2180 ; X86-LABEL: length384_lt:
2182 ; X86-NEXT: pushl $384 # imm = 0x180
2183 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2184 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2185 ; X86-NEXT: calll memcmp
2186 ; X86-NEXT: addl $12, %esp
2187 ; X86-NEXT: shrl $31, %eax
2188 ; X86-NEXT: # kill: def $al killed $al killed $eax
2190 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 384) nounwind
2191 %cmp = icmp slt i32 %call, 0
2195 define i1 @length384_gt(ptr %x, ptr %y) nounwind {
2196 ; X86-LABEL: length384_gt:
2198 ; X86-NEXT: pushl $384 # imm = 0x180
2199 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2200 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2201 ; X86-NEXT: calll memcmp
2202 ; X86-NEXT: addl $12, %esp
2203 ; X86-NEXT: testl %eax, %eax
2204 ; X86-NEXT: setg %al
2206 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 384) nounwind
2207 %cmp = icmp sgt i32 %call, 0
2211 define i1 @length384_eq_const(ptr %X) nounwind {
2212 ; X86-LABEL: length384_eq_const:
2214 ; X86-NEXT: pushl $384 # imm = 0x180
2215 ; X86-NEXT: pushl $.L.str
2216 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2217 ; X86-NEXT: calll memcmp
2218 ; X86-NEXT: addl $12, %esp
2219 ; X86-NEXT: testl %eax, %eax
2220 ; X86-NEXT: sete %al
2222 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 384) nounwind
2223 %c = icmp eq i32 %m, 0
2227 define i32 @length511(ptr %X, ptr %Y) nounwind {
2228 ; X86-LABEL: length511:
2230 ; X86-NEXT: pushl $511 # imm = 0x1FF
2231 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2232 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2233 ; X86-NEXT: calll memcmp
2234 ; X86-NEXT: addl $12, %esp
2236 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 511) nounwind
2240 define i1 @length511_eq(ptr %x, ptr %y) nounwind {
2241 ; X86-LABEL: length511_eq:
2243 ; X86-NEXT: pushl $511 # imm = 0x1FF
2244 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2245 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2246 ; X86-NEXT: calll memcmp
2247 ; X86-NEXT: addl $12, %esp
2248 ; X86-NEXT: testl %eax, %eax
2249 ; X86-NEXT: setne %al
2251 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 511) nounwind
2252 %cmp = icmp ne i32 %call, 0
2256 define i1 @length511_lt(ptr %x, ptr %y) nounwind {
2257 ; X86-LABEL: length511_lt:
2259 ; X86-NEXT: pushl $511 # imm = 0x1FF
2260 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2261 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2262 ; X86-NEXT: calll memcmp
2263 ; X86-NEXT: addl $12, %esp
2264 ; X86-NEXT: shrl $31, %eax
2265 ; X86-NEXT: # kill: def $al killed $al killed $eax
2267 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 511) nounwind
2268 %cmp = icmp slt i32 %call, 0
2272 define i1 @length511_gt(ptr %x, ptr %y) nounwind {
2273 ; X86-LABEL: length511_gt:
2275 ; X86-NEXT: pushl $511 # imm = 0x1FF
2276 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2277 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2278 ; X86-NEXT: calll memcmp
2279 ; X86-NEXT: addl $12, %esp
2280 ; X86-NEXT: testl %eax, %eax
2281 ; X86-NEXT: setg %al
2283 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 511) nounwind
2284 %cmp = icmp sgt i32 %call, 0
2288 define i1 @length511_eq_const(ptr %X) nounwind {
2289 ; X86-LABEL: length511_eq_const:
2291 ; X86-NEXT: pushl $511 # imm = 0x1FF
2292 ; X86-NEXT: pushl $.L.str
2293 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2294 ; X86-NEXT: calll memcmp
2295 ; X86-NEXT: addl $12, %esp
2296 ; X86-NEXT: testl %eax, %eax
2297 ; X86-NEXT: sete %al
2299 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 511) nounwind
2300 %c = icmp eq i32 %m, 0
2304 define i32 @length512(ptr %X, ptr %Y) nounwind {
2305 ; X86-LABEL: length512:
2307 ; X86-NEXT: pushl $512 # imm = 0x200
2308 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2309 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2310 ; X86-NEXT: calll memcmp
2311 ; X86-NEXT: addl $12, %esp
2313 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 512) nounwind
2317 define i1 @length512_eq(ptr %x, ptr %y) nounwind {
2318 ; X86-LABEL: length512_eq:
2320 ; X86-NEXT: pushl $512 # imm = 0x200
2321 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2322 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2323 ; X86-NEXT: calll memcmp
2324 ; X86-NEXT: addl $12, %esp
2325 ; X86-NEXT: testl %eax, %eax
2326 ; X86-NEXT: setne %al
2328 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 512) nounwind
2329 %cmp = icmp ne i32 %call, 0
2333 define i1 @length512_lt(ptr %x, ptr %y) nounwind {
2334 ; X86-LABEL: length512_lt:
2336 ; X86-NEXT: pushl $512 # imm = 0x200
2337 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2338 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2339 ; X86-NEXT: calll memcmp
2340 ; X86-NEXT: addl $12, %esp
2341 ; X86-NEXT: shrl $31, %eax
2342 ; X86-NEXT: # kill: def $al killed $al killed $eax
2344 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 512) nounwind
2345 %cmp = icmp slt i32 %call, 0
2349 define i1 @length512_gt(ptr %x, ptr %y) nounwind {
2350 ; X86-LABEL: length512_gt:
2352 ; X86-NEXT: pushl $512 # imm = 0x200
2353 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2354 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2355 ; X86-NEXT: calll memcmp
2356 ; X86-NEXT: addl $12, %esp
2357 ; X86-NEXT: testl %eax, %eax
2358 ; X86-NEXT: setg %al
2360 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 512) nounwind
2361 %cmp = icmp sgt i32 %call, 0
2365 define i1 @length512_eq_const(ptr %X) nounwind {
2366 ; X86-LABEL: length512_eq_const:
2368 ; X86-NEXT: pushl $512 # imm = 0x200
2369 ; X86-NEXT: pushl $.L.str
2370 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2371 ; X86-NEXT: calll memcmp
2372 ; X86-NEXT: addl $12, %esp
2373 ; X86-NEXT: testl %eax, %eax
2374 ; X86-NEXT: sete %al
2376 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 512) nounwind
2377 %c = icmp eq i32 %m, 0
2381 ; This checks that we do not do stupid things with huge sizes.
2382 define i32 @huge_length(ptr %X, ptr %Y) nounwind {
2383 ; X86-LABEL: huge_length:
2385 ; X86-NEXT: pushl $-1
2386 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2387 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2388 ; X86-NEXT: calll memcmp
2389 ; X86-NEXT: addl $12, %esp
2391 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 9223372036854775807) nounwind
2395 define i1 @huge_length_eq(ptr %X, ptr %Y) nounwind {
2396 ; X86-LABEL: huge_length_eq:
2398 ; X86-NEXT: pushl $-1
2399 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2400 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2401 ; X86-NEXT: calll memcmp
2402 ; X86-NEXT: addl $12, %esp
2403 ; X86-NEXT: testl %eax, %eax
2404 ; X86-NEXT: sete %al
2406 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 9223372036854775807) nounwind
2407 %c = icmp eq i32 %m, 0
2411 ; This checks non-constant sizes.
2412 define i32 @nonconst_length(ptr %X, ptr %Y, i32 %size) nounwind {
2413 ; X86-LABEL: nonconst_length:
2415 ; X86-NEXT: jmp memcmp # TAILCALL
2416 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 %size) nounwind
2420 define i1 @nonconst_length_eq(ptr %X, ptr %Y, i32 %size) nounwind {
2421 ; X86-LABEL: nonconst_length_eq:
2423 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2424 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2425 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2426 ; X86-NEXT: calll memcmp
2427 ; X86-NEXT: addl $12, %esp
2428 ; X86-NEXT: testl %eax, %eax
2429 ; X86-NEXT: sete %al
2431 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 %size) nounwind
2432 %c = icmp eq i32 %m, 0