1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2 ; RUN: llc < %s -mtriple=aarch64-unknown-unknown | FileCheck %s
4 @.str = private constant [513 x i8] c"01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901\00", align 1
6 declare dso_local i32 @memcmp(ptr, ptr, i64)
8 define i32 @length0(ptr %X, ptr %Y) nounwind {
9 ; CHECK-LABEL: length0:
11 ; CHECK-NEXT: mov w0, wzr
13 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 0) nounwind
17 define i1 @length0_eq(ptr %X, ptr %Y) nounwind {
18 ; CHECK-LABEL: length0_eq:
20 ; CHECK-NEXT: mov w0, #1 // =0x1
22 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 0) nounwind
23 %c = icmp eq i32 %m, 0
27 define i1 @length0_lt(ptr %X, ptr %Y) nounwind {
28 ; CHECK-LABEL: length0_lt:
30 ; CHECK-NEXT: mov w0, wzr
32 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 0) nounwind
33 %c = icmp slt i32 %m, 0
37 define i32 @length2(ptr %X, ptr %Y) nounwind {
38 ; CHECK-LABEL: length2:
40 ; CHECK-NEXT: ldrh w8, [x0]
41 ; CHECK-NEXT: ldrh w9, [x1]
42 ; CHECK-NEXT: rev w8, w8
43 ; CHECK-NEXT: rev w9, w9
44 ; CHECK-NEXT: lsr w8, w8, #16
45 ; CHECK-NEXT: sub w0, w8, w9, lsr #16
47 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 2) nounwind
51 define i32 @length2_const(ptr %X, ptr %Y) nounwind {
52 ; CHECK-LABEL: length2_const:
54 ; CHECK-NEXT: ldrh w9, [x0]
55 ; CHECK-NEXT: mov w8, #-12594 // =0xffffcece
56 ; CHECK-NEXT: rev w9, w9
57 ; CHECK-NEXT: add w0, w8, w9, lsr #16
59 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i64 2) nounwind
63 define i1 @length2_gt_const(ptr %X, ptr %Y) nounwind {
64 ; CHECK-LABEL: length2_gt_const:
66 ; CHECK-NEXT: ldrh w9, [x0]
67 ; CHECK-NEXT: mov w8, #-12594 // =0xffffcece
68 ; CHECK-NEXT: rev w9, w9
69 ; CHECK-NEXT: add w8, w8, w9, lsr #16
70 ; CHECK-NEXT: cmp w8, #0
71 ; CHECK-NEXT: cset w0, gt
73 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i64 2) nounwind
74 %c = icmp sgt i32 %m, 0
78 define i1 @length2_eq(ptr %X, ptr %Y) nounwind {
79 ; CHECK-LABEL: length2_eq:
81 ; CHECK-NEXT: ldrh w8, [x0]
82 ; CHECK-NEXT: ldrh w9, [x1]
83 ; CHECK-NEXT: cmp w8, w9
84 ; CHECK-NEXT: cset w0, eq
86 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 2) nounwind
87 %c = icmp eq i32 %m, 0
91 define i1 @length2_lt(ptr %X, ptr %Y) nounwind {
92 ; CHECK-LABEL: length2_lt:
94 ; CHECK-NEXT: ldrh w8, [x0]
95 ; CHECK-NEXT: ldrh w9, [x1]
96 ; CHECK-NEXT: rev w8, w8
97 ; CHECK-NEXT: rev w9, w9
98 ; CHECK-NEXT: lsr w8, w8, #16
99 ; CHECK-NEXT: sub w8, w8, w9, lsr #16
100 ; CHECK-NEXT: lsr w0, w8, #31
102 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 2) nounwind
103 %c = icmp slt i32 %m, 0
107 define i1 @length2_gt(ptr %X, ptr %Y) nounwind {
108 ; CHECK-LABEL: length2_gt:
110 ; CHECK-NEXT: ldrh w8, [x0]
111 ; CHECK-NEXT: ldrh w9, [x1]
112 ; CHECK-NEXT: rev w8, w8
113 ; CHECK-NEXT: rev w9, w9
114 ; CHECK-NEXT: lsr w8, w8, #16
115 ; CHECK-NEXT: sub w8, w8, w9, lsr #16
116 ; CHECK-NEXT: cmp w8, #0
117 ; CHECK-NEXT: cset w0, gt
119 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 2) nounwind
120 %c = icmp sgt i32 %m, 0
124 define i1 @length2_eq_const(ptr %X) nounwind {
125 ; CHECK-LABEL: length2_eq_const:
127 ; CHECK-NEXT: ldrh w8, [x0]
128 ; CHECK-NEXT: mov w9, #12849 // =0x3231
129 ; CHECK-NEXT: cmp w8, w9
130 ; CHECK-NEXT: cset w0, ne
132 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i64 2) nounwind
133 %c = icmp ne i32 %m, 0
137 define i1 @length2_eq_nobuiltin_attr(ptr %X, ptr %Y) nounwind {
138 ; CHECK-LABEL: length2_eq_nobuiltin_attr:
140 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
141 ; CHECK-NEXT: mov w2, #2 // =0x2
142 ; CHECK-NEXT: bl memcmp
143 ; CHECK-NEXT: cmp w0, #0
144 ; CHECK-NEXT: cset w0, eq
145 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
147 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 2) nounwind nobuiltin
148 %c = icmp eq i32 %m, 0
152 define i32 @length3(ptr %X, ptr %Y) nounwind {
153 ; CHECK-LABEL: length3:
155 ; CHECK-NEXT: ldrb w8, [x0, #2]
156 ; CHECK-NEXT: ldrh w9, [x0]
157 ; CHECK-NEXT: ldrb w10, [x1, #2]
158 ; CHECK-NEXT: ldrh w11, [x1]
159 ; CHECK-NEXT: orr w8, w9, w8, lsl #16
160 ; CHECK-NEXT: orr w9, w11, w10, lsl #16
161 ; CHECK-NEXT: rev w8, w8
162 ; CHECK-NEXT: rev w9, w9
163 ; CHECK-NEXT: cmp w8, w9
164 ; CHECK-NEXT: cset w8, hi
165 ; CHECK-NEXT: csinv w0, w8, wzr, hs
167 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 3) nounwind
171 define i1 @length3_eq(ptr %X, ptr %Y) nounwind {
172 ; CHECK-LABEL: length3_eq:
174 ; CHECK-NEXT: ldrh w8, [x0]
175 ; CHECK-NEXT: ldrh w9, [x1]
176 ; CHECK-NEXT: ldrb w10, [x0, #2]
177 ; CHECK-NEXT: ldrb w11, [x1, #2]
178 ; CHECK-NEXT: cmp w8, w9
179 ; CHECK-NEXT: ccmp w10, w11, #0, eq
180 ; CHECK-NEXT: cset w0, ne
182 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 3) nounwind
183 %c = icmp ne i32 %m, 0
187 define i32 @length4(ptr %X, ptr %Y) nounwind {
188 ; CHECK-LABEL: length4:
190 ; CHECK-NEXT: ldr w8, [x0]
191 ; CHECK-NEXT: ldr w9, [x1]
192 ; CHECK-NEXT: rev w8, w8
193 ; CHECK-NEXT: rev w9, w9
194 ; CHECK-NEXT: cmp w8, w9
195 ; CHECK-NEXT: cset w8, hi
196 ; CHECK-NEXT: csinv w0, w8, wzr, hs
198 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 4) nounwind
202 define i1 @length4_eq(ptr %X, ptr %Y) nounwind {
203 ; CHECK-LABEL: length4_eq:
205 ; CHECK-NEXT: ldr w8, [x0]
206 ; CHECK-NEXT: ldr w9, [x1]
207 ; CHECK-NEXT: cmp w8, w9
208 ; CHECK-NEXT: cset w0, ne
210 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 4) nounwind
211 %c = icmp ne i32 %m, 0
215 define i1 @length4_lt(ptr %X, ptr %Y) nounwind {
216 ; CHECK-LABEL: length4_lt:
218 ; CHECK-NEXT: ldr w8, [x0]
219 ; CHECK-NEXT: ldr w9, [x1]
220 ; CHECK-NEXT: rev w8, w8
221 ; CHECK-NEXT: rev w9, w9
222 ; CHECK-NEXT: cmp w8, w9
223 ; CHECK-NEXT: cset w0, lo
225 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 4) nounwind
226 %c = icmp slt i32 %m, 0
230 define i32 @length4_lt_32(ptr %X, ptr %Y) nounwind {
231 ; CHECK-LABEL: length4_lt_32:
233 ; CHECK-NEXT: ldr w8, [x0]
234 ; CHECK-NEXT: ldr w9, [x1]
235 ; CHECK-NEXT: rev w8, w8
236 ; CHECK-NEXT: rev w9, w9
237 ; CHECK-NEXT: cmp w8, w9
238 ; CHECK-NEXT: cset w0, lo
240 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 4) nounwind
245 define i1 @length4_gt(ptr %X, ptr %Y) nounwind {
246 ; CHECK-LABEL: length4_gt:
248 ; CHECK-NEXT: ldr w8, [x0]
249 ; CHECK-NEXT: ldr w9, [x1]
250 ; CHECK-NEXT: rev w8, w8
251 ; CHECK-NEXT: rev w9, w9
252 ; CHECK-NEXT: cmp w8, w9
253 ; CHECK-NEXT: cset w0, hi
255 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 4) nounwind
256 %c = icmp sgt i32 %m, 0
260 define i1 @length4_le(ptr %X, ptr %Y) nounwind {
261 ; CHECK-LABEL: length4_le:
263 ; CHECK-NEXT: ldr w8, [x0]
264 ; CHECK-NEXT: ldr w9, [x1]
265 ; CHECK-NEXT: rev w8, w8
266 ; CHECK-NEXT: rev w9, w9
267 ; CHECK-NEXT: cmp w8, w9
268 ; CHECK-NEXT: cset w0, ls
270 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 4) nounwind
271 %c = icmp slt i32 %m, 1
275 define i1 @length4_ge(ptr %X, ptr %Y) nounwind {
276 ; CHECK-LABEL: length4_ge:
278 ; CHECK-NEXT: ldr w8, [x0]
279 ; CHECK-NEXT: ldr w9, [x1]
280 ; CHECK-NEXT: rev w8, w8
281 ; CHECK-NEXT: rev w9, w9
282 ; CHECK-NEXT: cmp w8, w9
283 ; CHECK-NEXT: cset w0, hs
285 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 4) nounwind
286 %c = icmp sgt i32 %m, -1
290 define i1 @length4_eq_const(ptr %X) nounwind {
291 ; CHECK-LABEL: length4_eq_const:
293 ; CHECK-NEXT: ldr w8, [x0]
294 ; CHECK-NEXT: mov w9, #12849 // =0x3231
295 ; CHECK-NEXT: movk w9, #13363, lsl #16
296 ; CHECK-NEXT: cmp w8, w9
297 ; CHECK-NEXT: cset w0, eq
299 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i64 4) nounwind
300 %c = icmp eq i32 %m, 0
304 define i32 @length5(ptr %X, ptr %Y) nounwind {
305 ; CHECK-LABEL: length5:
307 ; CHECK-NEXT: ldrb w8, [x0, #4]
308 ; CHECK-NEXT: ldr w9, [x0]
309 ; CHECK-NEXT: ldrb w10, [x1, #4]
310 ; CHECK-NEXT: ldr w11, [x1]
311 ; CHECK-NEXT: orr x8, x9, x8, lsl #32
312 ; CHECK-NEXT: orr x9, x11, x10, lsl #32
313 ; CHECK-NEXT: rev x8, x8
314 ; CHECK-NEXT: rev x9, x9
315 ; CHECK-NEXT: cmp x8, x9
316 ; CHECK-NEXT: cset w8, hi
317 ; CHECK-NEXT: csinv w0, w8, wzr, hs
319 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 5) nounwind
323 define i1 @length5_eq(ptr %X, ptr %Y) nounwind {
324 ; CHECK-LABEL: length5_eq:
326 ; CHECK-NEXT: ldr w8, [x0]
327 ; CHECK-NEXT: ldr w9, [x1]
328 ; CHECK-NEXT: ldrb w10, [x0, #4]
329 ; CHECK-NEXT: ldrb w11, [x1, #4]
330 ; CHECK-NEXT: cmp w8, w9
331 ; CHECK-NEXT: ccmp w10, w11, #0, eq
332 ; CHECK-NEXT: cset w0, ne
334 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 5) nounwind
335 %c = icmp ne i32 %m, 0
339 define i1 @length5_lt(ptr %X, ptr %Y) nounwind {
340 ; CHECK-LABEL: length5_lt:
342 ; CHECK-NEXT: ldrb w8, [x0, #4]
343 ; CHECK-NEXT: ldr w9, [x0]
344 ; CHECK-NEXT: ldrb w10, [x1, #4]
345 ; CHECK-NEXT: ldr w11, [x1]
346 ; CHECK-NEXT: orr x8, x9, x8, lsl #32
347 ; CHECK-NEXT: orr x9, x11, x10, lsl #32
348 ; CHECK-NEXT: rev x8, x8
349 ; CHECK-NEXT: rev x9, x9
350 ; CHECK-NEXT: cmp x8, x9
351 ; CHECK-NEXT: cset w0, lo
353 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 5) nounwind
354 %c = icmp slt i32 %m, 0
358 define i32 @length6(ptr %X, ptr %Y) nounwind {
359 ; CHECK-LABEL: length6:
361 ; CHECK-NEXT: ldrh w8, [x0, #4]
362 ; CHECK-NEXT: ldr w9, [x0]
363 ; CHECK-NEXT: ldrh w10, [x1, #4]
364 ; CHECK-NEXT: ldr w11, [x1]
365 ; CHECK-NEXT: orr x8, x9, x8, lsl #32
366 ; CHECK-NEXT: orr x9, x11, x10, lsl #32
367 ; CHECK-NEXT: rev x8, x8
368 ; CHECK-NEXT: rev x9, x9
369 ; CHECK-NEXT: cmp x8, x9
370 ; CHECK-NEXT: cset w8, hi
371 ; CHECK-NEXT: csinv w0, w8, wzr, hs
373 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 6) nounwind
377 define i32 @length6_lt(ptr %X, ptr %Y) nounwind {
378 ; CHECK-LABEL: length6_lt:
380 ; CHECK-NEXT: ldrh w8, [x0, #4]
381 ; CHECK-NEXT: ldr w9, [x0]
382 ; CHECK-NEXT: ldrh w10, [x1, #4]
383 ; CHECK-NEXT: ldr w11, [x1]
384 ; CHECK-NEXT: orr x8, x9, x8, lsl #32
385 ; CHECK-NEXT: orr x9, x11, x10, lsl #32
386 ; CHECK-NEXT: rev x8, x8
387 ; CHECK-NEXT: rev x9, x9
388 ; CHECK-NEXT: cmp x8, x9
389 ; CHECK-NEXT: cset w0, lo
391 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 6) nounwind
396 define i32 @length7(ptr %X, ptr %Y) nounwind {
397 ; CHECK-LABEL: length7:
399 ; CHECK-NEXT: ldr w8, [x0]
400 ; CHECK-NEXT: ldr w9, [x1]
401 ; CHECK-NEXT: rev w8, w8
402 ; CHECK-NEXT: rev w9, w9
403 ; CHECK-NEXT: cmp w8, w9
404 ; CHECK-NEXT: b.ne .LBB26_3
405 ; CHECK-NEXT: // %bb.1: // %loadbb1
406 ; CHECK-NEXT: ldur w8, [x0, #3]
407 ; CHECK-NEXT: ldur w9, [x1, #3]
408 ; CHECK-NEXT: rev w8, w8
409 ; CHECK-NEXT: rev w9, w9
410 ; CHECK-NEXT: cmp w8, w9
411 ; CHECK-NEXT: b.ne .LBB26_3
412 ; CHECK-NEXT: // %bb.2:
413 ; CHECK-NEXT: mov w0, wzr
415 ; CHECK-NEXT: .LBB26_3: // %res_block
416 ; CHECK-NEXT: cmp w8, w9
417 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
418 ; CHECK-NEXT: cneg w0, w8, hs
420 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 7) nounwind
424 define i1 @length7_lt(ptr %X, ptr %Y) nounwind {
425 ; CHECK-LABEL: length7_lt:
427 ; CHECK-NEXT: ldr w8, [x0]
428 ; CHECK-NEXT: ldr w9, [x1]
429 ; CHECK-NEXT: rev w8, w8
430 ; CHECK-NEXT: rev w9, w9
431 ; CHECK-NEXT: cmp w8, w9
432 ; CHECK-NEXT: b.ne .LBB27_3
433 ; CHECK-NEXT: // %bb.1: // %loadbb1
434 ; CHECK-NEXT: ldur w8, [x0, #3]
435 ; CHECK-NEXT: ldur w9, [x1, #3]
436 ; CHECK-NEXT: rev w8, w8
437 ; CHECK-NEXT: rev w9, w9
438 ; CHECK-NEXT: cmp w8, w9
439 ; CHECK-NEXT: b.ne .LBB27_3
440 ; CHECK-NEXT: // %bb.2:
441 ; CHECK-NEXT: lsr w0, wzr, #31
443 ; CHECK-NEXT: .LBB27_3: // %res_block
444 ; CHECK-NEXT: cmp w8, w9
445 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
446 ; CHECK-NEXT: cneg w8, w8, hs
447 ; CHECK-NEXT: lsr w0, w8, #31
449 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 7) nounwind
450 %c = icmp slt i32 %m, 0
454 define i1 @length7_eq(ptr %X, ptr %Y) nounwind {
455 ; CHECK-LABEL: length7_eq:
457 ; CHECK-NEXT: ldr w8, [x0]
458 ; CHECK-NEXT: ldr w9, [x1]
459 ; CHECK-NEXT: ldur w10, [x0, #3]
460 ; CHECK-NEXT: ldur w11, [x1, #3]
461 ; CHECK-NEXT: cmp w8, w9
462 ; CHECK-NEXT: ccmp w10, w11, #0, eq
463 ; CHECK-NEXT: cset w0, ne
465 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 7) nounwind
466 %c = icmp ne i32 %m, 0
470 define i32 @length8(ptr %X, ptr %Y) nounwind {
471 ; CHECK-LABEL: length8:
473 ; CHECK-NEXT: ldr x8, [x0]
474 ; CHECK-NEXT: ldr x9, [x1]
475 ; CHECK-NEXT: rev x8, x8
476 ; CHECK-NEXT: rev x9, x9
477 ; CHECK-NEXT: cmp x8, x9
478 ; CHECK-NEXT: cset w8, hi
479 ; CHECK-NEXT: csinv w0, w8, wzr, hs
481 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 8) nounwind
485 define i1 @length8_eq(ptr %X, ptr %Y) nounwind {
486 ; CHECK-LABEL: length8_eq:
488 ; CHECK-NEXT: ldr x8, [x0]
489 ; CHECK-NEXT: ldr x9, [x1]
490 ; CHECK-NEXT: cmp x8, x9
491 ; CHECK-NEXT: cset w0, eq
493 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 8) nounwind
494 %c = icmp eq i32 %m, 0
498 define i1 @length8_eq_const(ptr %X) nounwind {
499 ; CHECK-LABEL: length8_eq_const:
501 ; CHECK-NEXT: mov x9, #12592 // =0x3130
502 ; CHECK-NEXT: ldr x8, [x0]
503 ; CHECK-NEXT: movk x9, #13106, lsl #16
504 ; CHECK-NEXT: movk x9, #13620, lsl #32
505 ; CHECK-NEXT: movk x9, #14134, lsl #48
506 ; CHECK-NEXT: cmp x8, x9
507 ; CHECK-NEXT: cset w0, ne
509 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 8) nounwind
510 %c = icmp ne i32 %m, 0
514 define i32 @length9(ptr %X, ptr %Y) nounwind {
515 ; CHECK-LABEL: length9:
517 ; CHECK-NEXT: ldr x8, [x0]
518 ; CHECK-NEXT: ldr x9, [x1]
519 ; CHECK-NEXT: rev x8, x8
520 ; CHECK-NEXT: rev x9, x9
521 ; CHECK-NEXT: cmp x8, x9
522 ; CHECK-NEXT: b.ne .LBB32_2
523 ; CHECK-NEXT: // %bb.1: // %loadbb1
524 ; CHECK-NEXT: ldrb w8, [x0, #8]
525 ; CHECK-NEXT: ldrb w9, [x1, #8]
526 ; CHECK-NEXT: sub w0, w8, w9
528 ; CHECK-NEXT: .LBB32_2: // %res_block
529 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
530 ; CHECK-NEXT: cneg w0, w8, hs
532 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 9) nounwind
536 define i1 @length9_eq(ptr %X, ptr %Y) nounwind {
537 ; CHECK-LABEL: length9_eq:
539 ; CHECK-NEXT: ldr x8, [x0]
540 ; CHECK-NEXT: ldr x9, [x1]
541 ; CHECK-NEXT: ldrb w10, [x0, #8]
542 ; CHECK-NEXT: ldrb w11, [x1, #8]
543 ; CHECK-NEXT: cmp x8, x9
544 ; CHECK-NEXT: ccmp x10, x11, #0, eq
545 ; CHECK-NEXT: cset w0, eq
547 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 9) nounwind
548 %c = icmp eq i32 %m, 0
552 define i32 @length10(ptr %X, ptr %Y) nounwind {
553 ; CHECK-LABEL: length10:
555 ; CHECK-NEXT: ldr x8, [x0]
556 ; CHECK-NEXT: ldr x9, [x1]
557 ; CHECK-NEXT: rev x8, x8
558 ; CHECK-NEXT: rev x9, x9
559 ; CHECK-NEXT: cmp x8, x9
560 ; CHECK-NEXT: b.ne .LBB34_3
561 ; CHECK-NEXT: // %bb.1: // %loadbb1
562 ; CHECK-NEXT: ldrh w8, [x0, #8]
563 ; CHECK-NEXT: ldrh w9, [x1, #8]
564 ; CHECK-NEXT: rev w8, w8
565 ; CHECK-NEXT: rev w9, w9
566 ; CHECK-NEXT: lsr w8, w8, #16
567 ; CHECK-NEXT: lsr w9, w9, #16
568 ; CHECK-NEXT: cmp x8, x9
569 ; CHECK-NEXT: b.ne .LBB34_3
570 ; CHECK-NEXT: // %bb.2:
571 ; CHECK-NEXT: mov w0, wzr
573 ; CHECK-NEXT: .LBB34_3: // %res_block
574 ; CHECK-NEXT: cmp x8, x9
575 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
576 ; CHECK-NEXT: cneg w0, w8, hs
578 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 10) nounwind
582 define i1 @length10_eq(ptr %X, ptr %Y) nounwind {
583 ; CHECK-LABEL: length10_eq:
585 ; CHECK-NEXT: ldr x8, [x0]
586 ; CHECK-NEXT: ldr x9, [x1]
587 ; CHECK-NEXT: ldrh w10, [x0, #8]
588 ; CHECK-NEXT: ldrh w11, [x1, #8]
589 ; CHECK-NEXT: cmp x8, x9
590 ; CHECK-NEXT: ccmp x10, x11, #0, eq
591 ; CHECK-NEXT: cset w0, eq
593 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 10) nounwind
594 %c = icmp eq i32 %m, 0
598 define i32 @length11(ptr %X, ptr %Y) nounwind {
599 ; CHECK-LABEL: length11:
601 ; CHECK-NEXT: ldr x8, [x0]
602 ; CHECK-NEXT: ldr x9, [x1]
603 ; CHECK-NEXT: rev x8, x8
604 ; CHECK-NEXT: rev x9, x9
605 ; CHECK-NEXT: cmp x8, x9
606 ; CHECK-NEXT: b.ne .LBB36_3
607 ; CHECK-NEXT: // %bb.1: // %loadbb1
608 ; CHECK-NEXT: ldur x8, [x0, #3]
609 ; CHECK-NEXT: ldur x9, [x1, #3]
610 ; CHECK-NEXT: rev x8, x8
611 ; CHECK-NEXT: rev x9, x9
612 ; CHECK-NEXT: cmp x8, x9
613 ; CHECK-NEXT: b.ne .LBB36_3
614 ; CHECK-NEXT: // %bb.2:
615 ; CHECK-NEXT: mov w0, wzr
617 ; CHECK-NEXT: .LBB36_3: // %res_block
618 ; CHECK-NEXT: cmp x8, x9
619 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
620 ; CHECK-NEXT: cneg w0, w8, hs
622 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 11) nounwind
626 define i1 @length11_eq(ptr %X, ptr %Y) nounwind {
627 ; CHECK-LABEL: length11_eq:
629 ; CHECK-NEXT: ldr x8, [x0]
630 ; CHECK-NEXT: ldr x9, [x1]
631 ; CHECK-NEXT: ldur x10, [x0, #3]
632 ; CHECK-NEXT: ldur x11, [x1, #3]
633 ; CHECK-NEXT: cmp x8, x9
634 ; CHECK-NEXT: ccmp x10, x11, #0, eq
635 ; CHECK-NEXT: cset w0, eq
637 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 11) nounwind
638 %c = icmp eq i32 %m, 0
642 define i1 @length12_eq(ptr %X, ptr %Y) nounwind {
643 ; CHECK-LABEL: length12_eq:
645 ; CHECK-NEXT: ldr x8, [x0]
646 ; CHECK-NEXT: ldr x9, [x1]
647 ; CHECK-NEXT: ldr w10, [x0, #8]
648 ; CHECK-NEXT: ldr w11, [x1, #8]
649 ; CHECK-NEXT: cmp x8, x9
650 ; CHECK-NEXT: ccmp x10, x11, #0, eq
651 ; CHECK-NEXT: cset w0, ne
653 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 12) nounwind
654 %c = icmp ne i32 %m, 0
658 define i32 @length12(ptr %X, ptr %Y) nounwind {
659 ; CHECK-LABEL: length12:
661 ; CHECK-NEXT: ldr x8, [x0]
662 ; CHECK-NEXT: ldr x9, [x1]
663 ; CHECK-NEXT: rev x8, x8
664 ; CHECK-NEXT: rev x9, x9
665 ; CHECK-NEXT: cmp x8, x9
666 ; CHECK-NEXT: b.ne .LBB39_3
667 ; CHECK-NEXT: // %bb.1: // %loadbb1
668 ; CHECK-NEXT: ldr w8, [x0, #8]
669 ; CHECK-NEXT: ldr w9, [x1, #8]
670 ; CHECK-NEXT: rev w8, w8
671 ; CHECK-NEXT: rev w9, w9
672 ; CHECK-NEXT: cmp x8, x9
673 ; CHECK-NEXT: b.ne .LBB39_3
674 ; CHECK-NEXT: // %bb.2:
675 ; CHECK-NEXT: mov w0, wzr
677 ; CHECK-NEXT: .LBB39_3: // %res_block
678 ; CHECK-NEXT: cmp x8, x9
679 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
680 ; CHECK-NEXT: cneg w0, w8, hs
682 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 12) nounwind
686 define i1 @length13_eq(ptr %X, ptr %Y) nounwind {
687 ; CHECK-LABEL: length13_eq:
689 ; CHECK-NEXT: ldr x8, [x0]
690 ; CHECK-NEXT: ldr x9, [x1]
691 ; CHECK-NEXT: ldur x10, [x0, #5]
692 ; CHECK-NEXT: ldur x11, [x1, #5]
693 ; CHECK-NEXT: cmp x8, x9
694 ; CHECK-NEXT: ccmp x10, x11, #0, eq
695 ; CHECK-NEXT: cset w0, eq
697 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 13) nounwind
698 %c = icmp eq i32 %m, 0
702 define i1 @length14_eq(ptr %X, ptr %Y) nounwind {
703 ; CHECK-LABEL: length14_eq:
705 ; CHECK-NEXT: ldr x8, [x0]
706 ; CHECK-NEXT: ldr x9, [x1]
707 ; CHECK-NEXT: ldur x10, [x0, #6]
708 ; CHECK-NEXT: ldur x11, [x1, #6]
709 ; CHECK-NEXT: cmp x8, x9
710 ; CHECK-NEXT: ccmp x10, x11, #0, eq
711 ; CHECK-NEXT: cset w0, eq
713 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 14) nounwind
714 %c = icmp eq i32 %m, 0
718 define i32 @length15(ptr %X, ptr %Y) nounwind {
719 ; CHECK-LABEL: length15:
721 ; CHECK-NEXT: ldr x8, [x0]
722 ; CHECK-NEXT: ldr x9, [x1]
723 ; CHECK-NEXT: rev x8, x8
724 ; CHECK-NEXT: rev x9, x9
725 ; CHECK-NEXT: cmp x8, x9
726 ; CHECK-NEXT: b.ne .LBB42_3
727 ; CHECK-NEXT: // %bb.1: // %loadbb1
728 ; CHECK-NEXT: ldur x8, [x0, #7]
729 ; CHECK-NEXT: ldur x9, [x1, #7]
730 ; CHECK-NEXT: rev x8, x8
731 ; CHECK-NEXT: rev x9, x9
732 ; CHECK-NEXT: cmp x8, x9
733 ; CHECK-NEXT: b.ne .LBB42_3
734 ; CHECK-NEXT: // %bb.2:
735 ; CHECK-NEXT: mov w0, wzr
737 ; CHECK-NEXT: .LBB42_3: // %res_block
738 ; CHECK-NEXT: cmp x8, x9
739 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
740 ; CHECK-NEXT: cneg w0, w8, hs
742 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 15) nounwind
746 define i1 @length15_lt(ptr %X, ptr %Y) nounwind {
747 ; CHECK-LABEL: length15_lt:
749 ; CHECK-NEXT: ldr x8, [x0]
750 ; CHECK-NEXT: ldr x9, [x1]
751 ; CHECK-NEXT: rev x8, x8
752 ; CHECK-NEXT: rev x9, x9
753 ; CHECK-NEXT: cmp x8, x9
754 ; CHECK-NEXT: b.ne .LBB43_3
755 ; CHECK-NEXT: // %bb.1: // %loadbb1
756 ; CHECK-NEXT: ldur x8, [x0, #7]
757 ; CHECK-NEXT: ldur x9, [x1, #7]
758 ; CHECK-NEXT: rev x8, x8
759 ; CHECK-NEXT: rev x9, x9
760 ; CHECK-NEXT: cmp x8, x9
761 ; CHECK-NEXT: b.ne .LBB43_3
762 ; CHECK-NEXT: // %bb.2:
763 ; CHECK-NEXT: lsr w0, wzr, #31
765 ; CHECK-NEXT: .LBB43_3: // %res_block
766 ; CHECK-NEXT: cmp x8, x9
767 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
768 ; CHECK-NEXT: cneg w8, w8, hs
769 ; CHECK-NEXT: lsr w0, w8, #31
771 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 15) nounwind
772 %c = icmp slt i32 %m, 0
776 define i32 @length15_const(ptr %X, ptr %Y) nounwind {
777 ; CHECK-LABEL: length15_const:
779 ; CHECK-NEXT: mov x8, #14136 // =0x3738
780 ; CHECK-NEXT: ldr x9, [x0]
781 ; CHECK-NEXT: movk x8, #13622, lsl #16
782 ; CHECK-NEXT: movk x8, #13108, lsl #32
783 ; CHECK-NEXT: rev x9, x9
784 ; CHECK-NEXT: movk x8, #12594, lsl #48
785 ; CHECK-NEXT: cmp x9, x8
786 ; CHECK-NEXT: b.ne .LBB44_3
787 ; CHECK-NEXT: // %bb.1: // %loadbb1
788 ; CHECK-NEXT: mov x8, #13365 // =0x3435
789 ; CHECK-NEXT: ldur x9, [x0, #7]
790 ; CHECK-NEXT: movk x8, #12851, lsl #16
791 ; CHECK-NEXT: movk x8, #12337, lsl #32
792 ; CHECK-NEXT: rev x9, x9
793 ; CHECK-NEXT: movk x8, #14393, lsl #48
794 ; CHECK-NEXT: cmp x9, x8
795 ; CHECK-NEXT: b.ne .LBB44_3
796 ; CHECK-NEXT: // %bb.2:
797 ; CHECK-NEXT: mov w0, wzr
799 ; CHECK-NEXT: .LBB44_3: // %res_block
800 ; CHECK-NEXT: cmp x9, x8
801 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
802 ; CHECK-NEXT: cneg w0, w8, hs
804 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i64 15) nounwind
808 define i1 @length15_eq(ptr %X, ptr %Y) nounwind {
809 ; CHECK-LABEL: length15_eq:
811 ; CHECK-NEXT: ldr x8, [x0]
812 ; CHECK-NEXT: ldr x9, [x1]
813 ; CHECK-NEXT: ldur x10, [x0, #7]
814 ; CHECK-NEXT: ldur x11, [x1, #7]
815 ; CHECK-NEXT: cmp x8, x9
816 ; CHECK-NEXT: ccmp x10, x11, #0, eq
817 ; CHECK-NEXT: cset w0, eq
819 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 15) nounwind
820 %c = icmp eq i32 %m, 0
824 define i1 @length15_gt_const(ptr %X, ptr %Y) nounwind {
825 ; CHECK-LABEL: length15_gt_const:
827 ; CHECK-NEXT: mov x8, #14136 // =0x3738
828 ; CHECK-NEXT: ldr x9, [x0]
829 ; CHECK-NEXT: movk x8, #13622, lsl #16
830 ; CHECK-NEXT: movk x8, #13108, lsl #32
831 ; CHECK-NEXT: rev x9, x9
832 ; CHECK-NEXT: movk x8, #12594, lsl #48
833 ; CHECK-NEXT: cmp x9, x8
834 ; CHECK-NEXT: b.ne .LBB46_3
835 ; CHECK-NEXT: // %bb.1: // %loadbb1
836 ; CHECK-NEXT: mov x8, #13365 // =0x3435
837 ; CHECK-NEXT: ldur x9, [x0, #7]
838 ; CHECK-NEXT: movk x8, #12851, lsl #16
839 ; CHECK-NEXT: movk x8, #12337, lsl #32
840 ; CHECK-NEXT: rev x9, x9
841 ; CHECK-NEXT: movk x8, #14393, lsl #48
842 ; CHECK-NEXT: cmp x9, x8
843 ; CHECK-NEXT: b.ne .LBB46_3
844 ; CHECK-NEXT: // %bb.2:
845 ; CHECK-NEXT: mov w8, wzr
846 ; CHECK-NEXT: b .LBB46_4
847 ; CHECK-NEXT: .LBB46_3: // %res_block
848 ; CHECK-NEXT: cmp x9, x8
849 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
850 ; CHECK-NEXT: cneg w8, w8, hs
851 ; CHECK-NEXT: .LBB46_4: // %endblock
852 ; CHECK-NEXT: cmp w8, #0
853 ; CHECK-NEXT: cset w0, gt
855 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i64 15) nounwind
856 %c = icmp sgt i32 %m, 0
861 define i32 @length16(ptr %X, ptr %Y) nounwind {
862 ; CHECK-LABEL: length16:
864 ; CHECK-NEXT: ldr x8, [x0]
865 ; CHECK-NEXT: ldr x9, [x1]
866 ; CHECK-NEXT: rev x8, x8
867 ; CHECK-NEXT: rev x9, x9
868 ; CHECK-NEXT: cmp x8, x9
869 ; CHECK-NEXT: b.ne .LBB47_3
870 ; CHECK-NEXT: // %bb.1: // %loadbb1
871 ; CHECK-NEXT: ldr x8, [x0, #8]
872 ; CHECK-NEXT: ldr x9, [x1, #8]
873 ; CHECK-NEXT: rev x8, x8
874 ; CHECK-NEXT: rev x9, x9
875 ; CHECK-NEXT: cmp x8, x9
876 ; CHECK-NEXT: b.ne .LBB47_3
877 ; CHECK-NEXT: // %bb.2:
878 ; CHECK-NEXT: mov w0, wzr
880 ; CHECK-NEXT: .LBB47_3: // %res_block
881 ; CHECK-NEXT: cmp x8, x9
882 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
883 ; CHECK-NEXT: cneg w0, w8, hs
885 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 16) nounwind
889 define i1 @length16_eq(ptr %x, ptr %y) nounwind {
890 ; CHECK-LABEL: length16_eq:
892 ; CHECK-NEXT: ldp x8, x11, [x1]
893 ; CHECK-NEXT: ldp x9, x10, [x0]
894 ; CHECK-NEXT: cmp x9, x8
895 ; CHECK-NEXT: ccmp x10, x11, #0, eq
896 ; CHECK-NEXT: cset w0, ne
898 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 16) nounwind
899 %cmp = icmp ne i32 %call, 0
903 define i1 @length16_lt(ptr %x, ptr %y) nounwind {
904 ; CHECK-LABEL: length16_lt:
906 ; CHECK-NEXT: ldr x8, [x0]
907 ; CHECK-NEXT: ldr x9, [x1]
908 ; CHECK-NEXT: rev x8, x8
909 ; CHECK-NEXT: rev x9, x9
910 ; CHECK-NEXT: cmp x8, x9
911 ; CHECK-NEXT: b.ne .LBB49_3
912 ; CHECK-NEXT: // %bb.1: // %loadbb1
913 ; CHECK-NEXT: ldr x8, [x0, #8]
914 ; CHECK-NEXT: ldr x9, [x1, #8]
915 ; CHECK-NEXT: rev x8, x8
916 ; CHECK-NEXT: rev x9, x9
917 ; CHECK-NEXT: cmp x8, x9
918 ; CHECK-NEXT: b.ne .LBB49_3
919 ; CHECK-NEXT: // %bb.2:
920 ; CHECK-NEXT: lsr w0, wzr, #31
922 ; CHECK-NEXT: .LBB49_3: // %res_block
923 ; CHECK-NEXT: cmp x8, x9
924 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
925 ; CHECK-NEXT: cneg w8, w8, hs
926 ; CHECK-NEXT: lsr w0, w8, #31
928 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 16) nounwind
929 %cmp = icmp slt i32 %call, 0
933 define i1 @length16_gt(ptr %x, ptr %y) nounwind {
934 ; CHECK-LABEL: length16_gt:
936 ; CHECK-NEXT: ldr x8, [x0]
937 ; CHECK-NEXT: ldr x9, [x1]
938 ; CHECK-NEXT: rev x8, x8
939 ; CHECK-NEXT: rev x9, x9
940 ; CHECK-NEXT: cmp x8, x9
941 ; CHECK-NEXT: b.ne .LBB50_3
942 ; CHECK-NEXT: // %bb.1: // %loadbb1
943 ; CHECK-NEXT: ldr x8, [x0, #8]
944 ; CHECK-NEXT: ldr x9, [x1, #8]
945 ; CHECK-NEXT: rev x8, x8
946 ; CHECK-NEXT: rev x9, x9
947 ; CHECK-NEXT: cmp x8, x9
948 ; CHECK-NEXT: b.ne .LBB50_3
949 ; CHECK-NEXT: // %bb.2:
950 ; CHECK-NEXT: mov w8, wzr
951 ; CHECK-NEXT: b .LBB50_4
952 ; CHECK-NEXT: .LBB50_3: // %res_block
953 ; CHECK-NEXT: cmp x8, x9
954 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
955 ; CHECK-NEXT: cneg w8, w8, hs
956 ; CHECK-NEXT: .LBB50_4: // %endblock
957 ; CHECK-NEXT: cmp w8, #0
958 ; CHECK-NEXT: cset w0, gt
960 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 16) nounwind
961 %cmp = icmp sgt i32 %call, 0
965 define i1 @length16_eq_const(ptr %X) nounwind {
966 ; CHECK-LABEL: length16_eq_const:
968 ; CHECK-NEXT: mov x8, #12592 // =0x3130
969 ; CHECK-NEXT: ldp x9, x10, [x0]
970 ; CHECK-NEXT: movk x8, #13106, lsl #16
971 ; CHECK-NEXT: movk x8, #13620, lsl #32
972 ; CHECK-NEXT: movk x8, #14134, lsl #48
973 ; CHECK-NEXT: cmp x9, x8
974 ; CHECK-NEXT: mov x8, #14648 // =0x3938
975 ; CHECK-NEXT: movk x8, #12592, lsl #16
976 ; CHECK-NEXT: movk x8, #13106, lsl #32
977 ; CHECK-NEXT: movk x8, #13620, lsl #48
978 ; CHECK-NEXT: ccmp x10, x8, #0, eq
979 ; CHECK-NEXT: cset w0, eq
981 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 16) nounwind
982 %c = icmp eq i32 %m, 0
987 define i32 @length24(ptr %X, ptr %Y) nounwind {
988 ; CHECK-LABEL: length24:
990 ; CHECK-NEXT: ldr x8, [x0]
991 ; CHECK-NEXT: ldr x9, [x1]
992 ; CHECK-NEXT: rev x8, x8
993 ; CHECK-NEXT: rev x9, x9
994 ; CHECK-NEXT: cmp x8, x9
995 ; CHECK-NEXT: b.ne .LBB52_4
996 ; CHECK-NEXT: // %bb.1: // %loadbb1
997 ; CHECK-NEXT: ldr x8, [x0, #8]
998 ; CHECK-NEXT: ldr x9, [x1, #8]
999 ; CHECK-NEXT: rev x8, x8
1000 ; CHECK-NEXT: rev x9, x9
1001 ; CHECK-NEXT: cmp x8, x9
1002 ; CHECK-NEXT: b.ne .LBB52_4
1003 ; CHECK-NEXT: // %bb.2: // %loadbb2
1004 ; CHECK-NEXT: ldr x8, [x0, #16]
1005 ; CHECK-NEXT: ldr x9, [x1, #16]
1006 ; CHECK-NEXT: rev x8, x8
1007 ; CHECK-NEXT: rev x9, x9
1008 ; CHECK-NEXT: cmp x8, x9
1009 ; CHECK-NEXT: b.ne .LBB52_4
1010 ; CHECK-NEXT: // %bb.3:
1011 ; CHECK-NEXT: mov w0, wzr
1013 ; CHECK-NEXT: .LBB52_4: // %res_block
1014 ; CHECK-NEXT: cmp x8, x9
1015 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1016 ; CHECK-NEXT: cneg w0, w8, hs
1018 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 24) nounwind
1022 define i1 @length24_eq(ptr %x, ptr %y) nounwind {
1023 ; CHECK-LABEL: length24_eq:
1025 ; CHECK-NEXT: ldp x8, x11, [x1]
1026 ; CHECK-NEXT: ldr x12, [x0, #16]
1027 ; CHECK-NEXT: ldp x9, x10, [x0]
1028 ; CHECK-NEXT: ldr x13, [x1, #16]
1029 ; CHECK-NEXT: cmp x9, x8
1030 ; CHECK-NEXT: ccmp x10, x11, #0, eq
1031 ; CHECK-NEXT: ccmp x12, x13, #0, eq
1032 ; CHECK-NEXT: cset w0, eq
1034 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 24) nounwind
1035 %cmp = icmp eq i32 %call, 0
1039 define i1 @length24_lt(ptr %x, ptr %y) nounwind {
1040 ; CHECK-LABEL: length24_lt:
1042 ; CHECK-NEXT: ldr x8, [x0]
1043 ; CHECK-NEXT: ldr x9, [x1]
1044 ; CHECK-NEXT: rev x8, x8
1045 ; CHECK-NEXT: rev x9, x9
1046 ; CHECK-NEXT: cmp x8, x9
1047 ; CHECK-NEXT: b.ne .LBB54_4
1048 ; CHECK-NEXT: // %bb.1: // %loadbb1
1049 ; CHECK-NEXT: ldr x8, [x0, #8]
1050 ; CHECK-NEXT: ldr x9, [x1, #8]
1051 ; CHECK-NEXT: rev x8, x8
1052 ; CHECK-NEXT: rev x9, x9
1053 ; CHECK-NEXT: cmp x8, x9
1054 ; CHECK-NEXT: b.ne .LBB54_4
1055 ; CHECK-NEXT: // %bb.2: // %loadbb2
1056 ; CHECK-NEXT: ldr x8, [x0, #16]
1057 ; CHECK-NEXT: ldr x9, [x1, #16]
1058 ; CHECK-NEXT: rev x8, x8
1059 ; CHECK-NEXT: rev x9, x9
1060 ; CHECK-NEXT: cmp x8, x9
1061 ; CHECK-NEXT: b.ne .LBB54_4
1062 ; CHECK-NEXT: // %bb.3:
1063 ; CHECK-NEXT: lsr w0, wzr, #31
1065 ; CHECK-NEXT: .LBB54_4: // %res_block
1066 ; CHECK-NEXT: cmp x8, x9
1067 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1068 ; CHECK-NEXT: cneg w8, w8, hs
1069 ; CHECK-NEXT: lsr w0, w8, #31
1071 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 24) nounwind
1072 %cmp = icmp slt i32 %call, 0
1076 define i1 @length24_gt(ptr %x, ptr %y) nounwind {
1077 ; CHECK-LABEL: length24_gt:
1079 ; CHECK-NEXT: ldr x8, [x0]
1080 ; CHECK-NEXT: ldr x9, [x1]
1081 ; CHECK-NEXT: rev x8, x8
1082 ; CHECK-NEXT: rev x9, x9
1083 ; CHECK-NEXT: cmp x8, x9
1084 ; CHECK-NEXT: b.ne .LBB55_4
1085 ; CHECK-NEXT: // %bb.1: // %loadbb1
1086 ; CHECK-NEXT: ldr x8, [x0, #8]
1087 ; CHECK-NEXT: ldr x9, [x1, #8]
1088 ; CHECK-NEXT: rev x8, x8
1089 ; CHECK-NEXT: rev x9, x9
1090 ; CHECK-NEXT: cmp x8, x9
1091 ; CHECK-NEXT: b.ne .LBB55_4
1092 ; CHECK-NEXT: // %bb.2: // %loadbb2
1093 ; CHECK-NEXT: ldr x8, [x0, #16]
1094 ; CHECK-NEXT: ldr x9, [x1, #16]
1095 ; CHECK-NEXT: rev x8, x8
1096 ; CHECK-NEXT: rev x9, x9
1097 ; CHECK-NEXT: cmp x8, x9
1098 ; CHECK-NEXT: b.ne .LBB55_4
1099 ; CHECK-NEXT: // %bb.3:
1100 ; CHECK-NEXT: mov w8, wzr
1101 ; CHECK-NEXT: b .LBB55_5
1102 ; CHECK-NEXT: .LBB55_4: // %res_block
1103 ; CHECK-NEXT: cmp x8, x9
1104 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1105 ; CHECK-NEXT: cneg w8, w8, hs
1106 ; CHECK-NEXT: .LBB55_5: // %endblock
1107 ; CHECK-NEXT: cmp w8, #0
1108 ; CHECK-NEXT: cset w0, gt
1110 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 24) nounwind
1111 %cmp = icmp sgt i32 %call, 0
1115 define i1 @length24_eq_const(ptr %X) nounwind {
1116 ; CHECK-LABEL: length24_eq_const:
1118 ; CHECK-NEXT: mov x8, #12592 // =0x3130
1119 ; CHECK-NEXT: ldp x9, x10, [x0]
1120 ; CHECK-NEXT: movk x8, #13106, lsl #16
1121 ; CHECK-NEXT: ldr x11, [x0, #16]
1122 ; CHECK-NEXT: movk x8, #13620, lsl #32
1123 ; CHECK-NEXT: movk x8, #14134, lsl #48
1124 ; CHECK-NEXT: cmp x9, x8
1125 ; CHECK-NEXT: mov x8, #14648 // =0x3938
1126 ; CHECK-NEXT: movk x8, #12592, lsl #16
1127 ; CHECK-NEXT: movk x8, #13106, lsl #32
1128 ; CHECK-NEXT: movk x8, #13620, lsl #48
1129 ; CHECK-NEXT: ccmp x10, x8, #0, eq
1130 ; CHECK-NEXT: mov x8, #14134 // =0x3736
1131 ; CHECK-NEXT: movk x8, #14648, lsl #16
1132 ; CHECK-NEXT: movk x8, #12592, lsl #32
1133 ; CHECK-NEXT: movk x8, #13106, lsl #48
1134 ; CHECK-NEXT: ccmp x11, x8, #0, eq
1135 ; CHECK-NEXT: cset w0, ne
1137 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 24) nounwind
1138 %c = icmp ne i32 %m, 0
1142 define i32 @length31(ptr %X, ptr %Y) nounwind {
1143 ; CHECK-LABEL: length31:
1145 ; CHECK-NEXT: ldr x8, [x0]
1146 ; CHECK-NEXT: ldr x9, [x1]
1147 ; CHECK-NEXT: rev x8, x8
1148 ; CHECK-NEXT: rev x9, x9
1149 ; CHECK-NEXT: cmp x8, x9
1150 ; CHECK-NEXT: b.ne .LBB57_5
1151 ; CHECK-NEXT: // %bb.1: // %loadbb1
1152 ; CHECK-NEXT: ldr x8, [x0, #8]
1153 ; CHECK-NEXT: ldr x9, [x1, #8]
1154 ; CHECK-NEXT: rev x8, x8
1155 ; CHECK-NEXT: rev x9, x9
1156 ; CHECK-NEXT: cmp x8, x9
1157 ; CHECK-NEXT: b.ne .LBB57_5
1158 ; CHECK-NEXT: // %bb.2: // %loadbb2
1159 ; CHECK-NEXT: ldr x8, [x0, #16]
1160 ; CHECK-NEXT: ldr x9, [x1, #16]
1161 ; CHECK-NEXT: rev x8, x8
1162 ; CHECK-NEXT: rev x9, x9
1163 ; CHECK-NEXT: cmp x8, x9
1164 ; CHECK-NEXT: b.ne .LBB57_5
1165 ; CHECK-NEXT: // %bb.3: // %loadbb3
1166 ; CHECK-NEXT: ldur x8, [x0, #23]
1167 ; CHECK-NEXT: ldur x9, [x1, #23]
1168 ; CHECK-NEXT: rev x8, x8
1169 ; CHECK-NEXT: rev x9, x9
1170 ; CHECK-NEXT: cmp x8, x9
1171 ; CHECK-NEXT: b.ne .LBB57_5
1172 ; CHECK-NEXT: // %bb.4:
1173 ; CHECK-NEXT: mov w0, wzr
1175 ; CHECK-NEXT: .LBB57_5: // %res_block
1176 ; CHECK-NEXT: cmp x8, x9
1177 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1178 ; CHECK-NEXT: cneg w0, w8, hs
1180 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 31) nounwind
1184 define i1 @length31_eq(ptr %x, ptr %y) nounwind {
1185 ; CHECK-LABEL: length31_eq:
1187 ; CHECK-NEXT: ldp x8, x11, [x1]
1188 ; CHECK-NEXT: ldr x12, [x0, #16]
1189 ; CHECK-NEXT: ldp x9, x10, [x0]
1190 ; CHECK-NEXT: ldr x13, [x1, #16]
1191 ; CHECK-NEXT: cmp x9, x8
1192 ; CHECK-NEXT: ldur x8, [x0, #23]
1193 ; CHECK-NEXT: ldur x9, [x1, #23]
1194 ; CHECK-NEXT: ccmp x10, x11, #0, eq
1195 ; CHECK-NEXT: ccmp x12, x13, #0, eq
1196 ; CHECK-NEXT: ccmp x8, x9, #0, eq
1197 ; CHECK-NEXT: cset w0, eq
1199 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 31) nounwind
1200 %cmp = icmp eq i32 %call, 0
1204 define i1 @length31_lt(ptr %x, ptr %y) nounwind {
1205 ; CHECK-LABEL: length31_lt:
1207 ; CHECK-NEXT: ldr x8, [x0]
1208 ; CHECK-NEXT: ldr x9, [x1]
1209 ; CHECK-NEXT: rev x8, x8
1210 ; CHECK-NEXT: rev x9, x9
1211 ; CHECK-NEXT: cmp x8, x9
1212 ; CHECK-NEXT: b.ne .LBB59_5
1213 ; CHECK-NEXT: // %bb.1: // %loadbb1
1214 ; CHECK-NEXT: ldr x8, [x0, #8]
1215 ; CHECK-NEXT: ldr x9, [x1, #8]
1216 ; CHECK-NEXT: rev x8, x8
1217 ; CHECK-NEXT: rev x9, x9
1218 ; CHECK-NEXT: cmp x8, x9
1219 ; CHECK-NEXT: b.ne .LBB59_5
1220 ; CHECK-NEXT: // %bb.2: // %loadbb2
1221 ; CHECK-NEXT: ldr x8, [x0, #16]
1222 ; CHECK-NEXT: ldr x9, [x1, #16]
1223 ; CHECK-NEXT: rev x8, x8
1224 ; CHECK-NEXT: rev x9, x9
1225 ; CHECK-NEXT: cmp x8, x9
1226 ; CHECK-NEXT: b.ne .LBB59_5
1227 ; CHECK-NEXT: // %bb.3: // %loadbb3
1228 ; CHECK-NEXT: ldur x8, [x0, #23]
1229 ; CHECK-NEXT: ldur x9, [x1, #23]
1230 ; CHECK-NEXT: rev x8, x8
1231 ; CHECK-NEXT: rev x9, x9
1232 ; CHECK-NEXT: cmp x8, x9
1233 ; CHECK-NEXT: b.ne .LBB59_5
1234 ; CHECK-NEXT: // %bb.4:
1235 ; CHECK-NEXT: lsr w0, wzr, #31
1237 ; CHECK-NEXT: .LBB59_5: // %res_block
1238 ; CHECK-NEXT: cmp x8, x9
1239 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1240 ; CHECK-NEXT: cneg w8, w8, hs
1241 ; CHECK-NEXT: lsr w0, w8, #31
1243 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 31) nounwind
1244 %cmp = icmp slt i32 %call, 0
1248 define i1 @length31_gt(ptr %x, ptr %y) nounwind {
1249 ; CHECK-LABEL: length31_gt:
1251 ; CHECK-NEXT: ldr x8, [x0]
1252 ; CHECK-NEXT: ldr x9, [x1]
1253 ; CHECK-NEXT: rev x8, x8
1254 ; CHECK-NEXT: rev x9, x9
1255 ; CHECK-NEXT: cmp x8, x9
1256 ; CHECK-NEXT: b.ne .LBB60_5
1257 ; CHECK-NEXT: // %bb.1: // %loadbb1
1258 ; CHECK-NEXT: ldr x8, [x0, #8]
1259 ; CHECK-NEXT: ldr x9, [x1, #8]
1260 ; CHECK-NEXT: rev x8, x8
1261 ; CHECK-NEXT: rev x9, x9
1262 ; CHECK-NEXT: cmp x8, x9
1263 ; CHECK-NEXT: b.ne .LBB60_5
1264 ; CHECK-NEXT: // %bb.2: // %loadbb2
1265 ; CHECK-NEXT: ldr x8, [x0, #16]
1266 ; CHECK-NEXT: ldr x9, [x1, #16]
1267 ; CHECK-NEXT: rev x8, x8
1268 ; CHECK-NEXT: rev x9, x9
1269 ; CHECK-NEXT: cmp x8, x9
1270 ; CHECK-NEXT: b.ne .LBB60_5
1271 ; CHECK-NEXT: // %bb.3: // %loadbb3
1272 ; CHECK-NEXT: ldur x8, [x0, #23]
1273 ; CHECK-NEXT: ldur x9, [x1, #23]
1274 ; CHECK-NEXT: rev x8, x8
1275 ; CHECK-NEXT: rev x9, x9
1276 ; CHECK-NEXT: cmp x8, x9
1277 ; CHECK-NEXT: b.ne .LBB60_5
1278 ; CHECK-NEXT: // %bb.4:
1279 ; CHECK-NEXT: mov w8, wzr
1280 ; CHECK-NEXT: b .LBB60_6
1281 ; CHECK-NEXT: .LBB60_5: // %res_block
1282 ; CHECK-NEXT: cmp x8, x9
1283 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1284 ; CHECK-NEXT: cneg w8, w8, hs
1285 ; CHECK-NEXT: .LBB60_6: // %endblock
1286 ; CHECK-NEXT: cmp w8, #0
1287 ; CHECK-NEXT: cset w0, gt
1289 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 31) nounwind
1290 %cmp = icmp sgt i32 %call, 0
1294 define i1 @length31_eq_prefer128(ptr %x, ptr %y) nounwind "prefer-vector-width"="128" {
1295 ; CHECK-LABEL: length31_eq_prefer128:
1297 ; CHECK-NEXT: ldp x8, x11, [x1]
1298 ; CHECK-NEXT: ldr x12, [x0, #16]
1299 ; CHECK-NEXT: ldp x9, x10, [x0]
1300 ; CHECK-NEXT: ldr x13, [x1, #16]
1301 ; CHECK-NEXT: cmp x9, x8
1302 ; CHECK-NEXT: ldur x8, [x0, #23]
1303 ; CHECK-NEXT: ldur x9, [x1, #23]
1304 ; CHECK-NEXT: ccmp x10, x11, #0, eq
1305 ; CHECK-NEXT: ccmp x12, x13, #0, eq
1306 ; CHECK-NEXT: ccmp x8, x9, #0, eq
1307 ; CHECK-NEXT: cset w0, eq
1309 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 31) nounwind
1310 %cmp = icmp eq i32 %call, 0
1314 define i1 @length31_eq_const(ptr %X) nounwind {
1315 ; CHECK-LABEL: length31_eq_const:
1317 ; CHECK-NEXT: mov x8, #12592 // =0x3130
1318 ; CHECK-NEXT: ldp x9, x10, [x0]
1319 ; CHECK-NEXT: movk x8, #13106, lsl #16
1320 ; CHECK-NEXT: ldr x11, [x0, #16]
1321 ; CHECK-NEXT: movk x8, #13620, lsl #32
1322 ; CHECK-NEXT: movk x8, #14134, lsl #48
1323 ; CHECK-NEXT: cmp x9, x8
1324 ; CHECK-NEXT: mov x8, #14648 // =0x3938
1325 ; CHECK-NEXT: ldur x9, [x0, #23]
1326 ; CHECK-NEXT: movk x8, #12592, lsl #16
1327 ; CHECK-NEXT: movk x8, #13106, lsl #32
1328 ; CHECK-NEXT: movk x8, #13620, lsl #48
1329 ; CHECK-NEXT: ccmp x10, x8, #0, eq
1330 ; CHECK-NEXT: mov x8, #14134 // =0x3736
1331 ; CHECK-NEXT: movk x8, #14648, lsl #16
1332 ; CHECK-NEXT: movk x8, #12592, lsl #32
1333 ; CHECK-NEXT: movk x8, #13106, lsl #48
1334 ; CHECK-NEXT: ccmp x11, x8, #0, eq
1335 ; CHECK-NEXT: mov x8, #13363 // =0x3433
1336 ; CHECK-NEXT: movk x8, #13877, lsl #16
1337 ; CHECK-NEXT: movk x8, #14391, lsl #32
1338 ; CHECK-NEXT: movk x8, #12345, lsl #48
1339 ; CHECK-NEXT: ccmp x9, x8, #0, eq
1340 ; CHECK-NEXT: cset w0, ne
1342 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 31) nounwind
1343 %c = icmp ne i32 %m, 0
1347 define i32 @length32(ptr %X, ptr %Y) nounwind {
1348 ; CHECK-LABEL: length32:
1350 ; CHECK-NEXT: ldr x8, [x0]
1351 ; CHECK-NEXT: ldr x9, [x1]
1352 ; CHECK-NEXT: rev x8, x8
1353 ; CHECK-NEXT: rev x9, x9
1354 ; CHECK-NEXT: cmp x8, x9
1355 ; CHECK-NEXT: b.ne .LBB63_5
1356 ; CHECK-NEXT: // %bb.1: // %loadbb1
1357 ; CHECK-NEXT: ldr x8, [x0, #8]
1358 ; CHECK-NEXT: ldr x9, [x1, #8]
1359 ; CHECK-NEXT: rev x8, x8
1360 ; CHECK-NEXT: rev x9, x9
1361 ; CHECK-NEXT: cmp x8, x9
1362 ; CHECK-NEXT: b.ne .LBB63_5
1363 ; CHECK-NEXT: // %bb.2: // %loadbb2
1364 ; CHECK-NEXT: ldr x8, [x0, #16]
1365 ; CHECK-NEXT: ldr x9, [x1, #16]
1366 ; CHECK-NEXT: rev x8, x8
1367 ; CHECK-NEXT: rev x9, x9
1368 ; CHECK-NEXT: cmp x8, x9
1369 ; CHECK-NEXT: b.ne .LBB63_5
1370 ; CHECK-NEXT: // %bb.3: // %loadbb3
1371 ; CHECK-NEXT: ldr x8, [x0, #24]
1372 ; CHECK-NEXT: ldr x9, [x1, #24]
1373 ; CHECK-NEXT: rev x8, x8
1374 ; CHECK-NEXT: rev x9, x9
1375 ; CHECK-NEXT: cmp x8, x9
1376 ; CHECK-NEXT: b.ne .LBB63_5
1377 ; CHECK-NEXT: // %bb.4:
1378 ; CHECK-NEXT: mov w0, wzr
1380 ; CHECK-NEXT: .LBB63_5: // %res_block
1381 ; CHECK-NEXT: cmp x8, x9
1382 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1383 ; CHECK-NEXT: cneg w0, w8, hs
1385 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 32) nounwind
1390 define i1 @length32_eq(ptr %x, ptr %y) nounwind {
1391 ; CHECK-LABEL: length32_eq:
1393 ; CHECK-NEXT: ldp x8, x11, [x1]
1394 ; CHECK-NEXT: ldp x9, x10, [x0]
1395 ; CHECK-NEXT: ldp x12, x13, [x1, #16]
1396 ; CHECK-NEXT: cmp x9, x8
1397 ; CHECK-NEXT: ldp x8, x9, [x0, #16]
1398 ; CHECK-NEXT: ccmp x10, x11, #0, eq
1399 ; CHECK-NEXT: ccmp x8, x12, #0, eq
1400 ; CHECK-NEXT: ccmp x9, x13, #0, eq
1401 ; CHECK-NEXT: cset w0, eq
1403 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 32) nounwind
1404 %cmp = icmp eq i32 %call, 0
1408 define i1 @length32_lt(ptr %x, ptr %y) nounwind {
1409 ; CHECK-LABEL: length32_lt:
1411 ; CHECK-NEXT: ldr x8, [x0]
1412 ; CHECK-NEXT: ldr x9, [x1]
1413 ; CHECK-NEXT: rev x8, x8
1414 ; CHECK-NEXT: rev x9, x9
1415 ; CHECK-NEXT: cmp x8, x9
1416 ; CHECK-NEXT: b.ne .LBB65_5
1417 ; CHECK-NEXT: // %bb.1: // %loadbb1
1418 ; CHECK-NEXT: ldr x8, [x0, #8]
1419 ; CHECK-NEXT: ldr x9, [x1, #8]
1420 ; CHECK-NEXT: rev x8, x8
1421 ; CHECK-NEXT: rev x9, x9
1422 ; CHECK-NEXT: cmp x8, x9
1423 ; CHECK-NEXT: b.ne .LBB65_5
1424 ; CHECK-NEXT: // %bb.2: // %loadbb2
1425 ; CHECK-NEXT: ldr x8, [x0, #16]
1426 ; CHECK-NEXT: ldr x9, [x1, #16]
1427 ; CHECK-NEXT: rev x8, x8
1428 ; CHECK-NEXT: rev x9, x9
1429 ; CHECK-NEXT: cmp x8, x9
1430 ; CHECK-NEXT: b.ne .LBB65_5
1431 ; CHECK-NEXT: // %bb.3: // %loadbb3
1432 ; CHECK-NEXT: ldr x8, [x0, #24]
1433 ; CHECK-NEXT: ldr x9, [x1, #24]
1434 ; CHECK-NEXT: rev x8, x8
1435 ; CHECK-NEXT: rev x9, x9
1436 ; CHECK-NEXT: cmp x8, x9
1437 ; CHECK-NEXT: b.ne .LBB65_5
1438 ; CHECK-NEXT: // %bb.4:
1439 ; CHECK-NEXT: lsr w0, wzr, #31
1441 ; CHECK-NEXT: .LBB65_5: // %res_block
1442 ; CHECK-NEXT: cmp x8, x9
1443 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1444 ; CHECK-NEXT: cneg w8, w8, hs
1445 ; CHECK-NEXT: lsr w0, w8, #31
1447 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 32) nounwind
1448 %cmp = icmp slt i32 %call, 0
1452 define i1 @length32_gt(ptr %x, ptr %y) nounwind {
1453 ; CHECK-LABEL: length32_gt:
1455 ; CHECK-NEXT: ldr x8, [x0]
1456 ; CHECK-NEXT: ldr x9, [x1]
1457 ; CHECK-NEXT: rev x8, x8
1458 ; CHECK-NEXT: rev x9, x9
1459 ; CHECK-NEXT: cmp x8, x9
1460 ; CHECK-NEXT: b.ne .LBB66_5
1461 ; CHECK-NEXT: // %bb.1: // %loadbb1
1462 ; CHECK-NEXT: ldr x8, [x0, #8]
1463 ; CHECK-NEXT: ldr x9, [x1, #8]
1464 ; CHECK-NEXT: rev x8, x8
1465 ; CHECK-NEXT: rev x9, x9
1466 ; CHECK-NEXT: cmp x8, x9
1467 ; CHECK-NEXT: b.ne .LBB66_5
1468 ; CHECK-NEXT: // %bb.2: // %loadbb2
1469 ; CHECK-NEXT: ldr x8, [x0, #16]
1470 ; CHECK-NEXT: ldr x9, [x1, #16]
1471 ; CHECK-NEXT: rev x8, x8
1472 ; CHECK-NEXT: rev x9, x9
1473 ; CHECK-NEXT: cmp x8, x9
1474 ; CHECK-NEXT: b.ne .LBB66_5
1475 ; CHECK-NEXT: // %bb.3: // %loadbb3
1476 ; CHECK-NEXT: ldr x8, [x0, #24]
1477 ; CHECK-NEXT: ldr x9, [x1, #24]
1478 ; CHECK-NEXT: rev x8, x8
1479 ; CHECK-NEXT: rev x9, x9
1480 ; CHECK-NEXT: cmp x8, x9
1481 ; CHECK-NEXT: b.ne .LBB66_5
1482 ; CHECK-NEXT: // %bb.4:
1483 ; CHECK-NEXT: mov w8, wzr
1484 ; CHECK-NEXT: b .LBB66_6
1485 ; CHECK-NEXT: .LBB66_5: // %res_block
1486 ; CHECK-NEXT: cmp x8, x9
1487 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1488 ; CHECK-NEXT: cneg w8, w8, hs
1489 ; CHECK-NEXT: .LBB66_6: // %endblock
1490 ; CHECK-NEXT: cmp w8, #0
1491 ; CHECK-NEXT: cset w0, gt
1493 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 32) nounwind
1494 %cmp = icmp sgt i32 %call, 0
1498 define i1 @length32_eq_prefer128(ptr %x, ptr %y) nounwind "prefer-vector-width"="128" {
1499 ; CHECK-LABEL: length32_eq_prefer128:
1501 ; CHECK-NEXT: ldp x8, x11, [x1]
1502 ; CHECK-NEXT: ldp x9, x10, [x0]
1503 ; CHECK-NEXT: ldp x12, x13, [x1, #16]
1504 ; CHECK-NEXT: cmp x9, x8
1505 ; CHECK-NEXT: ldp x8, x9, [x0, #16]
1506 ; CHECK-NEXT: ccmp x10, x11, #0, eq
1507 ; CHECK-NEXT: ccmp x8, x12, #0, eq
1508 ; CHECK-NEXT: ccmp x9, x13, #0, eq
1509 ; CHECK-NEXT: cset w0, eq
1511 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 32) nounwind
1512 %cmp = icmp eq i32 %call, 0
1516 define i1 @length32_eq_const(ptr %X) nounwind {
1517 ; CHECK-LABEL: length32_eq_const:
1519 ; CHECK-NEXT: mov x8, #12592 // =0x3130
1520 ; CHECK-NEXT: ldp x9, x10, [x0]
1521 ; CHECK-NEXT: movk x8, #13106, lsl #16
1522 ; CHECK-NEXT: movk x8, #13620, lsl #32
1523 ; CHECK-NEXT: movk x8, #14134, lsl #48
1524 ; CHECK-NEXT: cmp x9, x8
1525 ; CHECK-NEXT: mov x8, #14648 // =0x3938
1526 ; CHECK-NEXT: movk x8, #12592, lsl #16
1527 ; CHECK-NEXT: ldp x9, x11, [x0, #16]
1528 ; CHECK-NEXT: movk x8, #13106, lsl #32
1529 ; CHECK-NEXT: movk x8, #13620, lsl #48
1530 ; CHECK-NEXT: ccmp x10, x8, #0, eq
1531 ; CHECK-NEXT: mov x8, #14134 // =0x3736
1532 ; CHECK-NEXT: movk x8, #14648, lsl #16
1533 ; CHECK-NEXT: movk x8, #12592, lsl #32
1534 ; CHECK-NEXT: movk x8, #13106, lsl #48
1535 ; CHECK-NEXT: ccmp x9, x8, #0, eq
1536 ; CHECK-NEXT: mov x8, #13620 // =0x3534
1537 ; CHECK-NEXT: movk x8, #14134, lsl #16
1538 ; CHECK-NEXT: movk x8, #14648, lsl #32
1539 ; CHECK-NEXT: movk x8, #12592, lsl #48
1540 ; CHECK-NEXT: ccmp x11, x8, #0, eq
1541 ; CHECK-NEXT: cset w0, ne
1543 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 32) nounwind
1544 %c = icmp ne i32 %m, 0
1548 define i32 @length48(ptr %X, ptr %Y) nounwind {
1549 ; CHECK-LABEL: length48:
1551 ; CHECK-NEXT: ldr x8, [x0]
1552 ; CHECK-NEXT: ldr x9, [x1]
1553 ; CHECK-NEXT: rev x8, x8
1554 ; CHECK-NEXT: rev x9, x9
1555 ; CHECK-NEXT: cmp x8, x9
1556 ; CHECK-NEXT: b.ne .LBB69_7
1557 ; CHECK-NEXT: // %bb.1: // %loadbb1
1558 ; CHECK-NEXT: ldr x8, [x0, #8]
1559 ; CHECK-NEXT: ldr x9, [x1, #8]
1560 ; CHECK-NEXT: rev x8, x8
1561 ; CHECK-NEXT: rev x9, x9
1562 ; CHECK-NEXT: cmp x8, x9
1563 ; CHECK-NEXT: b.ne .LBB69_7
1564 ; CHECK-NEXT: // %bb.2: // %loadbb2
1565 ; CHECK-NEXT: ldr x8, [x0, #16]
1566 ; CHECK-NEXT: ldr x9, [x1, #16]
1567 ; CHECK-NEXT: rev x8, x8
1568 ; CHECK-NEXT: rev x9, x9
1569 ; CHECK-NEXT: cmp x8, x9
1570 ; CHECK-NEXT: b.ne .LBB69_7
1571 ; CHECK-NEXT: // %bb.3: // %loadbb3
1572 ; CHECK-NEXT: ldr x8, [x0, #24]
1573 ; CHECK-NEXT: ldr x9, [x1, #24]
1574 ; CHECK-NEXT: rev x8, x8
1575 ; CHECK-NEXT: rev x9, x9
1576 ; CHECK-NEXT: cmp x8, x9
1577 ; CHECK-NEXT: b.ne .LBB69_7
1578 ; CHECK-NEXT: // %bb.4: // %loadbb4
1579 ; CHECK-NEXT: ldr x8, [x0, #32]
1580 ; CHECK-NEXT: ldr x9, [x1, #32]
1581 ; CHECK-NEXT: rev x8, x8
1582 ; CHECK-NEXT: rev x9, x9
1583 ; CHECK-NEXT: cmp x8, x9
1584 ; CHECK-NEXT: b.ne .LBB69_7
1585 ; CHECK-NEXT: // %bb.5: // %loadbb5
1586 ; CHECK-NEXT: ldr x8, [x0, #40]
1587 ; CHECK-NEXT: ldr x9, [x1, #40]
1588 ; CHECK-NEXT: rev x8, x8
1589 ; CHECK-NEXT: rev x9, x9
1590 ; CHECK-NEXT: cmp x8, x9
1591 ; CHECK-NEXT: b.ne .LBB69_7
1592 ; CHECK-NEXT: // %bb.6:
1593 ; CHECK-NEXT: mov w0, wzr
1595 ; CHECK-NEXT: .LBB69_7: // %res_block
1596 ; CHECK-NEXT: cmp x8, x9
1597 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1598 ; CHECK-NEXT: cneg w0, w8, hs
1600 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 48) nounwind
1604 define i1 @length48_eq(ptr %x, ptr %y) nounwind {
1605 ; CHECK-LABEL: length48_eq:
1607 ; CHECK-NEXT: ldp x8, x11, [x1]
1608 ; CHECK-NEXT: ldp x9, x10, [x0]
1609 ; CHECK-NEXT: ldp x12, x13, [x1, #16]
1610 ; CHECK-NEXT: cmp x9, x8
1611 ; CHECK-NEXT: ldp x8, x9, [x0, #16]
1612 ; CHECK-NEXT: ccmp x10, x11, #0, eq
1613 ; CHECK-NEXT: ccmp x8, x12, #0, eq
1614 ; CHECK-NEXT: ldp x8, x11, [x0, #32]
1615 ; CHECK-NEXT: ldp x10, x12, [x1, #32]
1616 ; CHECK-NEXT: ccmp x9, x13, #0, eq
1617 ; CHECK-NEXT: ccmp x8, x10, #0, eq
1618 ; CHECK-NEXT: ccmp x11, x12, #0, eq
1619 ; CHECK-NEXT: cset w0, eq
1621 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 48) nounwind
1622 %cmp = icmp eq i32 %call, 0
1626 define i1 @length48_lt(ptr %x, ptr %y) nounwind {
1627 ; CHECK-LABEL: length48_lt:
1629 ; CHECK-NEXT: ldr x8, [x0]
1630 ; CHECK-NEXT: ldr x9, [x1]
1631 ; CHECK-NEXT: rev x8, x8
1632 ; CHECK-NEXT: rev x9, x9
1633 ; CHECK-NEXT: cmp x8, x9
1634 ; CHECK-NEXT: b.ne .LBB71_7
1635 ; CHECK-NEXT: // %bb.1: // %loadbb1
1636 ; CHECK-NEXT: ldr x8, [x0, #8]
1637 ; CHECK-NEXT: ldr x9, [x1, #8]
1638 ; CHECK-NEXT: rev x8, x8
1639 ; CHECK-NEXT: rev x9, x9
1640 ; CHECK-NEXT: cmp x8, x9
1641 ; CHECK-NEXT: b.ne .LBB71_7
1642 ; CHECK-NEXT: // %bb.2: // %loadbb2
1643 ; CHECK-NEXT: ldr x8, [x0, #16]
1644 ; CHECK-NEXT: ldr x9, [x1, #16]
1645 ; CHECK-NEXT: rev x8, x8
1646 ; CHECK-NEXT: rev x9, x9
1647 ; CHECK-NEXT: cmp x8, x9
1648 ; CHECK-NEXT: b.ne .LBB71_7
1649 ; CHECK-NEXT: // %bb.3: // %loadbb3
1650 ; CHECK-NEXT: ldr x8, [x0, #24]
1651 ; CHECK-NEXT: ldr x9, [x1, #24]
1652 ; CHECK-NEXT: rev x8, x8
1653 ; CHECK-NEXT: rev x9, x9
1654 ; CHECK-NEXT: cmp x8, x9
1655 ; CHECK-NEXT: b.ne .LBB71_7
1656 ; CHECK-NEXT: // %bb.4: // %loadbb4
1657 ; CHECK-NEXT: ldr x8, [x0, #32]
1658 ; CHECK-NEXT: ldr x9, [x1, #32]
1659 ; CHECK-NEXT: rev x8, x8
1660 ; CHECK-NEXT: rev x9, x9
1661 ; CHECK-NEXT: cmp x8, x9
1662 ; CHECK-NEXT: b.ne .LBB71_7
1663 ; CHECK-NEXT: // %bb.5: // %loadbb5
1664 ; CHECK-NEXT: ldr x8, [x0, #40]
1665 ; CHECK-NEXT: ldr x9, [x1, #40]
1666 ; CHECK-NEXT: rev x8, x8
1667 ; CHECK-NEXT: rev x9, x9
1668 ; CHECK-NEXT: cmp x8, x9
1669 ; CHECK-NEXT: b.ne .LBB71_7
1670 ; CHECK-NEXT: // %bb.6:
1671 ; CHECK-NEXT: lsr w0, wzr, #31
1673 ; CHECK-NEXT: .LBB71_7: // %res_block
1674 ; CHECK-NEXT: cmp x8, x9
1675 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1676 ; CHECK-NEXT: cneg w8, w8, hs
1677 ; CHECK-NEXT: lsr w0, w8, #31
1679 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 48) nounwind
1680 %cmp = icmp slt i32 %call, 0
1684 define i1 @length48_gt(ptr %x, ptr %y) nounwind {
1685 ; CHECK-LABEL: length48_gt:
1687 ; CHECK-NEXT: ldr x8, [x0]
1688 ; CHECK-NEXT: ldr x9, [x1]
1689 ; CHECK-NEXT: rev x8, x8
1690 ; CHECK-NEXT: rev x9, x9
1691 ; CHECK-NEXT: cmp x8, x9
1692 ; CHECK-NEXT: b.ne .LBB72_7
1693 ; CHECK-NEXT: // %bb.1: // %loadbb1
1694 ; CHECK-NEXT: ldr x8, [x0, #8]
1695 ; CHECK-NEXT: ldr x9, [x1, #8]
1696 ; CHECK-NEXT: rev x8, x8
1697 ; CHECK-NEXT: rev x9, x9
1698 ; CHECK-NEXT: cmp x8, x9
1699 ; CHECK-NEXT: b.ne .LBB72_7
1700 ; CHECK-NEXT: // %bb.2: // %loadbb2
1701 ; CHECK-NEXT: ldr x8, [x0, #16]
1702 ; CHECK-NEXT: ldr x9, [x1, #16]
1703 ; CHECK-NEXT: rev x8, x8
1704 ; CHECK-NEXT: rev x9, x9
1705 ; CHECK-NEXT: cmp x8, x9
1706 ; CHECK-NEXT: b.ne .LBB72_7
1707 ; CHECK-NEXT: // %bb.3: // %loadbb3
1708 ; CHECK-NEXT: ldr x8, [x0, #24]
1709 ; CHECK-NEXT: ldr x9, [x1, #24]
1710 ; CHECK-NEXT: rev x8, x8
1711 ; CHECK-NEXT: rev x9, x9
1712 ; CHECK-NEXT: cmp x8, x9
1713 ; CHECK-NEXT: b.ne .LBB72_7
1714 ; CHECK-NEXT: // %bb.4: // %loadbb4
1715 ; CHECK-NEXT: ldr x8, [x0, #32]
1716 ; CHECK-NEXT: ldr x9, [x1, #32]
1717 ; CHECK-NEXT: rev x8, x8
1718 ; CHECK-NEXT: rev x9, x9
1719 ; CHECK-NEXT: cmp x8, x9
1720 ; CHECK-NEXT: b.ne .LBB72_7
1721 ; CHECK-NEXT: // %bb.5: // %loadbb5
1722 ; CHECK-NEXT: ldr x8, [x0, #40]
1723 ; CHECK-NEXT: ldr x9, [x1, #40]
1724 ; CHECK-NEXT: rev x8, x8
1725 ; CHECK-NEXT: rev x9, x9
1726 ; CHECK-NEXT: cmp x8, x9
1727 ; CHECK-NEXT: b.ne .LBB72_7
1728 ; CHECK-NEXT: // %bb.6:
1729 ; CHECK-NEXT: mov w8, wzr
1730 ; CHECK-NEXT: b .LBB72_8
1731 ; CHECK-NEXT: .LBB72_7: // %res_block
1732 ; CHECK-NEXT: cmp x8, x9
1733 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1734 ; CHECK-NEXT: cneg w8, w8, hs
1735 ; CHECK-NEXT: .LBB72_8: // %endblock
1736 ; CHECK-NEXT: cmp w8, #0
1737 ; CHECK-NEXT: cset w0, gt
1739 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 48) nounwind
1740 %cmp = icmp sgt i32 %call, 0
1744 define i1 @length48_eq_prefer128(ptr %x, ptr %y) nounwind "prefer-vector-width"="128" {
1745 ; CHECK-LABEL: length48_eq_prefer128:
1747 ; CHECK-NEXT: ldp x8, x11, [x1]
1748 ; CHECK-NEXT: ldp x9, x10, [x0]
1749 ; CHECK-NEXT: ldp x12, x13, [x1, #16]
1750 ; CHECK-NEXT: cmp x9, x8
1751 ; CHECK-NEXT: ldp x8, x9, [x0, #16]
1752 ; CHECK-NEXT: ccmp x10, x11, #0, eq
1753 ; CHECK-NEXT: ccmp x8, x12, #0, eq
1754 ; CHECK-NEXT: ldp x8, x11, [x0, #32]
1755 ; CHECK-NEXT: ldp x10, x12, [x1, #32]
1756 ; CHECK-NEXT: ccmp x9, x13, #0, eq
1757 ; CHECK-NEXT: ccmp x8, x10, #0, eq
1758 ; CHECK-NEXT: ccmp x11, x12, #0, eq
1759 ; CHECK-NEXT: cset w0, eq
1761 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 48) nounwind
1762 %cmp = icmp eq i32 %call, 0
1766 define i1 @length48_eq_const(ptr %X) nounwind {
1767 ; CHECK-LABEL: length48_eq_const:
1769 ; CHECK-NEXT: mov x8, #12592 // =0x3130
1770 ; CHECK-NEXT: ldp x9, x10, [x0]
1771 ; CHECK-NEXT: movk x8, #13106, lsl #16
1772 ; CHECK-NEXT: ldp x11, x12, [x0, #16]
1773 ; CHECK-NEXT: movk x8, #13620, lsl #32
1774 ; CHECK-NEXT: movk x8, #14134, lsl #48
1775 ; CHECK-NEXT: cmp x9, x8
1776 ; CHECK-NEXT: mov x9, #14648 // =0x3938
1777 ; CHECK-NEXT: movk x9, #12592, lsl #16
1778 ; CHECK-NEXT: movk x9, #13106, lsl #32
1779 ; CHECK-NEXT: movk x9, #13620, lsl #48
1780 ; CHECK-NEXT: ccmp x10, x9, #0, eq
1781 ; CHECK-NEXT: mov x9, #14134 // =0x3736
1782 ; CHECK-NEXT: movk x9, #14648, lsl #16
1783 ; CHECK-NEXT: movk x9, #12592, lsl #32
1784 ; CHECK-NEXT: movk x9, #13106, lsl #48
1785 ; CHECK-NEXT: ccmp x11, x9, #0, eq
1786 ; CHECK-NEXT: mov x9, #13620 // =0x3534
1787 ; CHECK-NEXT: movk x9, #14134, lsl #16
1788 ; CHECK-NEXT: ldp x10, x11, [x0, #32]
1789 ; CHECK-NEXT: movk x9, #14648, lsl #32
1790 ; CHECK-NEXT: movk x9, #12592, lsl #48
1791 ; CHECK-NEXT: ccmp x12, x9, #0, eq
1792 ; CHECK-NEXT: mov x9, #13106 // =0x3332
1793 ; CHECK-NEXT: movk x9, #13620, lsl #16
1794 ; CHECK-NEXT: movk x9, #14134, lsl #32
1795 ; CHECK-NEXT: movk x9, #14648, lsl #48
1796 ; CHECK-NEXT: ccmp x10, x9, #0, eq
1797 ; CHECK-NEXT: ccmp x11, x8, #0, eq
1798 ; CHECK-NEXT: cset w0, ne
1800 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 48) nounwind
1801 %c = icmp ne i32 %m, 0
1805 define i32 @length63(ptr %X, ptr %Y) nounwind {
1806 ; CHECK-LABEL: length63:
1808 ; CHECK-NEXT: ldr x8, [x0]
1809 ; CHECK-NEXT: ldr x9, [x1]
1810 ; CHECK-NEXT: rev x8, x8
1811 ; CHECK-NEXT: rev x9, x9
1812 ; CHECK-NEXT: cmp x8, x9
1813 ; CHECK-NEXT: b.ne .LBB75_9
1814 ; CHECK-NEXT: // %bb.1: // %loadbb1
1815 ; CHECK-NEXT: ldr x8, [x0, #8]
1816 ; CHECK-NEXT: ldr x9, [x1, #8]
1817 ; CHECK-NEXT: rev x8, x8
1818 ; CHECK-NEXT: rev x9, x9
1819 ; CHECK-NEXT: cmp x8, x9
1820 ; CHECK-NEXT: b.ne .LBB75_9
1821 ; CHECK-NEXT: // %bb.2: // %loadbb2
1822 ; CHECK-NEXT: ldr x8, [x0, #16]
1823 ; CHECK-NEXT: ldr x9, [x1, #16]
1824 ; CHECK-NEXT: rev x8, x8
1825 ; CHECK-NEXT: rev x9, x9
1826 ; CHECK-NEXT: cmp x8, x9
1827 ; CHECK-NEXT: b.ne .LBB75_9
1828 ; CHECK-NEXT: // %bb.3: // %loadbb3
1829 ; CHECK-NEXT: ldr x8, [x0, #24]
1830 ; CHECK-NEXT: ldr x9, [x1, #24]
1831 ; CHECK-NEXT: rev x8, x8
1832 ; CHECK-NEXT: rev x9, x9
1833 ; CHECK-NEXT: cmp x8, x9
1834 ; CHECK-NEXT: b.ne .LBB75_9
1835 ; CHECK-NEXT: // %bb.4: // %loadbb4
1836 ; CHECK-NEXT: ldr x8, [x0, #32]
1837 ; CHECK-NEXT: ldr x9, [x1, #32]
1838 ; CHECK-NEXT: rev x8, x8
1839 ; CHECK-NEXT: rev x9, x9
1840 ; CHECK-NEXT: cmp x8, x9
1841 ; CHECK-NEXT: b.ne .LBB75_9
1842 ; CHECK-NEXT: // %bb.5: // %loadbb5
1843 ; CHECK-NEXT: ldr x8, [x0, #40]
1844 ; CHECK-NEXT: ldr x9, [x1, #40]
1845 ; CHECK-NEXT: rev x8, x8
1846 ; CHECK-NEXT: rev x9, x9
1847 ; CHECK-NEXT: cmp x8, x9
1848 ; CHECK-NEXT: b.ne .LBB75_9
1849 ; CHECK-NEXT: // %bb.6: // %loadbb6
1850 ; CHECK-NEXT: ldr x8, [x0, #48]
1851 ; CHECK-NEXT: ldr x9, [x1, #48]
1852 ; CHECK-NEXT: rev x8, x8
1853 ; CHECK-NEXT: rev x9, x9
1854 ; CHECK-NEXT: cmp x8, x9
1855 ; CHECK-NEXT: b.ne .LBB75_9
1856 ; CHECK-NEXT: // %bb.7: // %loadbb7
1857 ; CHECK-NEXT: ldur x8, [x0, #55]
1858 ; CHECK-NEXT: ldur x9, [x1, #55]
1859 ; CHECK-NEXT: rev x8, x8
1860 ; CHECK-NEXT: rev x9, x9
1861 ; CHECK-NEXT: cmp x8, x9
1862 ; CHECK-NEXT: b.ne .LBB75_9
1863 ; CHECK-NEXT: // %bb.8:
1864 ; CHECK-NEXT: mov w0, wzr
1866 ; CHECK-NEXT: .LBB75_9: // %res_block
1867 ; CHECK-NEXT: cmp x8, x9
1868 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1869 ; CHECK-NEXT: cneg w0, w8, hs
1871 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 63) nounwind
1875 define i1 @length63_eq(ptr %x, ptr %y) nounwind {
1876 ; CHECK-LABEL: length63_eq:
1878 ; CHECK-NEXT: ldp x8, x11, [x1]
1879 ; CHECK-NEXT: ldp x9, x10, [x0]
1880 ; CHECK-NEXT: ldp x12, x13, [x1, #16]
1881 ; CHECK-NEXT: cmp x9, x8
1882 ; CHECK-NEXT: ldp x8, x9, [x0, #16]
1883 ; CHECK-NEXT: ccmp x10, x11, #0, eq
1884 ; CHECK-NEXT: ccmp x8, x12, #0, eq
1885 ; CHECK-NEXT: ldp x8, x11, [x0, #32]
1886 ; CHECK-NEXT: ldp x10, x12, [x1, #32]
1887 ; CHECK-NEXT: ccmp x9, x13, #0, eq
1888 ; CHECK-NEXT: ldr x9, [x0, #48]
1889 ; CHECK-NEXT: ldr x13, [x1, #48]
1890 ; CHECK-NEXT: ccmp x8, x10, #0, eq
1891 ; CHECK-NEXT: ldur x8, [x0, #55]
1892 ; CHECK-NEXT: ldur x10, [x1, #55]
1893 ; CHECK-NEXT: ccmp x11, x12, #0, eq
1894 ; CHECK-NEXT: ccmp x9, x13, #0, eq
1895 ; CHECK-NEXT: ccmp x8, x10, #0, eq
1896 ; CHECK-NEXT: cset w0, ne
1898 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 63) nounwind
1899 %cmp = icmp ne i32 %call, 0
1903 define i1 @length63_lt(ptr %x, ptr %y) nounwind {
1904 ; CHECK-LABEL: length63_lt:
1906 ; CHECK-NEXT: ldr x8, [x0]
1907 ; CHECK-NEXT: ldr x9, [x1]
1908 ; CHECK-NEXT: rev x8, x8
1909 ; CHECK-NEXT: rev x9, x9
1910 ; CHECK-NEXT: cmp x8, x9
1911 ; CHECK-NEXT: b.ne .LBB77_9
1912 ; CHECK-NEXT: // %bb.1: // %loadbb1
1913 ; CHECK-NEXT: ldr x8, [x0, #8]
1914 ; CHECK-NEXT: ldr x9, [x1, #8]
1915 ; CHECK-NEXT: rev x8, x8
1916 ; CHECK-NEXT: rev x9, x9
1917 ; CHECK-NEXT: cmp x8, x9
1918 ; CHECK-NEXT: b.ne .LBB77_9
1919 ; CHECK-NEXT: // %bb.2: // %loadbb2
1920 ; CHECK-NEXT: ldr x8, [x0, #16]
1921 ; CHECK-NEXT: ldr x9, [x1, #16]
1922 ; CHECK-NEXT: rev x8, x8
1923 ; CHECK-NEXT: rev x9, x9
1924 ; CHECK-NEXT: cmp x8, x9
1925 ; CHECK-NEXT: b.ne .LBB77_9
1926 ; CHECK-NEXT: // %bb.3: // %loadbb3
1927 ; CHECK-NEXT: ldr x8, [x0, #24]
1928 ; CHECK-NEXT: ldr x9, [x1, #24]
1929 ; CHECK-NEXT: rev x8, x8
1930 ; CHECK-NEXT: rev x9, x9
1931 ; CHECK-NEXT: cmp x8, x9
1932 ; CHECK-NEXT: b.ne .LBB77_9
1933 ; CHECK-NEXT: // %bb.4: // %loadbb4
1934 ; CHECK-NEXT: ldr x8, [x0, #32]
1935 ; CHECK-NEXT: ldr x9, [x1, #32]
1936 ; CHECK-NEXT: rev x8, x8
1937 ; CHECK-NEXT: rev x9, x9
1938 ; CHECK-NEXT: cmp x8, x9
1939 ; CHECK-NEXT: b.ne .LBB77_9
1940 ; CHECK-NEXT: // %bb.5: // %loadbb5
1941 ; CHECK-NEXT: ldr x8, [x0, #40]
1942 ; CHECK-NEXT: ldr x9, [x1, #40]
1943 ; CHECK-NEXT: rev x8, x8
1944 ; CHECK-NEXT: rev x9, x9
1945 ; CHECK-NEXT: cmp x8, x9
1946 ; CHECK-NEXT: b.ne .LBB77_9
1947 ; CHECK-NEXT: // %bb.6: // %loadbb6
1948 ; CHECK-NEXT: ldr x8, [x0, #48]
1949 ; CHECK-NEXT: ldr x9, [x1, #48]
1950 ; CHECK-NEXT: rev x8, x8
1951 ; CHECK-NEXT: rev x9, x9
1952 ; CHECK-NEXT: cmp x8, x9
1953 ; CHECK-NEXT: b.ne .LBB77_9
1954 ; CHECK-NEXT: // %bb.7: // %loadbb7
1955 ; CHECK-NEXT: ldur x8, [x0, #55]
1956 ; CHECK-NEXT: ldur x9, [x1, #55]
1957 ; CHECK-NEXT: rev x8, x8
1958 ; CHECK-NEXT: rev x9, x9
1959 ; CHECK-NEXT: cmp x8, x9
1960 ; CHECK-NEXT: b.ne .LBB77_9
1961 ; CHECK-NEXT: // %bb.8:
1962 ; CHECK-NEXT: lsr w0, wzr, #31
1964 ; CHECK-NEXT: .LBB77_9: // %res_block
1965 ; CHECK-NEXT: cmp x8, x9
1966 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1967 ; CHECK-NEXT: cneg w8, w8, hs
1968 ; CHECK-NEXT: lsr w0, w8, #31
1970 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 63) nounwind
1971 %cmp = icmp slt i32 %call, 0
1975 define i1 @length63_gt(ptr %x, ptr %y) nounwind {
1976 ; CHECK-LABEL: length63_gt:
1978 ; CHECK-NEXT: ldr x8, [x0]
1979 ; CHECK-NEXT: ldr x9, [x1]
1980 ; CHECK-NEXT: rev x8, x8
1981 ; CHECK-NEXT: rev x9, x9
1982 ; CHECK-NEXT: cmp x8, x9
1983 ; CHECK-NEXT: b.ne .LBB78_9
1984 ; CHECK-NEXT: // %bb.1: // %loadbb1
1985 ; CHECK-NEXT: ldr x8, [x0, #8]
1986 ; CHECK-NEXT: ldr x9, [x1, #8]
1987 ; CHECK-NEXT: rev x8, x8
1988 ; CHECK-NEXT: rev x9, x9
1989 ; CHECK-NEXT: cmp x8, x9
1990 ; CHECK-NEXT: b.ne .LBB78_9
1991 ; CHECK-NEXT: // %bb.2: // %loadbb2
1992 ; CHECK-NEXT: ldr x8, [x0, #16]
1993 ; CHECK-NEXT: ldr x9, [x1, #16]
1994 ; CHECK-NEXT: rev x8, x8
1995 ; CHECK-NEXT: rev x9, x9
1996 ; CHECK-NEXT: cmp x8, x9
1997 ; CHECK-NEXT: b.ne .LBB78_9
1998 ; CHECK-NEXT: // %bb.3: // %loadbb3
1999 ; CHECK-NEXT: ldr x8, [x0, #24]
2000 ; CHECK-NEXT: ldr x9, [x1, #24]
2001 ; CHECK-NEXT: rev x8, x8
2002 ; CHECK-NEXT: rev x9, x9
2003 ; CHECK-NEXT: cmp x8, x9
2004 ; CHECK-NEXT: b.ne .LBB78_9
2005 ; CHECK-NEXT: // %bb.4: // %loadbb4
2006 ; CHECK-NEXT: ldr x8, [x0, #32]
2007 ; CHECK-NEXT: ldr x9, [x1, #32]
2008 ; CHECK-NEXT: rev x8, x8
2009 ; CHECK-NEXT: rev x9, x9
2010 ; CHECK-NEXT: cmp x8, x9
2011 ; CHECK-NEXT: b.ne .LBB78_9
2012 ; CHECK-NEXT: // %bb.5: // %loadbb5
2013 ; CHECK-NEXT: ldr x8, [x0, #40]
2014 ; CHECK-NEXT: ldr x9, [x1, #40]
2015 ; CHECK-NEXT: rev x8, x8
2016 ; CHECK-NEXT: rev x9, x9
2017 ; CHECK-NEXT: cmp x8, x9
2018 ; CHECK-NEXT: b.ne .LBB78_9
2019 ; CHECK-NEXT: // %bb.6: // %loadbb6
2020 ; CHECK-NEXT: ldr x8, [x0, #48]
2021 ; CHECK-NEXT: ldr x9, [x1, #48]
2022 ; CHECK-NEXT: rev x8, x8
2023 ; CHECK-NEXT: rev x9, x9
2024 ; CHECK-NEXT: cmp x8, x9
2025 ; CHECK-NEXT: b.ne .LBB78_9
2026 ; CHECK-NEXT: // %bb.7: // %loadbb7
2027 ; CHECK-NEXT: ldur x8, [x0, #55]
2028 ; CHECK-NEXT: ldur x9, [x1, #55]
2029 ; CHECK-NEXT: rev x8, x8
2030 ; CHECK-NEXT: rev x9, x9
2031 ; CHECK-NEXT: cmp x8, x9
2032 ; CHECK-NEXT: b.ne .LBB78_9
2033 ; CHECK-NEXT: // %bb.8:
2034 ; CHECK-NEXT: mov w8, wzr
2035 ; CHECK-NEXT: b .LBB78_10
2036 ; CHECK-NEXT: .LBB78_9: // %res_block
2037 ; CHECK-NEXT: cmp x8, x9
2038 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
2039 ; CHECK-NEXT: cneg w8, w8, hs
2040 ; CHECK-NEXT: .LBB78_10: // %endblock
2041 ; CHECK-NEXT: cmp w8, #0
2042 ; CHECK-NEXT: cset w0, gt
2044 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 63) nounwind
2045 %cmp = icmp sgt i32 %call, 0
2049 define i1 @length63_eq_const(ptr %X) nounwind {
2050 ; CHECK-LABEL: length63_eq_const:
2052 ; CHECK-NEXT: mov x8, #12592 // =0x3130
2053 ; CHECK-NEXT: ldp x9, x10, [x0]
2054 ; CHECK-NEXT: movk x8, #13106, lsl #16
2055 ; CHECK-NEXT: ldp x11, x12, [x0, #16]
2056 ; CHECK-NEXT: movk x8, #13620, lsl #32
2057 ; CHECK-NEXT: movk x8, #14134, lsl #48
2058 ; CHECK-NEXT: cmp x9, x8
2059 ; CHECK-NEXT: mov x9, #14648 // =0x3938
2060 ; CHECK-NEXT: movk x9, #12592, lsl #16
2061 ; CHECK-NEXT: movk x9, #13106, lsl #32
2062 ; CHECK-NEXT: movk x9, #13620, lsl #48
2063 ; CHECK-NEXT: ccmp x10, x9, #0, eq
2064 ; CHECK-NEXT: mov x10, #14134 // =0x3736
2065 ; CHECK-NEXT: movk x10, #14648, lsl #16
2066 ; CHECK-NEXT: movk x10, #12592, lsl #32
2067 ; CHECK-NEXT: movk x10, #13106, lsl #48
2068 ; CHECK-NEXT: ccmp x11, x10, #0, eq
2069 ; CHECK-NEXT: mov x10, #13620 // =0x3534
2070 ; CHECK-NEXT: movk x10, #14134, lsl #16
2071 ; CHECK-NEXT: ldp x11, x13, [x0, #32]
2072 ; CHECK-NEXT: movk x10, #14648, lsl #32
2073 ; CHECK-NEXT: movk x10, #12592, lsl #48
2074 ; CHECK-NEXT: ccmp x12, x10, #0, eq
2075 ; CHECK-NEXT: mov x10, #13106 // =0x3332
2076 ; CHECK-NEXT: ldr x12, [x0, #48]
2077 ; CHECK-NEXT: movk x10, #13620, lsl #16
2078 ; CHECK-NEXT: movk x10, #14134, lsl #32
2079 ; CHECK-NEXT: movk x10, #14648, lsl #48
2080 ; CHECK-NEXT: ccmp x11, x10, #0, eq
2081 ; CHECK-NEXT: ldur x10, [x0, #55]
2082 ; CHECK-NEXT: ccmp x13, x8, #0, eq
2083 ; CHECK-NEXT: mov x8, #13877 // =0x3635
2084 ; CHECK-NEXT: movk x8, #14391, lsl #16
2085 ; CHECK-NEXT: ccmp x12, x9, #0, eq
2086 ; CHECK-NEXT: movk x8, #12345, lsl #32
2087 ; CHECK-NEXT: movk x8, #12849, lsl #48
2088 ; CHECK-NEXT: ccmp x10, x8, #0, eq
2089 ; CHECK-NEXT: cset w0, eq
2091 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 63) nounwind
2092 %c = icmp eq i32 %m, 0
2096 define i32 @length64(ptr %X, ptr %Y) nounwind {
2097 ; CHECK-LABEL: length64:
2099 ; CHECK-NEXT: ldr x8, [x0]
2100 ; CHECK-NEXT: ldr x9, [x1]
2101 ; CHECK-NEXT: rev x8, x8
2102 ; CHECK-NEXT: rev x9, x9
2103 ; CHECK-NEXT: cmp x8, x9
2104 ; CHECK-NEXT: b.ne .LBB80_9
2105 ; CHECK-NEXT: // %bb.1: // %loadbb1
2106 ; CHECK-NEXT: ldr x8, [x0, #8]
2107 ; CHECK-NEXT: ldr x9, [x1, #8]
2108 ; CHECK-NEXT: rev x8, x8
2109 ; CHECK-NEXT: rev x9, x9
2110 ; CHECK-NEXT: cmp x8, x9
2111 ; CHECK-NEXT: b.ne .LBB80_9
2112 ; CHECK-NEXT: // %bb.2: // %loadbb2
2113 ; CHECK-NEXT: ldr x8, [x0, #16]
2114 ; CHECK-NEXT: ldr x9, [x1, #16]
2115 ; CHECK-NEXT: rev x8, x8
2116 ; CHECK-NEXT: rev x9, x9
2117 ; CHECK-NEXT: cmp x8, x9
2118 ; CHECK-NEXT: b.ne .LBB80_9
2119 ; CHECK-NEXT: // %bb.3: // %loadbb3
2120 ; CHECK-NEXT: ldr x8, [x0, #24]
2121 ; CHECK-NEXT: ldr x9, [x1, #24]
2122 ; CHECK-NEXT: rev x8, x8
2123 ; CHECK-NEXT: rev x9, x9
2124 ; CHECK-NEXT: cmp x8, x9
2125 ; CHECK-NEXT: b.ne .LBB80_9
2126 ; CHECK-NEXT: // %bb.4: // %loadbb4
2127 ; CHECK-NEXT: ldr x8, [x0, #32]
2128 ; CHECK-NEXT: ldr x9, [x1, #32]
2129 ; CHECK-NEXT: rev x8, x8
2130 ; CHECK-NEXT: rev x9, x9
2131 ; CHECK-NEXT: cmp x8, x9
2132 ; CHECK-NEXT: b.ne .LBB80_9
2133 ; CHECK-NEXT: // %bb.5: // %loadbb5
2134 ; CHECK-NEXT: ldr x8, [x0, #40]
2135 ; CHECK-NEXT: ldr x9, [x1, #40]
2136 ; CHECK-NEXT: rev x8, x8
2137 ; CHECK-NEXT: rev x9, x9
2138 ; CHECK-NEXT: cmp x8, x9
2139 ; CHECK-NEXT: b.ne .LBB80_9
2140 ; CHECK-NEXT: // %bb.6: // %loadbb6
2141 ; CHECK-NEXT: ldr x8, [x0, #48]
2142 ; CHECK-NEXT: ldr x9, [x1, #48]
2143 ; CHECK-NEXT: rev x8, x8
2144 ; CHECK-NEXT: rev x9, x9
2145 ; CHECK-NEXT: cmp x8, x9
2146 ; CHECK-NEXT: b.ne .LBB80_9
2147 ; CHECK-NEXT: // %bb.7: // %loadbb7
2148 ; CHECK-NEXT: ldr x8, [x0, #56]
2149 ; CHECK-NEXT: ldr x9, [x1, #56]
2150 ; CHECK-NEXT: rev x8, x8
2151 ; CHECK-NEXT: rev x9, x9
2152 ; CHECK-NEXT: cmp x8, x9
2153 ; CHECK-NEXT: b.ne .LBB80_9
2154 ; CHECK-NEXT: // %bb.8:
2155 ; CHECK-NEXT: mov w0, wzr
2157 ; CHECK-NEXT: .LBB80_9: // %res_block
2158 ; CHECK-NEXT: cmp x8, x9
2159 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
2160 ; CHECK-NEXT: cneg w0, w8, hs
2162 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 64) nounwind
2166 define i1 @length64_eq(ptr %x, ptr %y) nounwind {
2167 ; CHECK-LABEL: length64_eq:
2169 ; CHECK-NEXT: ldp x8, x11, [x1]
2170 ; CHECK-NEXT: ldp x9, x10, [x0]
2171 ; CHECK-NEXT: ldp x12, x13, [x1, #16]
2172 ; CHECK-NEXT: cmp x9, x8
2173 ; CHECK-NEXT: ldp x8, x9, [x0, #16]
2174 ; CHECK-NEXT: ccmp x10, x11, #0, eq
2175 ; CHECK-NEXT: ccmp x8, x12, #0, eq
2176 ; CHECK-NEXT: ldp x8, x11, [x0, #32]
2177 ; CHECK-NEXT: ldp x10, x12, [x1, #32]
2178 ; CHECK-NEXT: ccmp x9, x13, #0, eq
2179 ; CHECK-NEXT: ldp x9, x13, [x1, #48]
2180 ; CHECK-NEXT: ccmp x8, x10, #0, eq
2181 ; CHECK-NEXT: ldp x8, x10, [x0, #48]
2182 ; CHECK-NEXT: ccmp x11, x12, #0, eq
2183 ; CHECK-NEXT: ccmp x8, x9, #0, eq
2184 ; CHECK-NEXT: ccmp x10, x13, #0, eq
2185 ; CHECK-NEXT: cset w0, ne
2187 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 64) nounwind
2188 %cmp = icmp ne i32 %call, 0
2192 define i1 @length64_lt(ptr %x, ptr %y) nounwind {
2193 ; CHECK-LABEL: length64_lt:
2195 ; CHECK-NEXT: ldr x8, [x0]
2196 ; CHECK-NEXT: ldr x9, [x1]
2197 ; CHECK-NEXT: rev x8, x8
2198 ; CHECK-NEXT: rev x9, x9
2199 ; CHECK-NEXT: cmp x8, x9
2200 ; CHECK-NEXT: b.ne .LBB82_9
2201 ; CHECK-NEXT: // %bb.1: // %loadbb1
2202 ; CHECK-NEXT: ldr x8, [x0, #8]
2203 ; CHECK-NEXT: ldr x9, [x1, #8]
2204 ; CHECK-NEXT: rev x8, x8
2205 ; CHECK-NEXT: rev x9, x9
2206 ; CHECK-NEXT: cmp x8, x9
2207 ; CHECK-NEXT: b.ne .LBB82_9
2208 ; CHECK-NEXT: // %bb.2: // %loadbb2
2209 ; CHECK-NEXT: ldr x8, [x0, #16]
2210 ; CHECK-NEXT: ldr x9, [x1, #16]
2211 ; CHECK-NEXT: rev x8, x8
2212 ; CHECK-NEXT: rev x9, x9
2213 ; CHECK-NEXT: cmp x8, x9
2214 ; CHECK-NEXT: b.ne .LBB82_9
2215 ; CHECK-NEXT: // %bb.3: // %loadbb3
2216 ; CHECK-NEXT: ldr x8, [x0, #24]
2217 ; CHECK-NEXT: ldr x9, [x1, #24]
2218 ; CHECK-NEXT: rev x8, x8
2219 ; CHECK-NEXT: rev x9, x9
2220 ; CHECK-NEXT: cmp x8, x9
2221 ; CHECK-NEXT: b.ne .LBB82_9
2222 ; CHECK-NEXT: // %bb.4: // %loadbb4
2223 ; CHECK-NEXT: ldr x8, [x0, #32]
2224 ; CHECK-NEXT: ldr x9, [x1, #32]
2225 ; CHECK-NEXT: rev x8, x8
2226 ; CHECK-NEXT: rev x9, x9
2227 ; CHECK-NEXT: cmp x8, x9
2228 ; CHECK-NEXT: b.ne .LBB82_9
2229 ; CHECK-NEXT: // %bb.5: // %loadbb5
2230 ; CHECK-NEXT: ldr x8, [x0, #40]
2231 ; CHECK-NEXT: ldr x9, [x1, #40]
2232 ; CHECK-NEXT: rev x8, x8
2233 ; CHECK-NEXT: rev x9, x9
2234 ; CHECK-NEXT: cmp x8, x9
2235 ; CHECK-NEXT: b.ne .LBB82_9
2236 ; CHECK-NEXT: // %bb.6: // %loadbb6
2237 ; CHECK-NEXT: ldr x8, [x0, #48]
2238 ; CHECK-NEXT: ldr x9, [x1, #48]
2239 ; CHECK-NEXT: rev x8, x8
2240 ; CHECK-NEXT: rev x9, x9
2241 ; CHECK-NEXT: cmp x8, x9
2242 ; CHECK-NEXT: b.ne .LBB82_9
2243 ; CHECK-NEXT: // %bb.7: // %loadbb7
2244 ; CHECK-NEXT: ldr x8, [x0, #56]
2245 ; CHECK-NEXT: ldr x9, [x1, #56]
2246 ; CHECK-NEXT: rev x8, x8
2247 ; CHECK-NEXT: rev x9, x9
2248 ; CHECK-NEXT: cmp x8, x9
2249 ; CHECK-NEXT: b.ne .LBB82_9
2250 ; CHECK-NEXT: // %bb.8:
2251 ; CHECK-NEXT: lsr w0, wzr, #31
2253 ; CHECK-NEXT: .LBB82_9: // %res_block
2254 ; CHECK-NEXT: cmp x8, x9
2255 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
2256 ; CHECK-NEXT: cneg w8, w8, hs
2257 ; CHECK-NEXT: lsr w0, w8, #31
2259 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 64) nounwind
2260 %cmp = icmp slt i32 %call, 0
2264 define i1 @length64_gt(ptr %x, ptr %y) nounwind {
2265 ; CHECK-LABEL: length64_gt:
2267 ; CHECK-NEXT: ldr x8, [x0]
2268 ; CHECK-NEXT: ldr x9, [x1]
2269 ; CHECK-NEXT: rev x8, x8
2270 ; CHECK-NEXT: rev x9, x9
2271 ; CHECK-NEXT: cmp x8, x9
2272 ; CHECK-NEXT: b.ne .LBB83_9
2273 ; CHECK-NEXT: // %bb.1: // %loadbb1
2274 ; CHECK-NEXT: ldr x8, [x0, #8]
2275 ; CHECK-NEXT: ldr x9, [x1, #8]
2276 ; CHECK-NEXT: rev x8, x8
2277 ; CHECK-NEXT: rev x9, x9
2278 ; CHECK-NEXT: cmp x8, x9
2279 ; CHECK-NEXT: b.ne .LBB83_9
2280 ; CHECK-NEXT: // %bb.2: // %loadbb2
2281 ; CHECK-NEXT: ldr x8, [x0, #16]
2282 ; CHECK-NEXT: ldr x9, [x1, #16]
2283 ; CHECK-NEXT: rev x8, x8
2284 ; CHECK-NEXT: rev x9, x9
2285 ; CHECK-NEXT: cmp x8, x9
2286 ; CHECK-NEXT: b.ne .LBB83_9
2287 ; CHECK-NEXT: // %bb.3: // %loadbb3
2288 ; CHECK-NEXT: ldr x8, [x0, #24]
2289 ; CHECK-NEXT: ldr x9, [x1, #24]
2290 ; CHECK-NEXT: rev x8, x8
2291 ; CHECK-NEXT: rev x9, x9
2292 ; CHECK-NEXT: cmp x8, x9
2293 ; CHECK-NEXT: b.ne .LBB83_9
2294 ; CHECK-NEXT: // %bb.4: // %loadbb4
2295 ; CHECK-NEXT: ldr x8, [x0, #32]
2296 ; CHECK-NEXT: ldr x9, [x1, #32]
2297 ; CHECK-NEXT: rev x8, x8
2298 ; CHECK-NEXT: rev x9, x9
2299 ; CHECK-NEXT: cmp x8, x9
2300 ; CHECK-NEXT: b.ne .LBB83_9
2301 ; CHECK-NEXT: // %bb.5: // %loadbb5
2302 ; CHECK-NEXT: ldr x8, [x0, #40]
2303 ; CHECK-NEXT: ldr x9, [x1, #40]
2304 ; CHECK-NEXT: rev x8, x8
2305 ; CHECK-NEXT: rev x9, x9
2306 ; CHECK-NEXT: cmp x8, x9
2307 ; CHECK-NEXT: b.ne .LBB83_9
2308 ; CHECK-NEXT: // %bb.6: // %loadbb6
2309 ; CHECK-NEXT: ldr x8, [x0, #48]
2310 ; CHECK-NEXT: ldr x9, [x1, #48]
2311 ; CHECK-NEXT: rev x8, x8
2312 ; CHECK-NEXT: rev x9, x9
2313 ; CHECK-NEXT: cmp x8, x9
2314 ; CHECK-NEXT: b.ne .LBB83_9
2315 ; CHECK-NEXT: // %bb.7: // %loadbb7
2316 ; CHECK-NEXT: ldr x8, [x0, #56]
2317 ; CHECK-NEXT: ldr x9, [x1, #56]
2318 ; CHECK-NEXT: rev x8, x8
2319 ; CHECK-NEXT: rev x9, x9
2320 ; CHECK-NEXT: cmp x8, x9
2321 ; CHECK-NEXT: b.ne .LBB83_9
2322 ; CHECK-NEXT: // %bb.8:
2323 ; CHECK-NEXT: mov w8, wzr
2324 ; CHECK-NEXT: b .LBB83_10
2325 ; CHECK-NEXT: .LBB83_9: // %res_block
2326 ; CHECK-NEXT: cmp x8, x9
2327 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
2328 ; CHECK-NEXT: cneg w8, w8, hs
2329 ; CHECK-NEXT: .LBB83_10: // %endblock
2330 ; CHECK-NEXT: cmp w8, #0
2331 ; CHECK-NEXT: cset w0, gt
2333 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 64) nounwind
2334 %cmp = icmp sgt i32 %call, 0
2338 define i1 @length64_eq_const(ptr %X) nounwind {
2339 ; CHECK-LABEL: length64_eq_const:
2341 ; CHECK-NEXT: mov x8, #12592 // =0x3130
2342 ; CHECK-NEXT: ldp x9, x10, [x0]
2343 ; CHECK-NEXT: movk x8, #13106, lsl #16
2344 ; CHECK-NEXT: ldp x11, x12, [x0, #16]
2345 ; CHECK-NEXT: movk x8, #13620, lsl #32
2346 ; CHECK-NEXT: ldp x13, x14, [x0, #32]
2347 ; CHECK-NEXT: movk x8, #14134, lsl #48
2348 ; CHECK-NEXT: cmp x9, x8
2349 ; CHECK-NEXT: mov x9, #14648 // =0x3938
2350 ; CHECK-NEXT: movk x9, #12592, lsl #16
2351 ; CHECK-NEXT: movk x9, #13106, lsl #32
2352 ; CHECK-NEXT: movk x9, #13620, lsl #48
2353 ; CHECK-NEXT: ccmp x10, x9, #0, eq
2354 ; CHECK-NEXT: mov x10, #14134 // =0x3736
2355 ; CHECK-NEXT: movk x10, #14648, lsl #16
2356 ; CHECK-NEXT: movk x10, #12592, lsl #32
2357 ; CHECK-NEXT: movk x10, #13106, lsl #48
2358 ; CHECK-NEXT: ccmp x11, x10, #0, eq
2359 ; CHECK-NEXT: mov x11, #13620 // =0x3534
2360 ; CHECK-NEXT: movk x11, #14134, lsl #16
2361 ; CHECK-NEXT: movk x11, #14648, lsl #32
2362 ; CHECK-NEXT: movk x11, #12592, lsl #48
2363 ; CHECK-NEXT: ccmp x12, x11, #0, eq
2364 ; CHECK-NEXT: mov x11, #13106 // =0x3332
2365 ; CHECK-NEXT: movk x11, #13620, lsl #16
2366 ; CHECK-NEXT: movk x11, #14134, lsl #32
2367 ; CHECK-NEXT: movk x11, #14648, lsl #48
2368 ; CHECK-NEXT: ccmp x13, x11, #0, eq
2369 ; CHECK-NEXT: ldp x11, x12, [x0, #48]
2370 ; CHECK-NEXT: ccmp x14, x8, #0, eq
2371 ; CHECK-NEXT: ccmp x11, x9, #0, eq
2372 ; CHECK-NEXT: ccmp x12, x10, #0, eq
2373 ; CHECK-NEXT: cset w0, eq
2375 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 64) nounwind
2376 %c = icmp eq i32 %m, 0
2380 define i32 @length96(ptr %X, ptr %Y) nounwind {
2381 ; CHECK-LABEL: length96:
2383 ; CHECK-NEXT: mov w2, #96 // =0x60
2384 ; CHECK-NEXT: b memcmp
2385 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 96) nounwind
2389 define i1 @length96_eq(ptr %x, ptr %y) nounwind {
2390 ; CHECK-LABEL: length96_eq:
2392 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2393 ; CHECK-NEXT: mov w2, #96 // =0x60
2394 ; CHECK-NEXT: bl memcmp
2395 ; CHECK-NEXT: cmp w0, #0
2396 ; CHECK-NEXT: cset w0, ne
2397 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2399 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 96) nounwind
2400 %cmp = icmp ne i32 %call, 0
2404 define i1 @length96_lt(ptr %x, ptr %y) nounwind {
2405 ; CHECK-LABEL: length96_lt:
2407 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2408 ; CHECK-NEXT: mov w2, #96 // =0x60
2409 ; CHECK-NEXT: bl memcmp
2410 ; CHECK-NEXT: lsr w0, w0, #31
2411 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2413 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 96) nounwind
2414 %cmp = icmp slt i32 %call, 0
2418 define i1 @length96_gt(ptr %x, ptr %y) nounwind {
2419 ; CHECK-LABEL: length96_gt:
2421 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2422 ; CHECK-NEXT: mov w2, #96 // =0x60
2423 ; CHECK-NEXT: bl memcmp
2424 ; CHECK-NEXT: cmp w0, #0
2425 ; CHECK-NEXT: cset w0, gt
2426 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2428 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 96) nounwind
2429 %cmp = icmp sgt i32 %call, 0
2433 define i1 @length96_eq_const(ptr %X) nounwind {
2434 ; CHECK-LABEL: length96_eq_const:
2436 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2437 ; CHECK-NEXT: adrp x1, .L.str
2438 ; CHECK-NEXT: add x1, x1, :lo12:.L.str
2439 ; CHECK-NEXT: mov w2, #96 // =0x60
2440 ; CHECK-NEXT: bl memcmp
2441 ; CHECK-NEXT: cmp w0, #0
2442 ; CHECK-NEXT: cset w0, eq
2443 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2445 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 96) nounwind
2446 %c = icmp eq i32 %m, 0
2450 define i32 @length127(ptr %X, ptr %Y) nounwind {
2451 ; CHECK-LABEL: length127:
2453 ; CHECK-NEXT: mov w2, #127 // =0x7f
2454 ; CHECK-NEXT: b memcmp
2455 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 127) nounwind
2459 define i1 @length127_eq(ptr %x, ptr %y) nounwind {
2460 ; CHECK-LABEL: length127_eq:
2462 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2463 ; CHECK-NEXT: mov w2, #127 // =0x7f
2464 ; CHECK-NEXT: bl memcmp
2465 ; CHECK-NEXT: cmp w0, #0
2466 ; CHECK-NEXT: cset w0, ne
2467 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2469 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 127) nounwind
2470 %cmp = icmp ne i32 %call, 0
2474 define i1 @length127_lt(ptr %x, ptr %y) nounwind {
2475 ; CHECK-LABEL: length127_lt:
2477 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2478 ; CHECK-NEXT: mov w2, #127 // =0x7f
2479 ; CHECK-NEXT: bl memcmp
2480 ; CHECK-NEXT: lsr w0, w0, #31
2481 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2483 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 127) nounwind
2484 %cmp = icmp slt i32 %call, 0
2488 define i1 @length127_gt(ptr %x, ptr %y) nounwind {
2489 ; CHECK-LABEL: length127_gt:
2491 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2492 ; CHECK-NEXT: mov w2, #127 // =0x7f
2493 ; CHECK-NEXT: bl memcmp
2494 ; CHECK-NEXT: cmp w0, #0
2495 ; CHECK-NEXT: cset w0, gt
2496 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2498 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 127) nounwind
2499 %cmp = icmp sgt i32 %call, 0
2503 define i1 @length127_eq_const(ptr %X) nounwind {
2504 ; CHECK-LABEL: length127_eq_const:
2506 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2507 ; CHECK-NEXT: adrp x1, .L.str
2508 ; CHECK-NEXT: add x1, x1, :lo12:.L.str
2509 ; CHECK-NEXT: mov w2, #127 // =0x7f
2510 ; CHECK-NEXT: bl memcmp
2511 ; CHECK-NEXT: cmp w0, #0
2512 ; CHECK-NEXT: cset w0, eq
2513 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2515 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 127) nounwind
2516 %c = icmp eq i32 %m, 0
2520 define i32 @length128(ptr %X, ptr %Y) nounwind {
2521 ; CHECK-LABEL: length128:
2523 ; CHECK-NEXT: mov w2, #128 // =0x80
2524 ; CHECK-NEXT: b memcmp
2525 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 128) nounwind
2529 define i1 @length128_eq(ptr %x, ptr %y) nounwind {
2530 ; CHECK-LABEL: length128_eq:
2532 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2533 ; CHECK-NEXT: mov w2, #128 // =0x80
2534 ; CHECK-NEXT: bl memcmp
2535 ; CHECK-NEXT: cmp w0, #0
2536 ; CHECK-NEXT: cset w0, ne
2537 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2539 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 128) nounwind
2540 %cmp = icmp ne i32 %call, 0
2544 define i1 @length128_lt(ptr %x, ptr %y) nounwind {
2545 ; CHECK-LABEL: length128_lt:
2547 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2548 ; CHECK-NEXT: mov w2, #128 // =0x80
2549 ; CHECK-NEXT: bl memcmp
2550 ; CHECK-NEXT: lsr w0, w0, #31
2551 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2553 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 128) nounwind
2554 %cmp = icmp slt i32 %call, 0
2558 define i1 @length128_gt(ptr %x, ptr %y) nounwind {
2559 ; CHECK-LABEL: length128_gt:
2561 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2562 ; CHECK-NEXT: mov w2, #128 // =0x80
2563 ; CHECK-NEXT: bl memcmp
2564 ; CHECK-NEXT: cmp w0, #0
2565 ; CHECK-NEXT: cset w0, gt
2566 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2568 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 128) nounwind
2569 %cmp = icmp sgt i32 %call, 0
2573 define i1 @length128_eq_const(ptr %X) nounwind {
2574 ; CHECK-LABEL: length128_eq_const:
2576 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2577 ; CHECK-NEXT: adrp x1, .L.str
2578 ; CHECK-NEXT: add x1, x1, :lo12:.L.str
2579 ; CHECK-NEXT: mov w2, #128 // =0x80
2580 ; CHECK-NEXT: bl memcmp
2581 ; CHECK-NEXT: cmp w0, #0
2582 ; CHECK-NEXT: cset w0, eq
2583 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2585 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 128) nounwind
2586 %c = icmp eq i32 %m, 0
2590 define i32 @length192(ptr %X, ptr %Y) nounwind {
2591 ; CHECK-LABEL: length192:
2593 ; CHECK-NEXT: mov w2, #192 // =0xc0
2594 ; CHECK-NEXT: b memcmp
2595 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 192) nounwind
2599 define i1 @length192_eq(ptr %x, ptr %y) nounwind {
2600 ; CHECK-LABEL: length192_eq:
2602 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2603 ; CHECK-NEXT: mov w2, #192 // =0xc0
2604 ; CHECK-NEXT: bl memcmp
2605 ; CHECK-NEXT: cmp w0, #0
2606 ; CHECK-NEXT: cset w0, ne
2607 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2609 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 192) nounwind
2610 %cmp = icmp ne i32 %call, 0
2614 define i1 @length192_lt(ptr %x, ptr %y) nounwind {
2615 ; CHECK-LABEL: length192_lt:
2617 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2618 ; CHECK-NEXT: mov w2, #192 // =0xc0
2619 ; CHECK-NEXT: bl memcmp
2620 ; CHECK-NEXT: lsr w0, w0, #31
2621 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2623 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 192) nounwind
2624 %cmp = icmp slt i32 %call, 0
2628 define i1 @length192_gt(ptr %x, ptr %y) nounwind {
2629 ; CHECK-LABEL: length192_gt:
2631 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2632 ; CHECK-NEXT: mov w2, #192 // =0xc0
2633 ; CHECK-NEXT: bl memcmp
2634 ; CHECK-NEXT: cmp w0, #0
2635 ; CHECK-NEXT: cset w0, gt
2636 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2638 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 192) nounwind
2639 %cmp = icmp sgt i32 %call, 0
2643 define i1 @length192_eq_const(ptr %X) nounwind {
2644 ; CHECK-LABEL: length192_eq_const:
2646 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2647 ; CHECK-NEXT: adrp x1, .L.str
2648 ; CHECK-NEXT: add x1, x1, :lo12:.L.str
2649 ; CHECK-NEXT: mov w2, #192 // =0xc0
2650 ; CHECK-NEXT: bl memcmp
2651 ; CHECK-NEXT: cmp w0, #0
2652 ; CHECK-NEXT: cset w0, eq
2653 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2655 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 192) nounwind
2656 %c = icmp eq i32 %m, 0
2660 define i32 @length255(ptr %X, ptr %Y) nounwind {
2661 ; CHECK-LABEL: length255:
2663 ; CHECK-NEXT: mov w2, #255 // =0xff
2664 ; CHECK-NEXT: b memcmp
2665 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 255) nounwind
2669 define i1 @length255_eq(ptr %x, ptr %y) nounwind {
2670 ; CHECK-LABEL: length255_eq:
2672 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2673 ; CHECK-NEXT: mov w2, #255 // =0xff
2674 ; CHECK-NEXT: bl memcmp
2675 ; CHECK-NEXT: cmp w0, #0
2676 ; CHECK-NEXT: cset w0, ne
2677 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2679 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 255) nounwind
2680 %cmp = icmp ne i32 %call, 0
2684 define i1 @length255_lt(ptr %x, ptr %y) nounwind {
2685 ; CHECK-LABEL: length255_lt:
2687 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2688 ; CHECK-NEXT: mov w2, #255 // =0xff
2689 ; CHECK-NEXT: bl memcmp
2690 ; CHECK-NEXT: lsr w0, w0, #31
2691 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2693 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 255) nounwind
2694 %cmp = icmp slt i32 %call, 0
2698 define i1 @length255_gt(ptr %x, ptr %y) nounwind {
2699 ; CHECK-LABEL: length255_gt:
2701 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2702 ; CHECK-NEXT: mov w2, #255 // =0xff
2703 ; CHECK-NEXT: bl memcmp
2704 ; CHECK-NEXT: cmp w0, #0
2705 ; CHECK-NEXT: cset w0, gt
2706 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2708 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 255) nounwind
2709 %cmp = icmp sgt i32 %call, 0
2713 define i1 @length255_eq_const(ptr %X) nounwind {
2714 ; CHECK-LABEL: length255_eq_const:
2716 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2717 ; CHECK-NEXT: adrp x1, .L.str
2718 ; CHECK-NEXT: add x1, x1, :lo12:.L.str
2719 ; CHECK-NEXT: mov w2, #255 // =0xff
2720 ; CHECK-NEXT: bl memcmp
2721 ; CHECK-NEXT: cmp w0, #0
2722 ; CHECK-NEXT: cset w0, eq
2723 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2725 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 255) nounwind
2726 %c = icmp eq i32 %m, 0
2730 define i32 @length256(ptr %X, ptr %Y) nounwind {
2731 ; CHECK-LABEL: length256:
2733 ; CHECK-NEXT: mov w2, #256 // =0x100
2734 ; CHECK-NEXT: b memcmp
2735 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 256) nounwind
2739 define i1 @length256_eq(ptr %x, ptr %y) nounwind {
2740 ; CHECK-LABEL: length256_eq:
2742 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2743 ; CHECK-NEXT: mov w2, #256 // =0x100
2744 ; CHECK-NEXT: bl memcmp
2745 ; CHECK-NEXT: cmp w0, #0
2746 ; CHECK-NEXT: cset w0, ne
2747 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2749 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 256) nounwind
2750 %cmp = icmp ne i32 %call, 0
2754 define i1 @length256_lt(ptr %x, ptr %y) nounwind {
2755 ; CHECK-LABEL: length256_lt:
2757 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2758 ; CHECK-NEXT: mov w2, #256 // =0x100
2759 ; CHECK-NEXT: bl memcmp
2760 ; CHECK-NEXT: lsr w0, w0, #31
2761 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2763 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 256) nounwind
2764 %cmp = icmp slt i32 %call, 0
2768 define i1 @length256_gt(ptr %x, ptr %y) nounwind {
2769 ; CHECK-LABEL: length256_gt:
2771 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2772 ; CHECK-NEXT: mov w2, #256 // =0x100
2773 ; CHECK-NEXT: bl memcmp
2774 ; CHECK-NEXT: cmp w0, #0
2775 ; CHECK-NEXT: cset w0, gt
2776 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2778 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 256) nounwind
2779 %cmp = icmp sgt i32 %call, 0
2783 define i1 @length256_eq_const(ptr %X) nounwind {
2784 ; CHECK-LABEL: length256_eq_const:
2786 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2787 ; CHECK-NEXT: adrp x1, .L.str
2788 ; CHECK-NEXT: add x1, x1, :lo12:.L.str
2789 ; CHECK-NEXT: mov w2, #256 // =0x100
2790 ; CHECK-NEXT: bl memcmp
2791 ; CHECK-NEXT: cmp w0, #0
2792 ; CHECK-NEXT: cset w0, eq
2793 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2795 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 256) nounwind
2796 %c = icmp eq i32 %m, 0
2800 define i32 @length384(ptr %X, ptr %Y) nounwind {
2801 ; CHECK-LABEL: length384:
2803 ; CHECK-NEXT: mov w2, #384 // =0x180
2804 ; CHECK-NEXT: b memcmp
2805 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 384) nounwind
2809 define i1 @length384_eq(ptr %x, ptr %y) nounwind {
2810 ; CHECK-LABEL: length384_eq:
2812 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2813 ; CHECK-NEXT: mov w2, #384 // =0x180
2814 ; CHECK-NEXT: bl memcmp
2815 ; CHECK-NEXT: cmp w0, #0
2816 ; CHECK-NEXT: cset w0, ne
2817 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2819 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 384) nounwind
2820 %cmp = icmp ne i32 %call, 0
2824 define i1 @length384_lt(ptr %x, ptr %y) nounwind {
2825 ; CHECK-LABEL: length384_lt:
2827 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2828 ; CHECK-NEXT: mov w2, #384 // =0x180
2829 ; CHECK-NEXT: bl memcmp
2830 ; CHECK-NEXT: lsr w0, w0, #31
2831 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2833 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 384) nounwind
2834 %cmp = icmp slt i32 %call, 0
2838 define i1 @length384_gt(ptr %x, ptr %y) nounwind {
2839 ; CHECK-LABEL: length384_gt:
2841 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2842 ; CHECK-NEXT: mov w2, #384 // =0x180
2843 ; CHECK-NEXT: bl memcmp
2844 ; CHECK-NEXT: cmp w0, #0
2845 ; CHECK-NEXT: cset w0, gt
2846 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2848 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 384) nounwind
2849 %cmp = icmp sgt i32 %call, 0
2853 define i1 @length384_eq_const(ptr %X) nounwind {
2854 ; CHECK-LABEL: length384_eq_const:
2856 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2857 ; CHECK-NEXT: adrp x1, .L.str
2858 ; CHECK-NEXT: add x1, x1, :lo12:.L.str
2859 ; CHECK-NEXT: mov w2, #384 // =0x180
2860 ; CHECK-NEXT: bl memcmp
2861 ; CHECK-NEXT: cmp w0, #0
2862 ; CHECK-NEXT: cset w0, eq
2863 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2865 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 384) nounwind
2866 %c = icmp eq i32 %m, 0
2870 define i32 @length511(ptr %X, ptr %Y) nounwind {
2871 ; CHECK-LABEL: length511:
2873 ; CHECK-NEXT: mov w2, #511 // =0x1ff
2874 ; CHECK-NEXT: b memcmp
2875 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 511) nounwind
2879 define i1 @length511_eq(ptr %x, ptr %y) nounwind {
2880 ; CHECK-LABEL: length511_eq:
2882 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2883 ; CHECK-NEXT: mov w2, #511 // =0x1ff
2884 ; CHECK-NEXT: bl memcmp
2885 ; CHECK-NEXT: cmp w0, #0
2886 ; CHECK-NEXT: cset w0, ne
2887 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2889 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 511) nounwind
2890 %cmp = icmp ne i32 %call, 0
2894 define i1 @length511_lt(ptr %x, ptr %y) nounwind {
2895 ; CHECK-LABEL: length511_lt:
2897 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2898 ; CHECK-NEXT: mov w2, #511 // =0x1ff
2899 ; CHECK-NEXT: bl memcmp
2900 ; CHECK-NEXT: lsr w0, w0, #31
2901 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2903 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 511) nounwind
2904 %cmp = icmp slt i32 %call, 0
2908 define i1 @length511_gt(ptr %x, ptr %y) nounwind {
2909 ; CHECK-LABEL: length511_gt:
2911 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2912 ; CHECK-NEXT: mov w2, #511 // =0x1ff
2913 ; CHECK-NEXT: bl memcmp
2914 ; CHECK-NEXT: cmp w0, #0
2915 ; CHECK-NEXT: cset w0, gt
2916 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2918 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 511) nounwind
2919 %cmp = icmp sgt i32 %call, 0
2923 define i1 @length511_eq_const(ptr %X) nounwind {
2924 ; CHECK-LABEL: length511_eq_const:
2926 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2927 ; CHECK-NEXT: adrp x1, .L.str
2928 ; CHECK-NEXT: add x1, x1, :lo12:.L.str
2929 ; CHECK-NEXT: mov w2, #511 // =0x1ff
2930 ; CHECK-NEXT: bl memcmp
2931 ; CHECK-NEXT: cmp w0, #0
2932 ; CHECK-NEXT: cset w0, eq
2933 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2935 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 511) nounwind
2936 %c = icmp eq i32 %m, 0
2940 define i32 @length512(ptr %X, ptr %Y) nounwind {
2941 ; CHECK-LABEL: length512:
2943 ; CHECK-NEXT: mov w2, #512 // =0x200
2944 ; CHECK-NEXT: b memcmp
2945 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 512) nounwind
2949 define i1 @length512_eq(ptr %x, ptr %y) nounwind {
2950 ; CHECK-LABEL: length512_eq:
2952 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2953 ; CHECK-NEXT: mov w2, #512 // =0x200
2954 ; CHECK-NEXT: bl memcmp
2955 ; CHECK-NEXT: cmp w0, #0
2956 ; CHECK-NEXT: cset w0, ne
2957 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2959 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 512) nounwind
2960 %cmp = icmp ne i32 %call, 0
2964 define i1 @length512_lt(ptr %x, ptr %y) nounwind {
2965 ; CHECK-LABEL: length512_lt:
2967 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2968 ; CHECK-NEXT: mov w2, #512 // =0x200
2969 ; CHECK-NEXT: bl memcmp
2970 ; CHECK-NEXT: lsr w0, w0, #31
2971 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2973 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 512) nounwind
2974 %cmp = icmp slt i32 %call, 0
2978 define i1 @length512_gt(ptr %x, ptr %y) nounwind {
2979 ; CHECK-LABEL: length512_gt:
2981 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2982 ; CHECK-NEXT: mov w2, #512 // =0x200
2983 ; CHECK-NEXT: bl memcmp
2984 ; CHECK-NEXT: cmp w0, #0
2985 ; CHECK-NEXT: cset w0, gt
2986 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2988 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 512) nounwind
2989 %cmp = icmp sgt i32 %call, 0
2993 define i1 @length512_eq_const(ptr %X) nounwind {
2994 ; CHECK-LABEL: length512_eq_const:
2996 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2997 ; CHECK-NEXT: adrp x1, .L.str
2998 ; CHECK-NEXT: add x1, x1, :lo12:.L.str
2999 ; CHECK-NEXT: mov w2, #512 // =0x200
3000 ; CHECK-NEXT: bl memcmp
3001 ; CHECK-NEXT: cmp w0, #0
3002 ; CHECK-NEXT: cset w0, eq
3003 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
3005 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 512) nounwind
3006 %c = icmp eq i32 %m, 0
3010 define i32 @huge_length(ptr %X, ptr %Y) nounwind {
3011 ; CHECK-LABEL: huge_length:
3013 ; CHECK-NEXT: mov x2, #9223372036854775807 // =0x7fffffffffffffff
3014 ; CHECK-NEXT: b memcmp
3015 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 9223372036854775807) nounwind
3019 define i1 @huge_length_eq(ptr %X, ptr %Y) nounwind {
3020 ; CHECK-LABEL: huge_length_eq:
3022 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
3023 ; CHECK-NEXT: mov x2, #9223372036854775807 // =0x7fffffffffffffff
3024 ; CHECK-NEXT: bl memcmp
3025 ; CHECK-NEXT: cmp w0, #0
3026 ; CHECK-NEXT: cset w0, eq
3027 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
3029 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 9223372036854775807) nounwind
3030 %c = icmp eq i32 %m, 0
3034 define i32 @nonconst_length(ptr %X, ptr %Y, i64 %size) nounwind {
3035 ; CHECK-LABEL: nonconst_length:
3037 ; CHECK-NEXT: b memcmp
3038 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 %size) nounwind
3042 define i1 @nonconst_length_eq(ptr %X, ptr %Y, i64 %size) nounwind {
3043 ; CHECK-LABEL: nonconst_length_eq:
3045 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
3046 ; CHECK-NEXT: bl memcmp
3047 ; CHECK-NEXT: cmp w0, #0
3048 ; CHECK-NEXT: cset w0, eq
3049 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
3051 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 %size) nounwind
3052 %c = icmp eq i32 %m, 0