1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; NOTE: This is a copy of llvm/test/CodeGen/X86/memcmp.ll with more load pairs. Please keep it that way.
3 ; RUN: llc -max-loads-per-memcmp=4 -memcmp-num-loads-per-block=4 < %s -mtriple=i686-unknown-unknown -mattr=cmov | FileCheck %s --check-prefixes=X86,X86-NOSSE
4 ; RUN: llc -max-loads-per-memcmp=4 -memcmp-num-loads-per-block=4 < %s -mtriple=i686-unknown-unknown -mattr=+sse | FileCheck %s --check-prefixes=X86,X86-SSE1
5 ; RUN: llc -max-loads-per-memcmp=4 -memcmp-num-loads-per-block=4 < %s -mtriple=i686-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefixes=X86,X86-SSE2
6 ; RUN: llc -max-loads-per-memcmp=4 -memcmp-num-loads-per-block=4 < %s -mtriple=i686-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefixes=X86,X86-SSE41
8 ; This tests codegen time inlining/optimization of memcmp
11 @.str = private constant [513 x i8] c"01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901\00", align 1
13 declare dso_local i32 @memcmp(ptr, ptr, i32)
15 define i32 @length0(ptr %X, ptr %Y) nounwind {
18 ; X86-NEXT: xorl %eax, %eax
20 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 0) nounwind
24 define i1 @length0_eq(ptr %X, ptr %Y) nounwind {
25 ; X86-LABEL: length0_eq:
27 ; X86-NEXT: movb $1, %al
29 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 0) nounwind
30 %c = icmp eq i32 %m, 0
34 define i1 @length0_lt(ptr %X, ptr %Y) nounwind {
35 ; X86-LABEL: length0_lt:
37 ; X86-NEXT: xorl %eax, %eax
39 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 0) nounwind
40 %c = icmp slt i32 %m, 0
44 define i32 @length2(ptr %X, ptr %Y) nounwind {
47 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
48 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
49 ; X86-NEXT: movzwl (%ecx), %ecx
50 ; X86-NEXT: movzwl (%eax), %edx
51 ; X86-NEXT: rolw $8, %cx
52 ; X86-NEXT: rolw $8, %dx
53 ; X86-NEXT: movzwl %cx, %eax
54 ; X86-NEXT: movzwl %dx, %ecx
55 ; X86-NEXT: subl %ecx, %eax
57 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 2) nounwind
61 define i1 @length2_eq(ptr %X, ptr %Y) nounwind {
62 ; X86-LABEL: length2_eq:
64 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
65 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
66 ; X86-NEXT: movzwl (%ecx), %ecx
67 ; X86-NEXT: cmpw (%eax), %cx
70 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 2) nounwind
71 %c = icmp eq i32 %m, 0
75 define i1 @length2_lt(ptr %X, ptr %Y) nounwind {
76 ; X86-LABEL: length2_lt:
78 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
79 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
80 ; X86-NEXT: movzwl (%ecx), %ecx
81 ; X86-NEXT: movzwl (%eax), %edx
82 ; X86-NEXT: rolw $8, %cx
83 ; X86-NEXT: rolw $8, %dx
84 ; X86-NEXT: movzwl %cx, %eax
85 ; X86-NEXT: movzwl %dx, %ecx
86 ; X86-NEXT: subl %ecx, %eax
87 ; X86-NEXT: shrl $31, %eax
88 ; X86-NEXT: # kill: def $al killed $al killed $eax
90 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 2) nounwind
91 %c = icmp slt i32 %m, 0
95 define i1 @length2_gt(ptr %X, ptr %Y) nounwind {
96 ; X86-LABEL: length2_gt:
98 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
99 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
100 ; X86-NEXT: movzwl (%ecx), %ecx
101 ; X86-NEXT: movzwl (%eax), %eax
102 ; X86-NEXT: rolw $8, %cx
103 ; X86-NEXT: rolw $8, %ax
104 ; X86-NEXT: movzwl %cx, %ecx
105 ; X86-NEXT: movzwl %ax, %eax
106 ; X86-NEXT: subl %eax, %ecx
107 ; X86-NEXT: testl %ecx, %ecx
110 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 2) nounwind
111 %c = icmp sgt i32 %m, 0
115 define i1 @length2_eq_const(ptr %X) nounwind {
116 ; X86-LABEL: length2_eq_const:
118 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
119 ; X86-NEXT: movzwl (%eax), %eax
120 ; X86-NEXT: cmpl $12849, %eax # imm = 0x3231
121 ; X86-NEXT: setne %al
123 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i32 2) nounwind
124 %c = icmp ne i32 %m, 0
128 define i1 @length2_eq_nobuiltin_attr(ptr %X, ptr %Y) nounwind {
129 ; X86-LABEL: length2_eq_nobuiltin_attr:
132 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
133 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
134 ; X86-NEXT: calll memcmp
135 ; X86-NEXT: addl $12, %esp
136 ; X86-NEXT: testl %eax, %eax
139 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 2) nounwind nobuiltin
140 %c = icmp eq i32 %m, 0
144 define i32 @length3(ptr %X, ptr %Y) nounwind {
145 ; X86-LABEL: length3:
147 ; X86-NEXT: pushl %esi
148 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
149 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
150 ; X86-NEXT: movzwl (%eax), %edx
151 ; X86-NEXT: movzwl (%ecx), %esi
152 ; X86-NEXT: rolw $8, %dx
153 ; X86-NEXT: rolw $8, %si
154 ; X86-NEXT: cmpw %si, %dx
155 ; X86-NEXT: jne .LBB9_3
156 ; X86-NEXT: # %bb.1: # %loadbb1
157 ; X86-NEXT: movzbl 2(%eax), %eax
158 ; X86-NEXT: movzbl 2(%ecx), %ecx
159 ; X86-NEXT: subl %ecx, %eax
160 ; X86-NEXT: popl %esi
162 ; X86-NEXT: .LBB9_3: # %res_block
163 ; X86-NEXT: xorl %eax, %eax
164 ; X86-NEXT: cmpw %si, %dx
165 ; X86-NEXT: sbbl %eax, %eax
166 ; X86-NEXT: orl $1, %eax
167 ; X86-NEXT: popl %esi
169 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 3) nounwind
173 define i1 @length3_eq(ptr %X, ptr %Y) nounwind {
174 ; X86-LABEL: length3_eq:
176 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
177 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
178 ; X86-NEXT: movzwl (%ecx), %edx
179 ; X86-NEXT: xorw (%eax), %dx
180 ; X86-NEXT: movzbl 2(%ecx), %ecx
181 ; X86-NEXT: xorb 2(%eax), %cl
182 ; X86-NEXT: movzbl %cl, %eax
183 ; X86-NEXT: orw %dx, %ax
184 ; X86-NEXT: setne %al
186 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 3) nounwind
187 %c = icmp ne i32 %m, 0
191 define i32 @length4(ptr %X, ptr %Y) nounwind {
192 ; X86-LABEL: length4:
194 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
195 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
196 ; X86-NEXT: movl (%ecx), %ecx
197 ; X86-NEXT: movl (%eax), %edx
198 ; X86-NEXT: bswapl %ecx
199 ; X86-NEXT: bswapl %edx
200 ; X86-NEXT: xorl %eax, %eax
201 ; X86-NEXT: cmpl %edx, %ecx
203 ; X86-NEXT: sbbl $0, %eax
205 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 4) nounwind
209 define i1 @length4_eq(ptr %X, ptr %Y) nounwind {
210 ; X86-LABEL: length4_eq:
212 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
213 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
214 ; X86-NEXT: movl (%ecx), %ecx
215 ; X86-NEXT: cmpl (%eax), %ecx
216 ; X86-NEXT: setne %al
218 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 4) nounwind
219 %c = icmp ne i32 %m, 0
223 define i1 @length4_lt(ptr %X, ptr %Y) nounwind {
224 ; X86-LABEL: length4_lt:
226 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
227 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
228 ; X86-NEXT: movl (%ecx), %ecx
229 ; X86-NEXT: movl (%eax), %eax
230 ; X86-NEXT: bswapl %ecx
231 ; X86-NEXT: bswapl %eax
232 ; X86-NEXT: cmpl %eax, %ecx
235 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 4) nounwind
236 %c = icmp slt i32 %m, 0
240 define i1 @length4_gt(ptr %X, ptr %Y) nounwind {
241 ; X86-LABEL: length4_gt:
243 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
244 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
245 ; X86-NEXT: movl (%ecx), %ecx
246 ; X86-NEXT: movl (%eax), %eax
247 ; X86-NEXT: bswapl %ecx
248 ; X86-NEXT: bswapl %eax
249 ; X86-NEXT: cmpl %eax, %ecx
252 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 4) nounwind
253 %c = icmp sgt i32 %m, 0
257 define i1 @length4_eq_const(ptr %X) nounwind {
258 ; X86-LABEL: length4_eq_const:
260 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
261 ; X86-NEXT: cmpl $875770417, (%eax) # imm = 0x34333231
264 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i32 4) nounwind
265 %c = icmp eq i32 %m, 0
269 define i32 @length5(ptr %X, ptr %Y) nounwind {
270 ; X86-LABEL: length5:
272 ; X86-NEXT: pushl %esi
273 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
274 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
275 ; X86-NEXT: movl (%eax), %edx
276 ; X86-NEXT: movl (%ecx), %esi
277 ; X86-NEXT: bswapl %edx
278 ; X86-NEXT: bswapl %esi
279 ; X86-NEXT: cmpl %esi, %edx
280 ; X86-NEXT: jne .LBB16_3
281 ; X86-NEXT: # %bb.1: # %loadbb1
282 ; X86-NEXT: movzbl 4(%eax), %eax
283 ; X86-NEXT: movzbl 4(%ecx), %ecx
284 ; X86-NEXT: subl %ecx, %eax
285 ; X86-NEXT: popl %esi
287 ; X86-NEXT: .LBB16_3: # %res_block
288 ; X86-NEXT: xorl %eax, %eax
289 ; X86-NEXT: cmpl %esi, %edx
290 ; X86-NEXT: sbbl %eax, %eax
291 ; X86-NEXT: orl $1, %eax
292 ; X86-NEXT: popl %esi
294 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 5) nounwind
298 define i1 @length5_eq(ptr %X, ptr %Y) nounwind {
299 ; X86-LABEL: length5_eq:
301 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
302 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
303 ; X86-NEXT: movl (%ecx), %edx
304 ; X86-NEXT: xorl (%eax), %edx
305 ; X86-NEXT: movzbl 4(%ecx), %ecx
306 ; X86-NEXT: xorb 4(%eax), %cl
307 ; X86-NEXT: movzbl %cl, %eax
308 ; X86-NEXT: orl %edx, %eax
309 ; X86-NEXT: setne %al
311 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 5) nounwind
312 %c = icmp ne i32 %m, 0
316 define i1 @length5_lt(ptr %X, ptr %Y) nounwind {
317 ; X86-LABEL: length5_lt:
319 ; X86-NEXT: pushl %esi
320 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
321 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
322 ; X86-NEXT: movl (%eax), %edx
323 ; X86-NEXT: movl (%ecx), %esi
324 ; X86-NEXT: bswapl %edx
325 ; X86-NEXT: bswapl %esi
326 ; X86-NEXT: cmpl %esi, %edx
327 ; X86-NEXT: jne .LBB18_3
328 ; X86-NEXT: # %bb.1: # %loadbb1
329 ; X86-NEXT: movzbl 4(%eax), %eax
330 ; X86-NEXT: movzbl 4(%ecx), %ecx
331 ; X86-NEXT: subl %ecx, %eax
332 ; X86-NEXT: jmp .LBB18_2
333 ; X86-NEXT: .LBB18_3: # %res_block
334 ; X86-NEXT: xorl %eax, %eax
335 ; X86-NEXT: cmpl %esi, %edx
336 ; X86-NEXT: sbbl %eax, %eax
337 ; X86-NEXT: orl $1, %eax
338 ; X86-NEXT: .LBB18_2: # %endblock
339 ; X86-NEXT: shrl $31, %eax
340 ; X86-NEXT: # kill: def $al killed $al killed $eax
341 ; X86-NEXT: popl %esi
343 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 5) nounwind
344 %c = icmp slt i32 %m, 0
348 define i32 @length7(ptr %X, ptr %Y) nounwind {
349 ; X86-LABEL: length7:
351 ; X86-NEXT: pushl %esi
352 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
353 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
354 ; X86-NEXT: movl (%esi), %ecx
355 ; X86-NEXT: movl (%eax), %edx
356 ; X86-NEXT: bswapl %ecx
357 ; X86-NEXT: bswapl %edx
358 ; X86-NEXT: cmpl %edx, %ecx
359 ; X86-NEXT: jne .LBB19_2
360 ; X86-NEXT: # %bb.1: # %loadbb1
361 ; X86-NEXT: movl 3(%esi), %ecx
362 ; X86-NEXT: movl 3(%eax), %edx
363 ; X86-NEXT: bswapl %ecx
364 ; X86-NEXT: bswapl %edx
365 ; X86-NEXT: xorl %eax, %eax
366 ; X86-NEXT: cmpl %edx, %ecx
367 ; X86-NEXT: je .LBB19_3
368 ; X86-NEXT: .LBB19_2: # %res_block
369 ; X86-NEXT: xorl %eax, %eax
370 ; X86-NEXT: cmpl %edx, %ecx
371 ; X86-NEXT: sbbl %eax, %eax
372 ; X86-NEXT: orl $1, %eax
373 ; X86-NEXT: .LBB19_3: # %endblock
374 ; X86-NEXT: popl %esi
376 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 7) nounwind
380 define i1 @length7_eq(ptr %X, ptr %Y) nounwind {
381 ; X86-LABEL: length7_eq:
383 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
384 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
385 ; X86-NEXT: movl (%ecx), %edx
386 ; X86-NEXT: movl 3(%ecx), %ecx
387 ; X86-NEXT: xorl (%eax), %edx
388 ; X86-NEXT: xorl 3(%eax), %ecx
389 ; X86-NEXT: orl %edx, %ecx
390 ; X86-NEXT: setne %al
392 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 7) nounwind
393 %c = icmp ne i32 %m, 0
397 define i1 @length7_lt(ptr %X, ptr %Y) nounwind {
398 ; X86-LABEL: length7_lt:
400 ; X86-NEXT: pushl %esi
401 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
402 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
403 ; X86-NEXT: movl (%esi), %ecx
404 ; X86-NEXT: movl (%eax), %edx
405 ; X86-NEXT: bswapl %ecx
406 ; X86-NEXT: bswapl %edx
407 ; X86-NEXT: cmpl %edx, %ecx
408 ; X86-NEXT: jne .LBB21_2
409 ; X86-NEXT: # %bb.1: # %loadbb1
410 ; X86-NEXT: movl 3(%esi), %ecx
411 ; X86-NEXT: movl 3(%eax), %edx
412 ; X86-NEXT: bswapl %ecx
413 ; X86-NEXT: bswapl %edx
414 ; X86-NEXT: xorl %eax, %eax
415 ; X86-NEXT: cmpl %edx, %ecx
416 ; X86-NEXT: je .LBB21_3
417 ; X86-NEXT: .LBB21_2: # %res_block
418 ; X86-NEXT: xorl %eax, %eax
419 ; X86-NEXT: cmpl %edx, %ecx
420 ; X86-NEXT: sbbl %eax, %eax
421 ; X86-NEXT: orl $1, %eax
422 ; X86-NEXT: .LBB21_3: # %endblock
423 ; X86-NEXT: shrl $31, %eax
424 ; X86-NEXT: # kill: def $al killed $al killed $eax
425 ; X86-NEXT: popl %esi
427 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 7) nounwind
428 %c = icmp slt i32 %m, 0
432 define i32 @length8(ptr %X, ptr %Y) nounwind {
433 ; X86-LABEL: length8:
435 ; X86-NEXT: pushl %esi
436 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
437 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
438 ; X86-NEXT: movl (%esi), %ecx
439 ; X86-NEXT: movl (%eax), %edx
440 ; X86-NEXT: bswapl %ecx
441 ; X86-NEXT: bswapl %edx
442 ; X86-NEXT: cmpl %edx, %ecx
443 ; X86-NEXT: jne .LBB22_2
444 ; X86-NEXT: # %bb.1: # %loadbb1
445 ; X86-NEXT: movl 4(%esi), %ecx
446 ; X86-NEXT: movl 4(%eax), %edx
447 ; X86-NEXT: bswapl %ecx
448 ; X86-NEXT: bswapl %edx
449 ; X86-NEXT: xorl %eax, %eax
450 ; X86-NEXT: cmpl %edx, %ecx
451 ; X86-NEXT: je .LBB22_3
452 ; X86-NEXT: .LBB22_2: # %res_block
453 ; X86-NEXT: xorl %eax, %eax
454 ; X86-NEXT: cmpl %edx, %ecx
455 ; X86-NEXT: sbbl %eax, %eax
456 ; X86-NEXT: orl $1, %eax
457 ; X86-NEXT: .LBB22_3: # %endblock
458 ; X86-NEXT: popl %esi
460 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 8) nounwind
464 define i1 @length8_eq(ptr %X, ptr %Y) nounwind {
465 ; X86-LABEL: length8_eq:
467 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
468 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
469 ; X86-NEXT: movl (%ecx), %edx
470 ; X86-NEXT: movl 4(%ecx), %ecx
471 ; X86-NEXT: xorl (%eax), %edx
472 ; X86-NEXT: xorl 4(%eax), %ecx
473 ; X86-NEXT: orl %edx, %ecx
476 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 8) nounwind
477 %c = icmp eq i32 %m, 0
481 define i1 @length8_eq_const(ptr %X) nounwind {
482 ; X86-LABEL: length8_eq_const:
484 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
485 ; X86-NEXT: movl $858927408, %ecx # imm = 0x33323130
486 ; X86-NEXT: xorl (%eax), %ecx
487 ; X86-NEXT: movl $926299444, %edx # imm = 0x37363534
488 ; X86-NEXT: xorl 4(%eax), %edx
489 ; X86-NEXT: orl %ecx, %edx
490 ; X86-NEXT: setne %al
492 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 8) nounwind
493 %c = icmp ne i32 %m, 0
497 define i1 @length9_eq(ptr %X, ptr %Y) nounwind {
498 ; X86-LABEL: length9_eq:
500 ; X86-NEXT: pushl %esi
501 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
502 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
503 ; X86-NEXT: movl (%ecx), %edx
504 ; X86-NEXT: movl 4(%ecx), %esi
505 ; X86-NEXT: xorl (%eax), %edx
506 ; X86-NEXT: xorl 4(%eax), %esi
507 ; X86-NEXT: orl %edx, %esi
508 ; X86-NEXT: movzbl 8(%ecx), %ecx
509 ; X86-NEXT: xorb 8(%eax), %cl
510 ; X86-NEXT: movzbl %cl, %eax
511 ; X86-NEXT: orl %esi, %eax
513 ; X86-NEXT: popl %esi
515 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 9) nounwind
516 %c = icmp eq i32 %m, 0
520 define i1 @length10_eq(ptr %X, ptr %Y) nounwind {
521 ; X86-LABEL: length10_eq:
523 ; X86-NEXT: pushl %esi
524 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
525 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
526 ; X86-NEXT: movl (%ecx), %edx
527 ; X86-NEXT: movl 4(%ecx), %esi
528 ; X86-NEXT: xorl (%eax), %edx
529 ; X86-NEXT: xorl 4(%eax), %esi
530 ; X86-NEXT: orl %edx, %esi
531 ; X86-NEXT: movzwl 8(%ecx), %ecx
532 ; X86-NEXT: xorw 8(%eax), %cx
533 ; X86-NEXT: movzwl %cx, %eax
534 ; X86-NEXT: orl %esi, %eax
536 ; X86-NEXT: popl %esi
538 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 10) nounwind
539 %c = icmp eq i32 %m, 0
543 define i1 @length11_eq(ptr %X, ptr %Y) nounwind {
544 ; X86-LABEL: length11_eq:
546 ; X86-NEXT: pushl %esi
547 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
548 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
549 ; X86-NEXT: movl (%ecx), %edx
550 ; X86-NEXT: movl 4(%ecx), %esi
551 ; X86-NEXT: xorl (%eax), %edx
552 ; X86-NEXT: xorl 4(%eax), %esi
553 ; X86-NEXT: orl %edx, %esi
554 ; X86-NEXT: movl 7(%ecx), %ecx
555 ; X86-NEXT: xorl 7(%eax), %ecx
556 ; X86-NEXT: orl %esi, %ecx
558 ; X86-NEXT: popl %esi
560 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 11) nounwind
561 %c = icmp eq i32 %m, 0
565 define i1 @length12_eq(ptr %X, ptr %Y) nounwind {
566 ; X86-LABEL: length12_eq:
568 ; X86-NEXT: pushl %esi
569 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
570 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
571 ; X86-NEXT: movl (%ecx), %edx
572 ; X86-NEXT: movl 4(%ecx), %esi
573 ; X86-NEXT: xorl (%eax), %edx
574 ; X86-NEXT: xorl 4(%eax), %esi
575 ; X86-NEXT: orl %edx, %esi
576 ; X86-NEXT: movl 8(%ecx), %ecx
577 ; X86-NEXT: xorl 8(%eax), %ecx
578 ; X86-NEXT: orl %esi, %ecx
579 ; X86-NEXT: setne %al
580 ; X86-NEXT: popl %esi
582 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 12) nounwind
583 %c = icmp ne i32 %m, 0
587 define i32 @length12(ptr %X, ptr %Y) nounwind {
588 ; X86-LABEL: length12:
590 ; X86-NEXT: pushl %esi
591 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
592 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
593 ; X86-NEXT: movl (%esi), %ecx
594 ; X86-NEXT: movl (%eax), %edx
595 ; X86-NEXT: bswapl %ecx
596 ; X86-NEXT: bswapl %edx
597 ; X86-NEXT: cmpl %edx, %ecx
598 ; X86-NEXT: jne .LBB29_3
599 ; X86-NEXT: # %bb.1: # %loadbb1
600 ; X86-NEXT: movl 4(%esi), %ecx
601 ; X86-NEXT: movl 4(%eax), %edx
602 ; X86-NEXT: bswapl %ecx
603 ; X86-NEXT: bswapl %edx
604 ; X86-NEXT: cmpl %edx, %ecx
605 ; X86-NEXT: jne .LBB29_3
606 ; X86-NEXT: # %bb.2: # %loadbb2
607 ; X86-NEXT: movl 8(%esi), %ecx
608 ; X86-NEXT: movl 8(%eax), %edx
609 ; X86-NEXT: bswapl %ecx
610 ; X86-NEXT: bswapl %edx
611 ; X86-NEXT: xorl %eax, %eax
612 ; X86-NEXT: cmpl %edx, %ecx
613 ; X86-NEXT: je .LBB29_4
614 ; X86-NEXT: .LBB29_3: # %res_block
615 ; X86-NEXT: xorl %eax, %eax
616 ; X86-NEXT: cmpl %edx, %ecx
617 ; X86-NEXT: sbbl %eax, %eax
618 ; X86-NEXT: orl $1, %eax
619 ; X86-NEXT: .LBB29_4: # %endblock
620 ; X86-NEXT: popl %esi
622 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 12) nounwind
626 define i1 @length13_eq(ptr %X, ptr %Y) nounwind {
627 ; X86-LABEL: length13_eq:
629 ; X86-NEXT: pushl %esi
630 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
631 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
632 ; X86-NEXT: movl (%edx), %esi
633 ; X86-NEXT: movl 4(%edx), %eax
634 ; X86-NEXT: xorl (%ecx), %esi
635 ; X86-NEXT: xorl 4(%ecx), %eax
636 ; X86-NEXT: orl %esi, %eax
637 ; X86-NEXT: movl 8(%edx), %esi
638 ; X86-NEXT: xorl 8(%ecx), %esi
639 ; X86-NEXT: movzbl 12(%edx), %edx
640 ; X86-NEXT: xorb 12(%ecx), %dl
641 ; X86-NEXT: movzbl %dl, %ecx
642 ; X86-NEXT: orl %esi, %ecx
643 ; X86-NEXT: orl %eax, %ecx
645 ; X86-NEXT: popl %esi
647 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 13) nounwind
648 %c = icmp eq i32 %m, 0
652 define i1 @length14_eq(ptr %X, ptr %Y) nounwind {
653 ; X86-LABEL: length14_eq:
655 ; X86-NEXT: pushl %esi
656 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
657 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
658 ; X86-NEXT: movl (%edx), %esi
659 ; X86-NEXT: movl 4(%edx), %eax
660 ; X86-NEXT: xorl (%ecx), %esi
661 ; X86-NEXT: xorl 4(%ecx), %eax
662 ; X86-NEXT: orl %esi, %eax
663 ; X86-NEXT: movl 8(%edx), %esi
664 ; X86-NEXT: xorl 8(%ecx), %esi
665 ; X86-NEXT: movzwl 12(%edx), %edx
666 ; X86-NEXT: xorw 12(%ecx), %dx
667 ; X86-NEXT: movzwl %dx, %ecx
668 ; X86-NEXT: orl %esi, %ecx
669 ; X86-NEXT: orl %eax, %ecx
671 ; X86-NEXT: popl %esi
673 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 14) nounwind
674 %c = icmp eq i32 %m, 0
678 define i1 @length15_eq(ptr %X, ptr %Y) nounwind {
679 ; X86-LABEL: length15_eq:
681 ; X86-NEXT: pushl %esi
682 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
683 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
684 ; X86-NEXT: movl (%edx), %esi
685 ; X86-NEXT: movl 4(%edx), %eax
686 ; X86-NEXT: xorl (%ecx), %esi
687 ; X86-NEXT: xorl 4(%ecx), %eax
688 ; X86-NEXT: orl %esi, %eax
689 ; X86-NEXT: movl 8(%edx), %esi
690 ; X86-NEXT: xorl 8(%ecx), %esi
691 ; X86-NEXT: movl 11(%edx), %edx
692 ; X86-NEXT: xorl 11(%ecx), %edx
693 ; X86-NEXT: orl %esi, %edx
694 ; X86-NEXT: orl %eax, %edx
696 ; X86-NEXT: popl %esi
698 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 15) nounwind
699 %c = icmp eq i32 %m, 0
703 ; PR33329 - https://bugs.llvm.org/show_bug.cgi?id=33329
705 define i32 @length16(ptr %X, ptr %Y) nounwind {
706 ; X86-LABEL: length16:
708 ; X86-NEXT: pushl %esi
709 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
710 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
711 ; X86-NEXT: movl (%esi), %ecx
712 ; X86-NEXT: movl (%eax), %edx
713 ; X86-NEXT: bswapl %ecx
714 ; X86-NEXT: bswapl %edx
715 ; X86-NEXT: cmpl %edx, %ecx
716 ; X86-NEXT: jne .LBB33_4
717 ; X86-NEXT: # %bb.1: # %loadbb1
718 ; X86-NEXT: movl 4(%esi), %ecx
719 ; X86-NEXT: movl 4(%eax), %edx
720 ; X86-NEXT: bswapl %ecx
721 ; X86-NEXT: bswapl %edx
722 ; X86-NEXT: cmpl %edx, %ecx
723 ; X86-NEXT: jne .LBB33_4
724 ; X86-NEXT: # %bb.2: # %loadbb2
725 ; X86-NEXT: movl 8(%esi), %ecx
726 ; X86-NEXT: movl 8(%eax), %edx
727 ; X86-NEXT: bswapl %ecx
728 ; X86-NEXT: bswapl %edx
729 ; X86-NEXT: cmpl %edx, %ecx
730 ; X86-NEXT: jne .LBB33_4
731 ; X86-NEXT: # %bb.3: # %loadbb3
732 ; X86-NEXT: movl 12(%esi), %ecx
733 ; X86-NEXT: movl 12(%eax), %edx
734 ; X86-NEXT: bswapl %ecx
735 ; X86-NEXT: bswapl %edx
736 ; X86-NEXT: xorl %eax, %eax
737 ; X86-NEXT: cmpl %edx, %ecx
738 ; X86-NEXT: je .LBB33_5
739 ; X86-NEXT: .LBB33_4: # %res_block
740 ; X86-NEXT: xorl %eax, %eax
741 ; X86-NEXT: cmpl %edx, %ecx
742 ; X86-NEXT: sbbl %eax, %eax
743 ; X86-NEXT: orl $1, %eax
744 ; X86-NEXT: .LBB33_5: # %endblock
745 ; X86-NEXT: popl %esi
747 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 16) nounwind
751 define i1 @length16_eq(ptr %x, ptr %y) nounwind {
752 ; X86-NOSSE-LABEL: length16_eq:
753 ; X86-NOSSE: # %bb.0:
754 ; X86-NOSSE-NEXT: pushl %esi
755 ; X86-NOSSE-NEXT: movl {{[0-9]+}}(%esp), %ecx
756 ; X86-NOSSE-NEXT: movl {{[0-9]+}}(%esp), %edx
757 ; X86-NOSSE-NEXT: movl (%edx), %esi
758 ; X86-NOSSE-NEXT: movl 4(%edx), %eax
759 ; X86-NOSSE-NEXT: xorl (%ecx), %esi
760 ; X86-NOSSE-NEXT: xorl 4(%ecx), %eax
761 ; X86-NOSSE-NEXT: orl %esi, %eax
762 ; X86-NOSSE-NEXT: movl 8(%edx), %esi
763 ; X86-NOSSE-NEXT: xorl 8(%ecx), %esi
764 ; X86-NOSSE-NEXT: movl 12(%edx), %edx
765 ; X86-NOSSE-NEXT: xorl 12(%ecx), %edx
766 ; X86-NOSSE-NEXT: orl %esi, %edx
767 ; X86-NOSSE-NEXT: orl %eax, %edx
768 ; X86-NOSSE-NEXT: setne %al
769 ; X86-NOSSE-NEXT: popl %esi
770 ; X86-NOSSE-NEXT: retl
772 ; X86-SSE1-LABEL: length16_eq:
774 ; X86-SSE1-NEXT: pushl %esi
775 ; X86-SSE1-NEXT: movl {{[0-9]+}}(%esp), %ecx
776 ; X86-SSE1-NEXT: movl {{[0-9]+}}(%esp), %edx
777 ; X86-SSE1-NEXT: movl (%edx), %esi
778 ; X86-SSE1-NEXT: movl 4(%edx), %eax
779 ; X86-SSE1-NEXT: xorl (%ecx), %esi
780 ; X86-SSE1-NEXT: xorl 4(%ecx), %eax
781 ; X86-SSE1-NEXT: orl %esi, %eax
782 ; X86-SSE1-NEXT: movl 8(%edx), %esi
783 ; X86-SSE1-NEXT: xorl 8(%ecx), %esi
784 ; X86-SSE1-NEXT: movl 12(%edx), %edx
785 ; X86-SSE1-NEXT: xorl 12(%ecx), %edx
786 ; X86-SSE1-NEXT: orl %esi, %edx
787 ; X86-SSE1-NEXT: orl %eax, %edx
788 ; X86-SSE1-NEXT: setne %al
789 ; X86-SSE1-NEXT: popl %esi
790 ; X86-SSE1-NEXT: retl
792 ; X86-SSE2-LABEL: length16_eq:
794 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
795 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
796 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
797 ; X86-SSE2-NEXT: movdqu (%eax), %xmm1
798 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm1
799 ; X86-SSE2-NEXT: pmovmskb %xmm1, %eax
800 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
801 ; X86-SSE2-NEXT: setne %al
802 ; X86-SSE2-NEXT: retl
804 ; X86-SSE41-LABEL: length16_eq:
805 ; X86-SSE41: # %bb.0:
806 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
807 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
808 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
809 ; X86-SSE41-NEXT: movdqu (%eax), %xmm1
810 ; X86-SSE41-NEXT: pxor %xmm0, %xmm1
811 ; X86-SSE41-NEXT: ptest %xmm1, %xmm1
812 ; X86-SSE41-NEXT: setne %al
813 ; X86-SSE41-NEXT: retl
814 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 16) nounwind
815 %cmp = icmp ne i32 %call, 0
819 define i1 @length16_lt(ptr %x, ptr %y) nounwind {
820 ; X86-LABEL: length16_lt:
822 ; X86-NEXT: pushl %esi
823 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
824 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
825 ; X86-NEXT: movl (%esi), %ecx
826 ; X86-NEXT: movl (%eax), %edx
827 ; X86-NEXT: bswapl %ecx
828 ; X86-NEXT: bswapl %edx
829 ; X86-NEXT: cmpl %edx, %ecx
830 ; X86-NEXT: jne .LBB35_4
831 ; X86-NEXT: # %bb.1: # %loadbb1
832 ; X86-NEXT: movl 4(%esi), %ecx
833 ; X86-NEXT: movl 4(%eax), %edx
834 ; X86-NEXT: bswapl %ecx
835 ; X86-NEXT: bswapl %edx
836 ; X86-NEXT: cmpl %edx, %ecx
837 ; X86-NEXT: jne .LBB35_4
838 ; X86-NEXT: # %bb.2: # %loadbb2
839 ; X86-NEXT: movl 8(%esi), %ecx
840 ; X86-NEXT: movl 8(%eax), %edx
841 ; X86-NEXT: bswapl %ecx
842 ; X86-NEXT: bswapl %edx
843 ; X86-NEXT: cmpl %edx, %ecx
844 ; X86-NEXT: jne .LBB35_4
845 ; X86-NEXT: # %bb.3: # %loadbb3
846 ; X86-NEXT: movl 12(%esi), %ecx
847 ; X86-NEXT: movl 12(%eax), %edx
848 ; X86-NEXT: bswapl %ecx
849 ; X86-NEXT: bswapl %edx
850 ; X86-NEXT: xorl %eax, %eax
851 ; X86-NEXT: cmpl %edx, %ecx
852 ; X86-NEXT: je .LBB35_5
853 ; X86-NEXT: .LBB35_4: # %res_block
854 ; X86-NEXT: xorl %eax, %eax
855 ; X86-NEXT: cmpl %edx, %ecx
856 ; X86-NEXT: sbbl %eax, %eax
857 ; X86-NEXT: orl $1, %eax
858 ; X86-NEXT: .LBB35_5: # %endblock
859 ; X86-NEXT: shrl $31, %eax
860 ; X86-NEXT: # kill: def $al killed $al killed $eax
861 ; X86-NEXT: popl %esi
863 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 16) nounwind
864 %cmp = icmp slt i32 %call, 0
868 define i1 @length16_gt(ptr %x, ptr %y) nounwind {
869 ; X86-LABEL: length16_gt:
871 ; X86-NEXT: pushl %esi
872 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
873 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
874 ; X86-NEXT: movl (%esi), %eax
875 ; X86-NEXT: movl (%edx), %ecx
876 ; X86-NEXT: bswapl %eax
877 ; X86-NEXT: bswapl %ecx
878 ; X86-NEXT: cmpl %ecx, %eax
879 ; X86-NEXT: jne .LBB36_4
880 ; X86-NEXT: # %bb.1: # %loadbb1
881 ; X86-NEXT: movl 4(%esi), %eax
882 ; X86-NEXT: movl 4(%edx), %ecx
883 ; X86-NEXT: bswapl %eax
884 ; X86-NEXT: bswapl %ecx
885 ; X86-NEXT: cmpl %ecx, %eax
886 ; X86-NEXT: jne .LBB36_4
887 ; X86-NEXT: # %bb.2: # %loadbb2
888 ; X86-NEXT: movl 8(%esi), %eax
889 ; X86-NEXT: movl 8(%edx), %ecx
890 ; X86-NEXT: bswapl %eax
891 ; X86-NEXT: bswapl %ecx
892 ; X86-NEXT: cmpl %ecx, %eax
893 ; X86-NEXT: jne .LBB36_4
894 ; X86-NEXT: # %bb.3: # %loadbb3
895 ; X86-NEXT: movl 12(%esi), %eax
896 ; X86-NEXT: movl 12(%edx), %ecx
897 ; X86-NEXT: bswapl %eax
898 ; X86-NEXT: bswapl %ecx
899 ; X86-NEXT: xorl %edx, %edx
900 ; X86-NEXT: cmpl %ecx, %eax
901 ; X86-NEXT: je .LBB36_5
902 ; X86-NEXT: .LBB36_4: # %res_block
903 ; X86-NEXT: xorl %edx, %edx
904 ; X86-NEXT: cmpl %ecx, %eax
905 ; X86-NEXT: sbbl %edx, %edx
906 ; X86-NEXT: orl $1, %edx
907 ; X86-NEXT: .LBB36_5: # %endblock
908 ; X86-NEXT: testl %edx, %edx
910 ; X86-NEXT: popl %esi
912 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 16) nounwind
913 %cmp = icmp sgt i32 %call, 0
917 define i1 @length16_eq_const(ptr %X) nounwind {
918 ; X86-NOSSE-LABEL: length16_eq_const:
919 ; X86-NOSSE: # %bb.0:
920 ; X86-NOSSE-NEXT: pushl %esi
921 ; X86-NOSSE-NEXT: movl {{[0-9]+}}(%esp), %eax
922 ; X86-NOSSE-NEXT: movl $858927408, %ecx # imm = 0x33323130
923 ; X86-NOSSE-NEXT: xorl (%eax), %ecx
924 ; X86-NOSSE-NEXT: movl $926299444, %edx # imm = 0x37363534
925 ; X86-NOSSE-NEXT: xorl 4(%eax), %edx
926 ; X86-NOSSE-NEXT: orl %ecx, %edx
927 ; X86-NOSSE-NEXT: movl $825243960, %ecx # imm = 0x31303938
928 ; X86-NOSSE-NEXT: xorl 8(%eax), %ecx
929 ; X86-NOSSE-NEXT: movl $892613426, %esi # imm = 0x35343332
930 ; X86-NOSSE-NEXT: xorl 12(%eax), %esi
931 ; X86-NOSSE-NEXT: orl %ecx, %esi
932 ; X86-NOSSE-NEXT: orl %edx, %esi
933 ; X86-NOSSE-NEXT: sete %al
934 ; X86-NOSSE-NEXT: popl %esi
935 ; X86-NOSSE-NEXT: retl
937 ; X86-SSE1-LABEL: length16_eq_const:
939 ; X86-SSE1-NEXT: pushl %esi
940 ; X86-SSE1-NEXT: movl {{[0-9]+}}(%esp), %eax
941 ; X86-SSE1-NEXT: movl $858927408, %ecx # imm = 0x33323130
942 ; X86-SSE1-NEXT: xorl (%eax), %ecx
943 ; X86-SSE1-NEXT: movl $926299444, %edx # imm = 0x37363534
944 ; X86-SSE1-NEXT: xorl 4(%eax), %edx
945 ; X86-SSE1-NEXT: orl %ecx, %edx
946 ; X86-SSE1-NEXT: movl $825243960, %ecx # imm = 0x31303938
947 ; X86-SSE1-NEXT: xorl 8(%eax), %ecx
948 ; X86-SSE1-NEXT: movl $892613426, %esi # imm = 0x35343332
949 ; X86-SSE1-NEXT: xorl 12(%eax), %esi
950 ; X86-SSE1-NEXT: orl %ecx, %esi
951 ; X86-SSE1-NEXT: orl %edx, %esi
952 ; X86-SSE1-NEXT: sete %al
953 ; X86-SSE1-NEXT: popl %esi
954 ; X86-SSE1-NEXT: retl
956 ; X86-SSE2-LABEL: length16_eq_const:
958 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
959 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
960 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
961 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
962 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
963 ; X86-SSE2-NEXT: sete %al
964 ; X86-SSE2-NEXT: retl
966 ; X86-SSE41-LABEL: length16_eq_const:
967 ; X86-SSE41: # %bb.0:
968 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
969 ; X86-SSE41-NEXT: movdqu (%eax), %xmm0
970 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
971 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
972 ; X86-SSE41-NEXT: sete %al
973 ; X86-SSE41-NEXT: retl
974 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 16) nounwind
975 %c = icmp eq i32 %m, 0
979 ; PR33914 - https://bugs.llvm.org/show_bug.cgi?id=33914
981 define i32 @length24(ptr %X, ptr %Y) nounwind {
982 ; X86-LABEL: length24:
984 ; X86-NEXT: pushl $24
985 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
986 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
987 ; X86-NEXT: calll memcmp
988 ; X86-NEXT: addl $12, %esp
990 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 24) nounwind
994 define i1 @length24_eq(ptr %x, ptr %y) nounwind {
995 ; X86-NOSSE-LABEL: length24_eq:
996 ; X86-NOSSE: # %bb.0:
997 ; X86-NOSSE-NEXT: pushl $24
998 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
999 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1000 ; X86-NOSSE-NEXT: calll memcmp
1001 ; X86-NOSSE-NEXT: addl $12, %esp
1002 ; X86-NOSSE-NEXT: testl %eax, %eax
1003 ; X86-NOSSE-NEXT: sete %al
1004 ; X86-NOSSE-NEXT: retl
1006 ; X86-SSE1-LABEL: length24_eq:
1007 ; X86-SSE1: # %bb.0:
1008 ; X86-SSE1-NEXT: pushl $24
1009 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1010 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1011 ; X86-SSE1-NEXT: calll memcmp
1012 ; X86-SSE1-NEXT: addl $12, %esp
1013 ; X86-SSE1-NEXT: testl %eax, %eax
1014 ; X86-SSE1-NEXT: sete %al
1015 ; X86-SSE1-NEXT: retl
1017 ; X86-SSE2-LABEL: length24_eq:
1018 ; X86-SSE2: # %bb.0:
1019 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1020 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
1021 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
1022 ; X86-SSE2-NEXT: movdqu 8(%ecx), %xmm1
1023 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
1024 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
1025 ; X86-SSE2-NEXT: movdqu 8(%eax), %xmm0
1026 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
1027 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1028 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1029 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1030 ; X86-SSE2-NEXT: sete %al
1031 ; X86-SSE2-NEXT: retl
1033 ; X86-SSE41-LABEL: length24_eq:
1034 ; X86-SSE41: # %bb.0:
1035 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1036 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
1037 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
1038 ; X86-SSE41-NEXT: movdqu 8(%ecx), %xmm1
1039 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
1040 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
1041 ; X86-SSE41-NEXT: movdqu 8(%eax), %xmm0
1042 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
1043 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1044 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1045 ; X86-SSE41-NEXT: sete %al
1046 ; X86-SSE41-NEXT: retl
1047 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 24) nounwind
1048 %cmp = icmp eq i32 %call, 0
1052 define i1 @length24_lt(ptr %x, ptr %y) nounwind {
1053 ; X86-LABEL: length24_lt:
1055 ; X86-NEXT: pushl $24
1056 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1057 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1058 ; X86-NEXT: calll memcmp
1059 ; X86-NEXT: addl $12, %esp
1060 ; X86-NEXT: shrl $31, %eax
1061 ; X86-NEXT: # kill: def $al killed $al killed $eax
1063 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 24) nounwind
1064 %cmp = icmp slt i32 %call, 0
1068 define i1 @length24_gt(ptr %x, ptr %y) nounwind {
1069 ; X86-LABEL: length24_gt:
1071 ; X86-NEXT: pushl $24
1072 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1073 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1074 ; X86-NEXT: calll memcmp
1075 ; X86-NEXT: addl $12, %esp
1076 ; X86-NEXT: testl %eax, %eax
1077 ; X86-NEXT: setg %al
1079 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 24) nounwind
1080 %cmp = icmp sgt i32 %call, 0
1084 define i1 @length24_eq_const(ptr %X) nounwind {
1085 ; X86-NOSSE-LABEL: length24_eq_const:
1086 ; X86-NOSSE: # %bb.0:
1087 ; X86-NOSSE-NEXT: pushl $24
1088 ; X86-NOSSE-NEXT: pushl $.L.str
1089 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1090 ; X86-NOSSE-NEXT: calll memcmp
1091 ; X86-NOSSE-NEXT: addl $12, %esp
1092 ; X86-NOSSE-NEXT: testl %eax, %eax
1093 ; X86-NOSSE-NEXT: setne %al
1094 ; X86-NOSSE-NEXT: retl
1096 ; X86-SSE1-LABEL: length24_eq_const:
1097 ; X86-SSE1: # %bb.0:
1098 ; X86-SSE1-NEXT: pushl $24
1099 ; X86-SSE1-NEXT: pushl $.L.str
1100 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1101 ; X86-SSE1-NEXT: calll memcmp
1102 ; X86-SSE1-NEXT: addl $12, %esp
1103 ; X86-SSE1-NEXT: testl %eax, %eax
1104 ; X86-SSE1-NEXT: setne %al
1105 ; X86-SSE1-NEXT: retl
1107 ; X86-SSE2-LABEL: length24_eq_const:
1108 ; X86-SSE2: # %bb.0:
1109 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1110 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
1111 ; X86-SSE2-NEXT: movdqu 8(%eax), %xmm1
1112 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1113 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1114 ; X86-SSE2-NEXT: pand %xmm1, %xmm0
1115 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1116 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1117 ; X86-SSE2-NEXT: setne %al
1118 ; X86-SSE2-NEXT: retl
1120 ; X86-SSE41-LABEL: length24_eq_const:
1121 ; X86-SSE41: # %bb.0:
1122 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1123 ; X86-SSE41-NEXT: movdqu (%eax), %xmm0
1124 ; X86-SSE41-NEXT: movdqu 8(%eax), %xmm1
1125 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1126 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1127 ; X86-SSE41-NEXT: por %xmm1, %xmm0
1128 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1129 ; X86-SSE41-NEXT: setne %al
1130 ; X86-SSE41-NEXT: retl
1131 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 24) nounwind
1132 %c = icmp ne i32 %m, 0
1136 define i32 @length31(ptr %X, ptr %Y) nounwind {
1137 ; X86-LABEL: length31:
1139 ; X86-NEXT: pushl $31
1140 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1141 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1142 ; X86-NEXT: calll memcmp
1143 ; X86-NEXT: addl $12, %esp
1145 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 31) nounwind
1149 define i1 @length31_eq(ptr %x, ptr %y) nounwind {
1150 ; X86-NOSSE-LABEL: length31_eq:
1151 ; X86-NOSSE: # %bb.0:
1152 ; X86-NOSSE-NEXT: pushl $31
1153 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1154 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1155 ; X86-NOSSE-NEXT: calll memcmp
1156 ; X86-NOSSE-NEXT: addl $12, %esp
1157 ; X86-NOSSE-NEXT: testl %eax, %eax
1158 ; X86-NOSSE-NEXT: sete %al
1159 ; X86-NOSSE-NEXT: retl
1161 ; X86-SSE1-LABEL: length31_eq:
1162 ; X86-SSE1: # %bb.0:
1163 ; X86-SSE1-NEXT: pushl $31
1164 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1165 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1166 ; X86-SSE1-NEXT: calll memcmp
1167 ; X86-SSE1-NEXT: addl $12, %esp
1168 ; X86-SSE1-NEXT: testl %eax, %eax
1169 ; X86-SSE1-NEXT: sete %al
1170 ; X86-SSE1-NEXT: retl
1172 ; X86-SSE2-LABEL: length31_eq:
1173 ; X86-SSE2: # %bb.0:
1174 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1175 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
1176 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
1177 ; X86-SSE2-NEXT: movdqu 15(%ecx), %xmm1
1178 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
1179 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
1180 ; X86-SSE2-NEXT: movdqu 15(%eax), %xmm0
1181 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
1182 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1183 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1184 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1185 ; X86-SSE2-NEXT: sete %al
1186 ; X86-SSE2-NEXT: retl
1188 ; X86-SSE41-LABEL: length31_eq:
1189 ; X86-SSE41: # %bb.0:
1190 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1191 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
1192 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
1193 ; X86-SSE41-NEXT: movdqu 15(%ecx), %xmm1
1194 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
1195 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
1196 ; X86-SSE41-NEXT: movdqu 15(%eax), %xmm0
1197 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
1198 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1199 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1200 ; X86-SSE41-NEXT: sete %al
1201 ; X86-SSE41-NEXT: retl
1202 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 31) nounwind
1203 %cmp = icmp eq i32 %call, 0
1207 define i1 @length31_lt(ptr %x, ptr %y) nounwind {
1208 ; X86-LABEL: length31_lt:
1210 ; X86-NEXT: pushl $31
1211 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1212 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1213 ; X86-NEXT: calll memcmp
1214 ; X86-NEXT: addl $12, %esp
1215 ; X86-NEXT: shrl $31, %eax
1216 ; X86-NEXT: # kill: def $al killed $al killed $eax
1218 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 31) nounwind
1219 %cmp = icmp slt i32 %call, 0
1223 define i1 @length31_gt(ptr %x, ptr %y) nounwind {
1224 ; X86-LABEL: length31_gt:
1226 ; X86-NEXT: pushl $31
1227 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1228 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1229 ; X86-NEXT: calll memcmp
1230 ; X86-NEXT: addl $12, %esp
1231 ; X86-NEXT: testl %eax, %eax
1232 ; X86-NEXT: setg %al
1234 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 31) nounwind
1235 %cmp = icmp sgt i32 %call, 0
1239 define i1 @length31_eq_prefer128(ptr %x, ptr %y) nounwind "prefer-vector-width"="128" {
1240 ; X86-NOSSE-LABEL: length31_eq_prefer128:
1241 ; X86-NOSSE: # %bb.0:
1242 ; X86-NOSSE-NEXT: pushl $31
1243 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1244 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1245 ; X86-NOSSE-NEXT: calll memcmp
1246 ; X86-NOSSE-NEXT: addl $12, %esp
1247 ; X86-NOSSE-NEXT: testl %eax, %eax
1248 ; X86-NOSSE-NEXT: sete %al
1249 ; X86-NOSSE-NEXT: retl
1251 ; X86-SSE1-LABEL: length31_eq_prefer128:
1252 ; X86-SSE1: # %bb.0:
1253 ; X86-SSE1-NEXT: pushl $31
1254 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1255 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1256 ; X86-SSE1-NEXT: calll memcmp
1257 ; X86-SSE1-NEXT: addl $12, %esp
1258 ; X86-SSE1-NEXT: testl %eax, %eax
1259 ; X86-SSE1-NEXT: sete %al
1260 ; X86-SSE1-NEXT: retl
1262 ; X86-SSE2-LABEL: length31_eq_prefer128:
1263 ; X86-SSE2: # %bb.0:
1264 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1265 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
1266 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
1267 ; X86-SSE2-NEXT: movdqu 15(%ecx), %xmm1
1268 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
1269 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
1270 ; X86-SSE2-NEXT: movdqu 15(%eax), %xmm0
1271 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
1272 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1273 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1274 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1275 ; X86-SSE2-NEXT: sete %al
1276 ; X86-SSE2-NEXT: retl
1278 ; X86-SSE41-LABEL: length31_eq_prefer128:
1279 ; X86-SSE41: # %bb.0:
1280 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1281 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
1282 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
1283 ; X86-SSE41-NEXT: movdqu 15(%ecx), %xmm1
1284 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
1285 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
1286 ; X86-SSE41-NEXT: movdqu 15(%eax), %xmm0
1287 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
1288 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1289 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1290 ; X86-SSE41-NEXT: sete %al
1291 ; X86-SSE41-NEXT: retl
1292 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 31) nounwind
1293 %cmp = icmp eq i32 %call, 0
1297 define i1 @length31_eq_const(ptr %X) nounwind {
1298 ; X86-NOSSE-LABEL: length31_eq_const:
1299 ; X86-NOSSE: # %bb.0:
1300 ; X86-NOSSE-NEXT: pushl $31
1301 ; X86-NOSSE-NEXT: pushl $.L.str
1302 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1303 ; X86-NOSSE-NEXT: calll memcmp
1304 ; X86-NOSSE-NEXT: addl $12, %esp
1305 ; X86-NOSSE-NEXT: testl %eax, %eax
1306 ; X86-NOSSE-NEXT: setne %al
1307 ; X86-NOSSE-NEXT: retl
1309 ; X86-SSE1-LABEL: length31_eq_const:
1310 ; X86-SSE1: # %bb.0:
1311 ; X86-SSE1-NEXT: pushl $31
1312 ; X86-SSE1-NEXT: pushl $.L.str
1313 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1314 ; X86-SSE1-NEXT: calll memcmp
1315 ; X86-SSE1-NEXT: addl $12, %esp
1316 ; X86-SSE1-NEXT: testl %eax, %eax
1317 ; X86-SSE1-NEXT: setne %al
1318 ; X86-SSE1-NEXT: retl
1320 ; X86-SSE2-LABEL: length31_eq_const:
1321 ; X86-SSE2: # %bb.0:
1322 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1323 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
1324 ; X86-SSE2-NEXT: movdqu 15(%eax), %xmm1
1325 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1326 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1327 ; X86-SSE2-NEXT: pand %xmm1, %xmm0
1328 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1329 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1330 ; X86-SSE2-NEXT: setne %al
1331 ; X86-SSE2-NEXT: retl
1333 ; X86-SSE41-LABEL: length31_eq_const:
1334 ; X86-SSE41: # %bb.0:
1335 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1336 ; X86-SSE41-NEXT: movdqu (%eax), %xmm0
1337 ; X86-SSE41-NEXT: movdqu 15(%eax), %xmm1
1338 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1339 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1340 ; X86-SSE41-NEXT: por %xmm1, %xmm0
1341 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1342 ; X86-SSE41-NEXT: setne %al
1343 ; X86-SSE41-NEXT: retl
1344 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 31) nounwind
1345 %c = icmp ne i32 %m, 0
1349 define i32 @length32(ptr %X, ptr %Y) nounwind {
1350 ; X86-LABEL: length32:
1352 ; X86-NEXT: pushl $32
1353 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1354 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1355 ; X86-NEXT: calll memcmp
1356 ; X86-NEXT: addl $12, %esp
1358 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 32) nounwind
1362 ; PR33325 - https://bugs.llvm.org/show_bug.cgi?id=33325
1364 define i1 @length32_eq(ptr %x, ptr %y) nounwind {
1365 ; X86-NOSSE-LABEL: length32_eq:
1366 ; X86-NOSSE: # %bb.0:
1367 ; X86-NOSSE-NEXT: pushl $32
1368 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1369 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1370 ; X86-NOSSE-NEXT: calll memcmp
1371 ; X86-NOSSE-NEXT: addl $12, %esp
1372 ; X86-NOSSE-NEXT: testl %eax, %eax
1373 ; X86-NOSSE-NEXT: sete %al
1374 ; X86-NOSSE-NEXT: retl
1376 ; X86-SSE1-LABEL: length32_eq:
1377 ; X86-SSE1: # %bb.0:
1378 ; X86-SSE1-NEXT: pushl $32
1379 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1380 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1381 ; X86-SSE1-NEXT: calll memcmp
1382 ; X86-SSE1-NEXT: addl $12, %esp
1383 ; X86-SSE1-NEXT: testl %eax, %eax
1384 ; X86-SSE1-NEXT: sete %al
1385 ; X86-SSE1-NEXT: retl
1387 ; X86-SSE2-LABEL: length32_eq:
1388 ; X86-SSE2: # %bb.0:
1389 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1390 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
1391 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
1392 ; X86-SSE2-NEXT: movdqu 16(%ecx), %xmm1
1393 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
1394 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
1395 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm0
1396 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
1397 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1398 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1399 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1400 ; X86-SSE2-NEXT: sete %al
1401 ; X86-SSE2-NEXT: retl
1403 ; X86-SSE41-LABEL: length32_eq:
1404 ; X86-SSE41: # %bb.0:
1405 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1406 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
1407 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
1408 ; X86-SSE41-NEXT: movdqu 16(%ecx), %xmm1
1409 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
1410 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
1411 ; X86-SSE41-NEXT: movdqu 16(%eax), %xmm0
1412 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
1413 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1414 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1415 ; X86-SSE41-NEXT: sete %al
1416 ; X86-SSE41-NEXT: retl
1417 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 32) nounwind
1418 %cmp = icmp eq i32 %call, 0
1422 define i1 @length32_lt(ptr %x, ptr %y) nounwind {
1423 ; X86-LABEL: length32_lt:
1425 ; X86-NEXT: pushl $32
1426 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1427 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1428 ; X86-NEXT: calll memcmp
1429 ; X86-NEXT: addl $12, %esp
1430 ; X86-NEXT: shrl $31, %eax
1431 ; X86-NEXT: # kill: def $al killed $al killed $eax
1433 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 32) nounwind
1434 %cmp = icmp slt i32 %call, 0
1438 define i1 @length32_gt(ptr %x, ptr %y) nounwind {
1439 ; X86-LABEL: length32_gt:
1441 ; X86-NEXT: pushl $32
1442 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1443 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1444 ; X86-NEXT: calll memcmp
1445 ; X86-NEXT: addl $12, %esp
1446 ; X86-NEXT: testl %eax, %eax
1447 ; X86-NEXT: setg %al
1449 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 32) nounwind
1450 %cmp = icmp sgt i32 %call, 0
1454 define i1 @length32_eq_prefer128(ptr %x, ptr %y) nounwind "prefer-vector-width"="128" {
1455 ; X86-NOSSE-LABEL: length32_eq_prefer128:
1456 ; X86-NOSSE: # %bb.0:
1457 ; X86-NOSSE-NEXT: pushl $32
1458 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1459 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1460 ; X86-NOSSE-NEXT: calll memcmp
1461 ; X86-NOSSE-NEXT: addl $12, %esp
1462 ; X86-NOSSE-NEXT: testl %eax, %eax
1463 ; X86-NOSSE-NEXT: sete %al
1464 ; X86-NOSSE-NEXT: retl
1466 ; X86-SSE1-LABEL: length32_eq_prefer128:
1467 ; X86-SSE1: # %bb.0:
1468 ; X86-SSE1-NEXT: pushl $32
1469 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1470 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1471 ; X86-SSE1-NEXT: calll memcmp
1472 ; X86-SSE1-NEXT: addl $12, %esp
1473 ; X86-SSE1-NEXT: testl %eax, %eax
1474 ; X86-SSE1-NEXT: sete %al
1475 ; X86-SSE1-NEXT: retl
1477 ; X86-SSE2-LABEL: length32_eq_prefer128:
1478 ; X86-SSE2: # %bb.0:
1479 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1480 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
1481 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
1482 ; X86-SSE2-NEXT: movdqu 16(%ecx), %xmm1
1483 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
1484 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
1485 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm0
1486 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
1487 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1488 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1489 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1490 ; X86-SSE2-NEXT: sete %al
1491 ; X86-SSE2-NEXT: retl
1493 ; X86-SSE41-LABEL: length32_eq_prefer128:
1494 ; X86-SSE41: # %bb.0:
1495 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1496 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
1497 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
1498 ; X86-SSE41-NEXT: movdqu 16(%ecx), %xmm1
1499 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
1500 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
1501 ; X86-SSE41-NEXT: movdqu 16(%eax), %xmm0
1502 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
1503 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1504 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1505 ; X86-SSE41-NEXT: sete %al
1506 ; X86-SSE41-NEXT: retl
1507 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 32) nounwind
1508 %cmp = icmp eq i32 %call, 0
1512 define i1 @length32_eq_const(ptr %X) nounwind {
1513 ; X86-NOSSE-LABEL: length32_eq_const:
1514 ; X86-NOSSE: # %bb.0:
1515 ; X86-NOSSE-NEXT: pushl $32
1516 ; X86-NOSSE-NEXT: pushl $.L.str
1517 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1518 ; X86-NOSSE-NEXT: calll memcmp
1519 ; X86-NOSSE-NEXT: addl $12, %esp
1520 ; X86-NOSSE-NEXT: testl %eax, %eax
1521 ; X86-NOSSE-NEXT: setne %al
1522 ; X86-NOSSE-NEXT: retl
1524 ; X86-SSE1-LABEL: length32_eq_const:
1525 ; X86-SSE1: # %bb.0:
1526 ; X86-SSE1-NEXT: pushl $32
1527 ; X86-SSE1-NEXT: pushl $.L.str
1528 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1529 ; X86-SSE1-NEXT: calll memcmp
1530 ; X86-SSE1-NEXT: addl $12, %esp
1531 ; X86-SSE1-NEXT: testl %eax, %eax
1532 ; X86-SSE1-NEXT: setne %al
1533 ; X86-SSE1-NEXT: retl
1535 ; X86-SSE2-LABEL: length32_eq_const:
1536 ; X86-SSE2: # %bb.0:
1537 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1538 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
1539 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm1
1540 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1541 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1542 ; X86-SSE2-NEXT: pand %xmm1, %xmm0
1543 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1544 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1545 ; X86-SSE2-NEXT: setne %al
1546 ; X86-SSE2-NEXT: retl
1548 ; X86-SSE41-LABEL: length32_eq_const:
1549 ; X86-SSE41: # %bb.0:
1550 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1551 ; X86-SSE41-NEXT: movdqu (%eax), %xmm0
1552 ; X86-SSE41-NEXT: movdqu 16(%eax), %xmm1
1553 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1554 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1555 ; X86-SSE41-NEXT: por %xmm1, %xmm0
1556 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1557 ; X86-SSE41-NEXT: setne %al
1558 ; X86-SSE41-NEXT: retl
1559 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 32) nounwind
1560 %c = icmp ne i32 %m, 0
1564 define i32 @length48(ptr %X, ptr %Y) nounwind {
1565 ; X86-LABEL: length48:
1567 ; X86-NEXT: pushl $48
1568 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1569 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1570 ; X86-NEXT: calll memcmp
1571 ; X86-NEXT: addl $12, %esp
1573 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 48) nounwind
1577 define i1 @length48_eq(ptr %x, ptr %y) nounwind {
1578 ; X86-NOSSE-LABEL: length48_eq:
1579 ; X86-NOSSE: # %bb.0:
1580 ; X86-NOSSE-NEXT: pushl $48
1581 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1582 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1583 ; X86-NOSSE-NEXT: calll memcmp
1584 ; X86-NOSSE-NEXT: addl $12, %esp
1585 ; X86-NOSSE-NEXT: testl %eax, %eax
1586 ; X86-NOSSE-NEXT: sete %al
1587 ; X86-NOSSE-NEXT: retl
1589 ; X86-SSE1-LABEL: length48_eq:
1590 ; X86-SSE1: # %bb.0:
1591 ; X86-SSE1-NEXT: pushl $48
1592 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1593 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1594 ; X86-SSE1-NEXT: calll memcmp
1595 ; X86-SSE1-NEXT: addl $12, %esp
1596 ; X86-SSE1-NEXT: testl %eax, %eax
1597 ; X86-SSE1-NEXT: sete %al
1598 ; X86-SSE1-NEXT: retl
1600 ; X86-SSE2-LABEL: length48_eq:
1601 ; X86-SSE2: # %bb.0:
1602 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1603 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
1604 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
1605 ; X86-SSE2-NEXT: movdqu 16(%ecx), %xmm1
1606 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
1607 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
1608 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm0
1609 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
1610 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1611 ; X86-SSE2-NEXT: movdqu 32(%ecx), %xmm1
1612 ; X86-SSE2-NEXT: movdqu 32(%eax), %xmm2
1613 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm2
1614 ; X86-SSE2-NEXT: pand %xmm0, %xmm2
1615 ; X86-SSE2-NEXT: pmovmskb %xmm2, %eax
1616 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1617 ; X86-SSE2-NEXT: sete %al
1618 ; X86-SSE2-NEXT: retl
1620 ; X86-SSE41-LABEL: length48_eq:
1621 ; X86-SSE41: # %bb.0:
1622 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1623 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
1624 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
1625 ; X86-SSE41-NEXT: movdqu 16(%ecx), %xmm1
1626 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
1627 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
1628 ; X86-SSE41-NEXT: movdqu 16(%eax), %xmm0
1629 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
1630 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1631 ; X86-SSE41-NEXT: movdqu 32(%ecx), %xmm1
1632 ; X86-SSE41-NEXT: movdqu 32(%eax), %xmm2
1633 ; X86-SSE41-NEXT: pxor %xmm1, %xmm2
1634 ; X86-SSE41-NEXT: por %xmm0, %xmm2
1635 ; X86-SSE41-NEXT: ptest %xmm2, %xmm2
1636 ; X86-SSE41-NEXT: sete %al
1637 ; X86-SSE41-NEXT: retl
1638 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 48) nounwind
1639 %cmp = icmp eq i32 %call, 0
1643 define i1 @length48_lt(ptr %x, ptr %y) nounwind {
1644 ; X86-LABEL: length48_lt:
1646 ; X86-NEXT: pushl $48
1647 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1648 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1649 ; X86-NEXT: calll memcmp
1650 ; X86-NEXT: addl $12, %esp
1651 ; X86-NEXT: shrl $31, %eax
1652 ; X86-NEXT: # kill: def $al killed $al killed $eax
1654 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 48) nounwind
1655 %cmp = icmp slt i32 %call, 0
1659 define i1 @length48_gt(ptr %x, ptr %y) nounwind {
1660 ; X86-LABEL: length48_gt:
1662 ; X86-NEXT: pushl $48
1663 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1664 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1665 ; X86-NEXT: calll memcmp
1666 ; X86-NEXT: addl $12, %esp
1667 ; X86-NEXT: testl %eax, %eax
1668 ; X86-NEXT: setg %al
1670 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 48) nounwind
1671 %cmp = icmp sgt i32 %call, 0
1675 define i1 @length48_eq_prefer128(ptr %x, ptr %y) nounwind "prefer-vector-width"="128" {
1676 ; X86-NOSSE-LABEL: length48_eq_prefer128:
1677 ; X86-NOSSE: # %bb.0:
1678 ; X86-NOSSE-NEXT: pushl $48
1679 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1680 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1681 ; X86-NOSSE-NEXT: calll memcmp
1682 ; X86-NOSSE-NEXT: addl $12, %esp
1683 ; X86-NOSSE-NEXT: testl %eax, %eax
1684 ; X86-NOSSE-NEXT: sete %al
1685 ; X86-NOSSE-NEXT: retl
1687 ; X86-SSE1-LABEL: length48_eq_prefer128:
1688 ; X86-SSE1: # %bb.0:
1689 ; X86-SSE1-NEXT: pushl $48
1690 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1691 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1692 ; X86-SSE1-NEXT: calll memcmp
1693 ; X86-SSE1-NEXT: addl $12, %esp
1694 ; X86-SSE1-NEXT: testl %eax, %eax
1695 ; X86-SSE1-NEXT: sete %al
1696 ; X86-SSE1-NEXT: retl
1698 ; X86-SSE2-LABEL: length48_eq_prefer128:
1699 ; X86-SSE2: # %bb.0:
1700 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1701 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
1702 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
1703 ; X86-SSE2-NEXT: movdqu 16(%ecx), %xmm1
1704 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
1705 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
1706 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm0
1707 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
1708 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1709 ; X86-SSE2-NEXT: movdqu 32(%ecx), %xmm1
1710 ; X86-SSE2-NEXT: movdqu 32(%eax), %xmm2
1711 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm2
1712 ; X86-SSE2-NEXT: pand %xmm0, %xmm2
1713 ; X86-SSE2-NEXT: pmovmskb %xmm2, %eax
1714 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1715 ; X86-SSE2-NEXT: sete %al
1716 ; X86-SSE2-NEXT: retl
1718 ; X86-SSE41-LABEL: length48_eq_prefer128:
1719 ; X86-SSE41: # %bb.0:
1720 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1721 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
1722 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
1723 ; X86-SSE41-NEXT: movdqu 16(%ecx), %xmm1
1724 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
1725 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
1726 ; X86-SSE41-NEXT: movdqu 16(%eax), %xmm0
1727 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
1728 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1729 ; X86-SSE41-NEXT: movdqu 32(%ecx), %xmm1
1730 ; X86-SSE41-NEXT: movdqu 32(%eax), %xmm2
1731 ; X86-SSE41-NEXT: pxor %xmm1, %xmm2
1732 ; X86-SSE41-NEXT: por %xmm0, %xmm2
1733 ; X86-SSE41-NEXT: ptest %xmm2, %xmm2
1734 ; X86-SSE41-NEXT: sete %al
1735 ; X86-SSE41-NEXT: retl
1736 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 48) nounwind
1737 %cmp = icmp eq i32 %call, 0
1741 define i1 @length48_eq_const(ptr %X) nounwind {
1742 ; X86-NOSSE-LABEL: length48_eq_const:
1743 ; X86-NOSSE: # %bb.0:
1744 ; X86-NOSSE-NEXT: pushl $48
1745 ; X86-NOSSE-NEXT: pushl $.L.str
1746 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1747 ; X86-NOSSE-NEXT: calll memcmp
1748 ; X86-NOSSE-NEXT: addl $12, %esp
1749 ; X86-NOSSE-NEXT: testl %eax, %eax
1750 ; X86-NOSSE-NEXT: setne %al
1751 ; X86-NOSSE-NEXT: retl
1753 ; X86-SSE1-LABEL: length48_eq_const:
1754 ; X86-SSE1: # %bb.0:
1755 ; X86-SSE1-NEXT: pushl $48
1756 ; X86-SSE1-NEXT: pushl $.L.str
1757 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1758 ; X86-SSE1-NEXT: calll memcmp
1759 ; X86-SSE1-NEXT: addl $12, %esp
1760 ; X86-SSE1-NEXT: testl %eax, %eax
1761 ; X86-SSE1-NEXT: setne %al
1762 ; X86-SSE1-NEXT: retl
1764 ; X86-SSE2-LABEL: length48_eq_const:
1765 ; X86-SSE2: # %bb.0:
1766 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1767 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
1768 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm1
1769 ; X86-SSE2-NEXT: movdqu 32(%eax), %xmm2
1770 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1771 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1772 ; X86-SSE2-NEXT: pand %xmm1, %xmm0
1773 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm2
1774 ; X86-SSE2-NEXT: pand %xmm0, %xmm2
1775 ; X86-SSE2-NEXT: pmovmskb %xmm2, %eax
1776 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1777 ; X86-SSE2-NEXT: setne %al
1778 ; X86-SSE2-NEXT: retl
1780 ; X86-SSE41-LABEL: length48_eq_const:
1781 ; X86-SSE41: # %bb.0:
1782 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1783 ; X86-SSE41-NEXT: movdqu (%eax), %xmm0
1784 ; X86-SSE41-NEXT: movdqu 16(%eax), %xmm1
1785 ; X86-SSE41-NEXT: movdqu 32(%eax), %xmm2
1786 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1787 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1788 ; X86-SSE41-NEXT: por %xmm1, %xmm0
1789 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm2
1790 ; X86-SSE41-NEXT: por %xmm0, %xmm2
1791 ; X86-SSE41-NEXT: ptest %xmm2, %xmm2
1792 ; X86-SSE41-NEXT: setne %al
1793 ; X86-SSE41-NEXT: retl
1794 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 48) nounwind
1795 %c = icmp ne i32 %m, 0
1799 define i32 @length63(ptr %X, ptr %Y) nounwind {
1800 ; X86-LABEL: length63:
1802 ; X86-NEXT: pushl $63
1803 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1804 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1805 ; X86-NEXT: calll memcmp
1806 ; X86-NEXT: addl $12, %esp
1808 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 63) nounwind
1812 define i1 @length63_eq(ptr %x, ptr %y) nounwind {
1813 ; X86-NOSSE-LABEL: length63_eq:
1814 ; X86-NOSSE: # %bb.0:
1815 ; X86-NOSSE-NEXT: pushl $63
1816 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1817 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1818 ; X86-NOSSE-NEXT: calll memcmp
1819 ; X86-NOSSE-NEXT: addl $12, %esp
1820 ; X86-NOSSE-NEXT: testl %eax, %eax
1821 ; X86-NOSSE-NEXT: setne %al
1822 ; X86-NOSSE-NEXT: retl
1824 ; X86-SSE1-LABEL: length63_eq:
1825 ; X86-SSE1: # %bb.0:
1826 ; X86-SSE1-NEXT: pushl $63
1827 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1828 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1829 ; X86-SSE1-NEXT: calll memcmp
1830 ; X86-SSE1-NEXT: addl $12, %esp
1831 ; X86-SSE1-NEXT: testl %eax, %eax
1832 ; X86-SSE1-NEXT: setne %al
1833 ; X86-SSE1-NEXT: retl
1835 ; X86-SSE2-LABEL: length63_eq:
1836 ; X86-SSE2: # %bb.0:
1837 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1838 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
1839 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
1840 ; X86-SSE2-NEXT: movdqu 16(%ecx), %xmm1
1841 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
1842 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
1843 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm0
1844 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
1845 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1846 ; X86-SSE2-NEXT: movdqu 32(%ecx), %xmm1
1847 ; X86-SSE2-NEXT: movdqu 32(%eax), %xmm2
1848 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm2
1849 ; X86-SSE2-NEXT: movdqu 47(%ecx), %xmm1
1850 ; X86-SSE2-NEXT: movdqu 47(%eax), %xmm3
1851 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm3
1852 ; X86-SSE2-NEXT: pand %xmm2, %xmm3
1853 ; X86-SSE2-NEXT: pand %xmm0, %xmm3
1854 ; X86-SSE2-NEXT: pmovmskb %xmm3, %eax
1855 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1856 ; X86-SSE2-NEXT: setne %al
1857 ; X86-SSE2-NEXT: retl
1859 ; X86-SSE41-LABEL: length63_eq:
1860 ; X86-SSE41: # %bb.0:
1861 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1862 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
1863 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
1864 ; X86-SSE41-NEXT: movdqu 16(%ecx), %xmm1
1865 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
1866 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
1867 ; X86-SSE41-NEXT: movdqu 16(%eax), %xmm0
1868 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
1869 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1870 ; X86-SSE41-NEXT: movdqu 32(%ecx), %xmm1
1871 ; X86-SSE41-NEXT: movdqu 32(%eax), %xmm2
1872 ; X86-SSE41-NEXT: pxor %xmm1, %xmm2
1873 ; X86-SSE41-NEXT: movdqu 47(%ecx), %xmm1
1874 ; X86-SSE41-NEXT: movdqu 47(%eax), %xmm3
1875 ; X86-SSE41-NEXT: pxor %xmm1, %xmm3
1876 ; X86-SSE41-NEXT: por %xmm2, %xmm3
1877 ; X86-SSE41-NEXT: por %xmm0, %xmm3
1878 ; X86-SSE41-NEXT: ptest %xmm3, %xmm3
1879 ; X86-SSE41-NEXT: setne %al
1880 ; X86-SSE41-NEXT: retl
1881 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 63) nounwind
1882 %cmp = icmp ne i32 %call, 0
1886 define i1 @length63_lt(ptr %x, ptr %y) nounwind {
1887 ; X86-LABEL: length63_lt:
1889 ; X86-NEXT: pushl $63
1890 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1891 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1892 ; X86-NEXT: calll memcmp
1893 ; X86-NEXT: addl $12, %esp
1894 ; X86-NEXT: shrl $31, %eax
1895 ; X86-NEXT: # kill: def $al killed $al killed $eax
1897 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 63) nounwind
1898 %cmp = icmp slt i32 %call, 0
1902 define i1 @length63_gt(ptr %x, ptr %y) nounwind {
1903 ; X86-LABEL: length63_gt:
1905 ; X86-NEXT: pushl $63
1906 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1907 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1908 ; X86-NEXT: calll memcmp
1909 ; X86-NEXT: addl $12, %esp
1910 ; X86-NEXT: testl %eax, %eax
1911 ; X86-NEXT: setg %al
1913 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 63) nounwind
1914 %cmp = icmp sgt i32 %call, 0
1918 define i1 @length63_eq_const(ptr %X) nounwind {
1919 ; X86-NOSSE-LABEL: length63_eq_const:
1920 ; X86-NOSSE: # %bb.0:
1921 ; X86-NOSSE-NEXT: pushl $63
1922 ; X86-NOSSE-NEXT: pushl $.L.str
1923 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
1924 ; X86-NOSSE-NEXT: calll memcmp
1925 ; X86-NOSSE-NEXT: addl $12, %esp
1926 ; X86-NOSSE-NEXT: testl %eax, %eax
1927 ; X86-NOSSE-NEXT: sete %al
1928 ; X86-NOSSE-NEXT: retl
1930 ; X86-SSE1-LABEL: length63_eq_const:
1931 ; X86-SSE1: # %bb.0:
1932 ; X86-SSE1-NEXT: pushl $63
1933 ; X86-SSE1-NEXT: pushl $.L.str
1934 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
1935 ; X86-SSE1-NEXT: calll memcmp
1936 ; X86-SSE1-NEXT: addl $12, %esp
1937 ; X86-SSE1-NEXT: testl %eax, %eax
1938 ; X86-SSE1-NEXT: sete %al
1939 ; X86-SSE1-NEXT: retl
1941 ; X86-SSE2-LABEL: length63_eq_const:
1942 ; X86-SSE2: # %bb.0:
1943 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
1944 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
1945 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm1
1946 ; X86-SSE2-NEXT: movdqu 32(%eax), %xmm2
1947 ; X86-SSE2-NEXT: movdqu 47(%eax), %xmm3
1948 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm3
1949 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm2
1950 ; X86-SSE2-NEXT: pand %xmm3, %xmm2
1951 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1952 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1953 ; X86-SSE2-NEXT: pand %xmm1, %xmm0
1954 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1955 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1956 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
1957 ; X86-SSE2-NEXT: sete %al
1958 ; X86-SSE2-NEXT: retl
1960 ; X86-SSE41-LABEL: length63_eq_const:
1961 ; X86-SSE41: # %bb.0:
1962 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
1963 ; X86-SSE41-NEXT: movdqu (%eax), %xmm0
1964 ; X86-SSE41-NEXT: movdqu 16(%eax), %xmm1
1965 ; X86-SSE41-NEXT: movdqu 32(%eax), %xmm2
1966 ; X86-SSE41-NEXT: movdqu 47(%eax), %xmm3
1967 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm3
1968 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm2
1969 ; X86-SSE41-NEXT: por %xmm3, %xmm2
1970 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
1971 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
1972 ; X86-SSE41-NEXT: por %xmm1, %xmm0
1973 ; X86-SSE41-NEXT: por %xmm2, %xmm0
1974 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
1975 ; X86-SSE41-NEXT: sete %al
1976 ; X86-SSE41-NEXT: retl
1977 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 63) nounwind
1978 %c = icmp eq i32 %m, 0
1982 define i32 @length64(ptr %X, ptr %Y) nounwind {
1983 ; X86-LABEL: length64:
1985 ; X86-NEXT: pushl $64
1986 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1987 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
1988 ; X86-NEXT: calll memcmp
1989 ; X86-NEXT: addl $12, %esp
1991 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 64) nounwind
1995 define i1 @length64_eq(ptr %x, ptr %y) nounwind {
1996 ; X86-NOSSE-LABEL: length64_eq:
1997 ; X86-NOSSE: # %bb.0:
1998 ; X86-NOSSE-NEXT: pushl $64
1999 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
2000 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
2001 ; X86-NOSSE-NEXT: calll memcmp
2002 ; X86-NOSSE-NEXT: addl $12, %esp
2003 ; X86-NOSSE-NEXT: testl %eax, %eax
2004 ; X86-NOSSE-NEXT: setne %al
2005 ; X86-NOSSE-NEXT: retl
2007 ; X86-SSE1-LABEL: length64_eq:
2008 ; X86-SSE1: # %bb.0:
2009 ; X86-SSE1-NEXT: pushl $64
2010 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
2011 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
2012 ; X86-SSE1-NEXT: calll memcmp
2013 ; X86-SSE1-NEXT: addl $12, %esp
2014 ; X86-SSE1-NEXT: testl %eax, %eax
2015 ; X86-SSE1-NEXT: setne %al
2016 ; X86-SSE1-NEXT: retl
2018 ; X86-SSE2-LABEL: length64_eq:
2019 ; X86-SSE2: # %bb.0:
2020 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
2021 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
2022 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
2023 ; X86-SSE2-NEXT: movdqu 16(%ecx), %xmm1
2024 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
2025 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
2026 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm0
2027 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
2028 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
2029 ; X86-SSE2-NEXT: movdqu 32(%ecx), %xmm1
2030 ; X86-SSE2-NEXT: movdqu 32(%eax), %xmm2
2031 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm2
2032 ; X86-SSE2-NEXT: movdqu 48(%ecx), %xmm1
2033 ; X86-SSE2-NEXT: movdqu 48(%eax), %xmm3
2034 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm3
2035 ; X86-SSE2-NEXT: pand %xmm2, %xmm3
2036 ; X86-SSE2-NEXT: pand %xmm0, %xmm3
2037 ; X86-SSE2-NEXT: pmovmskb %xmm3, %eax
2038 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
2039 ; X86-SSE2-NEXT: setne %al
2040 ; X86-SSE2-NEXT: retl
2042 ; X86-SSE41-LABEL: length64_eq:
2043 ; X86-SSE41: # %bb.0:
2044 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
2045 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %ecx
2046 ; X86-SSE41-NEXT: movdqu (%ecx), %xmm0
2047 ; X86-SSE41-NEXT: movdqu 16(%ecx), %xmm1
2048 ; X86-SSE41-NEXT: movdqu (%eax), %xmm2
2049 ; X86-SSE41-NEXT: pxor %xmm0, %xmm2
2050 ; X86-SSE41-NEXT: movdqu 16(%eax), %xmm0
2051 ; X86-SSE41-NEXT: pxor %xmm1, %xmm0
2052 ; X86-SSE41-NEXT: por %xmm2, %xmm0
2053 ; X86-SSE41-NEXT: movdqu 32(%ecx), %xmm1
2054 ; X86-SSE41-NEXT: movdqu 32(%eax), %xmm2
2055 ; X86-SSE41-NEXT: pxor %xmm1, %xmm2
2056 ; X86-SSE41-NEXT: movdqu 48(%ecx), %xmm1
2057 ; X86-SSE41-NEXT: movdqu 48(%eax), %xmm3
2058 ; X86-SSE41-NEXT: pxor %xmm1, %xmm3
2059 ; X86-SSE41-NEXT: por %xmm2, %xmm3
2060 ; X86-SSE41-NEXT: por %xmm0, %xmm3
2061 ; X86-SSE41-NEXT: ptest %xmm3, %xmm3
2062 ; X86-SSE41-NEXT: setne %al
2063 ; X86-SSE41-NEXT: retl
2064 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 64) nounwind
2065 %cmp = icmp ne i32 %call, 0
2069 define i1 @length64_lt(ptr %x, ptr %y) nounwind {
2070 ; X86-LABEL: length64_lt:
2072 ; X86-NEXT: pushl $64
2073 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2074 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2075 ; X86-NEXT: calll memcmp
2076 ; X86-NEXT: addl $12, %esp
2077 ; X86-NEXT: shrl $31, %eax
2078 ; X86-NEXT: # kill: def $al killed $al killed $eax
2080 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 64) nounwind
2081 %cmp = icmp slt i32 %call, 0
2085 define i1 @length64_gt(ptr %x, ptr %y) nounwind {
2086 ; X86-LABEL: length64_gt:
2088 ; X86-NEXT: pushl $64
2089 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2090 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2091 ; X86-NEXT: calll memcmp
2092 ; X86-NEXT: addl $12, %esp
2093 ; X86-NEXT: testl %eax, %eax
2094 ; X86-NEXT: setg %al
2096 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 64) nounwind
2097 %cmp = icmp sgt i32 %call, 0
2101 define i1 @length64_eq_const(ptr %X) nounwind {
2102 ; X86-NOSSE-LABEL: length64_eq_const:
2103 ; X86-NOSSE: # %bb.0:
2104 ; X86-NOSSE-NEXT: pushl $64
2105 ; X86-NOSSE-NEXT: pushl $.L.str
2106 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
2107 ; X86-NOSSE-NEXT: calll memcmp
2108 ; X86-NOSSE-NEXT: addl $12, %esp
2109 ; X86-NOSSE-NEXT: testl %eax, %eax
2110 ; X86-NOSSE-NEXT: sete %al
2111 ; X86-NOSSE-NEXT: retl
2113 ; X86-SSE1-LABEL: length64_eq_const:
2114 ; X86-SSE1: # %bb.0:
2115 ; X86-SSE1-NEXT: pushl $64
2116 ; X86-SSE1-NEXT: pushl $.L.str
2117 ; X86-SSE1-NEXT: pushl {{[0-9]+}}(%esp)
2118 ; X86-SSE1-NEXT: calll memcmp
2119 ; X86-SSE1-NEXT: addl $12, %esp
2120 ; X86-SSE1-NEXT: testl %eax, %eax
2121 ; X86-SSE1-NEXT: sete %al
2122 ; X86-SSE1-NEXT: retl
2124 ; X86-SSE2-LABEL: length64_eq_const:
2125 ; X86-SSE2: # %bb.0:
2126 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
2127 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
2128 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm1
2129 ; X86-SSE2-NEXT: movdqu 32(%eax), %xmm2
2130 ; X86-SSE2-NEXT: movdqu 48(%eax), %xmm3
2131 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm3
2132 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm2
2133 ; X86-SSE2-NEXT: pand %xmm3, %xmm2
2134 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
2135 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
2136 ; X86-SSE2-NEXT: pand %xmm1, %xmm0
2137 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
2138 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
2139 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
2140 ; X86-SSE2-NEXT: sete %al
2141 ; X86-SSE2-NEXT: retl
2143 ; X86-SSE41-LABEL: length64_eq_const:
2144 ; X86-SSE41: # %bb.0:
2145 ; X86-SSE41-NEXT: movl {{[0-9]+}}(%esp), %eax
2146 ; X86-SSE41-NEXT: movdqu (%eax), %xmm0
2147 ; X86-SSE41-NEXT: movdqu 16(%eax), %xmm1
2148 ; X86-SSE41-NEXT: movdqu 32(%eax), %xmm2
2149 ; X86-SSE41-NEXT: movdqu 48(%eax), %xmm3
2150 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm3
2151 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm2
2152 ; X86-SSE41-NEXT: por %xmm3, %xmm2
2153 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
2154 ; X86-SSE41-NEXT: pxor {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
2155 ; X86-SSE41-NEXT: por %xmm1, %xmm0
2156 ; X86-SSE41-NEXT: por %xmm2, %xmm0
2157 ; X86-SSE41-NEXT: ptest %xmm0, %xmm0
2158 ; X86-SSE41-NEXT: sete %al
2159 ; X86-SSE41-NEXT: retl
2160 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 64) nounwind
2161 %c = icmp eq i32 %m, 0
2165 define i32 @length96(ptr %X, ptr %Y) nounwind {
2166 ; X86-LABEL: length96:
2168 ; X86-NEXT: pushl $96
2169 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2170 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2171 ; X86-NEXT: calll memcmp
2172 ; X86-NEXT: addl $12, %esp
2174 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 96) nounwind
2178 define i1 @length96_eq(ptr %x, ptr %y) nounwind {
2179 ; X86-LABEL: length96_eq:
2181 ; X86-NEXT: pushl $96
2182 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2183 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2184 ; X86-NEXT: calll memcmp
2185 ; X86-NEXT: addl $12, %esp
2186 ; X86-NEXT: testl %eax, %eax
2187 ; X86-NEXT: setne %al
2189 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 96) nounwind
2190 %cmp = icmp ne i32 %call, 0
2194 define i1 @length96_lt(ptr %x, ptr %y) nounwind {
2195 ; X86-LABEL: length96_lt:
2197 ; X86-NEXT: pushl $96
2198 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2199 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2200 ; X86-NEXT: calll memcmp
2201 ; X86-NEXT: addl $12, %esp
2202 ; X86-NEXT: shrl $31, %eax
2203 ; X86-NEXT: # kill: def $al killed $al killed $eax
2205 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 96) nounwind
2206 %cmp = icmp slt i32 %call, 0
2210 define i1 @length96_gt(ptr %x, ptr %y) nounwind {
2211 ; X86-LABEL: length96_gt:
2213 ; X86-NEXT: pushl $96
2214 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2215 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2216 ; X86-NEXT: calll memcmp
2217 ; X86-NEXT: addl $12, %esp
2218 ; X86-NEXT: testl %eax, %eax
2219 ; X86-NEXT: setg %al
2221 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 96) nounwind
2222 %cmp = icmp sgt i32 %call, 0
2226 define i1 @length96_eq_const(ptr %X) nounwind {
2227 ; X86-LABEL: length96_eq_const:
2229 ; X86-NEXT: pushl $96
2230 ; X86-NEXT: pushl $.L.str
2231 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2232 ; X86-NEXT: calll memcmp
2233 ; X86-NEXT: addl $12, %esp
2234 ; X86-NEXT: testl %eax, %eax
2235 ; X86-NEXT: sete %al
2237 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 96) nounwind
2238 %c = icmp eq i32 %m, 0
2242 define i32 @length127(ptr %X, ptr %Y) nounwind {
2243 ; X86-LABEL: length127:
2245 ; X86-NEXT: pushl $127
2246 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2247 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2248 ; X86-NEXT: calll memcmp
2249 ; X86-NEXT: addl $12, %esp
2251 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 127) nounwind
2255 define i1 @length127_eq(ptr %x, ptr %y) nounwind {
2256 ; X86-LABEL: length127_eq:
2258 ; X86-NEXT: pushl $127
2259 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2260 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2261 ; X86-NEXT: calll memcmp
2262 ; X86-NEXT: addl $12, %esp
2263 ; X86-NEXT: testl %eax, %eax
2264 ; X86-NEXT: setne %al
2266 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 127) nounwind
2267 %cmp = icmp ne i32 %call, 0
2271 define i1 @length127_lt(ptr %x, ptr %y) nounwind {
2272 ; X86-LABEL: length127_lt:
2274 ; X86-NEXT: pushl $127
2275 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2276 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2277 ; X86-NEXT: calll memcmp
2278 ; X86-NEXT: addl $12, %esp
2279 ; X86-NEXT: shrl $31, %eax
2280 ; X86-NEXT: # kill: def $al killed $al killed $eax
2282 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 127) nounwind
2283 %cmp = icmp slt i32 %call, 0
2287 define i1 @length127_gt(ptr %x, ptr %y) nounwind {
2288 ; X86-LABEL: length127_gt:
2290 ; X86-NEXT: pushl $127
2291 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2292 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2293 ; X86-NEXT: calll memcmp
2294 ; X86-NEXT: addl $12, %esp
2295 ; X86-NEXT: testl %eax, %eax
2296 ; X86-NEXT: setg %al
2298 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 127) nounwind
2299 %cmp = icmp sgt i32 %call, 0
2303 define i1 @length127_eq_const(ptr %X) nounwind {
2304 ; X86-LABEL: length127_eq_const:
2306 ; X86-NEXT: pushl $127
2307 ; X86-NEXT: pushl $.L.str
2308 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2309 ; X86-NEXT: calll memcmp
2310 ; X86-NEXT: addl $12, %esp
2311 ; X86-NEXT: testl %eax, %eax
2312 ; X86-NEXT: sete %al
2314 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 127) nounwind
2315 %c = icmp eq i32 %m, 0
2319 define i32 @length128(ptr %X, ptr %Y) nounwind {
2320 ; X86-LABEL: length128:
2322 ; X86-NEXT: pushl $128
2323 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2324 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2325 ; X86-NEXT: calll memcmp
2326 ; X86-NEXT: addl $12, %esp
2328 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 128) nounwind
2332 define i1 @length128_eq(ptr %x, ptr %y) nounwind {
2333 ; X86-LABEL: length128_eq:
2335 ; X86-NEXT: pushl $128
2336 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2337 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2338 ; X86-NEXT: calll memcmp
2339 ; X86-NEXT: addl $12, %esp
2340 ; X86-NEXT: testl %eax, %eax
2341 ; X86-NEXT: setne %al
2343 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 128) nounwind
2344 %cmp = icmp ne i32 %call, 0
2348 define i1 @length128_lt(ptr %x, ptr %y) nounwind {
2349 ; X86-LABEL: length128_lt:
2351 ; X86-NEXT: pushl $128
2352 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2353 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2354 ; X86-NEXT: calll memcmp
2355 ; X86-NEXT: addl $12, %esp
2356 ; X86-NEXT: shrl $31, %eax
2357 ; X86-NEXT: # kill: def $al killed $al killed $eax
2359 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 128) nounwind
2360 %cmp = icmp slt i32 %call, 0
2364 define i1 @length128_gt(ptr %x, ptr %y) nounwind {
2365 ; X86-LABEL: length128_gt:
2367 ; X86-NEXT: pushl $128
2368 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2369 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2370 ; X86-NEXT: calll memcmp
2371 ; X86-NEXT: addl $12, %esp
2372 ; X86-NEXT: testl %eax, %eax
2373 ; X86-NEXT: setg %al
2375 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 128) nounwind
2376 %cmp = icmp sgt i32 %call, 0
2380 define i1 @length128_eq_const(ptr %X) nounwind {
2381 ; X86-LABEL: length128_eq_const:
2383 ; X86-NEXT: pushl $128
2384 ; X86-NEXT: pushl $.L.str
2385 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2386 ; X86-NEXT: calll memcmp
2387 ; X86-NEXT: addl $12, %esp
2388 ; X86-NEXT: testl %eax, %eax
2389 ; X86-NEXT: sete %al
2391 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 128) nounwind
2392 %c = icmp eq i32 %m, 0
2396 define i32 @length192(ptr %X, ptr %Y) nounwind {
2397 ; X86-LABEL: length192:
2399 ; X86-NEXT: pushl $192
2400 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2401 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2402 ; X86-NEXT: calll memcmp
2403 ; X86-NEXT: addl $12, %esp
2405 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 192) nounwind
2409 define i1 @length192_eq(ptr %x, ptr %y) nounwind {
2410 ; X86-LABEL: length192_eq:
2412 ; X86-NEXT: pushl $192
2413 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2414 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2415 ; X86-NEXT: calll memcmp
2416 ; X86-NEXT: addl $12, %esp
2417 ; X86-NEXT: testl %eax, %eax
2418 ; X86-NEXT: setne %al
2420 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 192) nounwind
2421 %cmp = icmp ne i32 %call, 0
2425 define i1 @length192_lt(ptr %x, ptr %y) nounwind {
2426 ; X86-LABEL: length192_lt:
2428 ; X86-NEXT: pushl $192
2429 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2430 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2431 ; X86-NEXT: calll memcmp
2432 ; X86-NEXT: addl $12, %esp
2433 ; X86-NEXT: shrl $31, %eax
2434 ; X86-NEXT: # kill: def $al killed $al killed $eax
2436 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 192) nounwind
2437 %cmp = icmp slt i32 %call, 0
2441 define i1 @length192_gt(ptr %x, ptr %y) nounwind {
2442 ; X86-LABEL: length192_gt:
2444 ; X86-NEXT: pushl $192
2445 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2446 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2447 ; X86-NEXT: calll memcmp
2448 ; X86-NEXT: addl $12, %esp
2449 ; X86-NEXT: testl %eax, %eax
2450 ; X86-NEXT: setg %al
2452 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 192) nounwind
2453 %cmp = icmp sgt i32 %call, 0
2457 define i1 @length192_eq_const(ptr %X) nounwind {
2458 ; X86-LABEL: length192_eq_const:
2460 ; X86-NEXT: pushl $192
2461 ; X86-NEXT: pushl $.L.str
2462 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2463 ; X86-NEXT: calll memcmp
2464 ; X86-NEXT: addl $12, %esp
2465 ; X86-NEXT: testl %eax, %eax
2466 ; X86-NEXT: sete %al
2468 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 192) nounwind
2469 %c = icmp eq i32 %m, 0
2473 define i32 @length255(ptr %X, ptr %Y) nounwind {
2474 ; X86-LABEL: length255:
2476 ; X86-NEXT: pushl $255
2477 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2478 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2479 ; X86-NEXT: calll memcmp
2480 ; X86-NEXT: addl $12, %esp
2482 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 255) nounwind
2486 define i1 @length255_eq(ptr %x, ptr %y) nounwind {
2487 ; X86-LABEL: length255_eq:
2489 ; X86-NEXT: pushl $255
2490 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2491 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2492 ; X86-NEXT: calll memcmp
2493 ; X86-NEXT: addl $12, %esp
2494 ; X86-NEXT: testl %eax, %eax
2495 ; X86-NEXT: setne %al
2497 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 255) nounwind
2498 %cmp = icmp ne i32 %call, 0
2502 define i1 @length255_lt(ptr %x, ptr %y) nounwind {
2503 ; X86-LABEL: length255_lt:
2505 ; X86-NEXT: pushl $255
2506 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2507 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2508 ; X86-NEXT: calll memcmp
2509 ; X86-NEXT: addl $12, %esp
2510 ; X86-NEXT: shrl $31, %eax
2511 ; X86-NEXT: # kill: def $al killed $al killed $eax
2513 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 255) nounwind
2514 %cmp = icmp slt i32 %call, 0
2518 define i1 @length255_gt(ptr %x, ptr %y) nounwind {
2519 ; X86-LABEL: length255_gt:
2521 ; X86-NEXT: pushl $255
2522 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2523 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2524 ; X86-NEXT: calll memcmp
2525 ; X86-NEXT: addl $12, %esp
2526 ; X86-NEXT: testl %eax, %eax
2527 ; X86-NEXT: setg %al
2529 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 255) nounwind
2530 %cmp = icmp sgt i32 %call, 0
2534 define i1 @length255_eq_const(ptr %X) nounwind {
2535 ; X86-LABEL: length255_eq_const:
2537 ; X86-NEXT: pushl $255
2538 ; X86-NEXT: pushl $.L.str
2539 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2540 ; X86-NEXT: calll memcmp
2541 ; X86-NEXT: addl $12, %esp
2542 ; X86-NEXT: testl %eax, %eax
2543 ; X86-NEXT: sete %al
2545 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 255) nounwind
2546 %c = icmp eq i32 %m, 0
2550 define i32 @length256(ptr %X, ptr %Y) nounwind {
2551 ; X86-LABEL: length256:
2553 ; X86-NEXT: pushl $256 # imm = 0x100
2554 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2555 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2556 ; X86-NEXT: calll memcmp
2557 ; X86-NEXT: addl $12, %esp
2559 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 256) nounwind
2563 define i1 @length256_eq(ptr %x, ptr %y) nounwind {
2564 ; X86-LABEL: length256_eq:
2566 ; X86-NEXT: pushl $256 # imm = 0x100
2567 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2568 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2569 ; X86-NEXT: calll memcmp
2570 ; X86-NEXT: addl $12, %esp
2571 ; X86-NEXT: testl %eax, %eax
2572 ; X86-NEXT: setne %al
2574 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 256) nounwind
2575 %cmp = icmp ne i32 %call, 0
2579 define i1 @length256_lt(ptr %x, ptr %y) nounwind {
2580 ; X86-LABEL: length256_lt:
2582 ; X86-NEXT: pushl $256 # imm = 0x100
2583 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2584 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2585 ; X86-NEXT: calll memcmp
2586 ; X86-NEXT: addl $12, %esp
2587 ; X86-NEXT: shrl $31, %eax
2588 ; X86-NEXT: # kill: def $al killed $al killed $eax
2590 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 256) nounwind
2591 %cmp = icmp slt i32 %call, 0
2595 define i1 @length256_gt(ptr %x, ptr %y) nounwind {
2596 ; X86-LABEL: length256_gt:
2598 ; X86-NEXT: pushl $256 # imm = 0x100
2599 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2600 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2601 ; X86-NEXT: calll memcmp
2602 ; X86-NEXT: addl $12, %esp
2603 ; X86-NEXT: testl %eax, %eax
2604 ; X86-NEXT: setg %al
2606 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 256) nounwind
2607 %cmp = icmp sgt i32 %call, 0
2611 define i1 @length256_eq_const(ptr %X) nounwind {
2612 ; X86-LABEL: length256_eq_const:
2614 ; X86-NEXT: pushl $256 # imm = 0x100
2615 ; X86-NEXT: pushl $.L.str
2616 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2617 ; X86-NEXT: calll memcmp
2618 ; X86-NEXT: addl $12, %esp
2619 ; X86-NEXT: testl %eax, %eax
2620 ; X86-NEXT: sete %al
2622 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 256) nounwind
2623 %c = icmp eq i32 %m, 0
2627 define i32 @length384(ptr %X, ptr %Y) nounwind {
2628 ; X86-LABEL: length384:
2630 ; X86-NEXT: pushl $384 # imm = 0x180
2631 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2632 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2633 ; X86-NEXT: calll memcmp
2634 ; X86-NEXT: addl $12, %esp
2636 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 384) nounwind
2640 define i1 @length384_eq(ptr %x, ptr %y) nounwind {
2641 ; X86-LABEL: length384_eq:
2643 ; X86-NEXT: pushl $384 # imm = 0x180
2644 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2645 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2646 ; X86-NEXT: calll memcmp
2647 ; X86-NEXT: addl $12, %esp
2648 ; X86-NEXT: testl %eax, %eax
2649 ; X86-NEXT: setne %al
2651 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 384) nounwind
2652 %cmp = icmp ne i32 %call, 0
2656 define i1 @length384_lt(ptr %x, ptr %y) nounwind {
2657 ; X86-LABEL: length384_lt:
2659 ; X86-NEXT: pushl $384 # imm = 0x180
2660 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2661 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2662 ; X86-NEXT: calll memcmp
2663 ; X86-NEXT: addl $12, %esp
2664 ; X86-NEXT: shrl $31, %eax
2665 ; X86-NEXT: # kill: def $al killed $al killed $eax
2667 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 384) nounwind
2668 %cmp = icmp slt i32 %call, 0
2672 define i1 @length384_gt(ptr %x, ptr %y) nounwind {
2673 ; X86-LABEL: length384_gt:
2675 ; X86-NEXT: pushl $384 # imm = 0x180
2676 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2677 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2678 ; X86-NEXT: calll memcmp
2679 ; X86-NEXT: addl $12, %esp
2680 ; X86-NEXT: testl %eax, %eax
2681 ; X86-NEXT: setg %al
2683 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 384) nounwind
2684 %cmp = icmp sgt i32 %call, 0
2688 define i1 @length384_eq_const(ptr %X) nounwind {
2689 ; X86-LABEL: length384_eq_const:
2691 ; X86-NEXT: pushl $384 # imm = 0x180
2692 ; X86-NEXT: pushl $.L.str
2693 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2694 ; X86-NEXT: calll memcmp
2695 ; X86-NEXT: addl $12, %esp
2696 ; X86-NEXT: testl %eax, %eax
2697 ; X86-NEXT: sete %al
2699 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 384) nounwind
2700 %c = icmp eq i32 %m, 0
2704 define i32 @length511(ptr %X, ptr %Y) nounwind {
2705 ; X86-LABEL: length511:
2707 ; X86-NEXT: pushl $511 # imm = 0x1FF
2708 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2709 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2710 ; X86-NEXT: calll memcmp
2711 ; X86-NEXT: addl $12, %esp
2713 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 511) nounwind
2717 define i1 @length511_eq(ptr %x, ptr %y) nounwind {
2718 ; X86-LABEL: length511_eq:
2720 ; X86-NEXT: pushl $511 # imm = 0x1FF
2721 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2722 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2723 ; X86-NEXT: calll memcmp
2724 ; X86-NEXT: addl $12, %esp
2725 ; X86-NEXT: testl %eax, %eax
2726 ; X86-NEXT: setne %al
2728 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 511) nounwind
2729 %cmp = icmp ne i32 %call, 0
2733 define i1 @length511_lt(ptr %x, ptr %y) nounwind {
2734 ; X86-LABEL: length511_lt:
2736 ; X86-NEXT: pushl $511 # imm = 0x1FF
2737 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2738 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2739 ; X86-NEXT: calll memcmp
2740 ; X86-NEXT: addl $12, %esp
2741 ; X86-NEXT: shrl $31, %eax
2742 ; X86-NEXT: # kill: def $al killed $al killed $eax
2744 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 511) nounwind
2745 %cmp = icmp slt i32 %call, 0
2749 define i1 @length511_gt(ptr %x, ptr %y) nounwind {
2750 ; X86-LABEL: length511_gt:
2752 ; X86-NEXT: pushl $511 # imm = 0x1FF
2753 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2754 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2755 ; X86-NEXT: calll memcmp
2756 ; X86-NEXT: addl $12, %esp
2757 ; X86-NEXT: testl %eax, %eax
2758 ; X86-NEXT: setg %al
2760 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 511) nounwind
2761 %cmp = icmp sgt i32 %call, 0
2765 define i1 @length511_eq_const(ptr %X) nounwind {
2766 ; X86-LABEL: length511_eq_const:
2768 ; X86-NEXT: pushl $511 # imm = 0x1FF
2769 ; X86-NEXT: pushl $.L.str
2770 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2771 ; X86-NEXT: calll memcmp
2772 ; X86-NEXT: addl $12, %esp
2773 ; X86-NEXT: testl %eax, %eax
2774 ; X86-NEXT: sete %al
2776 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 511) nounwind
2777 %c = icmp eq i32 %m, 0
2781 define i32 @length512(ptr %X, ptr %Y) nounwind {
2782 ; X86-LABEL: length512:
2784 ; X86-NEXT: pushl $512 # imm = 0x200
2785 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2786 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2787 ; X86-NEXT: calll memcmp
2788 ; X86-NEXT: addl $12, %esp
2790 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 512) nounwind
2794 define i1 @length512_eq(ptr %x, ptr %y) nounwind {
2795 ; X86-LABEL: length512_eq:
2797 ; X86-NEXT: pushl $512 # imm = 0x200
2798 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2799 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2800 ; X86-NEXT: calll memcmp
2801 ; X86-NEXT: addl $12, %esp
2802 ; X86-NEXT: testl %eax, %eax
2803 ; X86-NEXT: setne %al
2805 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 512) nounwind
2806 %cmp = icmp ne i32 %call, 0
2810 define i1 @length512_lt(ptr %x, ptr %y) nounwind {
2811 ; X86-LABEL: length512_lt:
2813 ; X86-NEXT: pushl $512 # imm = 0x200
2814 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2815 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2816 ; X86-NEXT: calll memcmp
2817 ; X86-NEXT: addl $12, %esp
2818 ; X86-NEXT: shrl $31, %eax
2819 ; X86-NEXT: # kill: def $al killed $al killed $eax
2821 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 512) nounwind
2822 %cmp = icmp slt i32 %call, 0
2826 define i1 @length512_gt(ptr %x, ptr %y) nounwind {
2827 ; X86-LABEL: length512_gt:
2829 ; X86-NEXT: pushl $512 # imm = 0x200
2830 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2831 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2832 ; X86-NEXT: calll memcmp
2833 ; X86-NEXT: addl $12, %esp
2834 ; X86-NEXT: testl %eax, %eax
2835 ; X86-NEXT: setg %al
2837 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 512) nounwind
2838 %cmp = icmp sgt i32 %call, 0
2842 define i1 @length512_eq_const(ptr %X) nounwind {
2843 ; X86-LABEL: length512_eq_const:
2845 ; X86-NEXT: pushl $512 # imm = 0x200
2846 ; X86-NEXT: pushl $.L.str
2847 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2848 ; X86-NEXT: calll memcmp
2849 ; X86-NEXT: addl $12, %esp
2850 ; X86-NEXT: testl %eax, %eax
2851 ; X86-NEXT: sete %al
2853 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 512) nounwind
2854 %c = icmp eq i32 %m, 0
2858 ; This checks that we do not do stupid things with huge sizes.
2859 define i32 @huge_length(ptr %X, ptr %Y) nounwind {
2860 ; X86-LABEL: huge_length:
2862 ; X86-NEXT: pushl $-1
2863 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2864 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2865 ; X86-NEXT: calll memcmp
2866 ; X86-NEXT: addl $12, %esp
2868 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 9223372036854775807) nounwind
2872 define i1 @huge_length_eq(ptr %X, ptr %Y) nounwind {
2873 ; X86-LABEL: huge_length_eq:
2875 ; X86-NEXT: pushl $-1
2876 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2877 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2878 ; X86-NEXT: calll memcmp
2879 ; X86-NEXT: addl $12, %esp
2880 ; X86-NEXT: testl %eax, %eax
2881 ; X86-NEXT: sete %al
2883 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 9223372036854775807) nounwind
2884 %c = icmp eq i32 %m, 0
2888 ; This checks non-constant sizes.
2889 define i32 @nonconst_length(ptr %X, ptr %Y, i32 %size) nounwind {
2890 ; X86-LABEL: nonconst_length:
2892 ; X86-NEXT: jmp memcmp # TAILCALL
2893 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 %size) nounwind
2897 define i1 @nonconst_length_eq(ptr %X, ptr %Y, i32 %size) nounwind {
2898 ; X86-LABEL: nonconst_length_eq:
2900 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2901 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2902 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
2903 ; X86-NEXT: calll memcmp
2904 ; X86-NEXT: addl $12, %esp
2905 ; X86-NEXT: testl %eax, %eax
2906 ; X86-NEXT: sete %al
2908 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 %size) nounwind
2909 %c = icmp eq i32 %m, 0