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: cset w9, lo
166 ; CHECK-NEXT: sub w0, w8, w9
168 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 3) nounwind
172 define i1 @length3_eq(ptr %X, ptr %Y) nounwind {
173 ; CHECK-LABEL: length3_eq:
175 ; CHECK-NEXT: ldrh w8, [x0]
176 ; CHECK-NEXT: ldrh w9, [x1]
177 ; CHECK-NEXT: ldrb w10, [x0, #2]
178 ; CHECK-NEXT: ldrb w11, [x1, #2]
179 ; CHECK-NEXT: cmp w8, w9
180 ; CHECK-NEXT: ccmp w10, w11, #0, eq
181 ; CHECK-NEXT: cset w0, ne
183 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 3) nounwind
184 %c = icmp ne i32 %m, 0
188 define i32 @length4(ptr %X, ptr %Y) nounwind {
189 ; CHECK-LABEL: length4:
191 ; CHECK-NEXT: ldr w8, [x0]
192 ; CHECK-NEXT: ldr w9, [x1]
193 ; CHECK-NEXT: rev w8, w8
194 ; CHECK-NEXT: rev w9, w9
195 ; CHECK-NEXT: cmp w8, w9
196 ; CHECK-NEXT: cset w8, hi
197 ; CHECK-NEXT: cset w9, lo
198 ; CHECK-NEXT: sub w0, w8, w9
200 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 4) nounwind
204 define i1 @length4_eq(ptr %X, ptr %Y) nounwind {
205 ; CHECK-LABEL: length4_eq:
207 ; CHECK-NEXT: ldr w8, [x0]
208 ; CHECK-NEXT: ldr w9, [x1]
209 ; CHECK-NEXT: cmp w8, w9
210 ; CHECK-NEXT: cset w0, ne
212 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 4) nounwind
213 %c = icmp ne i32 %m, 0
217 define i1 @length4_lt(ptr %X, ptr %Y) nounwind {
218 ; CHECK-LABEL: length4_lt:
220 ; CHECK-NEXT: ldr w8, [x0]
221 ; CHECK-NEXT: ldr w9, [x1]
222 ; CHECK-NEXT: rev w8, w8
223 ; CHECK-NEXT: rev w9, w9
224 ; CHECK-NEXT: cmp w8, w9
225 ; CHECK-NEXT: cset w8, hi
226 ; CHECK-NEXT: cset w9, lo
227 ; CHECK-NEXT: sub w8, w8, w9
228 ; CHECK-NEXT: lsr w0, w8, #31
230 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 4) nounwind
231 %c = icmp slt i32 %m, 0
235 define i1 @length4_gt(ptr %X, ptr %Y) nounwind {
236 ; CHECK-LABEL: length4_gt:
238 ; CHECK-NEXT: ldr w8, [x0]
239 ; CHECK-NEXT: ldr w9, [x1]
240 ; CHECK-NEXT: rev w8, w8
241 ; CHECK-NEXT: rev w9, w9
242 ; CHECK-NEXT: cmp w8, w9
243 ; CHECK-NEXT: cset w8, hi
244 ; CHECK-NEXT: cset w9, lo
245 ; CHECK-NEXT: sub w8, w8, w9
246 ; CHECK-NEXT: cmp w8, #0
247 ; CHECK-NEXT: cset w0, gt
249 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 4) nounwind
250 %c = icmp sgt i32 %m, 0
254 define i1 @length4_eq_const(ptr %X) nounwind {
255 ; CHECK-LABEL: length4_eq_const:
257 ; CHECK-NEXT: ldr w8, [x0]
258 ; CHECK-NEXT: mov w9, #12849 // =0x3231
259 ; CHECK-NEXT: movk w9, #13363, lsl #16
260 ; CHECK-NEXT: cmp w8, w9
261 ; CHECK-NEXT: cset w0, eq
263 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i64 4) nounwind
264 %c = icmp eq i32 %m, 0
268 define i32 @length5(ptr %X, ptr %Y) nounwind {
269 ; CHECK-LABEL: length5:
271 ; CHECK-NEXT: ldrb w8, [x0, #4]
272 ; CHECK-NEXT: ldr w9, [x0]
273 ; CHECK-NEXT: ldrb w10, [x1, #4]
274 ; CHECK-NEXT: ldr w11, [x1]
275 ; CHECK-NEXT: orr x8, x9, x8, lsl #32
276 ; CHECK-NEXT: orr x9, x11, x10, lsl #32
277 ; CHECK-NEXT: rev x8, x8
278 ; CHECK-NEXT: rev x9, x9
279 ; CHECK-NEXT: cmp x8, x9
280 ; CHECK-NEXT: cset w8, hi
281 ; CHECK-NEXT: cset w9, lo
282 ; CHECK-NEXT: sub w0, w8, w9
284 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 5) nounwind
288 define i1 @length5_eq(ptr %X, ptr %Y) nounwind {
289 ; CHECK-LABEL: length5_eq:
291 ; CHECK-NEXT: ldr w8, [x0]
292 ; CHECK-NEXT: ldr w9, [x1]
293 ; CHECK-NEXT: ldrb w10, [x0, #4]
294 ; CHECK-NEXT: ldrb w11, [x1, #4]
295 ; CHECK-NEXT: cmp w8, w9
296 ; CHECK-NEXT: ccmp w10, w11, #0, eq
297 ; CHECK-NEXT: cset w0, ne
299 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 5) nounwind
300 %c = icmp ne i32 %m, 0
304 define i1 @length5_lt(ptr %X, ptr %Y) nounwind {
305 ; CHECK-LABEL: length5_lt:
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: cset w9, lo
318 ; CHECK-NEXT: sub w8, w8, w9
319 ; CHECK-NEXT: lsr w0, w8, #31
321 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 5) nounwind
322 %c = icmp slt i32 %m, 0
326 define i32 @length6(ptr %X, ptr %Y) nounwind {
327 ; CHECK-LABEL: length6:
329 ; CHECK-NEXT: ldrh w8, [x0, #4]
330 ; CHECK-NEXT: ldr w9, [x0]
331 ; CHECK-NEXT: ldrh w10, [x1, #4]
332 ; CHECK-NEXT: ldr w11, [x1]
333 ; CHECK-NEXT: orr x8, x9, x8, lsl #32
334 ; CHECK-NEXT: orr x9, x11, x10, lsl #32
335 ; CHECK-NEXT: rev x8, x8
336 ; CHECK-NEXT: rev x9, x9
337 ; CHECK-NEXT: cmp x8, x9
338 ; CHECK-NEXT: cset w8, hi
339 ; CHECK-NEXT: cset w9, lo
340 ; CHECK-NEXT: sub w0, w8, w9
342 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 6) nounwind
346 define i32 @length7(ptr %X, ptr %Y) nounwind {
347 ; CHECK-LABEL: length7:
349 ; CHECK-NEXT: ldr w8, [x0]
350 ; CHECK-NEXT: ldr w9, [x1]
351 ; CHECK-NEXT: rev w8, w8
352 ; CHECK-NEXT: rev w9, w9
353 ; CHECK-NEXT: cmp w8, w9
354 ; CHECK-NEXT: b.ne .LBB22_3
355 ; CHECK-NEXT: // %bb.1: // %loadbb1
356 ; CHECK-NEXT: ldur w8, [x0, #3]
357 ; CHECK-NEXT: ldur w9, [x1, #3]
358 ; CHECK-NEXT: rev w8, w8
359 ; CHECK-NEXT: rev w9, w9
360 ; CHECK-NEXT: cmp w8, w9
361 ; CHECK-NEXT: b.ne .LBB22_3
362 ; CHECK-NEXT: // %bb.2:
363 ; CHECK-NEXT: mov w0, wzr
365 ; CHECK-NEXT: .LBB22_3: // %res_block
366 ; CHECK-NEXT: cmp w8, w9
367 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
368 ; CHECK-NEXT: cneg w0, w8, hs
370 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 7) nounwind
374 define i1 @length7_lt(ptr %X, ptr %Y) nounwind {
375 ; CHECK-LABEL: length7_lt:
377 ; CHECK-NEXT: ldr w8, [x0]
378 ; CHECK-NEXT: ldr w9, [x1]
379 ; CHECK-NEXT: rev w8, w8
380 ; CHECK-NEXT: rev w9, w9
381 ; CHECK-NEXT: cmp w8, w9
382 ; CHECK-NEXT: b.ne .LBB23_3
383 ; CHECK-NEXT: // %bb.1: // %loadbb1
384 ; CHECK-NEXT: ldur w8, [x0, #3]
385 ; CHECK-NEXT: ldur w9, [x1, #3]
386 ; CHECK-NEXT: rev w8, w8
387 ; CHECK-NEXT: rev w9, w9
388 ; CHECK-NEXT: cmp w8, w9
389 ; CHECK-NEXT: b.ne .LBB23_3
390 ; CHECK-NEXT: // %bb.2:
391 ; CHECK-NEXT: lsr w0, wzr, #31
393 ; CHECK-NEXT: .LBB23_3: // %res_block
394 ; CHECK-NEXT: cmp w8, w9
395 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
396 ; CHECK-NEXT: cneg w8, w8, hs
397 ; CHECK-NEXT: lsr w0, w8, #31
399 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 7) nounwind
400 %c = icmp slt i32 %m, 0
404 define i1 @length7_eq(ptr %X, ptr %Y) nounwind {
405 ; CHECK-LABEL: length7_eq:
407 ; CHECK-NEXT: ldr w8, [x0]
408 ; CHECK-NEXT: ldr w9, [x1]
409 ; CHECK-NEXT: ldur w10, [x0, #3]
410 ; CHECK-NEXT: ldur w11, [x1, #3]
411 ; CHECK-NEXT: cmp w8, w9
412 ; CHECK-NEXT: ccmp w10, w11, #0, eq
413 ; CHECK-NEXT: cset w0, ne
415 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 7) nounwind
416 %c = icmp ne i32 %m, 0
420 define i32 @length8(ptr %X, ptr %Y) nounwind {
421 ; CHECK-LABEL: length8:
423 ; CHECK-NEXT: ldr x8, [x0]
424 ; CHECK-NEXT: ldr x9, [x1]
425 ; CHECK-NEXT: rev x8, x8
426 ; CHECK-NEXT: rev x9, x9
427 ; CHECK-NEXT: cmp x8, x9
428 ; CHECK-NEXT: cset w8, hi
429 ; CHECK-NEXT: cset w9, lo
430 ; CHECK-NEXT: sub w0, w8, w9
432 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 8) nounwind
436 define i1 @length8_eq(ptr %X, ptr %Y) nounwind {
437 ; CHECK-LABEL: length8_eq:
439 ; CHECK-NEXT: ldr x8, [x0]
440 ; CHECK-NEXT: ldr x9, [x1]
441 ; CHECK-NEXT: cmp x8, x9
442 ; CHECK-NEXT: cset w0, eq
444 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 8) nounwind
445 %c = icmp eq i32 %m, 0
449 define i1 @length8_eq_const(ptr %X) nounwind {
450 ; CHECK-LABEL: length8_eq_const:
452 ; CHECK-NEXT: mov x9, #12592 // =0x3130
453 ; CHECK-NEXT: ldr x8, [x0]
454 ; CHECK-NEXT: movk x9, #13106, lsl #16
455 ; CHECK-NEXT: movk x9, #13620, lsl #32
456 ; CHECK-NEXT: movk x9, #14134, lsl #48
457 ; CHECK-NEXT: cmp x8, x9
458 ; CHECK-NEXT: cset w0, ne
460 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 8) nounwind
461 %c = icmp ne i32 %m, 0
465 define i32 @length9(ptr %X, ptr %Y) nounwind {
466 ; CHECK-LABEL: length9:
468 ; CHECK-NEXT: ldr x8, [x0]
469 ; CHECK-NEXT: ldr x9, [x1]
470 ; CHECK-NEXT: rev x8, x8
471 ; CHECK-NEXT: rev x9, x9
472 ; CHECK-NEXT: cmp x8, x9
473 ; CHECK-NEXT: b.ne .LBB28_2
474 ; CHECK-NEXT: // %bb.1: // %loadbb1
475 ; CHECK-NEXT: ldrb w8, [x0, #8]
476 ; CHECK-NEXT: ldrb w9, [x1, #8]
477 ; CHECK-NEXT: sub w0, w8, w9
479 ; CHECK-NEXT: .LBB28_2: // %res_block
480 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
481 ; CHECK-NEXT: cneg w0, w8, hs
483 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 9) nounwind
487 define i1 @length9_eq(ptr %X, ptr %Y) nounwind {
488 ; CHECK-LABEL: length9_eq:
490 ; CHECK-NEXT: ldr x8, [x0]
491 ; CHECK-NEXT: ldr x9, [x1]
492 ; CHECK-NEXT: ldrb w10, [x0, #8]
493 ; CHECK-NEXT: ldrb w11, [x1, #8]
494 ; CHECK-NEXT: cmp x8, x9
495 ; CHECK-NEXT: ccmp x10, x11, #0, eq
496 ; CHECK-NEXT: cset w0, eq
498 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 9) nounwind
499 %c = icmp eq i32 %m, 0
503 define i32 @length10(ptr %X, ptr %Y) nounwind {
504 ; CHECK-LABEL: length10:
506 ; CHECK-NEXT: ldr x8, [x0]
507 ; CHECK-NEXT: ldr x9, [x1]
508 ; CHECK-NEXT: rev x8, x8
509 ; CHECK-NEXT: rev x9, x9
510 ; CHECK-NEXT: cmp x8, x9
511 ; CHECK-NEXT: b.ne .LBB30_3
512 ; CHECK-NEXT: // %bb.1: // %loadbb1
513 ; CHECK-NEXT: ldrh w8, [x0, #8]
514 ; CHECK-NEXT: ldrh w9, [x1, #8]
515 ; CHECK-NEXT: rev w8, w8
516 ; CHECK-NEXT: rev w9, w9
517 ; CHECK-NEXT: lsr w8, w8, #16
518 ; CHECK-NEXT: lsr w9, w9, #16
519 ; CHECK-NEXT: cmp x8, x9
520 ; CHECK-NEXT: b.ne .LBB30_3
521 ; CHECK-NEXT: // %bb.2:
522 ; CHECK-NEXT: mov w0, wzr
524 ; CHECK-NEXT: .LBB30_3: // %res_block
525 ; CHECK-NEXT: cmp x8, x9
526 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
527 ; CHECK-NEXT: cneg w0, w8, hs
529 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 10) nounwind
533 define i1 @length10_eq(ptr %X, ptr %Y) nounwind {
534 ; CHECK-LABEL: length10_eq:
536 ; CHECK-NEXT: ldr x8, [x0]
537 ; CHECK-NEXT: ldr x9, [x1]
538 ; CHECK-NEXT: ldrh w10, [x0, #8]
539 ; CHECK-NEXT: ldrh w11, [x1, #8]
540 ; CHECK-NEXT: cmp x8, x9
541 ; CHECK-NEXT: ccmp x10, x11, #0, eq
542 ; CHECK-NEXT: cset w0, eq
544 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 10) nounwind
545 %c = icmp eq i32 %m, 0
549 define i32 @length11(ptr %X, ptr %Y) nounwind {
550 ; CHECK-LABEL: length11:
552 ; CHECK-NEXT: ldr x8, [x0]
553 ; CHECK-NEXT: ldr x9, [x1]
554 ; CHECK-NEXT: rev x8, x8
555 ; CHECK-NEXT: rev x9, x9
556 ; CHECK-NEXT: cmp x8, x9
557 ; CHECK-NEXT: b.ne .LBB32_3
558 ; CHECK-NEXT: // %bb.1: // %loadbb1
559 ; CHECK-NEXT: ldur x8, [x0, #3]
560 ; CHECK-NEXT: ldur x9, [x1, #3]
561 ; CHECK-NEXT: rev x8, x8
562 ; CHECK-NEXT: rev x9, x9
563 ; CHECK-NEXT: cmp x8, x9
564 ; CHECK-NEXT: b.ne .LBB32_3
565 ; CHECK-NEXT: // %bb.2:
566 ; CHECK-NEXT: mov w0, wzr
568 ; CHECK-NEXT: .LBB32_3: // %res_block
569 ; CHECK-NEXT: cmp x8, x9
570 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
571 ; CHECK-NEXT: cneg w0, w8, hs
573 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 11) nounwind
577 define i1 @length11_eq(ptr %X, ptr %Y) nounwind {
578 ; CHECK-LABEL: length11_eq:
580 ; CHECK-NEXT: ldr x8, [x0]
581 ; CHECK-NEXT: ldr x9, [x1]
582 ; CHECK-NEXT: ldur x10, [x0, #3]
583 ; CHECK-NEXT: ldur x11, [x1, #3]
584 ; CHECK-NEXT: cmp x8, x9
585 ; CHECK-NEXT: ccmp x10, x11, #0, eq
586 ; CHECK-NEXT: cset w0, eq
588 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 11) nounwind
589 %c = icmp eq i32 %m, 0
593 define i1 @length12_eq(ptr %X, ptr %Y) nounwind {
594 ; CHECK-LABEL: length12_eq:
596 ; CHECK-NEXT: ldr x8, [x0]
597 ; CHECK-NEXT: ldr x9, [x1]
598 ; CHECK-NEXT: ldr w10, [x0, #8]
599 ; CHECK-NEXT: ldr w11, [x1, #8]
600 ; CHECK-NEXT: cmp x8, x9
601 ; CHECK-NEXT: ccmp x10, x11, #0, eq
602 ; CHECK-NEXT: cset w0, ne
604 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 12) nounwind
605 %c = icmp ne i32 %m, 0
609 define i32 @length12(ptr %X, ptr %Y) nounwind {
610 ; CHECK-LABEL: length12:
612 ; CHECK-NEXT: ldr x8, [x0]
613 ; CHECK-NEXT: ldr x9, [x1]
614 ; CHECK-NEXT: rev x8, x8
615 ; CHECK-NEXT: rev x9, x9
616 ; CHECK-NEXT: cmp x8, x9
617 ; CHECK-NEXT: b.ne .LBB35_3
618 ; CHECK-NEXT: // %bb.1: // %loadbb1
619 ; CHECK-NEXT: ldr w8, [x0, #8]
620 ; CHECK-NEXT: ldr w9, [x1, #8]
621 ; CHECK-NEXT: rev w8, w8
622 ; CHECK-NEXT: rev w9, w9
623 ; CHECK-NEXT: cmp x8, x9
624 ; CHECK-NEXT: b.ne .LBB35_3
625 ; CHECK-NEXT: // %bb.2:
626 ; CHECK-NEXT: mov w0, wzr
628 ; CHECK-NEXT: .LBB35_3: // %res_block
629 ; CHECK-NEXT: cmp x8, x9
630 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
631 ; CHECK-NEXT: cneg w0, w8, hs
633 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 12) nounwind
637 define i1 @length13_eq(ptr %X, ptr %Y) nounwind {
638 ; CHECK-LABEL: length13_eq:
640 ; CHECK-NEXT: ldr x8, [x0]
641 ; CHECK-NEXT: ldr x9, [x1]
642 ; CHECK-NEXT: ldur x10, [x0, #5]
643 ; CHECK-NEXT: ldur x11, [x1, #5]
644 ; CHECK-NEXT: cmp x8, x9
645 ; CHECK-NEXT: ccmp x10, x11, #0, eq
646 ; CHECK-NEXT: cset w0, eq
648 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 13) nounwind
649 %c = icmp eq i32 %m, 0
653 define i1 @length14_eq(ptr %X, ptr %Y) nounwind {
654 ; CHECK-LABEL: length14_eq:
656 ; CHECK-NEXT: ldr x8, [x0]
657 ; CHECK-NEXT: ldr x9, [x1]
658 ; CHECK-NEXT: ldur x10, [x0, #6]
659 ; CHECK-NEXT: ldur x11, [x1, #6]
660 ; CHECK-NEXT: cmp x8, x9
661 ; CHECK-NEXT: ccmp x10, x11, #0, eq
662 ; CHECK-NEXT: cset w0, eq
664 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 14) nounwind
665 %c = icmp eq i32 %m, 0
669 define i32 @length15(ptr %X, ptr %Y) nounwind {
670 ; CHECK-LABEL: length15:
672 ; CHECK-NEXT: ldr x8, [x0]
673 ; CHECK-NEXT: ldr x9, [x1]
674 ; CHECK-NEXT: rev x8, x8
675 ; CHECK-NEXT: rev x9, x9
676 ; CHECK-NEXT: cmp x8, x9
677 ; CHECK-NEXT: b.ne .LBB38_3
678 ; CHECK-NEXT: // %bb.1: // %loadbb1
679 ; CHECK-NEXT: ldur x8, [x0, #7]
680 ; CHECK-NEXT: ldur x9, [x1, #7]
681 ; CHECK-NEXT: rev x8, x8
682 ; CHECK-NEXT: rev x9, x9
683 ; CHECK-NEXT: cmp x8, x9
684 ; CHECK-NEXT: b.ne .LBB38_3
685 ; CHECK-NEXT: // %bb.2:
686 ; CHECK-NEXT: mov w0, wzr
688 ; CHECK-NEXT: .LBB38_3: // %res_block
689 ; CHECK-NEXT: cmp x8, x9
690 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
691 ; CHECK-NEXT: cneg w0, w8, hs
693 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 15) nounwind
697 define i1 @length15_lt(ptr %X, ptr %Y) nounwind {
698 ; CHECK-LABEL: length15_lt:
700 ; CHECK-NEXT: ldr x8, [x0]
701 ; CHECK-NEXT: ldr x9, [x1]
702 ; CHECK-NEXT: rev x8, x8
703 ; CHECK-NEXT: rev x9, x9
704 ; CHECK-NEXT: cmp x8, x9
705 ; CHECK-NEXT: b.ne .LBB39_3
706 ; CHECK-NEXT: // %bb.1: // %loadbb1
707 ; CHECK-NEXT: ldur x8, [x0, #7]
708 ; CHECK-NEXT: ldur x9, [x1, #7]
709 ; CHECK-NEXT: rev x8, x8
710 ; CHECK-NEXT: rev x9, x9
711 ; CHECK-NEXT: cmp x8, x9
712 ; CHECK-NEXT: b.ne .LBB39_3
713 ; CHECK-NEXT: // %bb.2:
714 ; CHECK-NEXT: lsr w0, wzr, #31
716 ; CHECK-NEXT: .LBB39_3: // %res_block
717 ; CHECK-NEXT: cmp x8, x9
718 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
719 ; CHECK-NEXT: cneg w8, w8, hs
720 ; CHECK-NEXT: lsr w0, w8, #31
722 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 15) nounwind
723 %c = icmp slt i32 %m, 0
727 define i32 @length15_const(ptr %X, ptr %Y) nounwind {
728 ; CHECK-LABEL: length15_const:
730 ; CHECK-NEXT: mov x8, #14136 // =0x3738
731 ; CHECK-NEXT: ldr x9, [x0]
732 ; CHECK-NEXT: movk x8, #13622, lsl #16
733 ; CHECK-NEXT: movk x8, #13108, lsl #32
734 ; CHECK-NEXT: rev x9, x9
735 ; CHECK-NEXT: movk x8, #12594, lsl #48
736 ; CHECK-NEXT: cmp x9, x8
737 ; CHECK-NEXT: b.ne .LBB40_3
738 ; CHECK-NEXT: // %bb.1: // %loadbb1
739 ; CHECK-NEXT: mov x8, #13365 // =0x3435
740 ; CHECK-NEXT: ldur x9, [x0, #7]
741 ; CHECK-NEXT: movk x8, #12851, lsl #16
742 ; CHECK-NEXT: movk x8, #12337, lsl #32
743 ; CHECK-NEXT: rev x9, x9
744 ; CHECK-NEXT: movk x8, #14393, lsl #48
745 ; CHECK-NEXT: cmp x9, x8
746 ; CHECK-NEXT: b.ne .LBB40_3
747 ; CHECK-NEXT: // %bb.2:
748 ; CHECK-NEXT: mov w0, wzr
750 ; CHECK-NEXT: .LBB40_3: // %res_block
751 ; CHECK-NEXT: cmp x9, x8
752 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
753 ; CHECK-NEXT: cneg w0, w8, hs
755 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i64 15) nounwind
759 define i1 @length15_eq(ptr %X, ptr %Y) nounwind {
760 ; CHECK-LABEL: length15_eq:
762 ; CHECK-NEXT: ldr x8, [x0]
763 ; CHECK-NEXT: ldr x9, [x1]
764 ; CHECK-NEXT: ldur x10, [x0, #7]
765 ; CHECK-NEXT: ldur x11, [x1, #7]
766 ; CHECK-NEXT: cmp x8, x9
767 ; CHECK-NEXT: ccmp x10, x11, #0, eq
768 ; CHECK-NEXT: cset w0, eq
770 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 15) nounwind
771 %c = icmp eq i32 %m, 0
775 define i1 @length15_gt_const(ptr %X, ptr %Y) nounwind {
776 ; CHECK-LABEL: length15_gt_const:
778 ; CHECK-NEXT: mov x8, #14136 // =0x3738
779 ; CHECK-NEXT: ldr x9, [x0]
780 ; CHECK-NEXT: movk x8, #13622, lsl #16
781 ; CHECK-NEXT: movk x8, #13108, lsl #32
782 ; CHECK-NEXT: rev x9, x9
783 ; CHECK-NEXT: movk x8, #12594, lsl #48
784 ; CHECK-NEXT: cmp x9, x8
785 ; CHECK-NEXT: b.ne .LBB42_3
786 ; CHECK-NEXT: // %bb.1: // %loadbb1
787 ; CHECK-NEXT: mov x8, #13365 // =0x3435
788 ; CHECK-NEXT: ldur x9, [x0, #7]
789 ; CHECK-NEXT: movk x8, #12851, lsl #16
790 ; CHECK-NEXT: movk x8, #12337, lsl #32
791 ; CHECK-NEXT: rev x9, x9
792 ; CHECK-NEXT: movk x8, #14393, lsl #48
793 ; CHECK-NEXT: cmp x9, x8
794 ; CHECK-NEXT: b.ne .LBB42_3
795 ; CHECK-NEXT: // %bb.2:
796 ; CHECK-NEXT: mov w8, wzr
797 ; CHECK-NEXT: b .LBB42_4
798 ; CHECK-NEXT: .LBB42_3: // %res_block
799 ; CHECK-NEXT: cmp x9, x8
800 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
801 ; CHECK-NEXT: cneg w8, w8, hs
802 ; CHECK-NEXT: .LBB42_4: // %endblock
803 ; CHECK-NEXT: cmp w8, #0
804 ; CHECK-NEXT: cset w0, gt
806 %m = tail call i32 @memcmp(ptr %X, ptr getelementptr inbounds ([513 x i8], ptr @.str, i32 0, i32 1), i64 15) nounwind
807 %c = icmp sgt i32 %m, 0
812 define i32 @length16(ptr %X, ptr %Y) nounwind {
813 ; CHECK-LABEL: length16:
815 ; CHECK-NEXT: ldr x8, [x0]
816 ; CHECK-NEXT: ldr x9, [x1]
817 ; CHECK-NEXT: rev x8, x8
818 ; CHECK-NEXT: rev x9, x9
819 ; CHECK-NEXT: cmp x8, x9
820 ; CHECK-NEXT: b.ne .LBB43_3
821 ; CHECK-NEXT: // %bb.1: // %loadbb1
822 ; CHECK-NEXT: ldr x8, [x0, #8]
823 ; CHECK-NEXT: ldr x9, [x1, #8]
824 ; CHECK-NEXT: rev x8, x8
825 ; CHECK-NEXT: rev x9, x9
826 ; CHECK-NEXT: cmp x8, x9
827 ; CHECK-NEXT: b.ne .LBB43_3
828 ; CHECK-NEXT: // %bb.2:
829 ; CHECK-NEXT: mov w0, wzr
831 ; CHECK-NEXT: .LBB43_3: // %res_block
832 ; CHECK-NEXT: cmp x8, x9
833 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
834 ; CHECK-NEXT: cneg w0, w8, hs
836 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 16) nounwind
840 define i1 @length16_eq(ptr %x, ptr %y) nounwind {
841 ; CHECK-LABEL: length16_eq:
843 ; CHECK-NEXT: ldp x8, x11, [x1]
844 ; CHECK-NEXT: ldp x9, x10, [x0]
845 ; CHECK-NEXT: cmp x9, x8
846 ; CHECK-NEXT: ccmp x10, x11, #0, eq
847 ; CHECK-NEXT: cset w0, ne
849 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 16) nounwind
850 %cmp = icmp ne i32 %call, 0
854 define i1 @length16_lt(ptr %x, ptr %y) nounwind {
855 ; CHECK-LABEL: length16_lt:
857 ; CHECK-NEXT: ldr x8, [x0]
858 ; CHECK-NEXT: ldr x9, [x1]
859 ; CHECK-NEXT: rev x8, x8
860 ; CHECK-NEXT: rev x9, x9
861 ; CHECK-NEXT: cmp x8, x9
862 ; CHECK-NEXT: b.ne .LBB45_3
863 ; CHECK-NEXT: // %bb.1: // %loadbb1
864 ; CHECK-NEXT: ldr x8, [x0, #8]
865 ; CHECK-NEXT: ldr x9, [x1, #8]
866 ; CHECK-NEXT: rev x8, x8
867 ; CHECK-NEXT: rev x9, x9
868 ; CHECK-NEXT: cmp x8, x9
869 ; CHECK-NEXT: b.ne .LBB45_3
870 ; CHECK-NEXT: // %bb.2:
871 ; CHECK-NEXT: lsr w0, wzr, #31
873 ; CHECK-NEXT: .LBB45_3: // %res_block
874 ; CHECK-NEXT: cmp x8, x9
875 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
876 ; CHECK-NEXT: cneg w8, w8, hs
877 ; CHECK-NEXT: lsr w0, w8, #31
879 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 16) nounwind
880 %cmp = icmp slt i32 %call, 0
884 define i1 @length16_gt(ptr %x, ptr %y) nounwind {
885 ; CHECK-LABEL: length16_gt:
887 ; CHECK-NEXT: ldr x8, [x0]
888 ; CHECK-NEXT: ldr x9, [x1]
889 ; CHECK-NEXT: rev x8, x8
890 ; CHECK-NEXT: rev x9, x9
891 ; CHECK-NEXT: cmp x8, x9
892 ; CHECK-NEXT: b.ne .LBB46_3
893 ; CHECK-NEXT: // %bb.1: // %loadbb1
894 ; CHECK-NEXT: ldr x8, [x0, #8]
895 ; CHECK-NEXT: ldr x9, [x1, #8]
896 ; CHECK-NEXT: rev x8, x8
897 ; CHECK-NEXT: rev x9, x9
898 ; CHECK-NEXT: cmp x8, x9
899 ; CHECK-NEXT: b.ne .LBB46_3
900 ; CHECK-NEXT: // %bb.2:
901 ; CHECK-NEXT: mov w8, wzr
902 ; CHECK-NEXT: b .LBB46_4
903 ; CHECK-NEXT: .LBB46_3: // %res_block
904 ; CHECK-NEXT: cmp x8, x9
905 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
906 ; CHECK-NEXT: cneg w8, w8, hs
907 ; CHECK-NEXT: .LBB46_4: // %endblock
908 ; CHECK-NEXT: cmp w8, #0
909 ; CHECK-NEXT: cset w0, gt
911 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 16) nounwind
912 %cmp = icmp sgt i32 %call, 0
916 define i1 @length16_eq_const(ptr %X) nounwind {
917 ; CHECK-LABEL: length16_eq_const:
919 ; CHECK-NEXT: mov x8, #12592 // =0x3130
920 ; CHECK-NEXT: ldp x9, x10, [x0]
921 ; CHECK-NEXT: movk x8, #13106, lsl #16
922 ; CHECK-NEXT: movk x8, #13620, lsl #32
923 ; CHECK-NEXT: movk x8, #14134, lsl #48
924 ; CHECK-NEXT: cmp x9, x8
925 ; CHECK-NEXT: mov x8, #14648 // =0x3938
926 ; CHECK-NEXT: movk x8, #12592, lsl #16
927 ; CHECK-NEXT: movk x8, #13106, lsl #32
928 ; CHECK-NEXT: movk x8, #13620, lsl #48
929 ; CHECK-NEXT: ccmp x10, x8, #0, eq
930 ; CHECK-NEXT: cset w0, eq
932 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 16) nounwind
933 %c = icmp eq i32 %m, 0
938 define i32 @length24(ptr %X, ptr %Y) nounwind {
939 ; CHECK-LABEL: length24:
941 ; CHECK-NEXT: ldr x8, [x0]
942 ; CHECK-NEXT: ldr x9, [x1]
943 ; CHECK-NEXT: rev x8, x8
944 ; CHECK-NEXT: rev x9, x9
945 ; CHECK-NEXT: cmp x8, x9
946 ; CHECK-NEXT: b.ne .LBB48_4
947 ; CHECK-NEXT: // %bb.1: // %loadbb1
948 ; CHECK-NEXT: ldr x8, [x0, #8]
949 ; CHECK-NEXT: ldr x9, [x1, #8]
950 ; CHECK-NEXT: rev x8, x8
951 ; CHECK-NEXT: rev x9, x9
952 ; CHECK-NEXT: cmp x8, x9
953 ; CHECK-NEXT: b.ne .LBB48_4
954 ; CHECK-NEXT: // %bb.2: // %loadbb2
955 ; CHECK-NEXT: ldr x8, [x0, #16]
956 ; CHECK-NEXT: ldr x9, [x1, #16]
957 ; CHECK-NEXT: rev x8, x8
958 ; CHECK-NEXT: rev x9, x9
959 ; CHECK-NEXT: cmp x8, x9
960 ; CHECK-NEXT: b.ne .LBB48_4
961 ; CHECK-NEXT: // %bb.3:
962 ; CHECK-NEXT: mov w0, wzr
964 ; CHECK-NEXT: .LBB48_4: // %res_block
965 ; CHECK-NEXT: cmp x8, x9
966 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
967 ; CHECK-NEXT: cneg w0, w8, hs
969 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 24) nounwind
973 define i1 @length24_eq(ptr %x, ptr %y) nounwind {
974 ; CHECK-LABEL: length24_eq:
976 ; CHECK-NEXT: ldp x8, x11, [x1]
977 ; CHECK-NEXT: ldr x12, [x0, #16]
978 ; CHECK-NEXT: ldp x9, x10, [x0]
979 ; CHECK-NEXT: ldr x13, [x1, #16]
980 ; CHECK-NEXT: cmp x9, x8
981 ; CHECK-NEXT: ccmp x10, x11, #0, eq
982 ; CHECK-NEXT: ccmp x12, x13, #0, eq
983 ; CHECK-NEXT: cset w0, eq
985 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 24) nounwind
986 %cmp = icmp eq i32 %call, 0
990 define i1 @length24_lt(ptr %x, ptr %y) nounwind {
991 ; CHECK-LABEL: length24_lt:
993 ; CHECK-NEXT: ldr x8, [x0]
994 ; CHECK-NEXT: ldr x9, [x1]
995 ; CHECK-NEXT: rev x8, x8
996 ; CHECK-NEXT: rev x9, x9
997 ; CHECK-NEXT: cmp x8, x9
998 ; CHECK-NEXT: b.ne .LBB50_4
999 ; CHECK-NEXT: // %bb.1: // %loadbb1
1000 ; CHECK-NEXT: ldr x8, [x0, #8]
1001 ; CHECK-NEXT: ldr x9, [x1, #8]
1002 ; CHECK-NEXT: rev x8, x8
1003 ; CHECK-NEXT: rev x9, x9
1004 ; CHECK-NEXT: cmp x8, x9
1005 ; CHECK-NEXT: b.ne .LBB50_4
1006 ; CHECK-NEXT: // %bb.2: // %loadbb2
1007 ; CHECK-NEXT: ldr x8, [x0, #16]
1008 ; CHECK-NEXT: ldr x9, [x1, #16]
1009 ; CHECK-NEXT: rev x8, x8
1010 ; CHECK-NEXT: rev x9, x9
1011 ; CHECK-NEXT: cmp x8, x9
1012 ; CHECK-NEXT: b.ne .LBB50_4
1013 ; CHECK-NEXT: // %bb.3:
1014 ; CHECK-NEXT: lsr w0, wzr, #31
1016 ; CHECK-NEXT: .LBB50_4: // %res_block
1017 ; CHECK-NEXT: cmp x8, x9
1018 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1019 ; CHECK-NEXT: cneg w8, w8, hs
1020 ; CHECK-NEXT: lsr w0, w8, #31
1022 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 24) nounwind
1023 %cmp = icmp slt i32 %call, 0
1027 define i1 @length24_gt(ptr %x, ptr %y) nounwind {
1028 ; CHECK-LABEL: length24_gt:
1030 ; CHECK-NEXT: ldr x8, [x0]
1031 ; CHECK-NEXT: ldr x9, [x1]
1032 ; CHECK-NEXT: rev x8, x8
1033 ; CHECK-NEXT: rev x9, x9
1034 ; CHECK-NEXT: cmp x8, x9
1035 ; CHECK-NEXT: b.ne .LBB51_4
1036 ; CHECK-NEXT: // %bb.1: // %loadbb1
1037 ; CHECK-NEXT: ldr x8, [x0, #8]
1038 ; CHECK-NEXT: ldr x9, [x1, #8]
1039 ; CHECK-NEXT: rev x8, x8
1040 ; CHECK-NEXT: rev x9, x9
1041 ; CHECK-NEXT: cmp x8, x9
1042 ; CHECK-NEXT: b.ne .LBB51_4
1043 ; CHECK-NEXT: // %bb.2: // %loadbb2
1044 ; CHECK-NEXT: ldr x8, [x0, #16]
1045 ; CHECK-NEXT: ldr x9, [x1, #16]
1046 ; CHECK-NEXT: rev x8, x8
1047 ; CHECK-NEXT: rev x9, x9
1048 ; CHECK-NEXT: cmp x8, x9
1049 ; CHECK-NEXT: b.ne .LBB51_4
1050 ; CHECK-NEXT: // %bb.3:
1051 ; CHECK-NEXT: mov w8, wzr
1052 ; CHECK-NEXT: b .LBB51_5
1053 ; CHECK-NEXT: .LBB51_4: // %res_block
1054 ; CHECK-NEXT: cmp x8, x9
1055 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1056 ; CHECK-NEXT: cneg w8, w8, hs
1057 ; CHECK-NEXT: .LBB51_5: // %endblock
1058 ; CHECK-NEXT: cmp w8, #0
1059 ; CHECK-NEXT: cset w0, gt
1061 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 24) nounwind
1062 %cmp = icmp sgt i32 %call, 0
1066 define i1 @length24_eq_const(ptr %X) nounwind {
1067 ; CHECK-LABEL: length24_eq_const:
1069 ; CHECK-NEXT: mov x8, #12592 // =0x3130
1070 ; CHECK-NEXT: ldp x9, x10, [x0]
1071 ; CHECK-NEXT: movk x8, #13106, lsl #16
1072 ; CHECK-NEXT: ldr x11, [x0, #16]
1073 ; CHECK-NEXT: movk x8, #13620, lsl #32
1074 ; CHECK-NEXT: movk x8, #14134, lsl #48
1075 ; CHECK-NEXT: cmp x9, x8
1076 ; CHECK-NEXT: mov x8, #14648 // =0x3938
1077 ; CHECK-NEXT: movk x8, #12592, lsl #16
1078 ; CHECK-NEXT: movk x8, #13106, lsl #32
1079 ; CHECK-NEXT: movk x8, #13620, lsl #48
1080 ; CHECK-NEXT: ccmp x10, x8, #0, eq
1081 ; CHECK-NEXT: mov x8, #14134 // =0x3736
1082 ; CHECK-NEXT: movk x8, #14648, lsl #16
1083 ; CHECK-NEXT: movk x8, #12592, lsl #32
1084 ; CHECK-NEXT: movk x8, #13106, lsl #48
1085 ; CHECK-NEXT: ccmp x11, x8, #0, eq
1086 ; CHECK-NEXT: cset w0, ne
1088 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 24) nounwind
1089 %c = icmp ne i32 %m, 0
1093 define i32 @length31(ptr %X, ptr %Y) nounwind {
1094 ; CHECK-LABEL: length31:
1096 ; CHECK-NEXT: ldr x8, [x0]
1097 ; CHECK-NEXT: ldr x9, [x1]
1098 ; CHECK-NEXT: rev x8, x8
1099 ; CHECK-NEXT: rev x9, x9
1100 ; CHECK-NEXT: cmp x8, x9
1101 ; CHECK-NEXT: b.ne .LBB53_5
1102 ; CHECK-NEXT: // %bb.1: // %loadbb1
1103 ; CHECK-NEXT: ldr x8, [x0, #8]
1104 ; CHECK-NEXT: ldr x9, [x1, #8]
1105 ; CHECK-NEXT: rev x8, x8
1106 ; CHECK-NEXT: rev x9, x9
1107 ; CHECK-NEXT: cmp x8, x9
1108 ; CHECK-NEXT: b.ne .LBB53_5
1109 ; CHECK-NEXT: // %bb.2: // %loadbb2
1110 ; CHECK-NEXT: ldr x8, [x0, #16]
1111 ; CHECK-NEXT: ldr x9, [x1, #16]
1112 ; CHECK-NEXT: rev x8, x8
1113 ; CHECK-NEXT: rev x9, x9
1114 ; CHECK-NEXT: cmp x8, x9
1115 ; CHECK-NEXT: b.ne .LBB53_5
1116 ; CHECK-NEXT: // %bb.3: // %loadbb3
1117 ; CHECK-NEXT: ldur x8, [x0, #23]
1118 ; CHECK-NEXT: ldur x9, [x1, #23]
1119 ; CHECK-NEXT: rev x8, x8
1120 ; CHECK-NEXT: rev x9, x9
1121 ; CHECK-NEXT: cmp x8, x9
1122 ; CHECK-NEXT: b.ne .LBB53_5
1123 ; CHECK-NEXT: // %bb.4:
1124 ; CHECK-NEXT: mov w0, wzr
1126 ; CHECK-NEXT: .LBB53_5: // %res_block
1127 ; CHECK-NEXT: cmp x8, x9
1128 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1129 ; CHECK-NEXT: cneg w0, w8, hs
1131 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 31) nounwind
1135 define i1 @length31_eq(ptr %x, ptr %y) nounwind {
1136 ; CHECK-LABEL: length31_eq:
1138 ; CHECK-NEXT: ldp x8, x11, [x1]
1139 ; CHECK-NEXT: ldr x12, [x0, #16]
1140 ; CHECK-NEXT: ldp x9, x10, [x0]
1141 ; CHECK-NEXT: ldr x13, [x1, #16]
1142 ; CHECK-NEXT: cmp x9, x8
1143 ; CHECK-NEXT: ldur x8, [x0, #23]
1144 ; CHECK-NEXT: ldur x9, [x1, #23]
1145 ; CHECK-NEXT: ccmp x10, x11, #0, eq
1146 ; CHECK-NEXT: ccmp x12, x13, #0, eq
1147 ; CHECK-NEXT: ccmp x8, x9, #0, eq
1148 ; CHECK-NEXT: cset w0, eq
1150 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 31) nounwind
1151 %cmp = icmp eq i32 %call, 0
1155 define i1 @length31_lt(ptr %x, ptr %y) nounwind {
1156 ; CHECK-LABEL: length31_lt:
1158 ; CHECK-NEXT: ldr x8, [x0]
1159 ; CHECK-NEXT: ldr x9, [x1]
1160 ; CHECK-NEXT: rev x8, x8
1161 ; CHECK-NEXT: rev x9, x9
1162 ; CHECK-NEXT: cmp x8, x9
1163 ; CHECK-NEXT: b.ne .LBB55_5
1164 ; CHECK-NEXT: // %bb.1: // %loadbb1
1165 ; CHECK-NEXT: ldr x8, [x0, #8]
1166 ; CHECK-NEXT: ldr x9, [x1, #8]
1167 ; CHECK-NEXT: rev x8, x8
1168 ; CHECK-NEXT: rev x9, x9
1169 ; CHECK-NEXT: cmp x8, x9
1170 ; CHECK-NEXT: b.ne .LBB55_5
1171 ; CHECK-NEXT: // %bb.2: // %loadbb2
1172 ; CHECK-NEXT: ldr x8, [x0, #16]
1173 ; CHECK-NEXT: ldr x9, [x1, #16]
1174 ; CHECK-NEXT: rev x8, x8
1175 ; CHECK-NEXT: rev x9, x9
1176 ; CHECK-NEXT: cmp x8, x9
1177 ; CHECK-NEXT: b.ne .LBB55_5
1178 ; CHECK-NEXT: // %bb.3: // %loadbb3
1179 ; CHECK-NEXT: ldur x8, [x0, #23]
1180 ; CHECK-NEXT: ldur x9, [x1, #23]
1181 ; CHECK-NEXT: rev x8, x8
1182 ; CHECK-NEXT: rev x9, x9
1183 ; CHECK-NEXT: cmp x8, x9
1184 ; CHECK-NEXT: b.ne .LBB55_5
1185 ; CHECK-NEXT: // %bb.4:
1186 ; CHECK-NEXT: lsr w0, wzr, #31
1188 ; CHECK-NEXT: .LBB55_5: // %res_block
1189 ; CHECK-NEXT: cmp x8, x9
1190 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1191 ; CHECK-NEXT: cneg w8, w8, hs
1192 ; CHECK-NEXT: lsr w0, w8, #31
1194 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 31) nounwind
1195 %cmp = icmp slt i32 %call, 0
1199 define i1 @length31_gt(ptr %x, ptr %y) nounwind {
1200 ; CHECK-LABEL: length31_gt:
1202 ; CHECK-NEXT: ldr x8, [x0]
1203 ; CHECK-NEXT: ldr x9, [x1]
1204 ; CHECK-NEXT: rev x8, x8
1205 ; CHECK-NEXT: rev x9, x9
1206 ; CHECK-NEXT: cmp x8, x9
1207 ; CHECK-NEXT: b.ne .LBB56_5
1208 ; CHECK-NEXT: // %bb.1: // %loadbb1
1209 ; CHECK-NEXT: ldr x8, [x0, #8]
1210 ; CHECK-NEXT: ldr x9, [x1, #8]
1211 ; CHECK-NEXT: rev x8, x8
1212 ; CHECK-NEXT: rev x9, x9
1213 ; CHECK-NEXT: cmp x8, x9
1214 ; CHECK-NEXT: b.ne .LBB56_5
1215 ; CHECK-NEXT: // %bb.2: // %loadbb2
1216 ; CHECK-NEXT: ldr x8, [x0, #16]
1217 ; CHECK-NEXT: ldr x9, [x1, #16]
1218 ; CHECK-NEXT: rev x8, x8
1219 ; CHECK-NEXT: rev x9, x9
1220 ; CHECK-NEXT: cmp x8, x9
1221 ; CHECK-NEXT: b.ne .LBB56_5
1222 ; CHECK-NEXT: // %bb.3: // %loadbb3
1223 ; CHECK-NEXT: ldur x8, [x0, #23]
1224 ; CHECK-NEXT: ldur x9, [x1, #23]
1225 ; CHECK-NEXT: rev x8, x8
1226 ; CHECK-NEXT: rev x9, x9
1227 ; CHECK-NEXT: cmp x8, x9
1228 ; CHECK-NEXT: b.ne .LBB56_5
1229 ; CHECK-NEXT: // %bb.4:
1230 ; CHECK-NEXT: mov w8, wzr
1231 ; CHECK-NEXT: b .LBB56_6
1232 ; CHECK-NEXT: .LBB56_5: // %res_block
1233 ; CHECK-NEXT: cmp x8, x9
1234 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1235 ; CHECK-NEXT: cneg w8, w8, hs
1236 ; CHECK-NEXT: .LBB56_6: // %endblock
1237 ; CHECK-NEXT: cmp w8, #0
1238 ; CHECK-NEXT: cset w0, gt
1240 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 31) nounwind
1241 %cmp = icmp sgt i32 %call, 0
1245 define i1 @length31_eq_prefer128(ptr %x, ptr %y) nounwind "prefer-vector-width"="128" {
1246 ; CHECK-LABEL: length31_eq_prefer128:
1248 ; CHECK-NEXT: ldp x8, x11, [x1]
1249 ; CHECK-NEXT: ldr x12, [x0, #16]
1250 ; CHECK-NEXT: ldp x9, x10, [x0]
1251 ; CHECK-NEXT: ldr x13, [x1, #16]
1252 ; CHECK-NEXT: cmp x9, x8
1253 ; CHECK-NEXT: ldur x8, [x0, #23]
1254 ; CHECK-NEXT: ldur x9, [x1, #23]
1255 ; CHECK-NEXT: ccmp x10, x11, #0, eq
1256 ; CHECK-NEXT: ccmp x12, x13, #0, eq
1257 ; CHECK-NEXT: ccmp x8, x9, #0, eq
1258 ; CHECK-NEXT: cset w0, eq
1260 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 31) nounwind
1261 %cmp = icmp eq i32 %call, 0
1265 define i1 @length31_eq_const(ptr %X) nounwind {
1266 ; CHECK-LABEL: length31_eq_const:
1268 ; CHECK-NEXT: mov x8, #12592 // =0x3130
1269 ; CHECK-NEXT: ldp x9, x10, [x0]
1270 ; CHECK-NEXT: movk x8, #13106, lsl #16
1271 ; CHECK-NEXT: ldr x11, [x0, #16]
1272 ; CHECK-NEXT: movk x8, #13620, lsl #32
1273 ; CHECK-NEXT: movk x8, #14134, lsl #48
1274 ; CHECK-NEXT: cmp x9, x8
1275 ; CHECK-NEXT: mov x8, #14648 // =0x3938
1276 ; CHECK-NEXT: ldur x9, [x0, #23]
1277 ; CHECK-NEXT: movk x8, #12592, lsl #16
1278 ; CHECK-NEXT: movk x8, #13106, lsl #32
1279 ; CHECK-NEXT: movk x8, #13620, lsl #48
1280 ; CHECK-NEXT: ccmp x10, x8, #0, eq
1281 ; CHECK-NEXT: mov x8, #14134 // =0x3736
1282 ; CHECK-NEXT: movk x8, #14648, lsl #16
1283 ; CHECK-NEXT: movk x8, #12592, lsl #32
1284 ; CHECK-NEXT: movk x8, #13106, lsl #48
1285 ; CHECK-NEXT: ccmp x11, x8, #0, eq
1286 ; CHECK-NEXT: mov x8, #13363 // =0x3433
1287 ; CHECK-NEXT: movk x8, #13877, lsl #16
1288 ; CHECK-NEXT: movk x8, #14391, lsl #32
1289 ; CHECK-NEXT: movk x8, #12345, lsl #48
1290 ; CHECK-NEXT: ccmp x9, x8, #0, eq
1291 ; CHECK-NEXT: cset w0, ne
1293 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 31) nounwind
1294 %c = icmp ne i32 %m, 0
1298 define i32 @length32(ptr %X, ptr %Y) nounwind {
1299 ; CHECK-LABEL: length32:
1301 ; CHECK-NEXT: ldr x8, [x0]
1302 ; CHECK-NEXT: ldr x9, [x1]
1303 ; CHECK-NEXT: rev x8, x8
1304 ; CHECK-NEXT: rev x9, x9
1305 ; CHECK-NEXT: cmp x8, x9
1306 ; CHECK-NEXT: b.ne .LBB59_5
1307 ; CHECK-NEXT: // %bb.1: // %loadbb1
1308 ; CHECK-NEXT: ldr x8, [x0, #8]
1309 ; CHECK-NEXT: ldr x9, [x1, #8]
1310 ; CHECK-NEXT: rev x8, x8
1311 ; CHECK-NEXT: rev x9, x9
1312 ; CHECK-NEXT: cmp x8, x9
1313 ; CHECK-NEXT: b.ne .LBB59_5
1314 ; CHECK-NEXT: // %bb.2: // %loadbb2
1315 ; CHECK-NEXT: ldr x8, [x0, #16]
1316 ; CHECK-NEXT: ldr x9, [x1, #16]
1317 ; CHECK-NEXT: rev x8, x8
1318 ; CHECK-NEXT: rev x9, x9
1319 ; CHECK-NEXT: cmp x8, x9
1320 ; CHECK-NEXT: b.ne .LBB59_5
1321 ; CHECK-NEXT: // %bb.3: // %loadbb3
1322 ; CHECK-NEXT: ldr x8, [x0, #24]
1323 ; CHECK-NEXT: ldr x9, [x1, #24]
1324 ; CHECK-NEXT: rev x8, x8
1325 ; CHECK-NEXT: rev x9, x9
1326 ; CHECK-NEXT: cmp x8, x9
1327 ; CHECK-NEXT: b.ne .LBB59_5
1328 ; CHECK-NEXT: // %bb.4:
1329 ; CHECK-NEXT: mov w0, wzr
1331 ; CHECK-NEXT: .LBB59_5: // %res_block
1332 ; CHECK-NEXT: cmp x8, x9
1333 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1334 ; CHECK-NEXT: cneg w0, w8, hs
1336 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 32) nounwind
1341 define i1 @length32_eq(ptr %x, ptr %y) nounwind {
1342 ; CHECK-LABEL: length32_eq:
1344 ; CHECK-NEXT: ldp x8, x11, [x1]
1345 ; CHECK-NEXT: ldp x9, x10, [x0]
1346 ; CHECK-NEXT: ldp x12, x13, [x1, #16]
1347 ; CHECK-NEXT: cmp x9, x8
1348 ; CHECK-NEXT: ldp x8, x9, [x0, #16]
1349 ; CHECK-NEXT: ccmp x10, x11, #0, eq
1350 ; CHECK-NEXT: ccmp x8, x12, #0, eq
1351 ; CHECK-NEXT: ccmp x9, x13, #0, eq
1352 ; CHECK-NEXT: cset w0, eq
1354 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 32) nounwind
1355 %cmp = icmp eq i32 %call, 0
1359 define i1 @length32_lt(ptr %x, ptr %y) nounwind {
1360 ; CHECK-LABEL: length32_lt:
1362 ; CHECK-NEXT: ldr x8, [x0]
1363 ; CHECK-NEXT: ldr x9, [x1]
1364 ; CHECK-NEXT: rev x8, x8
1365 ; CHECK-NEXT: rev x9, x9
1366 ; CHECK-NEXT: cmp x8, x9
1367 ; CHECK-NEXT: b.ne .LBB61_5
1368 ; CHECK-NEXT: // %bb.1: // %loadbb1
1369 ; CHECK-NEXT: ldr x8, [x0, #8]
1370 ; CHECK-NEXT: ldr x9, [x1, #8]
1371 ; CHECK-NEXT: rev x8, x8
1372 ; CHECK-NEXT: rev x9, x9
1373 ; CHECK-NEXT: cmp x8, x9
1374 ; CHECK-NEXT: b.ne .LBB61_5
1375 ; CHECK-NEXT: // %bb.2: // %loadbb2
1376 ; CHECK-NEXT: ldr x8, [x0, #16]
1377 ; CHECK-NEXT: ldr x9, [x1, #16]
1378 ; CHECK-NEXT: rev x8, x8
1379 ; CHECK-NEXT: rev x9, x9
1380 ; CHECK-NEXT: cmp x8, x9
1381 ; CHECK-NEXT: b.ne .LBB61_5
1382 ; CHECK-NEXT: // %bb.3: // %loadbb3
1383 ; CHECK-NEXT: ldr x8, [x0, #24]
1384 ; CHECK-NEXT: ldr x9, [x1, #24]
1385 ; CHECK-NEXT: rev x8, x8
1386 ; CHECK-NEXT: rev x9, x9
1387 ; CHECK-NEXT: cmp x8, x9
1388 ; CHECK-NEXT: b.ne .LBB61_5
1389 ; CHECK-NEXT: // %bb.4:
1390 ; CHECK-NEXT: lsr w0, wzr, #31
1392 ; CHECK-NEXT: .LBB61_5: // %res_block
1393 ; CHECK-NEXT: cmp x8, x9
1394 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1395 ; CHECK-NEXT: cneg w8, w8, hs
1396 ; CHECK-NEXT: lsr w0, w8, #31
1398 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 32) nounwind
1399 %cmp = icmp slt i32 %call, 0
1403 define i1 @length32_gt(ptr %x, ptr %y) nounwind {
1404 ; CHECK-LABEL: length32_gt:
1406 ; CHECK-NEXT: ldr x8, [x0]
1407 ; CHECK-NEXT: ldr x9, [x1]
1408 ; CHECK-NEXT: rev x8, x8
1409 ; CHECK-NEXT: rev x9, x9
1410 ; CHECK-NEXT: cmp x8, x9
1411 ; CHECK-NEXT: b.ne .LBB62_5
1412 ; CHECK-NEXT: // %bb.1: // %loadbb1
1413 ; CHECK-NEXT: ldr x8, [x0, #8]
1414 ; CHECK-NEXT: ldr x9, [x1, #8]
1415 ; CHECK-NEXT: rev x8, x8
1416 ; CHECK-NEXT: rev x9, x9
1417 ; CHECK-NEXT: cmp x8, x9
1418 ; CHECK-NEXT: b.ne .LBB62_5
1419 ; CHECK-NEXT: // %bb.2: // %loadbb2
1420 ; CHECK-NEXT: ldr x8, [x0, #16]
1421 ; CHECK-NEXT: ldr x9, [x1, #16]
1422 ; CHECK-NEXT: rev x8, x8
1423 ; CHECK-NEXT: rev x9, x9
1424 ; CHECK-NEXT: cmp x8, x9
1425 ; CHECK-NEXT: b.ne .LBB62_5
1426 ; CHECK-NEXT: // %bb.3: // %loadbb3
1427 ; CHECK-NEXT: ldr x8, [x0, #24]
1428 ; CHECK-NEXT: ldr x9, [x1, #24]
1429 ; CHECK-NEXT: rev x8, x8
1430 ; CHECK-NEXT: rev x9, x9
1431 ; CHECK-NEXT: cmp x8, x9
1432 ; CHECK-NEXT: b.ne .LBB62_5
1433 ; CHECK-NEXT: // %bb.4:
1434 ; CHECK-NEXT: mov w8, wzr
1435 ; CHECK-NEXT: b .LBB62_6
1436 ; CHECK-NEXT: .LBB62_5: // %res_block
1437 ; CHECK-NEXT: cmp x8, x9
1438 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1439 ; CHECK-NEXT: cneg w8, w8, hs
1440 ; CHECK-NEXT: .LBB62_6: // %endblock
1441 ; CHECK-NEXT: cmp w8, #0
1442 ; CHECK-NEXT: cset w0, gt
1444 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 32) nounwind
1445 %cmp = icmp sgt i32 %call, 0
1449 define i1 @length32_eq_prefer128(ptr %x, ptr %y) nounwind "prefer-vector-width"="128" {
1450 ; CHECK-LABEL: length32_eq_prefer128:
1452 ; CHECK-NEXT: ldp x8, x11, [x1]
1453 ; CHECK-NEXT: ldp x9, x10, [x0]
1454 ; CHECK-NEXT: ldp x12, x13, [x1, #16]
1455 ; CHECK-NEXT: cmp x9, x8
1456 ; CHECK-NEXT: ldp x8, x9, [x0, #16]
1457 ; CHECK-NEXT: ccmp x10, x11, #0, eq
1458 ; CHECK-NEXT: ccmp x8, x12, #0, eq
1459 ; CHECK-NEXT: ccmp x9, x13, #0, eq
1460 ; CHECK-NEXT: cset w0, eq
1462 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 32) nounwind
1463 %cmp = icmp eq i32 %call, 0
1467 define i1 @length32_eq_const(ptr %X) nounwind {
1468 ; CHECK-LABEL: length32_eq_const:
1470 ; CHECK-NEXT: mov x8, #12592 // =0x3130
1471 ; CHECK-NEXT: ldp x9, x10, [x0]
1472 ; CHECK-NEXT: movk x8, #13106, lsl #16
1473 ; CHECK-NEXT: movk x8, #13620, lsl #32
1474 ; CHECK-NEXT: movk x8, #14134, lsl #48
1475 ; CHECK-NEXT: cmp x9, x8
1476 ; CHECK-NEXT: mov x8, #14648 // =0x3938
1477 ; CHECK-NEXT: movk x8, #12592, lsl #16
1478 ; CHECK-NEXT: ldp x9, x11, [x0, #16]
1479 ; CHECK-NEXT: movk x8, #13106, lsl #32
1480 ; CHECK-NEXT: movk x8, #13620, lsl #48
1481 ; CHECK-NEXT: ccmp x10, x8, #0, eq
1482 ; CHECK-NEXT: mov x8, #14134 // =0x3736
1483 ; CHECK-NEXT: movk x8, #14648, lsl #16
1484 ; CHECK-NEXT: movk x8, #12592, lsl #32
1485 ; CHECK-NEXT: movk x8, #13106, lsl #48
1486 ; CHECK-NEXT: ccmp x9, x8, #0, eq
1487 ; CHECK-NEXT: mov x8, #13620 // =0x3534
1488 ; CHECK-NEXT: movk x8, #14134, lsl #16
1489 ; CHECK-NEXT: movk x8, #14648, lsl #32
1490 ; CHECK-NEXT: movk x8, #12592, lsl #48
1491 ; CHECK-NEXT: ccmp x11, x8, #0, eq
1492 ; CHECK-NEXT: cset w0, ne
1494 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 32) nounwind
1495 %c = icmp ne i32 %m, 0
1499 define i32 @length48(ptr %X, ptr %Y) nounwind {
1500 ; CHECK-LABEL: length48:
1502 ; CHECK-NEXT: ldr x8, [x0]
1503 ; CHECK-NEXT: ldr x9, [x1]
1504 ; CHECK-NEXT: rev x8, x8
1505 ; CHECK-NEXT: rev x9, x9
1506 ; CHECK-NEXT: cmp x8, x9
1507 ; CHECK-NEXT: b.ne .LBB65_7
1508 ; CHECK-NEXT: // %bb.1: // %loadbb1
1509 ; CHECK-NEXT: ldr x8, [x0, #8]
1510 ; CHECK-NEXT: ldr x9, [x1, #8]
1511 ; CHECK-NEXT: rev x8, x8
1512 ; CHECK-NEXT: rev x9, x9
1513 ; CHECK-NEXT: cmp x8, x9
1514 ; CHECK-NEXT: b.ne .LBB65_7
1515 ; CHECK-NEXT: // %bb.2: // %loadbb2
1516 ; CHECK-NEXT: ldr x8, [x0, #16]
1517 ; CHECK-NEXT: ldr x9, [x1, #16]
1518 ; CHECK-NEXT: rev x8, x8
1519 ; CHECK-NEXT: rev x9, x9
1520 ; CHECK-NEXT: cmp x8, x9
1521 ; CHECK-NEXT: b.ne .LBB65_7
1522 ; CHECK-NEXT: // %bb.3: // %loadbb3
1523 ; CHECK-NEXT: ldr x8, [x0, #24]
1524 ; CHECK-NEXT: ldr x9, [x1, #24]
1525 ; CHECK-NEXT: rev x8, x8
1526 ; CHECK-NEXT: rev x9, x9
1527 ; CHECK-NEXT: cmp x8, x9
1528 ; CHECK-NEXT: b.ne .LBB65_7
1529 ; CHECK-NEXT: // %bb.4: // %loadbb4
1530 ; CHECK-NEXT: ldr x8, [x0, #32]
1531 ; CHECK-NEXT: ldr x9, [x1, #32]
1532 ; CHECK-NEXT: rev x8, x8
1533 ; CHECK-NEXT: rev x9, x9
1534 ; CHECK-NEXT: cmp x8, x9
1535 ; CHECK-NEXT: b.ne .LBB65_7
1536 ; CHECK-NEXT: // %bb.5: // %loadbb5
1537 ; CHECK-NEXT: ldr x8, [x0, #40]
1538 ; CHECK-NEXT: ldr x9, [x1, #40]
1539 ; CHECK-NEXT: rev x8, x8
1540 ; CHECK-NEXT: rev x9, x9
1541 ; CHECK-NEXT: cmp x8, x9
1542 ; CHECK-NEXT: b.ne .LBB65_7
1543 ; CHECK-NEXT: // %bb.6:
1544 ; CHECK-NEXT: mov w0, wzr
1546 ; CHECK-NEXT: .LBB65_7: // %res_block
1547 ; CHECK-NEXT: cmp x8, x9
1548 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1549 ; CHECK-NEXT: cneg w0, w8, hs
1551 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 48) nounwind
1555 define i1 @length48_eq(ptr %x, ptr %y) nounwind {
1556 ; CHECK-LABEL: length48_eq:
1558 ; CHECK-NEXT: ldp x8, x11, [x1]
1559 ; CHECK-NEXT: ldp x9, x10, [x0]
1560 ; CHECK-NEXT: ldp x12, x13, [x1, #16]
1561 ; CHECK-NEXT: cmp x9, x8
1562 ; CHECK-NEXT: ldp x8, x9, [x0, #16]
1563 ; CHECK-NEXT: ccmp x10, x11, #0, eq
1564 ; CHECK-NEXT: ccmp x8, x12, #0, eq
1565 ; CHECK-NEXT: ldp x8, x11, [x0, #32]
1566 ; CHECK-NEXT: ldp x10, x12, [x1, #32]
1567 ; CHECK-NEXT: ccmp x9, x13, #0, eq
1568 ; CHECK-NEXT: ccmp x8, x10, #0, eq
1569 ; CHECK-NEXT: ccmp x11, x12, #0, eq
1570 ; CHECK-NEXT: cset w0, eq
1572 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 48) nounwind
1573 %cmp = icmp eq i32 %call, 0
1577 define i1 @length48_lt(ptr %x, ptr %y) nounwind {
1578 ; CHECK-LABEL: length48_lt:
1580 ; CHECK-NEXT: ldr x8, [x0]
1581 ; CHECK-NEXT: ldr x9, [x1]
1582 ; CHECK-NEXT: rev x8, x8
1583 ; CHECK-NEXT: rev x9, x9
1584 ; CHECK-NEXT: cmp x8, x9
1585 ; CHECK-NEXT: b.ne .LBB67_7
1586 ; CHECK-NEXT: // %bb.1: // %loadbb1
1587 ; CHECK-NEXT: ldr x8, [x0, #8]
1588 ; CHECK-NEXT: ldr x9, [x1, #8]
1589 ; CHECK-NEXT: rev x8, x8
1590 ; CHECK-NEXT: rev x9, x9
1591 ; CHECK-NEXT: cmp x8, x9
1592 ; CHECK-NEXT: b.ne .LBB67_7
1593 ; CHECK-NEXT: // %bb.2: // %loadbb2
1594 ; CHECK-NEXT: ldr x8, [x0, #16]
1595 ; CHECK-NEXT: ldr x9, [x1, #16]
1596 ; CHECK-NEXT: rev x8, x8
1597 ; CHECK-NEXT: rev x9, x9
1598 ; CHECK-NEXT: cmp x8, x9
1599 ; CHECK-NEXT: b.ne .LBB67_7
1600 ; CHECK-NEXT: // %bb.3: // %loadbb3
1601 ; CHECK-NEXT: ldr x8, [x0, #24]
1602 ; CHECK-NEXT: ldr x9, [x1, #24]
1603 ; CHECK-NEXT: rev x8, x8
1604 ; CHECK-NEXT: rev x9, x9
1605 ; CHECK-NEXT: cmp x8, x9
1606 ; CHECK-NEXT: b.ne .LBB67_7
1607 ; CHECK-NEXT: // %bb.4: // %loadbb4
1608 ; CHECK-NEXT: ldr x8, [x0, #32]
1609 ; CHECK-NEXT: ldr x9, [x1, #32]
1610 ; CHECK-NEXT: rev x8, x8
1611 ; CHECK-NEXT: rev x9, x9
1612 ; CHECK-NEXT: cmp x8, x9
1613 ; CHECK-NEXT: b.ne .LBB67_7
1614 ; CHECK-NEXT: // %bb.5: // %loadbb5
1615 ; CHECK-NEXT: ldr x8, [x0, #40]
1616 ; CHECK-NEXT: ldr x9, [x1, #40]
1617 ; CHECK-NEXT: rev x8, x8
1618 ; CHECK-NEXT: rev x9, x9
1619 ; CHECK-NEXT: cmp x8, x9
1620 ; CHECK-NEXT: b.ne .LBB67_7
1621 ; CHECK-NEXT: // %bb.6:
1622 ; CHECK-NEXT: lsr w0, wzr, #31
1624 ; CHECK-NEXT: .LBB67_7: // %res_block
1625 ; CHECK-NEXT: cmp x8, x9
1626 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1627 ; CHECK-NEXT: cneg w8, w8, hs
1628 ; CHECK-NEXT: lsr w0, w8, #31
1630 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 48) nounwind
1631 %cmp = icmp slt i32 %call, 0
1635 define i1 @length48_gt(ptr %x, ptr %y) nounwind {
1636 ; CHECK-LABEL: length48_gt:
1638 ; CHECK-NEXT: ldr x8, [x0]
1639 ; CHECK-NEXT: ldr x9, [x1]
1640 ; CHECK-NEXT: rev x8, x8
1641 ; CHECK-NEXT: rev x9, x9
1642 ; CHECK-NEXT: cmp x8, x9
1643 ; CHECK-NEXT: b.ne .LBB68_7
1644 ; CHECK-NEXT: // %bb.1: // %loadbb1
1645 ; CHECK-NEXT: ldr x8, [x0, #8]
1646 ; CHECK-NEXT: ldr x9, [x1, #8]
1647 ; CHECK-NEXT: rev x8, x8
1648 ; CHECK-NEXT: rev x9, x9
1649 ; CHECK-NEXT: cmp x8, x9
1650 ; CHECK-NEXT: b.ne .LBB68_7
1651 ; CHECK-NEXT: // %bb.2: // %loadbb2
1652 ; CHECK-NEXT: ldr x8, [x0, #16]
1653 ; CHECK-NEXT: ldr x9, [x1, #16]
1654 ; CHECK-NEXT: rev x8, x8
1655 ; CHECK-NEXT: rev x9, x9
1656 ; CHECK-NEXT: cmp x8, x9
1657 ; CHECK-NEXT: b.ne .LBB68_7
1658 ; CHECK-NEXT: // %bb.3: // %loadbb3
1659 ; CHECK-NEXT: ldr x8, [x0, #24]
1660 ; CHECK-NEXT: ldr x9, [x1, #24]
1661 ; CHECK-NEXT: rev x8, x8
1662 ; CHECK-NEXT: rev x9, x9
1663 ; CHECK-NEXT: cmp x8, x9
1664 ; CHECK-NEXT: b.ne .LBB68_7
1665 ; CHECK-NEXT: // %bb.4: // %loadbb4
1666 ; CHECK-NEXT: ldr x8, [x0, #32]
1667 ; CHECK-NEXT: ldr x9, [x1, #32]
1668 ; CHECK-NEXT: rev x8, x8
1669 ; CHECK-NEXT: rev x9, x9
1670 ; CHECK-NEXT: cmp x8, x9
1671 ; CHECK-NEXT: b.ne .LBB68_7
1672 ; CHECK-NEXT: // %bb.5: // %loadbb5
1673 ; CHECK-NEXT: ldr x8, [x0, #40]
1674 ; CHECK-NEXT: ldr x9, [x1, #40]
1675 ; CHECK-NEXT: rev x8, x8
1676 ; CHECK-NEXT: rev x9, x9
1677 ; CHECK-NEXT: cmp x8, x9
1678 ; CHECK-NEXT: b.ne .LBB68_7
1679 ; CHECK-NEXT: // %bb.6:
1680 ; CHECK-NEXT: mov w8, wzr
1681 ; CHECK-NEXT: b .LBB68_8
1682 ; CHECK-NEXT: .LBB68_7: // %res_block
1683 ; CHECK-NEXT: cmp x8, x9
1684 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1685 ; CHECK-NEXT: cneg w8, w8, hs
1686 ; CHECK-NEXT: .LBB68_8: // %endblock
1687 ; CHECK-NEXT: cmp w8, #0
1688 ; CHECK-NEXT: cset w0, gt
1690 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 48) nounwind
1691 %cmp = icmp sgt i32 %call, 0
1695 define i1 @length48_eq_prefer128(ptr %x, ptr %y) nounwind "prefer-vector-width"="128" {
1696 ; CHECK-LABEL: length48_eq_prefer128:
1698 ; CHECK-NEXT: ldp x8, x11, [x1]
1699 ; CHECK-NEXT: ldp x9, x10, [x0]
1700 ; CHECK-NEXT: ldp x12, x13, [x1, #16]
1701 ; CHECK-NEXT: cmp x9, x8
1702 ; CHECK-NEXT: ldp x8, x9, [x0, #16]
1703 ; CHECK-NEXT: ccmp x10, x11, #0, eq
1704 ; CHECK-NEXT: ccmp x8, x12, #0, eq
1705 ; CHECK-NEXT: ldp x8, x11, [x0, #32]
1706 ; CHECK-NEXT: ldp x10, x12, [x1, #32]
1707 ; CHECK-NEXT: ccmp x9, x13, #0, eq
1708 ; CHECK-NEXT: ccmp x8, x10, #0, eq
1709 ; CHECK-NEXT: ccmp x11, x12, #0, eq
1710 ; CHECK-NEXT: cset w0, eq
1712 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 48) nounwind
1713 %cmp = icmp eq i32 %call, 0
1717 define i1 @length48_eq_const(ptr %X) nounwind {
1718 ; CHECK-LABEL: length48_eq_const:
1720 ; CHECK-NEXT: mov x8, #12592 // =0x3130
1721 ; CHECK-NEXT: ldp x9, x10, [x0]
1722 ; CHECK-NEXT: movk x8, #13106, lsl #16
1723 ; CHECK-NEXT: ldp x11, x12, [x0, #16]
1724 ; CHECK-NEXT: movk x8, #13620, lsl #32
1725 ; CHECK-NEXT: movk x8, #14134, lsl #48
1726 ; CHECK-NEXT: cmp x9, x8
1727 ; CHECK-NEXT: mov x9, #14648 // =0x3938
1728 ; CHECK-NEXT: movk x9, #12592, lsl #16
1729 ; CHECK-NEXT: movk x9, #13106, lsl #32
1730 ; CHECK-NEXT: movk x9, #13620, lsl #48
1731 ; CHECK-NEXT: ccmp x10, x9, #0, eq
1732 ; CHECK-NEXT: mov x9, #14134 // =0x3736
1733 ; CHECK-NEXT: movk x9, #14648, lsl #16
1734 ; CHECK-NEXT: movk x9, #12592, lsl #32
1735 ; CHECK-NEXT: movk x9, #13106, lsl #48
1736 ; CHECK-NEXT: ccmp x11, x9, #0, eq
1737 ; CHECK-NEXT: mov x9, #13620 // =0x3534
1738 ; CHECK-NEXT: movk x9, #14134, lsl #16
1739 ; CHECK-NEXT: ldp x10, x11, [x0, #32]
1740 ; CHECK-NEXT: movk x9, #14648, lsl #32
1741 ; CHECK-NEXT: movk x9, #12592, lsl #48
1742 ; CHECK-NEXT: ccmp x12, x9, #0, eq
1743 ; CHECK-NEXT: mov x9, #13106 // =0x3332
1744 ; CHECK-NEXT: movk x9, #13620, lsl #16
1745 ; CHECK-NEXT: movk x9, #14134, lsl #32
1746 ; CHECK-NEXT: movk x9, #14648, lsl #48
1747 ; CHECK-NEXT: ccmp x10, x9, #0, eq
1748 ; CHECK-NEXT: ccmp x11, x8, #0, eq
1749 ; CHECK-NEXT: cset w0, ne
1751 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 48) nounwind
1752 %c = icmp ne i32 %m, 0
1756 define i32 @length63(ptr %X, ptr %Y) nounwind {
1757 ; CHECK-LABEL: length63:
1759 ; CHECK-NEXT: ldr x8, [x0]
1760 ; CHECK-NEXT: ldr x9, [x1]
1761 ; CHECK-NEXT: rev x8, x8
1762 ; CHECK-NEXT: rev x9, x9
1763 ; CHECK-NEXT: cmp x8, x9
1764 ; CHECK-NEXT: b.ne .LBB71_9
1765 ; CHECK-NEXT: // %bb.1: // %loadbb1
1766 ; CHECK-NEXT: ldr x8, [x0, #8]
1767 ; CHECK-NEXT: ldr x9, [x1, #8]
1768 ; CHECK-NEXT: rev x8, x8
1769 ; CHECK-NEXT: rev x9, x9
1770 ; CHECK-NEXT: cmp x8, x9
1771 ; CHECK-NEXT: b.ne .LBB71_9
1772 ; CHECK-NEXT: // %bb.2: // %loadbb2
1773 ; CHECK-NEXT: ldr x8, [x0, #16]
1774 ; CHECK-NEXT: ldr x9, [x1, #16]
1775 ; CHECK-NEXT: rev x8, x8
1776 ; CHECK-NEXT: rev x9, x9
1777 ; CHECK-NEXT: cmp x8, x9
1778 ; CHECK-NEXT: b.ne .LBB71_9
1779 ; CHECK-NEXT: // %bb.3: // %loadbb3
1780 ; CHECK-NEXT: ldr x8, [x0, #24]
1781 ; CHECK-NEXT: ldr x9, [x1, #24]
1782 ; CHECK-NEXT: rev x8, x8
1783 ; CHECK-NEXT: rev x9, x9
1784 ; CHECK-NEXT: cmp x8, x9
1785 ; CHECK-NEXT: b.ne .LBB71_9
1786 ; CHECK-NEXT: // %bb.4: // %loadbb4
1787 ; CHECK-NEXT: ldr x8, [x0, #32]
1788 ; CHECK-NEXT: ldr x9, [x1, #32]
1789 ; CHECK-NEXT: rev x8, x8
1790 ; CHECK-NEXT: rev x9, x9
1791 ; CHECK-NEXT: cmp x8, x9
1792 ; CHECK-NEXT: b.ne .LBB71_9
1793 ; CHECK-NEXT: // %bb.5: // %loadbb5
1794 ; CHECK-NEXT: ldr x8, [x0, #40]
1795 ; CHECK-NEXT: ldr x9, [x1, #40]
1796 ; CHECK-NEXT: rev x8, x8
1797 ; CHECK-NEXT: rev x9, x9
1798 ; CHECK-NEXT: cmp x8, x9
1799 ; CHECK-NEXT: b.ne .LBB71_9
1800 ; CHECK-NEXT: // %bb.6: // %loadbb6
1801 ; CHECK-NEXT: ldr x8, [x0, #48]
1802 ; CHECK-NEXT: ldr x9, [x1, #48]
1803 ; CHECK-NEXT: rev x8, x8
1804 ; CHECK-NEXT: rev x9, x9
1805 ; CHECK-NEXT: cmp x8, x9
1806 ; CHECK-NEXT: b.ne .LBB71_9
1807 ; CHECK-NEXT: // %bb.7: // %loadbb7
1808 ; CHECK-NEXT: ldur x8, [x0, #55]
1809 ; CHECK-NEXT: ldur x9, [x1, #55]
1810 ; CHECK-NEXT: rev x8, x8
1811 ; CHECK-NEXT: rev x9, x9
1812 ; CHECK-NEXT: cmp x8, x9
1813 ; CHECK-NEXT: b.ne .LBB71_9
1814 ; CHECK-NEXT: // %bb.8:
1815 ; CHECK-NEXT: mov w0, wzr
1817 ; CHECK-NEXT: .LBB71_9: // %res_block
1818 ; CHECK-NEXT: cmp x8, x9
1819 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1820 ; CHECK-NEXT: cneg w0, w8, hs
1822 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 63) nounwind
1826 define i1 @length63_eq(ptr %x, ptr %y) nounwind {
1827 ; CHECK-LABEL: length63_eq:
1829 ; CHECK-NEXT: ldp x8, x11, [x1]
1830 ; CHECK-NEXT: ldp x9, x10, [x0]
1831 ; CHECK-NEXT: ldp x12, x13, [x1, #16]
1832 ; CHECK-NEXT: cmp x9, x8
1833 ; CHECK-NEXT: ldp x8, x9, [x0, #16]
1834 ; CHECK-NEXT: ccmp x10, x11, #0, eq
1835 ; CHECK-NEXT: ccmp x8, x12, #0, eq
1836 ; CHECK-NEXT: ldp x8, x11, [x0, #32]
1837 ; CHECK-NEXT: ldp x10, x12, [x1, #32]
1838 ; CHECK-NEXT: ccmp x9, x13, #0, eq
1839 ; CHECK-NEXT: ldr x9, [x0, #48]
1840 ; CHECK-NEXT: ldr x13, [x1, #48]
1841 ; CHECK-NEXT: ccmp x8, x10, #0, eq
1842 ; CHECK-NEXT: ldur x8, [x0, #55]
1843 ; CHECK-NEXT: ldur x10, [x1, #55]
1844 ; CHECK-NEXT: ccmp x11, x12, #0, eq
1845 ; CHECK-NEXT: ccmp x9, x13, #0, eq
1846 ; CHECK-NEXT: ccmp x8, x10, #0, eq
1847 ; CHECK-NEXT: cset w0, ne
1849 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 63) nounwind
1850 %cmp = icmp ne i32 %call, 0
1854 define i1 @length63_lt(ptr %x, ptr %y) nounwind {
1855 ; CHECK-LABEL: length63_lt:
1857 ; CHECK-NEXT: ldr x8, [x0]
1858 ; CHECK-NEXT: ldr x9, [x1]
1859 ; CHECK-NEXT: rev x8, x8
1860 ; CHECK-NEXT: rev x9, x9
1861 ; CHECK-NEXT: cmp x8, x9
1862 ; CHECK-NEXT: b.ne .LBB73_9
1863 ; CHECK-NEXT: // %bb.1: // %loadbb1
1864 ; CHECK-NEXT: ldr x8, [x0, #8]
1865 ; CHECK-NEXT: ldr x9, [x1, #8]
1866 ; CHECK-NEXT: rev x8, x8
1867 ; CHECK-NEXT: rev x9, x9
1868 ; CHECK-NEXT: cmp x8, x9
1869 ; CHECK-NEXT: b.ne .LBB73_9
1870 ; CHECK-NEXT: // %bb.2: // %loadbb2
1871 ; CHECK-NEXT: ldr x8, [x0, #16]
1872 ; CHECK-NEXT: ldr x9, [x1, #16]
1873 ; CHECK-NEXT: rev x8, x8
1874 ; CHECK-NEXT: rev x9, x9
1875 ; CHECK-NEXT: cmp x8, x9
1876 ; CHECK-NEXT: b.ne .LBB73_9
1877 ; CHECK-NEXT: // %bb.3: // %loadbb3
1878 ; CHECK-NEXT: ldr x8, [x0, #24]
1879 ; CHECK-NEXT: ldr x9, [x1, #24]
1880 ; CHECK-NEXT: rev x8, x8
1881 ; CHECK-NEXT: rev x9, x9
1882 ; CHECK-NEXT: cmp x8, x9
1883 ; CHECK-NEXT: b.ne .LBB73_9
1884 ; CHECK-NEXT: // %bb.4: // %loadbb4
1885 ; CHECK-NEXT: ldr x8, [x0, #32]
1886 ; CHECK-NEXT: ldr x9, [x1, #32]
1887 ; CHECK-NEXT: rev x8, x8
1888 ; CHECK-NEXT: rev x9, x9
1889 ; CHECK-NEXT: cmp x8, x9
1890 ; CHECK-NEXT: b.ne .LBB73_9
1891 ; CHECK-NEXT: // %bb.5: // %loadbb5
1892 ; CHECK-NEXT: ldr x8, [x0, #40]
1893 ; CHECK-NEXT: ldr x9, [x1, #40]
1894 ; CHECK-NEXT: rev x8, x8
1895 ; CHECK-NEXT: rev x9, x9
1896 ; CHECK-NEXT: cmp x8, x9
1897 ; CHECK-NEXT: b.ne .LBB73_9
1898 ; CHECK-NEXT: // %bb.6: // %loadbb6
1899 ; CHECK-NEXT: ldr x8, [x0, #48]
1900 ; CHECK-NEXT: ldr x9, [x1, #48]
1901 ; CHECK-NEXT: rev x8, x8
1902 ; CHECK-NEXT: rev x9, x9
1903 ; CHECK-NEXT: cmp x8, x9
1904 ; CHECK-NEXT: b.ne .LBB73_9
1905 ; CHECK-NEXT: // %bb.7: // %loadbb7
1906 ; CHECK-NEXT: ldur x8, [x0, #55]
1907 ; CHECK-NEXT: ldur x9, [x1, #55]
1908 ; CHECK-NEXT: rev x8, x8
1909 ; CHECK-NEXT: rev x9, x9
1910 ; CHECK-NEXT: cmp x8, x9
1911 ; CHECK-NEXT: b.ne .LBB73_9
1912 ; CHECK-NEXT: // %bb.8:
1913 ; CHECK-NEXT: lsr w0, wzr, #31
1915 ; CHECK-NEXT: .LBB73_9: // %res_block
1916 ; CHECK-NEXT: cmp x8, x9
1917 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1918 ; CHECK-NEXT: cneg w8, w8, hs
1919 ; CHECK-NEXT: lsr w0, w8, #31
1921 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 63) nounwind
1922 %cmp = icmp slt i32 %call, 0
1926 define i1 @length63_gt(ptr %x, ptr %y) nounwind {
1927 ; CHECK-LABEL: length63_gt:
1929 ; CHECK-NEXT: ldr x8, [x0]
1930 ; CHECK-NEXT: ldr x9, [x1]
1931 ; CHECK-NEXT: rev x8, x8
1932 ; CHECK-NEXT: rev x9, x9
1933 ; CHECK-NEXT: cmp x8, x9
1934 ; CHECK-NEXT: b.ne .LBB74_9
1935 ; CHECK-NEXT: // %bb.1: // %loadbb1
1936 ; CHECK-NEXT: ldr x8, [x0, #8]
1937 ; CHECK-NEXT: ldr x9, [x1, #8]
1938 ; CHECK-NEXT: rev x8, x8
1939 ; CHECK-NEXT: rev x9, x9
1940 ; CHECK-NEXT: cmp x8, x9
1941 ; CHECK-NEXT: b.ne .LBB74_9
1942 ; CHECK-NEXT: // %bb.2: // %loadbb2
1943 ; CHECK-NEXT: ldr x8, [x0, #16]
1944 ; CHECK-NEXT: ldr x9, [x1, #16]
1945 ; CHECK-NEXT: rev x8, x8
1946 ; CHECK-NEXT: rev x9, x9
1947 ; CHECK-NEXT: cmp x8, x9
1948 ; CHECK-NEXT: b.ne .LBB74_9
1949 ; CHECK-NEXT: // %bb.3: // %loadbb3
1950 ; CHECK-NEXT: ldr x8, [x0, #24]
1951 ; CHECK-NEXT: ldr x9, [x1, #24]
1952 ; CHECK-NEXT: rev x8, x8
1953 ; CHECK-NEXT: rev x9, x9
1954 ; CHECK-NEXT: cmp x8, x9
1955 ; CHECK-NEXT: b.ne .LBB74_9
1956 ; CHECK-NEXT: // %bb.4: // %loadbb4
1957 ; CHECK-NEXT: ldr x8, [x0, #32]
1958 ; CHECK-NEXT: ldr x9, [x1, #32]
1959 ; CHECK-NEXT: rev x8, x8
1960 ; CHECK-NEXT: rev x9, x9
1961 ; CHECK-NEXT: cmp x8, x9
1962 ; CHECK-NEXT: b.ne .LBB74_9
1963 ; CHECK-NEXT: // %bb.5: // %loadbb5
1964 ; CHECK-NEXT: ldr x8, [x0, #40]
1965 ; CHECK-NEXT: ldr x9, [x1, #40]
1966 ; CHECK-NEXT: rev x8, x8
1967 ; CHECK-NEXT: rev x9, x9
1968 ; CHECK-NEXT: cmp x8, x9
1969 ; CHECK-NEXT: b.ne .LBB74_9
1970 ; CHECK-NEXT: // %bb.6: // %loadbb6
1971 ; CHECK-NEXT: ldr x8, [x0, #48]
1972 ; CHECK-NEXT: ldr x9, [x1, #48]
1973 ; CHECK-NEXT: rev x8, x8
1974 ; CHECK-NEXT: rev x9, x9
1975 ; CHECK-NEXT: cmp x8, x9
1976 ; CHECK-NEXT: b.ne .LBB74_9
1977 ; CHECK-NEXT: // %bb.7: // %loadbb7
1978 ; CHECK-NEXT: ldur x8, [x0, #55]
1979 ; CHECK-NEXT: ldur x9, [x1, #55]
1980 ; CHECK-NEXT: rev x8, x8
1981 ; CHECK-NEXT: rev x9, x9
1982 ; CHECK-NEXT: cmp x8, x9
1983 ; CHECK-NEXT: b.ne .LBB74_9
1984 ; CHECK-NEXT: // %bb.8:
1985 ; CHECK-NEXT: mov w8, wzr
1986 ; CHECK-NEXT: b .LBB74_10
1987 ; CHECK-NEXT: .LBB74_9: // %res_block
1988 ; CHECK-NEXT: cmp x8, x9
1989 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
1990 ; CHECK-NEXT: cneg w8, w8, hs
1991 ; CHECK-NEXT: .LBB74_10: // %endblock
1992 ; CHECK-NEXT: cmp w8, #0
1993 ; CHECK-NEXT: cset w0, gt
1995 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 63) nounwind
1996 %cmp = icmp sgt i32 %call, 0
2000 define i1 @length63_eq_const(ptr %X) nounwind {
2001 ; CHECK-LABEL: length63_eq_const:
2003 ; CHECK-NEXT: mov x8, #12592 // =0x3130
2004 ; CHECK-NEXT: ldp x9, x10, [x0]
2005 ; CHECK-NEXT: movk x8, #13106, lsl #16
2006 ; CHECK-NEXT: ldp x11, x12, [x0, #16]
2007 ; CHECK-NEXT: movk x8, #13620, lsl #32
2008 ; CHECK-NEXT: movk x8, #14134, lsl #48
2009 ; CHECK-NEXT: cmp x9, x8
2010 ; CHECK-NEXT: mov x9, #14648 // =0x3938
2011 ; CHECK-NEXT: movk x9, #12592, lsl #16
2012 ; CHECK-NEXT: movk x9, #13106, lsl #32
2013 ; CHECK-NEXT: movk x9, #13620, lsl #48
2014 ; CHECK-NEXT: ccmp x10, x9, #0, eq
2015 ; CHECK-NEXT: mov x10, #14134 // =0x3736
2016 ; CHECK-NEXT: movk x10, #14648, lsl #16
2017 ; CHECK-NEXT: movk x10, #12592, lsl #32
2018 ; CHECK-NEXT: movk x10, #13106, lsl #48
2019 ; CHECK-NEXT: ccmp x11, x10, #0, eq
2020 ; CHECK-NEXT: mov x10, #13620 // =0x3534
2021 ; CHECK-NEXT: movk x10, #14134, lsl #16
2022 ; CHECK-NEXT: ldp x11, x13, [x0, #32]
2023 ; CHECK-NEXT: movk x10, #14648, lsl #32
2024 ; CHECK-NEXT: movk x10, #12592, lsl #48
2025 ; CHECK-NEXT: ccmp x12, x10, #0, eq
2026 ; CHECK-NEXT: mov x10, #13106 // =0x3332
2027 ; CHECK-NEXT: ldr x12, [x0, #48]
2028 ; CHECK-NEXT: movk x10, #13620, lsl #16
2029 ; CHECK-NEXT: movk x10, #14134, lsl #32
2030 ; CHECK-NEXT: movk x10, #14648, lsl #48
2031 ; CHECK-NEXT: ccmp x11, x10, #0, eq
2032 ; CHECK-NEXT: ldur x10, [x0, #55]
2033 ; CHECK-NEXT: ccmp x13, x8, #0, eq
2034 ; CHECK-NEXT: mov x8, #13877 // =0x3635
2035 ; CHECK-NEXT: movk x8, #14391, lsl #16
2036 ; CHECK-NEXT: ccmp x12, x9, #0, eq
2037 ; CHECK-NEXT: movk x8, #12345, lsl #32
2038 ; CHECK-NEXT: movk x8, #12849, lsl #48
2039 ; CHECK-NEXT: ccmp x10, x8, #0, eq
2040 ; CHECK-NEXT: cset w0, eq
2042 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 63) nounwind
2043 %c = icmp eq i32 %m, 0
2047 define i32 @length64(ptr %X, ptr %Y) nounwind {
2048 ; CHECK-LABEL: length64:
2050 ; CHECK-NEXT: ldr x8, [x0]
2051 ; CHECK-NEXT: ldr x9, [x1]
2052 ; CHECK-NEXT: rev x8, x8
2053 ; CHECK-NEXT: rev x9, x9
2054 ; CHECK-NEXT: cmp x8, x9
2055 ; CHECK-NEXT: b.ne .LBB76_9
2056 ; CHECK-NEXT: // %bb.1: // %loadbb1
2057 ; CHECK-NEXT: ldr x8, [x0, #8]
2058 ; CHECK-NEXT: ldr x9, [x1, #8]
2059 ; CHECK-NEXT: rev x8, x8
2060 ; CHECK-NEXT: rev x9, x9
2061 ; CHECK-NEXT: cmp x8, x9
2062 ; CHECK-NEXT: b.ne .LBB76_9
2063 ; CHECK-NEXT: // %bb.2: // %loadbb2
2064 ; CHECK-NEXT: ldr x8, [x0, #16]
2065 ; CHECK-NEXT: ldr x9, [x1, #16]
2066 ; CHECK-NEXT: rev x8, x8
2067 ; CHECK-NEXT: rev x9, x9
2068 ; CHECK-NEXT: cmp x8, x9
2069 ; CHECK-NEXT: b.ne .LBB76_9
2070 ; CHECK-NEXT: // %bb.3: // %loadbb3
2071 ; CHECK-NEXT: ldr x8, [x0, #24]
2072 ; CHECK-NEXT: ldr x9, [x1, #24]
2073 ; CHECK-NEXT: rev x8, x8
2074 ; CHECK-NEXT: rev x9, x9
2075 ; CHECK-NEXT: cmp x8, x9
2076 ; CHECK-NEXT: b.ne .LBB76_9
2077 ; CHECK-NEXT: // %bb.4: // %loadbb4
2078 ; CHECK-NEXT: ldr x8, [x0, #32]
2079 ; CHECK-NEXT: ldr x9, [x1, #32]
2080 ; CHECK-NEXT: rev x8, x8
2081 ; CHECK-NEXT: rev x9, x9
2082 ; CHECK-NEXT: cmp x8, x9
2083 ; CHECK-NEXT: b.ne .LBB76_9
2084 ; CHECK-NEXT: // %bb.5: // %loadbb5
2085 ; CHECK-NEXT: ldr x8, [x0, #40]
2086 ; CHECK-NEXT: ldr x9, [x1, #40]
2087 ; CHECK-NEXT: rev x8, x8
2088 ; CHECK-NEXT: rev x9, x9
2089 ; CHECK-NEXT: cmp x8, x9
2090 ; CHECK-NEXT: b.ne .LBB76_9
2091 ; CHECK-NEXT: // %bb.6: // %loadbb6
2092 ; CHECK-NEXT: ldr x8, [x0, #48]
2093 ; CHECK-NEXT: ldr x9, [x1, #48]
2094 ; CHECK-NEXT: rev x8, x8
2095 ; CHECK-NEXT: rev x9, x9
2096 ; CHECK-NEXT: cmp x8, x9
2097 ; CHECK-NEXT: b.ne .LBB76_9
2098 ; CHECK-NEXT: // %bb.7: // %loadbb7
2099 ; CHECK-NEXT: ldr x8, [x0, #56]
2100 ; CHECK-NEXT: ldr x9, [x1, #56]
2101 ; CHECK-NEXT: rev x8, x8
2102 ; CHECK-NEXT: rev x9, x9
2103 ; CHECK-NEXT: cmp x8, x9
2104 ; CHECK-NEXT: b.ne .LBB76_9
2105 ; CHECK-NEXT: // %bb.8:
2106 ; CHECK-NEXT: mov w0, wzr
2108 ; CHECK-NEXT: .LBB76_9: // %res_block
2109 ; CHECK-NEXT: cmp x8, x9
2110 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
2111 ; CHECK-NEXT: cneg w0, w8, hs
2113 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 64) nounwind
2117 define i1 @length64_eq(ptr %x, ptr %y) nounwind {
2118 ; CHECK-LABEL: length64_eq:
2120 ; CHECK-NEXT: ldp x8, x11, [x1]
2121 ; CHECK-NEXT: ldp x9, x10, [x0]
2122 ; CHECK-NEXT: ldp x12, x13, [x1, #16]
2123 ; CHECK-NEXT: cmp x9, x8
2124 ; CHECK-NEXT: ldp x8, x9, [x0, #16]
2125 ; CHECK-NEXT: ccmp x10, x11, #0, eq
2126 ; CHECK-NEXT: ccmp x8, x12, #0, eq
2127 ; CHECK-NEXT: ldp x8, x11, [x0, #32]
2128 ; CHECK-NEXT: ldp x10, x12, [x1, #32]
2129 ; CHECK-NEXT: ccmp x9, x13, #0, eq
2130 ; CHECK-NEXT: ldp x9, x13, [x1, #48]
2131 ; CHECK-NEXT: ccmp x8, x10, #0, eq
2132 ; CHECK-NEXT: ldp x8, x10, [x0, #48]
2133 ; CHECK-NEXT: ccmp x11, x12, #0, eq
2134 ; CHECK-NEXT: ccmp x8, x9, #0, eq
2135 ; CHECK-NEXT: ccmp x10, x13, #0, eq
2136 ; CHECK-NEXT: cset w0, ne
2138 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 64) nounwind
2139 %cmp = icmp ne i32 %call, 0
2143 define i1 @length64_lt(ptr %x, ptr %y) nounwind {
2144 ; CHECK-LABEL: length64_lt:
2146 ; CHECK-NEXT: ldr x8, [x0]
2147 ; CHECK-NEXT: ldr x9, [x1]
2148 ; CHECK-NEXT: rev x8, x8
2149 ; CHECK-NEXT: rev x9, x9
2150 ; CHECK-NEXT: cmp x8, x9
2151 ; CHECK-NEXT: b.ne .LBB78_9
2152 ; CHECK-NEXT: // %bb.1: // %loadbb1
2153 ; CHECK-NEXT: ldr x8, [x0, #8]
2154 ; CHECK-NEXT: ldr x9, [x1, #8]
2155 ; CHECK-NEXT: rev x8, x8
2156 ; CHECK-NEXT: rev x9, x9
2157 ; CHECK-NEXT: cmp x8, x9
2158 ; CHECK-NEXT: b.ne .LBB78_9
2159 ; CHECK-NEXT: // %bb.2: // %loadbb2
2160 ; CHECK-NEXT: ldr x8, [x0, #16]
2161 ; CHECK-NEXT: ldr x9, [x1, #16]
2162 ; CHECK-NEXT: rev x8, x8
2163 ; CHECK-NEXT: rev x9, x9
2164 ; CHECK-NEXT: cmp x8, x9
2165 ; CHECK-NEXT: b.ne .LBB78_9
2166 ; CHECK-NEXT: // %bb.3: // %loadbb3
2167 ; CHECK-NEXT: ldr x8, [x0, #24]
2168 ; CHECK-NEXT: ldr x9, [x1, #24]
2169 ; CHECK-NEXT: rev x8, x8
2170 ; CHECK-NEXT: rev x9, x9
2171 ; CHECK-NEXT: cmp x8, x9
2172 ; CHECK-NEXT: b.ne .LBB78_9
2173 ; CHECK-NEXT: // %bb.4: // %loadbb4
2174 ; CHECK-NEXT: ldr x8, [x0, #32]
2175 ; CHECK-NEXT: ldr x9, [x1, #32]
2176 ; CHECK-NEXT: rev x8, x8
2177 ; CHECK-NEXT: rev x9, x9
2178 ; CHECK-NEXT: cmp x8, x9
2179 ; CHECK-NEXT: b.ne .LBB78_9
2180 ; CHECK-NEXT: // %bb.5: // %loadbb5
2181 ; CHECK-NEXT: ldr x8, [x0, #40]
2182 ; CHECK-NEXT: ldr x9, [x1, #40]
2183 ; CHECK-NEXT: rev x8, x8
2184 ; CHECK-NEXT: rev x9, x9
2185 ; CHECK-NEXT: cmp x8, x9
2186 ; CHECK-NEXT: b.ne .LBB78_9
2187 ; CHECK-NEXT: // %bb.6: // %loadbb6
2188 ; CHECK-NEXT: ldr x8, [x0, #48]
2189 ; CHECK-NEXT: ldr x9, [x1, #48]
2190 ; CHECK-NEXT: rev x8, x8
2191 ; CHECK-NEXT: rev x9, x9
2192 ; CHECK-NEXT: cmp x8, x9
2193 ; CHECK-NEXT: b.ne .LBB78_9
2194 ; CHECK-NEXT: // %bb.7: // %loadbb7
2195 ; CHECK-NEXT: ldr x8, [x0, #56]
2196 ; CHECK-NEXT: ldr x9, [x1, #56]
2197 ; CHECK-NEXT: rev x8, x8
2198 ; CHECK-NEXT: rev x9, x9
2199 ; CHECK-NEXT: cmp x8, x9
2200 ; CHECK-NEXT: b.ne .LBB78_9
2201 ; CHECK-NEXT: // %bb.8:
2202 ; CHECK-NEXT: lsr w0, wzr, #31
2204 ; CHECK-NEXT: .LBB78_9: // %res_block
2205 ; CHECK-NEXT: cmp x8, x9
2206 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
2207 ; CHECK-NEXT: cneg w8, w8, hs
2208 ; CHECK-NEXT: lsr w0, w8, #31
2210 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 64) nounwind
2211 %cmp = icmp slt i32 %call, 0
2215 define i1 @length64_gt(ptr %x, ptr %y) nounwind {
2216 ; CHECK-LABEL: length64_gt:
2218 ; CHECK-NEXT: ldr x8, [x0]
2219 ; CHECK-NEXT: ldr x9, [x1]
2220 ; CHECK-NEXT: rev x8, x8
2221 ; CHECK-NEXT: rev x9, x9
2222 ; CHECK-NEXT: cmp x8, x9
2223 ; CHECK-NEXT: b.ne .LBB79_9
2224 ; CHECK-NEXT: // %bb.1: // %loadbb1
2225 ; CHECK-NEXT: ldr x8, [x0, #8]
2226 ; CHECK-NEXT: ldr x9, [x1, #8]
2227 ; CHECK-NEXT: rev x8, x8
2228 ; CHECK-NEXT: rev x9, x9
2229 ; CHECK-NEXT: cmp x8, x9
2230 ; CHECK-NEXT: b.ne .LBB79_9
2231 ; CHECK-NEXT: // %bb.2: // %loadbb2
2232 ; CHECK-NEXT: ldr x8, [x0, #16]
2233 ; CHECK-NEXT: ldr x9, [x1, #16]
2234 ; CHECK-NEXT: rev x8, x8
2235 ; CHECK-NEXT: rev x9, x9
2236 ; CHECK-NEXT: cmp x8, x9
2237 ; CHECK-NEXT: b.ne .LBB79_9
2238 ; CHECK-NEXT: // %bb.3: // %loadbb3
2239 ; CHECK-NEXT: ldr x8, [x0, #24]
2240 ; CHECK-NEXT: ldr x9, [x1, #24]
2241 ; CHECK-NEXT: rev x8, x8
2242 ; CHECK-NEXT: rev x9, x9
2243 ; CHECK-NEXT: cmp x8, x9
2244 ; CHECK-NEXT: b.ne .LBB79_9
2245 ; CHECK-NEXT: // %bb.4: // %loadbb4
2246 ; CHECK-NEXT: ldr x8, [x0, #32]
2247 ; CHECK-NEXT: ldr x9, [x1, #32]
2248 ; CHECK-NEXT: rev x8, x8
2249 ; CHECK-NEXT: rev x9, x9
2250 ; CHECK-NEXT: cmp x8, x9
2251 ; CHECK-NEXT: b.ne .LBB79_9
2252 ; CHECK-NEXT: // %bb.5: // %loadbb5
2253 ; CHECK-NEXT: ldr x8, [x0, #40]
2254 ; CHECK-NEXT: ldr x9, [x1, #40]
2255 ; CHECK-NEXT: rev x8, x8
2256 ; CHECK-NEXT: rev x9, x9
2257 ; CHECK-NEXT: cmp x8, x9
2258 ; CHECK-NEXT: b.ne .LBB79_9
2259 ; CHECK-NEXT: // %bb.6: // %loadbb6
2260 ; CHECK-NEXT: ldr x8, [x0, #48]
2261 ; CHECK-NEXT: ldr x9, [x1, #48]
2262 ; CHECK-NEXT: rev x8, x8
2263 ; CHECK-NEXT: rev x9, x9
2264 ; CHECK-NEXT: cmp x8, x9
2265 ; CHECK-NEXT: b.ne .LBB79_9
2266 ; CHECK-NEXT: // %bb.7: // %loadbb7
2267 ; CHECK-NEXT: ldr x8, [x0, #56]
2268 ; CHECK-NEXT: ldr x9, [x1, #56]
2269 ; CHECK-NEXT: rev x8, x8
2270 ; CHECK-NEXT: rev x9, x9
2271 ; CHECK-NEXT: cmp x8, x9
2272 ; CHECK-NEXT: b.ne .LBB79_9
2273 ; CHECK-NEXT: // %bb.8:
2274 ; CHECK-NEXT: mov w8, wzr
2275 ; CHECK-NEXT: b .LBB79_10
2276 ; CHECK-NEXT: .LBB79_9: // %res_block
2277 ; CHECK-NEXT: cmp x8, x9
2278 ; CHECK-NEXT: mov w8, #-1 // =0xffffffff
2279 ; CHECK-NEXT: cneg w8, w8, hs
2280 ; CHECK-NEXT: .LBB79_10: // %endblock
2281 ; CHECK-NEXT: cmp w8, #0
2282 ; CHECK-NEXT: cset w0, gt
2284 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 64) nounwind
2285 %cmp = icmp sgt i32 %call, 0
2289 define i1 @length64_eq_const(ptr %X) nounwind {
2290 ; CHECK-LABEL: length64_eq_const:
2292 ; CHECK-NEXT: mov x8, #12592 // =0x3130
2293 ; CHECK-NEXT: ldp x9, x10, [x0]
2294 ; CHECK-NEXT: movk x8, #13106, lsl #16
2295 ; CHECK-NEXT: ldp x11, x12, [x0, #16]
2296 ; CHECK-NEXT: movk x8, #13620, lsl #32
2297 ; CHECK-NEXT: ldp x13, x14, [x0, #32]
2298 ; CHECK-NEXT: movk x8, #14134, lsl #48
2299 ; CHECK-NEXT: cmp x9, x8
2300 ; CHECK-NEXT: mov x9, #14648 // =0x3938
2301 ; CHECK-NEXT: movk x9, #12592, lsl #16
2302 ; CHECK-NEXT: movk x9, #13106, lsl #32
2303 ; CHECK-NEXT: movk x9, #13620, lsl #48
2304 ; CHECK-NEXT: ccmp x10, x9, #0, eq
2305 ; CHECK-NEXT: mov x10, #14134 // =0x3736
2306 ; CHECK-NEXT: movk x10, #14648, lsl #16
2307 ; CHECK-NEXT: movk x10, #12592, lsl #32
2308 ; CHECK-NEXT: movk x10, #13106, lsl #48
2309 ; CHECK-NEXT: ccmp x11, x10, #0, eq
2310 ; CHECK-NEXT: mov x11, #13620 // =0x3534
2311 ; CHECK-NEXT: movk x11, #14134, lsl #16
2312 ; CHECK-NEXT: movk x11, #14648, lsl #32
2313 ; CHECK-NEXT: movk x11, #12592, lsl #48
2314 ; CHECK-NEXT: ccmp x12, x11, #0, eq
2315 ; CHECK-NEXT: mov x11, #13106 // =0x3332
2316 ; CHECK-NEXT: movk x11, #13620, lsl #16
2317 ; CHECK-NEXT: movk x11, #14134, lsl #32
2318 ; CHECK-NEXT: movk x11, #14648, lsl #48
2319 ; CHECK-NEXT: ccmp x13, x11, #0, eq
2320 ; CHECK-NEXT: ldp x11, x12, [x0, #48]
2321 ; CHECK-NEXT: ccmp x14, x8, #0, eq
2322 ; CHECK-NEXT: ccmp x11, x9, #0, eq
2323 ; CHECK-NEXT: ccmp x12, x10, #0, eq
2324 ; CHECK-NEXT: cset w0, eq
2326 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 64) nounwind
2327 %c = icmp eq i32 %m, 0
2331 define i32 @length96(ptr %X, ptr %Y) nounwind {
2332 ; CHECK-LABEL: length96:
2334 ; CHECK-NEXT: mov w2, #96 // =0x60
2335 ; CHECK-NEXT: b memcmp
2336 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 96) nounwind
2340 define i1 @length96_eq(ptr %x, ptr %y) nounwind {
2341 ; CHECK-LABEL: length96_eq:
2343 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2344 ; CHECK-NEXT: mov w2, #96 // =0x60
2345 ; CHECK-NEXT: bl memcmp
2346 ; CHECK-NEXT: cmp w0, #0
2347 ; CHECK-NEXT: cset w0, ne
2348 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2350 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 96) nounwind
2351 %cmp = icmp ne i32 %call, 0
2355 define i1 @length96_lt(ptr %x, ptr %y) nounwind {
2356 ; CHECK-LABEL: length96_lt:
2358 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2359 ; CHECK-NEXT: mov w2, #96 // =0x60
2360 ; CHECK-NEXT: bl memcmp
2361 ; CHECK-NEXT: lsr w0, w0, #31
2362 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2364 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 96) nounwind
2365 %cmp = icmp slt i32 %call, 0
2369 define i1 @length96_gt(ptr %x, ptr %y) nounwind {
2370 ; CHECK-LABEL: length96_gt:
2372 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2373 ; CHECK-NEXT: mov w2, #96 // =0x60
2374 ; CHECK-NEXT: bl memcmp
2375 ; CHECK-NEXT: cmp w0, #0
2376 ; CHECK-NEXT: cset w0, gt
2377 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2379 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 96) nounwind
2380 %cmp = icmp sgt i32 %call, 0
2384 define i1 @length96_eq_const(ptr %X) nounwind {
2385 ; CHECK-LABEL: length96_eq_const:
2387 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2388 ; CHECK-NEXT: adrp x1, .L.str
2389 ; CHECK-NEXT: add x1, x1, :lo12:.L.str
2390 ; CHECK-NEXT: mov w2, #96 // =0x60
2391 ; CHECK-NEXT: bl memcmp
2392 ; CHECK-NEXT: cmp w0, #0
2393 ; CHECK-NEXT: cset w0, eq
2394 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2396 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 96) nounwind
2397 %c = icmp eq i32 %m, 0
2401 define i32 @length127(ptr %X, ptr %Y) nounwind {
2402 ; CHECK-LABEL: length127:
2404 ; CHECK-NEXT: mov w2, #127 // =0x7f
2405 ; CHECK-NEXT: b memcmp
2406 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 127) nounwind
2410 define i1 @length127_eq(ptr %x, ptr %y) nounwind {
2411 ; CHECK-LABEL: length127_eq:
2413 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2414 ; CHECK-NEXT: mov w2, #127 // =0x7f
2415 ; CHECK-NEXT: bl memcmp
2416 ; CHECK-NEXT: cmp w0, #0
2417 ; CHECK-NEXT: cset w0, ne
2418 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2420 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 127) nounwind
2421 %cmp = icmp ne i32 %call, 0
2425 define i1 @length127_lt(ptr %x, ptr %y) nounwind {
2426 ; CHECK-LABEL: length127_lt:
2428 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2429 ; CHECK-NEXT: mov w2, #127 // =0x7f
2430 ; CHECK-NEXT: bl memcmp
2431 ; CHECK-NEXT: lsr w0, w0, #31
2432 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2434 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 127) nounwind
2435 %cmp = icmp slt i32 %call, 0
2439 define i1 @length127_gt(ptr %x, ptr %y) nounwind {
2440 ; CHECK-LABEL: length127_gt:
2442 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2443 ; CHECK-NEXT: mov w2, #127 // =0x7f
2444 ; CHECK-NEXT: bl memcmp
2445 ; CHECK-NEXT: cmp w0, #0
2446 ; CHECK-NEXT: cset w0, gt
2447 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2449 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 127) nounwind
2450 %cmp = icmp sgt i32 %call, 0
2454 define i1 @length127_eq_const(ptr %X) nounwind {
2455 ; CHECK-LABEL: length127_eq_const:
2457 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2458 ; CHECK-NEXT: adrp x1, .L.str
2459 ; CHECK-NEXT: add x1, x1, :lo12:.L.str
2460 ; CHECK-NEXT: mov w2, #127 // =0x7f
2461 ; CHECK-NEXT: bl memcmp
2462 ; CHECK-NEXT: cmp w0, #0
2463 ; CHECK-NEXT: cset w0, eq
2464 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2466 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 127) nounwind
2467 %c = icmp eq i32 %m, 0
2471 define i32 @length128(ptr %X, ptr %Y) nounwind {
2472 ; CHECK-LABEL: length128:
2474 ; CHECK-NEXT: mov w2, #128 // =0x80
2475 ; CHECK-NEXT: b memcmp
2476 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 128) nounwind
2480 define i1 @length128_eq(ptr %x, ptr %y) nounwind {
2481 ; CHECK-LABEL: length128_eq:
2483 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2484 ; CHECK-NEXT: mov w2, #128 // =0x80
2485 ; CHECK-NEXT: bl memcmp
2486 ; CHECK-NEXT: cmp w0, #0
2487 ; CHECK-NEXT: cset w0, ne
2488 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2490 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 128) nounwind
2491 %cmp = icmp ne i32 %call, 0
2495 define i1 @length128_lt(ptr %x, ptr %y) nounwind {
2496 ; CHECK-LABEL: length128_lt:
2498 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2499 ; CHECK-NEXT: mov w2, #128 // =0x80
2500 ; CHECK-NEXT: bl memcmp
2501 ; CHECK-NEXT: lsr w0, w0, #31
2502 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2504 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 128) nounwind
2505 %cmp = icmp slt i32 %call, 0
2509 define i1 @length128_gt(ptr %x, ptr %y) nounwind {
2510 ; CHECK-LABEL: length128_gt:
2512 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2513 ; CHECK-NEXT: mov w2, #128 // =0x80
2514 ; CHECK-NEXT: bl memcmp
2515 ; CHECK-NEXT: cmp w0, #0
2516 ; CHECK-NEXT: cset w0, gt
2517 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2519 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 128) nounwind
2520 %cmp = icmp sgt i32 %call, 0
2524 define i1 @length128_eq_const(ptr %X) nounwind {
2525 ; CHECK-LABEL: length128_eq_const:
2527 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2528 ; CHECK-NEXT: adrp x1, .L.str
2529 ; CHECK-NEXT: add x1, x1, :lo12:.L.str
2530 ; CHECK-NEXT: mov w2, #128 // =0x80
2531 ; CHECK-NEXT: bl memcmp
2532 ; CHECK-NEXT: cmp w0, #0
2533 ; CHECK-NEXT: cset w0, eq
2534 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2536 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 128) nounwind
2537 %c = icmp eq i32 %m, 0
2541 define i32 @length192(ptr %X, ptr %Y) nounwind {
2542 ; CHECK-LABEL: length192:
2544 ; CHECK-NEXT: mov w2, #192 // =0xc0
2545 ; CHECK-NEXT: b memcmp
2546 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 192) nounwind
2550 define i1 @length192_eq(ptr %x, ptr %y) nounwind {
2551 ; CHECK-LABEL: length192_eq:
2553 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2554 ; CHECK-NEXT: mov w2, #192 // =0xc0
2555 ; CHECK-NEXT: bl memcmp
2556 ; CHECK-NEXT: cmp w0, #0
2557 ; CHECK-NEXT: cset w0, ne
2558 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2560 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 192) nounwind
2561 %cmp = icmp ne i32 %call, 0
2565 define i1 @length192_lt(ptr %x, ptr %y) nounwind {
2566 ; CHECK-LABEL: length192_lt:
2568 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2569 ; CHECK-NEXT: mov w2, #192 // =0xc0
2570 ; CHECK-NEXT: bl memcmp
2571 ; CHECK-NEXT: lsr w0, w0, #31
2572 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2574 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 192) nounwind
2575 %cmp = icmp slt i32 %call, 0
2579 define i1 @length192_gt(ptr %x, ptr %y) nounwind {
2580 ; CHECK-LABEL: length192_gt:
2582 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2583 ; CHECK-NEXT: mov w2, #192 // =0xc0
2584 ; CHECK-NEXT: bl memcmp
2585 ; CHECK-NEXT: cmp w0, #0
2586 ; CHECK-NEXT: cset w0, gt
2587 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2589 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 192) nounwind
2590 %cmp = icmp sgt i32 %call, 0
2594 define i1 @length192_eq_const(ptr %X) nounwind {
2595 ; CHECK-LABEL: length192_eq_const:
2597 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2598 ; CHECK-NEXT: adrp x1, .L.str
2599 ; CHECK-NEXT: add x1, x1, :lo12:.L.str
2600 ; CHECK-NEXT: mov w2, #192 // =0xc0
2601 ; CHECK-NEXT: bl memcmp
2602 ; CHECK-NEXT: cmp w0, #0
2603 ; CHECK-NEXT: cset w0, eq
2604 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2606 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 192) nounwind
2607 %c = icmp eq i32 %m, 0
2611 define i32 @length255(ptr %X, ptr %Y) nounwind {
2612 ; CHECK-LABEL: length255:
2614 ; CHECK-NEXT: mov w2, #255 // =0xff
2615 ; CHECK-NEXT: b memcmp
2616 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 255) nounwind
2620 define i1 @length255_eq(ptr %x, ptr %y) nounwind {
2621 ; CHECK-LABEL: length255_eq:
2623 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2624 ; CHECK-NEXT: mov w2, #255 // =0xff
2625 ; CHECK-NEXT: bl memcmp
2626 ; CHECK-NEXT: cmp w0, #0
2627 ; CHECK-NEXT: cset w0, ne
2628 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2630 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 255) nounwind
2631 %cmp = icmp ne i32 %call, 0
2635 define i1 @length255_lt(ptr %x, ptr %y) nounwind {
2636 ; CHECK-LABEL: length255_lt:
2638 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2639 ; CHECK-NEXT: mov w2, #255 // =0xff
2640 ; CHECK-NEXT: bl memcmp
2641 ; CHECK-NEXT: lsr w0, w0, #31
2642 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2644 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 255) nounwind
2645 %cmp = icmp slt i32 %call, 0
2649 define i1 @length255_gt(ptr %x, ptr %y) nounwind {
2650 ; CHECK-LABEL: length255_gt:
2652 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2653 ; CHECK-NEXT: mov w2, #255 // =0xff
2654 ; CHECK-NEXT: bl memcmp
2655 ; CHECK-NEXT: cmp w0, #0
2656 ; CHECK-NEXT: cset w0, gt
2657 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2659 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 255) nounwind
2660 %cmp = icmp sgt i32 %call, 0
2664 define i1 @length255_eq_const(ptr %X) nounwind {
2665 ; CHECK-LABEL: length255_eq_const:
2667 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2668 ; CHECK-NEXT: adrp x1, .L.str
2669 ; CHECK-NEXT: add x1, x1, :lo12:.L.str
2670 ; CHECK-NEXT: mov w2, #255 // =0xff
2671 ; CHECK-NEXT: bl memcmp
2672 ; CHECK-NEXT: cmp w0, #0
2673 ; CHECK-NEXT: cset w0, eq
2674 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2676 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 255) nounwind
2677 %c = icmp eq i32 %m, 0
2681 define i32 @length256(ptr %X, ptr %Y) nounwind {
2682 ; CHECK-LABEL: length256:
2684 ; CHECK-NEXT: mov w2, #256 // =0x100
2685 ; CHECK-NEXT: b memcmp
2686 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 256) nounwind
2690 define i1 @length256_eq(ptr %x, ptr %y) nounwind {
2691 ; CHECK-LABEL: length256_eq:
2693 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2694 ; CHECK-NEXT: mov w2, #256 // =0x100
2695 ; CHECK-NEXT: bl memcmp
2696 ; CHECK-NEXT: cmp w0, #0
2697 ; CHECK-NEXT: cset w0, ne
2698 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2700 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 256) nounwind
2701 %cmp = icmp ne i32 %call, 0
2705 define i1 @length256_lt(ptr %x, ptr %y) nounwind {
2706 ; CHECK-LABEL: length256_lt:
2708 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2709 ; CHECK-NEXT: mov w2, #256 // =0x100
2710 ; CHECK-NEXT: bl memcmp
2711 ; CHECK-NEXT: lsr w0, w0, #31
2712 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2714 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 256) nounwind
2715 %cmp = icmp slt i32 %call, 0
2719 define i1 @length256_gt(ptr %x, ptr %y) nounwind {
2720 ; CHECK-LABEL: length256_gt:
2722 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2723 ; CHECK-NEXT: mov w2, #256 // =0x100
2724 ; CHECK-NEXT: bl memcmp
2725 ; CHECK-NEXT: cmp w0, #0
2726 ; CHECK-NEXT: cset w0, gt
2727 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2729 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 256) nounwind
2730 %cmp = icmp sgt i32 %call, 0
2734 define i1 @length256_eq_const(ptr %X) nounwind {
2735 ; CHECK-LABEL: length256_eq_const:
2737 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2738 ; CHECK-NEXT: adrp x1, .L.str
2739 ; CHECK-NEXT: add x1, x1, :lo12:.L.str
2740 ; CHECK-NEXT: mov w2, #256 // =0x100
2741 ; CHECK-NEXT: bl memcmp
2742 ; CHECK-NEXT: cmp w0, #0
2743 ; CHECK-NEXT: cset w0, eq
2744 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2746 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 256) nounwind
2747 %c = icmp eq i32 %m, 0
2751 define i32 @length384(ptr %X, ptr %Y) nounwind {
2752 ; CHECK-LABEL: length384:
2754 ; CHECK-NEXT: mov w2, #384 // =0x180
2755 ; CHECK-NEXT: b memcmp
2756 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 384) nounwind
2760 define i1 @length384_eq(ptr %x, ptr %y) nounwind {
2761 ; CHECK-LABEL: length384_eq:
2763 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2764 ; CHECK-NEXT: mov w2, #384 // =0x180
2765 ; CHECK-NEXT: bl memcmp
2766 ; CHECK-NEXT: cmp w0, #0
2767 ; CHECK-NEXT: cset w0, ne
2768 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2770 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 384) nounwind
2771 %cmp = icmp ne i32 %call, 0
2775 define i1 @length384_lt(ptr %x, ptr %y) nounwind {
2776 ; CHECK-LABEL: length384_lt:
2778 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2779 ; CHECK-NEXT: mov w2, #384 // =0x180
2780 ; CHECK-NEXT: bl memcmp
2781 ; CHECK-NEXT: lsr w0, w0, #31
2782 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2784 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 384) nounwind
2785 %cmp = icmp slt i32 %call, 0
2789 define i1 @length384_gt(ptr %x, ptr %y) nounwind {
2790 ; CHECK-LABEL: length384_gt:
2792 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2793 ; CHECK-NEXT: mov w2, #384 // =0x180
2794 ; CHECK-NEXT: bl memcmp
2795 ; CHECK-NEXT: cmp w0, #0
2796 ; CHECK-NEXT: cset w0, gt
2797 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2799 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 384) nounwind
2800 %cmp = icmp sgt i32 %call, 0
2804 define i1 @length384_eq_const(ptr %X) nounwind {
2805 ; CHECK-LABEL: length384_eq_const:
2807 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2808 ; CHECK-NEXT: adrp x1, .L.str
2809 ; CHECK-NEXT: add x1, x1, :lo12:.L.str
2810 ; CHECK-NEXT: mov w2, #384 // =0x180
2811 ; CHECK-NEXT: bl memcmp
2812 ; CHECK-NEXT: cmp w0, #0
2813 ; CHECK-NEXT: cset w0, eq
2814 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2816 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 384) nounwind
2817 %c = icmp eq i32 %m, 0
2821 define i32 @length511(ptr %X, ptr %Y) nounwind {
2822 ; CHECK-LABEL: length511:
2824 ; CHECK-NEXT: mov w2, #511 // =0x1ff
2825 ; CHECK-NEXT: b memcmp
2826 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 511) nounwind
2830 define i1 @length511_eq(ptr %x, ptr %y) nounwind {
2831 ; CHECK-LABEL: length511_eq:
2833 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2834 ; CHECK-NEXT: mov w2, #511 // =0x1ff
2835 ; CHECK-NEXT: bl memcmp
2836 ; CHECK-NEXT: cmp w0, #0
2837 ; CHECK-NEXT: cset w0, ne
2838 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2840 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 511) nounwind
2841 %cmp = icmp ne i32 %call, 0
2845 define i1 @length511_lt(ptr %x, ptr %y) nounwind {
2846 ; CHECK-LABEL: length511_lt:
2848 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2849 ; CHECK-NEXT: mov w2, #511 // =0x1ff
2850 ; CHECK-NEXT: bl memcmp
2851 ; CHECK-NEXT: lsr w0, w0, #31
2852 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2854 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 511) nounwind
2855 %cmp = icmp slt i32 %call, 0
2859 define i1 @length511_gt(ptr %x, ptr %y) nounwind {
2860 ; CHECK-LABEL: length511_gt:
2862 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2863 ; CHECK-NEXT: mov w2, #511 // =0x1ff
2864 ; CHECK-NEXT: bl memcmp
2865 ; CHECK-NEXT: cmp w0, #0
2866 ; CHECK-NEXT: cset w0, gt
2867 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2869 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 511) nounwind
2870 %cmp = icmp sgt i32 %call, 0
2874 define i1 @length511_eq_const(ptr %X) nounwind {
2875 ; CHECK-LABEL: length511_eq_const:
2877 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2878 ; CHECK-NEXT: adrp x1, .L.str
2879 ; CHECK-NEXT: add x1, x1, :lo12:.L.str
2880 ; CHECK-NEXT: mov w2, #511 // =0x1ff
2881 ; CHECK-NEXT: bl memcmp
2882 ; CHECK-NEXT: cmp w0, #0
2883 ; CHECK-NEXT: cset w0, eq
2884 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2886 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 511) nounwind
2887 %c = icmp eq i32 %m, 0
2891 define i32 @length512(ptr %X, ptr %Y) nounwind {
2892 ; CHECK-LABEL: length512:
2894 ; CHECK-NEXT: mov w2, #512 // =0x200
2895 ; CHECK-NEXT: b memcmp
2896 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 512) nounwind
2900 define i1 @length512_eq(ptr %x, ptr %y) nounwind {
2901 ; CHECK-LABEL: length512_eq:
2903 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2904 ; CHECK-NEXT: mov w2, #512 // =0x200
2905 ; CHECK-NEXT: bl memcmp
2906 ; CHECK-NEXT: cmp w0, #0
2907 ; CHECK-NEXT: cset w0, ne
2908 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2910 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 512) nounwind
2911 %cmp = icmp ne i32 %call, 0
2915 define i1 @length512_lt(ptr %x, ptr %y) nounwind {
2916 ; CHECK-LABEL: length512_lt:
2918 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2919 ; CHECK-NEXT: mov w2, #512 // =0x200
2920 ; CHECK-NEXT: bl memcmp
2921 ; CHECK-NEXT: lsr w0, w0, #31
2922 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2924 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 512) nounwind
2925 %cmp = icmp slt i32 %call, 0
2929 define i1 @length512_gt(ptr %x, ptr %y) nounwind {
2930 ; CHECK-LABEL: length512_gt:
2932 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2933 ; CHECK-NEXT: mov w2, #512 // =0x200
2934 ; CHECK-NEXT: bl memcmp
2935 ; CHECK-NEXT: cmp w0, #0
2936 ; CHECK-NEXT: cset w0, gt
2937 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2939 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 512) nounwind
2940 %cmp = icmp sgt i32 %call, 0
2944 define i1 @length512_eq_const(ptr %X) nounwind {
2945 ; CHECK-LABEL: length512_eq_const:
2947 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2948 ; CHECK-NEXT: adrp x1, .L.str
2949 ; CHECK-NEXT: add x1, x1, :lo12:.L.str
2950 ; CHECK-NEXT: mov w2, #512 // =0x200
2951 ; CHECK-NEXT: bl memcmp
2952 ; CHECK-NEXT: cmp w0, #0
2953 ; CHECK-NEXT: cset w0, eq
2954 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2956 %m = tail call i32 @memcmp(ptr %X, ptr @.str, i64 512) nounwind
2957 %c = icmp eq i32 %m, 0
2961 define i32 @huge_length(ptr %X, ptr %Y) nounwind {
2962 ; CHECK-LABEL: huge_length:
2964 ; CHECK-NEXT: mov x2, #9223372036854775807 // =0x7fffffffffffffff
2965 ; CHECK-NEXT: b memcmp
2966 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 9223372036854775807) nounwind
2970 define i1 @huge_length_eq(ptr %X, ptr %Y) nounwind {
2971 ; CHECK-LABEL: huge_length_eq:
2973 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2974 ; CHECK-NEXT: mov x2, #9223372036854775807 // =0x7fffffffffffffff
2975 ; CHECK-NEXT: bl memcmp
2976 ; CHECK-NEXT: cmp w0, #0
2977 ; CHECK-NEXT: cset w0, eq
2978 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
2980 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 9223372036854775807) nounwind
2981 %c = icmp eq i32 %m, 0
2985 define i32 @nonconst_length(ptr %X, ptr %Y, i64 %size) nounwind {
2986 ; CHECK-LABEL: nonconst_length:
2988 ; CHECK-NEXT: b memcmp
2989 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 %size) nounwind
2993 define i1 @nonconst_length_eq(ptr %X, ptr %Y, i64 %size) nounwind {
2994 ; CHECK-LABEL: nonconst_length_eq:
2996 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
2997 ; CHECK-NEXT: bl memcmp
2998 ; CHECK-NEXT: cmp w0, #0
2999 ; CHECK-NEXT: cset w0, eq
3000 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
3002 %m = tail call i32 @memcmp(ptr %X, ptr %Y, i64 %size) nounwind
3003 %c = icmp eq i32 %m, 0