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=+sse2 | FileCheck %s --check-prefixes=X86,X86-SSE2
5 ; This tests codegen time inlining/optimization of memcmp
8 @.str = private constant [65 x i8] c"0123456789012345678901234567890123456789012345678901234567890123\00", align 1
10 declare dso_local i32 @memcmp(ptr, ptr, i32)
11 declare dso_local i32 @bcmp(ptr, ptr, i32)
13 define i32 @length2(ptr %X, ptr %Y) nounwind !prof !14 {
16 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
17 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
18 ; X86-NEXT: movzwl (%ecx), %ecx
19 ; X86-NEXT: movzwl (%eax), %edx
20 ; X86-NEXT: rolw $8, %cx
21 ; X86-NEXT: rolw $8, %dx
22 ; X86-NEXT: movzwl %cx, %eax
23 ; X86-NEXT: movzwl %dx, %ecx
24 ; X86-NEXT: subl %ecx, %eax
26 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 2) nounwind
30 define i1 @length2_eq(ptr %X, ptr %Y) nounwind !prof !14 {
31 ; X86-LABEL: length2_eq:
33 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
34 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
35 ; X86-NEXT: movzwl (%ecx), %ecx
36 ; X86-NEXT: cmpw (%eax), %cx
39 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 2) nounwind
40 %c = icmp eq i32 %m, 0
44 define i1 @length2_eq_const(ptr %X) nounwind !prof !14 {
45 ; X86-LABEL: length2_eq_const:
47 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
48 ; X86-NEXT: cmpw $12849, (%eax) # imm = 0x3231
51 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([65 x i8], ptr @.str, i32 0, i32 1), i32 2) nounwind
52 %c = icmp ne i32 %m, 0
56 define i1 @length2_eq_nobuiltin_attr(ptr %X, ptr %Y) nounwind !prof !14 {
57 ; X86-LABEL: length2_eq_nobuiltin_attr:
60 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
61 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
62 ; X86-NEXT: calll memcmp
63 ; X86-NEXT: addl $12, %esp
64 ; X86-NEXT: testl %eax, %eax
67 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 2) nounwind nobuiltin
68 %c = icmp eq i32 %m, 0
72 define i32 @length3(ptr %X, ptr %Y) nounwind !prof !14 {
75 ; X86-NEXT: pushl %esi
76 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
77 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
78 ; X86-NEXT: movzwl (%eax), %edx
79 ; X86-NEXT: movzwl (%ecx), %esi
80 ; X86-NEXT: rolw $8, %dx
81 ; X86-NEXT: rolw $8, %si
82 ; X86-NEXT: cmpw %si, %dx
83 ; X86-NEXT: jne .LBB4_3
84 ; X86-NEXT: # %bb.1: # %loadbb1
85 ; X86-NEXT: movzbl 2(%eax), %eax
86 ; X86-NEXT: movzbl 2(%ecx), %ecx
87 ; X86-NEXT: subl %ecx, %eax
88 ; X86-NEXT: jmp .LBB4_2
89 ; X86-NEXT: .LBB4_3: # %res_block
90 ; X86-NEXT: xorl %eax, %eax
91 ; X86-NEXT: cmpw %si, %dx
92 ; X86-NEXT: sbbl %eax, %eax
93 ; X86-NEXT: orl $1, %eax
94 ; X86-NEXT: .LBB4_2: # %endblock
97 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 3) nounwind
101 define i1 @length3_eq(ptr %X, ptr %Y) nounwind !prof !14 {
102 ; X86-LABEL: length3_eq:
104 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
105 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
106 ; X86-NEXT: movzwl (%ecx), %edx
107 ; X86-NEXT: xorw (%eax), %dx
108 ; X86-NEXT: movb 2(%ecx), %cl
109 ; X86-NEXT: xorb 2(%eax), %cl
110 ; X86-NEXT: movzbl %cl, %eax
111 ; X86-NEXT: orw %dx, %ax
112 ; X86-NEXT: setne %al
114 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 3) nounwind
115 %c = icmp ne i32 %m, 0
119 define i32 @length4(ptr %X, ptr %Y) nounwind !prof !14 {
120 ; X86-LABEL: length4:
122 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
123 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
124 ; X86-NEXT: movl (%ecx), %ecx
125 ; X86-NEXT: movl (%eax), %edx
126 ; X86-NEXT: bswapl %ecx
127 ; X86-NEXT: bswapl %edx
128 ; X86-NEXT: xorl %eax, %eax
129 ; X86-NEXT: cmpl %edx, %ecx
131 ; X86-NEXT: sbbl $0, %eax
133 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 4) nounwind
137 define i1 @length4_eq(ptr %X, ptr %Y) nounwind !prof !14 {
138 ; X86-LABEL: length4_eq:
140 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
141 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
142 ; X86-NEXT: movl (%ecx), %ecx
143 ; X86-NEXT: cmpl (%eax), %ecx
144 ; X86-NEXT: setne %al
146 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 4) nounwind
147 %c = icmp ne i32 %m, 0
151 define i1 @length4_eq_const(ptr %X) nounwind !prof !14 {
152 ; X86-LABEL: length4_eq_const:
154 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
155 ; X86-NEXT: cmpl $875770417, (%eax) # imm = 0x34333231
158 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([65 x i8], ptr @.str, i32 0, i32 1), i32 4) nounwind
159 %c = icmp eq i32 %m, 0
163 define i32 @length5(ptr %X, ptr %Y) nounwind !prof !14 {
164 ; X86-LABEL: length5:
166 ; X86-NEXT: pushl %esi
167 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
168 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
169 ; X86-NEXT: movl (%eax), %edx
170 ; X86-NEXT: movl (%ecx), %esi
171 ; X86-NEXT: bswapl %edx
172 ; X86-NEXT: bswapl %esi
173 ; X86-NEXT: cmpl %esi, %edx
174 ; X86-NEXT: jne .LBB9_3
175 ; X86-NEXT: # %bb.1: # %loadbb1
176 ; X86-NEXT: movzbl 4(%eax), %eax
177 ; X86-NEXT: movzbl 4(%ecx), %ecx
178 ; X86-NEXT: subl %ecx, %eax
179 ; X86-NEXT: jmp .LBB9_2
180 ; X86-NEXT: .LBB9_3: # %res_block
181 ; X86-NEXT: xorl %eax, %eax
182 ; X86-NEXT: cmpl %esi, %edx
183 ; X86-NEXT: sbbl %eax, %eax
184 ; X86-NEXT: orl $1, %eax
185 ; X86-NEXT: .LBB9_2: # %endblock
186 ; X86-NEXT: popl %esi
188 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 5) nounwind
192 define i1 @length5_eq(ptr %X, ptr %Y) nounwind !prof !14 {
193 ; X86-LABEL: length5_eq:
195 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
196 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
197 ; X86-NEXT: movl (%ecx), %edx
198 ; X86-NEXT: xorl (%eax), %edx
199 ; X86-NEXT: movb 4(%ecx), %cl
200 ; X86-NEXT: xorb 4(%eax), %cl
201 ; X86-NEXT: movzbl %cl, %eax
202 ; X86-NEXT: orl %edx, %eax
203 ; X86-NEXT: setne %al
205 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 5) nounwind
206 %c = icmp ne i32 %m, 0
210 define i32 @length8(ptr %X, ptr %Y) nounwind !prof !14 {
211 ; X86-LABEL: length8:
213 ; X86-NEXT: pushl %esi
214 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
215 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
216 ; X86-NEXT: movl (%esi), %ecx
217 ; X86-NEXT: movl (%eax), %edx
218 ; X86-NEXT: bswapl %ecx
219 ; X86-NEXT: bswapl %edx
220 ; X86-NEXT: cmpl %edx, %ecx
221 ; X86-NEXT: jne .LBB11_2
222 ; X86-NEXT: # %bb.1: # %loadbb1
223 ; X86-NEXT: movl 4(%esi), %ecx
224 ; X86-NEXT: movl 4(%eax), %edx
225 ; X86-NEXT: bswapl %ecx
226 ; X86-NEXT: bswapl %edx
227 ; X86-NEXT: xorl %eax, %eax
228 ; X86-NEXT: cmpl %edx, %ecx
229 ; X86-NEXT: je .LBB11_3
230 ; X86-NEXT: .LBB11_2: # %res_block
231 ; X86-NEXT: xorl %eax, %eax
232 ; X86-NEXT: cmpl %edx, %ecx
233 ; X86-NEXT: sbbl %eax, %eax
234 ; X86-NEXT: orl $1, %eax
235 ; X86-NEXT: .LBB11_3: # %endblock
236 ; X86-NEXT: popl %esi
238 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 8) nounwind
242 define i1 @length8_eq(ptr %X, ptr %Y) nounwind !prof !14 {
243 ; X86-LABEL: length8_eq:
245 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
246 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
247 ; X86-NEXT: movl (%ecx), %edx
248 ; X86-NEXT: movl 4(%ecx), %ecx
249 ; X86-NEXT: xorl (%eax), %edx
250 ; X86-NEXT: xorl 4(%eax), %ecx
251 ; X86-NEXT: orl %edx, %ecx
254 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 8) nounwind
255 %c = icmp eq i32 %m, 0
259 define i1 @length8_eq_const(ptr %X) nounwind !prof !14 {
260 ; X86-LABEL: length8_eq_const:
262 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
263 ; X86-NEXT: movl $858927408, %ecx # imm = 0x33323130
264 ; X86-NEXT: xorl (%eax), %ecx
265 ; X86-NEXT: movl $926299444, %edx # imm = 0x37363534
266 ; X86-NEXT: xorl 4(%eax), %edx
267 ; X86-NEXT: orl %ecx, %edx
268 ; X86-NEXT: setne %al
270 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 8) nounwind
271 %c = icmp ne i32 %m, 0
275 define i1 @length12_eq(ptr %X, ptr %Y) nounwind !prof !14 {
276 ; X86-LABEL: length12_eq:
278 ; X86-NEXT: pushl $12
279 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
280 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
281 ; X86-NEXT: calll memcmp
282 ; X86-NEXT: addl $12, %esp
283 ; X86-NEXT: testl %eax, %eax
284 ; X86-NEXT: setne %al
286 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 12) nounwind
287 %c = icmp ne i32 %m, 0
291 define i32 @length12(ptr %X, ptr %Y) nounwind !prof !14 {
292 ; X86-LABEL: length12:
294 ; X86-NEXT: pushl $12
295 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
296 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
297 ; X86-NEXT: calll memcmp
298 ; X86-NEXT: addl $12, %esp
300 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 12) nounwind
304 ; PR33329 - https://bugs.llvm.org/show_bug.cgi?id=33329
306 define i32 @length16(ptr %X, ptr %Y) nounwind !prof !14 {
307 ; X86-LABEL: length16:
309 ; X86-NEXT: pushl $16
310 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
311 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
312 ; X86-NEXT: calll memcmp
313 ; X86-NEXT: addl $12, %esp
315 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 16) nounwind
319 define i1 @length16_eq(ptr %x, ptr %y) nounwind !prof !14 {
320 ; X86-NOSSE-LABEL: length16_eq:
321 ; X86-NOSSE: # %bb.0:
322 ; X86-NOSSE-NEXT: pushl $16
323 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
324 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
325 ; X86-NOSSE-NEXT: calll memcmp
326 ; X86-NOSSE-NEXT: addl $12, %esp
327 ; X86-NOSSE-NEXT: testl %eax, %eax
328 ; X86-NOSSE-NEXT: setne %al
329 ; X86-NOSSE-NEXT: retl
331 ; X86-SSE2-LABEL: length16_eq:
333 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
334 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
335 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
336 ; X86-SSE2-NEXT: movdqu (%eax), %xmm1
337 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm1
338 ; X86-SSE2-NEXT: pmovmskb %xmm1, %eax
339 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
340 ; X86-SSE2-NEXT: setne %al
341 ; X86-SSE2-NEXT: retl
342 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 16) nounwind
343 %cmp = icmp ne i32 %call, 0
347 define i1 @length16_eq_const(ptr %X) nounwind !prof !14 {
348 ; X86-NOSSE-LABEL: length16_eq_const:
349 ; X86-NOSSE: # %bb.0:
350 ; X86-NOSSE-NEXT: pushl $16
351 ; X86-NOSSE-NEXT: pushl $.L.str
352 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
353 ; X86-NOSSE-NEXT: calll memcmp
354 ; X86-NOSSE-NEXT: addl $12, %esp
355 ; X86-NOSSE-NEXT: testl %eax, %eax
356 ; X86-NOSSE-NEXT: sete %al
357 ; X86-NOSSE-NEXT: retl
359 ; X86-SSE2-LABEL: length16_eq_const:
361 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
362 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
363 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
364 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
365 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
366 ; X86-SSE2-NEXT: sete %al
367 ; X86-SSE2-NEXT: retl
368 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 16) nounwind
369 %c = icmp eq i32 %m, 0
373 ; PR33914 - https://bugs.llvm.org/show_bug.cgi?id=33914
375 define i32 @length24(ptr %X, ptr %Y) nounwind !prof !14 {
376 ; X86-LABEL: length24:
378 ; X86-NEXT: pushl $24
379 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
380 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
381 ; X86-NEXT: calll memcmp
382 ; X86-NEXT: addl $12, %esp
384 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 24) nounwind
388 define i1 @length24_eq(ptr %x, ptr %y) nounwind !prof !14 {
389 ; X86-NOSSE-LABEL: length24_eq:
390 ; X86-NOSSE: # %bb.0:
391 ; X86-NOSSE-NEXT: pushl $24
392 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
393 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
394 ; X86-NOSSE-NEXT: calll memcmp
395 ; X86-NOSSE-NEXT: addl $12, %esp
396 ; X86-NOSSE-NEXT: testl %eax, %eax
397 ; X86-NOSSE-NEXT: sete %al
398 ; X86-NOSSE-NEXT: retl
400 ; X86-SSE2-LABEL: length24_eq:
402 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
403 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
404 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
405 ; X86-SSE2-NEXT: movdqu 8(%ecx), %xmm1
406 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
407 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
408 ; X86-SSE2-NEXT: movdqu 8(%eax), %xmm0
409 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
410 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
411 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
412 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
413 ; X86-SSE2-NEXT: sete %al
414 ; X86-SSE2-NEXT: retl
415 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 24) nounwind
416 %cmp = icmp eq i32 %call, 0
420 define i1 @length24_eq_const(ptr %X) nounwind !prof !14 {
421 ; X86-NOSSE-LABEL: length24_eq_const:
422 ; X86-NOSSE: # %bb.0:
423 ; X86-NOSSE-NEXT: pushl $24
424 ; X86-NOSSE-NEXT: pushl $.L.str
425 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
426 ; X86-NOSSE-NEXT: calll memcmp
427 ; X86-NOSSE-NEXT: addl $12, %esp
428 ; X86-NOSSE-NEXT: testl %eax, %eax
429 ; X86-NOSSE-NEXT: setne %al
430 ; X86-NOSSE-NEXT: retl
432 ; X86-SSE2-LABEL: length24_eq_const:
434 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
435 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
436 ; X86-SSE2-NEXT: movdqu 8(%eax), %xmm1
437 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
438 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
439 ; X86-SSE2-NEXT: pand %xmm1, %xmm0
440 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
441 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
442 ; X86-SSE2-NEXT: setne %al
443 ; X86-SSE2-NEXT: retl
444 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 24) nounwind
445 %c = icmp ne i32 %m, 0
449 define i32 @length32(ptr %X, ptr %Y) nounwind !prof !14 {
450 ; X86-LABEL: length32:
452 ; X86-NEXT: pushl $32
453 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
454 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
455 ; X86-NEXT: calll memcmp
456 ; X86-NEXT: addl $12, %esp
458 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 32) nounwind
462 ; PR33325 - https://bugs.llvm.org/show_bug.cgi?id=33325
464 define i1 @length32_eq(ptr %x, ptr %y) nounwind !prof !14 {
465 ; X86-NOSSE-LABEL: length32_eq:
466 ; X86-NOSSE: # %bb.0:
467 ; X86-NOSSE-NEXT: pushl $32
468 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
469 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
470 ; X86-NOSSE-NEXT: calll memcmp
471 ; X86-NOSSE-NEXT: addl $12, %esp
472 ; X86-NOSSE-NEXT: testl %eax, %eax
473 ; X86-NOSSE-NEXT: sete %al
474 ; X86-NOSSE-NEXT: retl
476 ; X86-SSE2-LABEL: length32_eq:
478 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
479 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %ecx
480 ; X86-SSE2-NEXT: movdqu (%ecx), %xmm0
481 ; X86-SSE2-NEXT: movdqu 16(%ecx), %xmm1
482 ; X86-SSE2-NEXT: movdqu (%eax), %xmm2
483 ; X86-SSE2-NEXT: pcmpeqb %xmm0, %xmm2
484 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm0
485 ; X86-SSE2-NEXT: pcmpeqb %xmm1, %xmm0
486 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
487 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
488 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
489 ; X86-SSE2-NEXT: sete %al
490 ; X86-SSE2-NEXT: retl
491 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 32) nounwind
492 %cmp = icmp eq i32 %call, 0
496 define i1 @length32_eq_const(ptr %X) nounwind !prof !14 {
497 ; X86-NOSSE-LABEL: length32_eq_const:
498 ; X86-NOSSE: # %bb.0:
499 ; X86-NOSSE-NEXT: pushl $32
500 ; X86-NOSSE-NEXT: pushl $.L.str
501 ; X86-NOSSE-NEXT: pushl {{[0-9]+}}(%esp)
502 ; X86-NOSSE-NEXT: calll memcmp
503 ; X86-NOSSE-NEXT: addl $12, %esp
504 ; X86-NOSSE-NEXT: testl %eax, %eax
505 ; X86-NOSSE-NEXT: setne %al
506 ; X86-NOSSE-NEXT: retl
508 ; X86-SSE2-LABEL: length32_eq_const:
510 ; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
511 ; X86-SSE2-NEXT: movdqu (%eax), %xmm0
512 ; X86-SSE2-NEXT: movdqu 16(%eax), %xmm1
513 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
514 ; X86-SSE2-NEXT: pcmpeqb {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
515 ; X86-SSE2-NEXT: pand %xmm1, %xmm0
516 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
517 ; X86-SSE2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
518 ; X86-SSE2-NEXT: setne %al
519 ; X86-SSE2-NEXT: retl
520 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 32) nounwind
521 %c = icmp ne i32 %m, 0
525 define i32 @length64(ptr %X, ptr %Y) nounwind !prof !14 {
526 ; X86-LABEL: length64:
528 ; X86-NEXT: pushl $64
529 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
530 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
531 ; X86-NEXT: calll memcmp
532 ; X86-NEXT: addl $12, %esp
534 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i32 64) nounwind
538 define i1 @length64_eq(ptr %x, ptr %y) nounwind !prof !14 {
539 ; X86-LABEL: length64_eq:
541 ; X86-NEXT: pushl $64
542 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
543 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
544 ; X86-NEXT: calll memcmp
545 ; X86-NEXT: addl $12, %esp
546 ; X86-NEXT: testl %eax, %eax
547 ; X86-NEXT: setne %al
549 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 64) nounwind
550 %cmp = icmp ne i32 %call, 0
554 define i1 @length64_eq_const(ptr %X) nounwind !prof !14 {
555 ; X86-LABEL: length64_eq_const:
557 ; X86-NEXT: pushl $64
558 ; X86-NEXT: pushl $.L.str
559 ; X86-NEXT: pushl {{[0-9]+}}(%esp)
560 ; X86-NEXT: calll memcmp
561 ; X86-NEXT: addl $12, %esp
562 ; X86-NEXT: testl %eax, %eax
565 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i32 64) nounwind
566 %c = icmp eq i32 %m, 0
570 define i32 @bcmp_length2(ptr %X, ptr %Y) nounwind !prof !14 {
571 ; X86-LABEL: bcmp_length2:
573 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
574 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
575 ; X86-NEXT: movzwl (%eax), %edx
576 ; X86-NEXT: xorl %eax, %eax
577 ; X86-NEXT: cmpw (%ecx), %dx
578 ; X86-NEXT: setne %al
580 %m = tail call i32 @bcmp(ptr %X, ptr %Y, i32 2) nounwind
584 !llvm.module.flags = !{!0}
585 !0 = !{i32 1, !"ProfileSummary", !1}
586 !1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
587 !2 = !{!"ProfileFormat", !"InstrProf"}
588 !3 = !{!"TotalCount", i32 10000}
589 !4 = !{!"MaxCount", i32 10}
590 !5 = !{!"MaxInternalCount", i32 1}
591 !6 = !{!"MaxFunctionCount", i32 1000}
592 !7 = !{!"NumCounts", i32 3}
593 !8 = !{!"NumFunctions", i32 3}
594 !9 = !{!"DetailedSummary", !10}
595 !10 = !{!11, !12, !13}
596 !11 = !{i32 10000, i32 100, i32 1}
597 !12 = !{i32 999000, i32 100, i32 1}
598 !13 = !{i32 999999, i32 1, i32 2}
599 !14 = !{!"function_entry_count", i32 0}