1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \
3 ; RUN: -ppc-asm-full-reg-names -mcpu=pwr10 < %s | FileCheck %s \
4 ; RUN: --check-prefixes=CHECK,CHECK-LE
5 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \
6 ; RUN: -ppc-asm-full-reg-names -mcpu=pwr10 < %s | FileCheck %s \
7 ; RUN: --check-prefixes=CHECK,CHECK-BE
9 ; This file does not contain many test cases involving comparisons and logical
10 ; comparisons (cmplwi, cmpldi). This is because alternative code is generated
11 ; when there is a compare (logical or not), followed by a sign or zero extend.
12 ; This codegen will be re-evaluated at a later time on whether or not it should
15 @globalVal = common dso_local local_unnamed_addr global i8 0, align 1
16 @globalVal2 = common dso_local local_unnamed_addr global i32 0, align 4
17 @globalVal3 = common dso_local local_unnamed_addr global i64 0, align 8
18 @globalVal4 = common dso_local local_unnamed_addr global i16 0, align 2
21 define dso_local signext i32 @setbcr1(i32 signext %a, i32 signext %b) {
22 ; CHECK-LABEL: setbcr1:
23 ; CHECK: # %bb.0: # %entry
24 ; CHECK-NEXT: cmpw r3, r4
25 ; CHECK-NEXT: setbcr r3, lt
28 %cmp = icmp sge i32 %a, %b
29 %lnot.ext = zext i1 %cmp to i32
34 define dso_local signext i32 @setbcr2(i32 signext %a, i32 signext %b) {
35 ; CHECK-LABEL: setbcr2:
36 ; CHECK: # %bb.0: # %entry
37 ; CHECK-NEXT: cmpw r3, r4
38 ; CHECK-NEXT: setbcr r3, gt
41 %cmp = icmp sle i32 %a, %b
42 %lnot.ext = zext i1 %cmp to i32
47 define dso_local signext i32 @setbcr3(i32 signext %a, i32 signext %b) {
48 ; CHECK-LABEL: setbcr3:
49 ; CHECK: # %bb.0: # %entry
50 ; CHECK-NEXT: cmpw r3, r4
51 ; CHECK-NEXT: setbcr r3, eq
54 %cmp = icmp ne i32 %a, %b
55 %lnot.ext = zext i1 %cmp to i32
60 define dso_local signext i32 @setbcr4(i8 signext %a, i8 signext %b) {
61 ; CHECK-LABEL: setbcr4:
62 ; CHECK: # %bb.0: # %entry
63 ; CHECK-NEXT: cmpw r3, r4
64 ; CHECK-NEXT: setbcr r3, lt
67 %cmp = icmp sge i8 %a, %b
68 %conv2 = zext i1 %cmp to i32
73 define dso_local void @setbcr5(i8 signext %a, i8 signext %b) {
74 ; CHECK-LE-LABEL: setbcr5:
75 ; CHECK-LE: # %bb.0: # %entry
76 ; CHECK-LE-NEXT: cmpw r3, r4
77 ; CHECK-LE-NEXT: setbcr r3, lt
78 ; CHECK-LE-NEXT: pstb r3, globalVal@PCREL(0), 1
81 ; CHECK-BE-LABEL: setbcr5:
82 ; CHECK-BE: # %bb.0: # %entry
83 ; CHECK-BE-NEXT: cmpw r3, r4
84 ; CHECK-BE-NEXT: addis r4, r2, globalVal@toc@ha
85 ; CHECK-BE-NEXT: setbcr r3, lt
86 ; CHECK-BE-NEXT: stb r3, globalVal@toc@l(r4)
89 %cmp = icmp sge i8 %a, %b
90 %conv3 = zext i1 %cmp to i8
91 store i8 %conv3, i8* @globalVal, align 1
96 define dso_local void @setbcr6(i32 signext %a, i32 signext %b) {
97 ; CHECK-LE-LABEL: setbcr6:
98 ; CHECK-LE: # %bb.0: # %entry
99 ; CHECK-LE-NEXT: cmpw r3, r4
100 ; CHECK-LE-NEXT: setbcr r3, lt
101 ; CHECK-LE-NEXT: pstw r3, globalVal2@PCREL(0), 1
104 ; CHECK-BE-LABEL: setbcr6:
105 ; CHECK-BE: # %bb.0: # %entry
106 ; CHECK-BE-NEXT: cmpw r3, r4
107 ; CHECK-BE-NEXT: addis r4, r2, globalVal2@toc@ha
108 ; CHECK-BE-NEXT: setbcr r3, lt
109 ; CHECK-BE-NEXT: stw r3, globalVal2@toc@l(r4)
112 %cmp = icmp sge i32 %a, %b
113 %conv = zext i1 %cmp to i32
114 store i32 %conv, i32* @globalVal2, align 4
119 define dso_local signext i32 @setbcr7(i64 %a, i64 %b) {
120 ; CHECK-LABEL: setbcr7:
121 ; CHECK: # %bb.0: # %entry
122 ; CHECK-NEXT: cmpd r3, r4
123 ; CHECK-NEXT: setbcr r3, lt
126 %cmp = icmp sge i64 %a, %b
127 %conv = zext i1 %cmp to i32
132 define signext i64 @setbcr8(i64 %a, i64 %b) {
133 ; CHECK-LABEL: setbcr8:
134 ; CHECK: # %bb.0: # %entry
135 ; CHECK-NEXT: cmpd r3, r4
136 ; CHECK-NEXT: setbcr r3, lt
139 %cmp = icmp sge i64 %a, %b
140 %conv = zext i1 %cmp to i64
145 define dso_local void @setbcr9(i64 %a, i64 %b) {
146 ; CHECK-LE-LABEL: setbcr9:
147 ; CHECK-LE: # %bb.0: # %entry
148 ; CHECK-LE-NEXT: cmpd r3, r4
149 ; CHECK-LE-NEXT: setbcr r3, lt
150 ; CHECK-LE-NEXT: pstd r3, globalVal3@PCREL(0), 1
153 ; CHECK-BE-LABEL: setbcr9:
154 ; CHECK-BE: # %bb.0: # %entry
155 ; CHECK-BE-NEXT: cmpd r3, r4
156 ; CHECK-BE-NEXT: addis r4, r2, globalVal3@toc@ha
157 ; CHECK-BE-NEXT: setbcr r3, lt
158 ; CHECK-BE-NEXT: std r3, globalVal3@toc@l(r4)
161 %cmp = icmp sge i64 %a, %b
162 %conv1 = zext i1 %cmp to i64
163 store i64 %conv1, i64* @globalVal3, align 8
168 define dso_local signext i32 @setbcr10(i16 signext %a, i16 signext %b) {
169 ; CHECK-LABEL: setbcr10:
170 ; CHECK: # %bb.0: # %entry
171 ; CHECK-NEXT: cmpw r3, r4
172 ; CHECK-NEXT: setbcr r3, lt
175 %cmp = icmp sge i16 %a, %b
176 %conv2 = zext i1 %cmp to i32
181 define dso_local void @setbcr11(i16 signext %a, i16 signext %b) {
182 ; CHECK-LE-LABEL: setbcr11:
183 ; CHECK-LE: # %bb.0: # %entry
184 ; CHECK-LE-NEXT: cmpw r3, r4
185 ; CHECK-LE-NEXT: setbcr r3, lt
186 ; CHECK-LE-NEXT: psth r3, globalVal4@PCREL(0), 1
189 ; CHECK-BE-LABEL: setbcr11:
190 ; CHECK-BE: # %bb.0: # %entry
191 ; CHECK-BE-NEXT: cmpw r3, r4
192 ; CHECK-BE-NEXT: addis r4, r2, globalVal4@toc@ha
193 ; CHECK-BE-NEXT: setbcr r3, lt
194 ; CHECK-BE-NEXT: sth r3, globalVal4@toc@l(r4)
197 %cmp = icmp sge i16 %a, %b
198 %conv3 = zext i1 %cmp to i16
199 store i16 %conv3, i16* @globalVal4, align 2
204 define dso_local signext i32 @setbcr12(i64 %a, i64 %b) {
205 ; CHECK-LABEL: setbcr12:
206 ; CHECK: # %bb.0: # %entry
207 ; CHECK-NEXT: cmpld r3, r4
208 ; CHECK-NEXT: setbcr r3, lt
211 %cmp = icmp uge i64 %a, %b
212 %conv = zext i1 %cmp to i32
217 define dso_local void @setbcr13(i64 %a, i64 %b) {
218 ; CHECK-LE-LABEL: setbcr13:
219 ; CHECK-LE: # %bb.0: # %entry
220 ; CHECK-LE-NEXT: cmpld r3, r4
221 ; CHECK-LE-NEXT: setbcr r3, lt
222 ; CHECK-LE-NEXT: pstd r3, globalVal3@PCREL(0), 1
225 ; CHECK-BE-LABEL: setbcr13:
226 ; CHECK-BE: # %bb.0: # %entry
227 ; CHECK-BE-NEXT: cmpld r3, r4
228 ; CHECK-BE-NEXT: addis r4, r2, globalVal3@toc@ha
229 ; CHECK-BE-NEXT: setbcr r3, lt
230 ; CHECK-BE-NEXT: std r3, globalVal3@toc@l(r4)
233 %cmp = icmp uge i64 %a, %b
234 %conv1 = zext i1 %cmp to i64
235 store i64 %conv1, i64* @globalVal3
240 define dso_local signext i32 @setbcr14(i8 signext %a, i8 signext %b) {
241 ; CHECK-LABEL: setbcr14:
242 ; CHECK: # %bb.0: # %entry
243 ; CHECK-NEXT: cmpw r3, r4
244 ; CHECK-NEXT: setbcr r3, gt
247 %cmp = icmp sle i8 %a, %b
248 %conv2 = zext i1 %cmp to i32
253 define dso_local void @setbcr15(i8 signext %a, i8 signext %b) {
254 ; CHECK-LE-LABEL: setbcr15:
255 ; CHECK-LE: # %bb.0: # %entry
256 ; CHECK-LE-NEXT: cmpw r3, r4
257 ; CHECK-LE-NEXT: setbcr r3, gt
258 ; CHECK-LE-NEXT: pstb r3, globalVal@PCREL(0), 1
261 ; CHECK-BE-LABEL: setbcr15:
262 ; CHECK-BE: # %bb.0: # %entry
263 ; CHECK-BE-NEXT: cmpw r3, r4
264 ; CHECK-BE-NEXT: addis r4, r2, globalVal@toc@ha
265 ; CHECK-BE-NEXT: setbcr r3, gt
266 ; CHECK-BE-NEXT: stb r3, globalVal@toc@l(r4)
269 %cmp = icmp sle i8 %a, %b
270 %conv3 = zext i1 %cmp to i8
271 store i8 %conv3, i8* @globalVal, align 1
276 define dso_local signext i32 @setbcr16(i32 signext %a, i32 signext %b) {
277 ; CHECK-LABEL: setbcr16:
278 ; CHECK: # %bb.0: # %entry
279 ; CHECK-NEXT: cmpw r3, r4
280 ; CHECK-NEXT: setbcr r3, gt
283 %cmp = icmp sle i32 %a, %b
284 %conv = zext i1 %cmp to i32
289 define dso_local void @setbcr17(i32 signext %a, i32 signext %b) {
290 ; CHECK-LE-LABEL: setbcr17:
291 ; CHECK-LE: # %bb.0: # %entry
292 ; CHECK-LE-NEXT: cmpw r3, r4
293 ; CHECK-LE-NEXT: setbcr r3, gt
294 ; CHECK-LE-NEXT: pstw r3, globalVal2@PCREL(0), 1
297 ; CHECK-BE-LABEL: setbcr17:
298 ; CHECK-BE: # %bb.0: # %entry
299 ; CHECK-BE-NEXT: cmpw r3, r4
300 ; CHECK-BE-NEXT: addis r4, r2, globalVal2@toc@ha
301 ; CHECK-BE-NEXT: setbcr r3, gt
302 ; CHECK-BE-NEXT: stw r3, globalVal2@toc@l(r4)
305 %cmp = icmp sle i32 %a, %b
306 %conv = zext i1 %cmp to i32
307 store i32 %conv, i32* @globalVal2, align 4
312 define dso_local signext i32 @setbcr18(i64 %a, i64 %b) {
313 ; CHECK-LABEL: setbcr18:
314 ; CHECK: # %bb.0: # %entry
315 ; CHECK-NEXT: cmpd r3, r4
316 ; CHECK-NEXT: setbcr r3, gt
319 %cmp = icmp sle i64 %a, %b
320 %conv = zext i1 %cmp to i32
325 define dso_local void @setbcr19(i64 %a, i64 %b) {
326 ; CHECK-LE-LABEL: setbcr19:
327 ; CHECK-LE: # %bb.0: # %entry
328 ; CHECK-LE-NEXT: cmpd r3, r4
329 ; CHECK-LE-NEXT: setbcr r3, gt
330 ; CHECK-LE-NEXT: pstd r3, globalVal3@PCREL(0), 1
333 ; CHECK-BE-LABEL: setbcr19:
334 ; CHECK-BE: # %bb.0: # %entry
335 ; CHECK-BE-NEXT: cmpd r3, r4
336 ; CHECK-BE-NEXT: addis r4, r2, globalVal3@toc@ha
337 ; CHECK-BE-NEXT: setbcr r3, gt
338 ; CHECK-BE-NEXT: std r3, globalVal3@toc@l(r4)
341 %cmp = icmp sle i64 %a, %b
342 %conv1 = zext i1 %cmp to i64
343 store i64 %conv1, i64* @globalVal3, align 8
348 define dso_local signext i32 @setbcr20(i16 signext %a, i16 signext %b) {
349 ; CHECK-LABEL: setbcr20:
350 ; CHECK: # %bb.0: # %entry
351 ; CHECK-NEXT: cmpw r3, r4
352 ; CHECK-NEXT: setbcr r3, gt
355 %cmp = icmp sle i16 %a, %b
356 %conv2 = zext i1 %cmp to i32
361 define dso_local void @setbcr21(i16 signext %a, i16 signext %b) {
362 ; CHECK-LE-LABEL: setbcr21:
363 ; CHECK-LE: # %bb.0: # %entry
364 ; CHECK-LE-NEXT: cmpw r3, r4
365 ; CHECK-LE-NEXT: setbcr r3, gt
366 ; CHECK-LE-NEXT: psth r3, globalVal4@PCREL(0), 1
369 ; CHECK-BE-LABEL: setbcr21:
370 ; CHECK-BE: # %bb.0: # %entry
371 ; CHECK-BE-NEXT: cmpw r3, r4
372 ; CHECK-BE-NEXT: addis r4, r2, globalVal4@toc@ha
373 ; CHECK-BE-NEXT: setbcr r3, gt
374 ; CHECK-BE-NEXT: sth r3, globalVal4@toc@l(r4)
377 %cmp = icmp sle i16 %a, %b
378 %conv3 = zext i1 %cmp to i16
379 store i16 %conv3, i16* @globalVal4, align 2
384 define dso_local signext i32 @setbcr22(i64 %a, i64 %b) {
385 ; CHECK-LABEL: setbcr22:
386 ; CHECK: # %bb.0: # %entry
387 ; CHECK-NEXT: cmpld r3, r4
388 ; CHECK-NEXT: setbcr r3, gt
391 %cmp = icmp ule i64 %a, %b
392 %conv = zext i1 %cmp to i32
397 define dso_local void @setbcr23(i64 %a, i64 %b) {
398 ; CHECK-LE-LABEL: setbcr23:
399 ; CHECK-LE: # %bb.0: # %entry
400 ; CHECK-LE-NEXT: cmpld r3, r4
401 ; CHECK-LE-NEXT: setbcr r3, gt
402 ; CHECK-LE-NEXT: pstd r3, globalVal3@PCREL(0), 1
405 ; CHECK-BE-LABEL: setbcr23:
406 ; CHECK-BE: # %bb.0: # %entry
407 ; CHECK-BE-NEXT: cmpld r3, r4
408 ; CHECK-BE-NEXT: addis r4, r2, globalVal3@toc@ha
409 ; CHECK-BE-NEXT: setbcr r3, gt
410 ; CHECK-BE-NEXT: std r3, globalVal3@toc@l(r4)
413 %cmp = icmp ule i64 %a, %b
414 %conv1 = zext i1 %cmp to i64
415 store i64 %conv1, i64* @globalVal3
419 define dso_local signext i32 @setbcr24(i8 signext %a, i8 signext %b) {
420 ; CHECK-LABEL: setbcr24:
421 ; CHECK: # %bb.0: # %entry
422 ; CHECK-NEXT: cmpw r3, r4
423 ; CHECK-NEXT: setbcr r3, eq
426 %cmp = icmp ne i8 %a, %b
427 %conv2 = zext i1 %cmp to i32
431 define dso_local void @setbcr25(i8 signext %a, i8 signext %b) {
432 ; CHECK-LE-LABEL: setbcr25:
433 ; CHECK-LE: # %bb.0: # %entry
434 ; CHECK-LE-NEXT: cmpw r3, r4
435 ; CHECK-LE-NEXT: setbcr r3, eq
436 ; CHECK-LE-NEXT: pstb r3, globalVal@PCREL(0), 1
439 ; CHECK-BE-LABEL: setbcr25:
440 ; CHECK-BE: # %bb.0: # %entry
441 ; CHECK-BE-NEXT: cmpw r3, r4
442 ; CHECK-BE-NEXT: addis r4, r2, globalVal@toc@ha
443 ; CHECK-BE-NEXT: setbcr r3, eq
444 ; CHECK-BE-NEXT: stb r3, globalVal@toc@l(r4)
447 %cmp = icmp ne i8 %a, %b
448 %conv3 = zext i1 %cmp to i8
449 store i8 %conv3, i8* @globalVal, align 1
453 define dso_local void @setbcr26(i32 signext %a, i32 signext %b) {
454 ; CHECK-LE-LABEL: setbcr26:
455 ; CHECK-LE: # %bb.0: # %entry
456 ; CHECK-LE-NEXT: cmpw r3, r4
457 ; CHECK-LE-NEXT: setbcr r3, eq
458 ; CHECK-LE-NEXT: pstw r3, globalVal2@PCREL(0), 1
461 ; CHECK-BE-LABEL: setbcr26:
462 ; CHECK-BE: # %bb.0: # %entry
463 ; CHECK-BE-NEXT: cmpw r3, r4
464 ; CHECK-BE-NEXT: addis r4, r2, globalVal2@toc@ha
465 ; CHECK-BE-NEXT: setbcr r3, eq
466 ; CHECK-BE-NEXT: stw r3, globalVal2@toc@l(r4)
469 %cmp = icmp ne i32 %a, %b
470 %conv = zext i1 %cmp to i32
471 store i32 %conv, i32* @globalVal2, align 4
475 define dso_local signext i32 @setbcr27(i64 %a, i64 %b) {
476 ; CHECK-LABEL: setbcr27:
477 ; CHECK: # %bb.0: # %entry
478 ; CHECK-NEXT: cmpd r3, r4
479 ; CHECK-NEXT: setbcr r3, eq
482 %cmp = icmp ne i64 %a, %b
483 %conv = zext i1 %cmp to i32
487 define dso_local void @setbcr28(i64 %a, i64 %b) {
488 ; CHECK-LE-LABEL: setbcr28:
489 ; CHECK-LE: # %bb.0: # %entry
490 ; CHECK-LE-NEXT: cmpd r3, r4
491 ; CHECK-LE-NEXT: setbcr r3, eq
492 ; CHECK-LE-NEXT: pstd r3, globalVal3@PCREL(0), 1
495 ; CHECK-BE-LABEL: setbcr28:
496 ; CHECK-BE: # %bb.0: # %entry
497 ; CHECK-BE-NEXT: cmpd r3, r4
498 ; CHECK-BE-NEXT: addis r4, r2, globalVal3@toc@ha
499 ; CHECK-BE-NEXT: setbcr r3, eq
500 ; CHECK-BE-NEXT: std r3, globalVal3@toc@l(r4)
503 %cmp = icmp ne i64 %a, %b
504 %conv1 = zext i1 %cmp to i64
505 store i64 %conv1, i64* @globalVal3, align 8
509 define dso_local signext i32 @setbcr29(i16 signext %a, i16 signext %b) {
510 ; CHECK-LABEL: setbcr29:
511 ; CHECK: # %bb.0: # %entry
512 ; CHECK-NEXT: cmpw r3, r4
513 ; CHECK-NEXT: setbcr r3, eq
516 %cmp = icmp ne i16 %a, %b
517 %conv2 = zext i1 %cmp to i32
521 define dso_local void @setbcr30(i16 signext %a, i16 signext %b) {
522 ; CHECK-LE-LABEL: setbcr30:
523 ; CHECK-LE: # %bb.0: # %entry
524 ; CHECK-LE-NEXT: cmpw r3, r4
525 ; CHECK-LE-NEXT: setbcr r3, eq
526 ; CHECK-LE-NEXT: psth r3, globalVal4@PCREL(0), 1
529 ; CHECK-BE-LABEL: setbcr30:
530 ; CHECK-BE: # %bb.0: # %entry
531 ; CHECK-BE-NEXT: cmpw r3, r4
532 ; CHECK-BE-NEXT: addis r4, r2, globalVal4@toc@ha
533 ; CHECK-BE-NEXT: setbcr r3, eq
534 ; CHECK-BE-NEXT: sth r3, globalVal4@toc@l(r4)
537 %cmp = icmp ne i16 %a, %b
538 %conv3 = zext i1 %cmp to i16
539 store i16 %conv3, i16* @globalVal4, align 2
543 define dso_local signext i32 @setbcr31(i8 zeroext %a, i8 zeroext %b) {
544 ; CHECK-LABEL: setbcr31:
545 ; CHECK: # %bb.0: # %entry
546 ; CHECK-NEXT: cmpw r3, r4
547 ; CHECK-NEXT: setbcr r3, eq
550 %cmp = icmp ne i8 %a, %b
551 %conv2 = zext i1 %cmp to i32
555 define dso_local void @setbcr32(i8 zeroext %a, i8 zeroext %b) {
556 ; CHECK-LE-LABEL: setbcr32:
557 ; CHECK-LE: # %bb.0: # %entry
558 ; CHECK-LE-NEXT: cmpw r3, r4
559 ; CHECK-LE-NEXT: setbcr r3, eq
560 ; CHECK-LE-NEXT: pstb r3, globalVal@PCREL(0), 1
563 ; CHECK-BE-LABEL: setbcr32:
564 ; CHECK-BE: # %bb.0: # %entry
565 ; CHECK-BE-NEXT: cmpw r3, r4
566 ; CHECK-BE-NEXT: addis r4, r2, globalVal@toc@ha
567 ; CHECK-BE-NEXT: setbcr r3, eq
568 ; CHECK-BE-NEXT: stb r3, globalVal@toc@l(r4)
571 %cmp = icmp ne i8 %a, %b
572 %conv3 = zext i1 %cmp to i8
573 store i8 %conv3, i8* @globalVal, align 1
577 define dso_local signext i32 @setbcr33(i32 zeroext %a, i32 zeroext %b) {
578 ; CHECK-LABEL: setbcr33:
579 ; CHECK: # %bb.0: # %entry
580 ; CHECK-NEXT: cmpw r3, r4
581 ; CHECK-NEXT: setbcr r3, eq
584 %cmp = icmp ne i32 %a, %b
585 %conv = zext i1 %cmp to i32
589 define dso_local void @setbcr34(i32 zeroext %a, i32 zeroext %b) {
590 ; CHECK-LE-LABEL: setbcr34:
591 ; CHECK-LE: # %bb.0: # %entry
592 ; CHECK-LE-NEXT: cmpw r3, r4
593 ; CHECK-LE-NEXT: setbcr r3, eq
594 ; CHECK-LE-NEXT: pstw r3, globalVal2@PCREL(0), 1
597 ; CHECK-BE-LABEL: setbcr34:
598 ; CHECK-BE: # %bb.0: # %entry
599 ; CHECK-BE-NEXT: cmpw r3, r4
600 ; CHECK-BE-NEXT: addis r4, r2, globalVal2@toc@ha
601 ; CHECK-BE-NEXT: setbcr r3, eq
602 ; CHECK-BE-NEXT: stw r3, globalVal2@toc@l(r4)
605 %cmp = icmp ne i32 %a, %b
606 %conv = zext i1 %cmp to i32
607 store i32 %conv, i32* @globalVal2, align 4
611 define dso_local signext i32 @setbcr35(i16 zeroext %a, i16 zeroext %b) {
612 ; CHECK-LABEL: setbcr35:
613 ; CHECK: # %bb.0: # %entry
614 ; CHECK-NEXT: cmpw r3, r4
615 ; CHECK-NEXT: setbcr r3, eq
618 %cmp = icmp ne i16 %a, %b
619 %conv2 = zext i1 %cmp to i32
623 define dso_local void @setbcr36(i16 zeroext %a, i16 zeroext %b) {
624 ; CHECK-LE-LABEL: setbcr36:
625 ; CHECK-LE: # %bb.0: # %entry
626 ; CHECK-LE-NEXT: cmpw r3, r4
627 ; CHECK-LE-NEXT: setbcr r3, eq
628 ; CHECK-LE-NEXT: psth r3, globalVal4@PCREL(0), 1
631 ; CHECK-BE-LABEL: setbcr36:
632 ; CHECK-BE: # %bb.0: # %entry
633 ; CHECK-BE-NEXT: cmpw r3, r4
634 ; CHECK-BE-NEXT: addis r4, r2, globalVal4@toc@ha
635 ; CHECK-BE-NEXT: setbcr r3, eq
636 ; CHECK-BE-NEXT: sth r3, globalVal4@toc@l(r4)
639 %cmp = icmp ne i16 %a, %b
640 %conv3 = zext i1 %cmp to i16
641 store i16 %conv3, i16* @globalVal4, align 2
645 define i64 @setbcr37(i8 signext %a, i8 signext %b) {
646 ; CHECK-LABEL: setbcr37:
647 ; CHECK: # %bb.0: # %entry
648 ; CHECK-NEXT: cmpw r3, r4
649 ; CHECK-NEXT: setbcr r3, lt
652 %cmp = icmp sge i8 %a, %b
653 %conv3 = zext i1 %cmp to i64
657 define dso_local void @setbcr38(i8 signext %a, i8 signext %b) {
658 ; CHECK-LE-LABEL: setbcr38:
659 ; CHECK-LE: # %bb.0: # %entry
660 ; CHECK-LE-NEXT: cmpw r3, r4
661 ; CHECK-LE-NEXT: setbcr r3, lt
662 ; CHECK-LE-NEXT: pstb r3, globalVal@PCREL(0), 1
665 ; CHECK-BE-LABEL: setbcr38:
666 ; CHECK-BE: # %bb.0: # %entry
667 ; CHECK-BE-NEXT: cmpw r3, r4
668 ; CHECK-BE-NEXT: addis r4, r2, globalVal@toc@ha
669 ; CHECK-BE-NEXT: setbcr r3, lt
670 ; CHECK-BE-NEXT: stb r3, globalVal@toc@l(r4)
673 %cmp = icmp sge i8 %a, %b
674 %conv3 = zext i1 %cmp to i8
675 store i8 %conv3, i8* @globalVal, align 1
679 define i64 @setbcr39(i32 signext %a, i32 signext %b) {
680 ; CHECK-LABEL: setbcr39:
681 ; CHECK: # %bb.0: # %entry
682 ; CHECK-NEXT: cmpw r3, r4
683 ; CHECK-NEXT: setbcr r3, lt
686 %cmp = icmp sge i32 %a, %b
687 %conv1 = zext i1 %cmp to i64
691 define dso_local void @setbcr40(i32 signext %a, i32 signext %b) {
692 ; CHECK-LE-LABEL: setbcr40:
693 ; CHECK-LE: # %bb.0: # %entry
694 ; CHECK-LE-NEXT: cmpw r3, r4
695 ; CHECK-LE-NEXT: setbcr r3, lt
696 ; CHECK-LE-NEXT: pstw r3, globalVal2@PCREL(0), 1
699 ; CHECK-BE-LABEL: setbcr40:
700 ; CHECK-BE: # %bb.0: # %entry
701 ; CHECK-BE-NEXT: cmpw r3, r4
702 ; CHECK-BE-NEXT: addis r4, r2, globalVal2@toc@ha
703 ; CHECK-BE-NEXT: setbcr r3, lt
704 ; CHECK-BE-NEXT: stw r3, globalVal2@toc@l(r4)
707 %cmp = icmp sge i32 %a, %b
708 %conv = zext i1 %cmp to i32
709 store i32 %conv, i32* @globalVal2, align 4
713 define i64 @setbcr41(i64 %a, i64 %b) {
714 ; CHECK-LABEL: setbcr41:
715 ; CHECK: # %bb.0: # %entry
716 ; CHECK-NEXT: cmpd r3, r4
717 ; CHECK-NEXT: setbcr r3, lt
720 %cmp = icmp sge i64 %a, %b
721 %conv1 = zext i1 %cmp to i64
725 define dso_local void @setbcr42(i64 %a, i64 %b) {
726 ; CHECK-LE-LABEL: setbcr42:
727 ; CHECK-LE: # %bb.0: # %entry
728 ; CHECK-LE-NEXT: cmpd r3, r4
729 ; CHECK-LE-NEXT: setbcr r3, lt
730 ; CHECK-LE-NEXT: pstd r3, globalVal3@PCREL(0), 1
733 ; CHECK-BE-LABEL: setbcr42:
734 ; CHECK-BE: # %bb.0: # %entry
735 ; CHECK-BE-NEXT: cmpd r3, r4
736 ; CHECK-BE-NEXT: addis r4, r2, globalVal3@toc@ha
737 ; CHECK-BE-NEXT: setbcr r3, lt
738 ; CHECK-BE-NEXT: std r3, globalVal3@toc@l(r4)
741 %cmp = icmp sge i64 %a, %b
742 %conv1 = zext i1 %cmp to i64
743 store i64 %conv1, i64* @globalVal3, align 8
747 define i64 @setbcr43(i16 signext %a, i16 signext %b) {
748 ; CHECK-LABEL: setbcr43:
749 ; CHECK: # %bb.0: # %entry
750 ; CHECK-NEXT: cmpw r3, r4
751 ; CHECK-NEXT: setbcr r3, lt
754 %cmp = icmp sge i16 %a, %b
755 %conv3 = zext i1 %cmp to i64
759 define dso_local void @setbcr44(i16 signext %a, i16 signext %b) {
760 ; CHECK-LE-LABEL: setbcr44:
761 ; CHECK-LE: # %bb.0: # %entry
762 ; CHECK-LE-NEXT: cmpw r3, r4
763 ; CHECK-LE-NEXT: setbcr r3, lt
764 ; CHECK-LE-NEXT: psth r3, globalVal4@PCREL(0), 1
767 ; CHECK-BE-LABEL: setbcr44:
768 ; CHECK-BE: # %bb.0: # %entry
769 ; CHECK-BE-NEXT: cmpw r3, r4
770 ; CHECK-BE-NEXT: addis r4, r2, globalVal4@toc@ha
771 ; CHECK-BE-NEXT: setbcr r3, lt
772 ; CHECK-BE-NEXT: sth r3, globalVal4@toc@l(r4)
775 %cmp = icmp sge i16 %a, %b
776 %conv3 = zext i1 %cmp to i16
777 store i16 %conv3, i16* @globalVal4, align 2
782 define i64 @setbcr45(i64 %a, i64 %b) {
783 ; CHECK-LABEL: setbcr45:
784 ; CHECK: # %bb.0: # %entry
785 ; CHECK-NEXT: cmpld r3, r4
786 ; CHECK-NEXT: setbcr r3, lt
789 %cmp = icmp uge i64 %a, %b
790 %conv1 = zext i1 %cmp to i64
795 define dso_local void @setbcr46(i64 %a, i64 %b) {
796 ; CHECK-LE-LABEL: setbcr46:
797 ; CHECK-LE: # %bb.0: # %entry
798 ; CHECK-LE-NEXT: cmpld r3, r4
799 ; CHECK-LE-NEXT: setbcr r3, lt
800 ; CHECK-LE-NEXT: pstd r3, globalVal3@PCREL(0), 1
803 ; CHECK-BE-LABEL: setbcr46:
804 ; CHECK-BE: # %bb.0: # %entry
805 ; CHECK-BE-NEXT: cmpld r3, r4
806 ; CHECK-BE-NEXT: addis r4, r2, globalVal3@toc@ha
807 ; CHECK-BE-NEXT: setbcr r3, lt
808 ; CHECK-BE-NEXT: std r3, globalVal3@toc@l(r4)
811 %cmp = icmp uge i64 %a, %b
812 %conv1 = zext i1 %cmp to i64
813 store i64 %conv1, i64* @globalVal3
817 define i64 @setbcr47(i8 signext %a, i8 signext %b) {
818 ; CHECK-LABEL: setbcr47:
819 ; CHECK: # %bb.0: # %entry
820 ; CHECK-NEXT: cmpw r3, r4
821 ; CHECK-NEXT: setbcr r3, gt
824 %cmp = icmp sle i8 %a, %b
825 %conv3 = zext i1 %cmp to i64
829 define dso_local void @setbcr48(i8 signext %a, i8 signext %b) {
830 ; CHECK-LE-LABEL: setbcr48:
831 ; CHECK-LE: # %bb.0: # %entry
832 ; CHECK-LE-NEXT: cmpw r3, r4
833 ; CHECK-LE-NEXT: setbcr r3, gt
834 ; CHECK-LE-NEXT: pstb r3, globalVal@PCREL(0), 1
837 ; CHECK-BE-LABEL: setbcr48:
838 ; CHECK-BE: # %bb.0: # %entry
839 ; CHECK-BE-NEXT: cmpw r3, r4
840 ; CHECK-BE-NEXT: addis r4, r2, globalVal@toc@ha
841 ; CHECK-BE-NEXT: setbcr r3, gt
842 ; CHECK-BE-NEXT: stb r3, globalVal@toc@l(r4)
845 %cmp = icmp sle i8 %a, %b
846 %conv3 = zext i1 %cmp to i8
847 store i8 %conv3, i8* @globalVal, align 1
851 define i64 @setbcr49(i32 signext %a, i32 signext %b) {
852 ; CHECK-LABEL: setbcr49:
853 ; CHECK: # %bb.0: # %entry
854 ; CHECK-NEXT: cmpw r3, r4
855 ; CHECK-NEXT: setbcr r3, gt
858 %cmp = icmp sle i32 %a, %b
859 %conv1 = zext i1 %cmp to i64
863 define dso_local void @setbcr50(i32 signext %a, i32 signext %b) {
864 ; CHECK-LE-LABEL: setbcr50:
865 ; CHECK-LE: # %bb.0: # %entry
866 ; CHECK-LE-NEXT: cmpw r3, r4
867 ; CHECK-LE-NEXT: setbcr r3, gt
868 ; CHECK-LE-NEXT: pstw r3, globalVal2@PCREL(0), 1
871 ; CHECK-BE-LABEL: setbcr50:
872 ; CHECK-BE: # %bb.0: # %entry
873 ; CHECK-BE-NEXT: cmpw r3, r4
874 ; CHECK-BE-NEXT: addis r4, r2, globalVal2@toc@ha
875 ; CHECK-BE-NEXT: setbcr r3, gt
876 ; CHECK-BE-NEXT: stw r3, globalVal2@toc@l(r4)
879 %cmp = icmp sle i32 %a, %b
880 %conv = zext i1 %cmp to i32
881 store i32 %conv, i32* @globalVal2, align 4
886 define i64 @setbcr51(i64 %a, i64 %b) {
887 ; CHECK-LABEL: setbcr51:
888 ; CHECK: # %bb.0: # %entry
889 ; CHECK-NEXT: cmpd r3, r4
890 ; CHECK-NEXT: setbcr r3, gt
893 %cmp = icmp sle i64 %a, %b
894 %conv1 = zext i1 %cmp to i64
899 define dso_local void @setbcr52(i64 %a, i64 %b) {
900 ; CHECK-LE-LABEL: setbcr52:
901 ; CHECK-LE: # %bb.0: # %entry
902 ; CHECK-LE-NEXT: cmpd r3, r4
903 ; CHECK-LE-NEXT: setbcr r3, gt
904 ; CHECK-LE-NEXT: pstd r3, globalVal3@PCREL(0), 1
907 ; CHECK-BE-LABEL: setbcr52:
908 ; CHECK-BE: # %bb.0: # %entry
909 ; CHECK-BE-NEXT: cmpd r3, r4
910 ; CHECK-BE-NEXT: addis r4, r2, globalVal3@toc@ha
911 ; CHECK-BE-NEXT: setbcr r3, gt
912 ; CHECK-BE-NEXT: std r3, globalVal3@toc@l(r4)
915 %cmp = icmp sle i64 %a, %b
916 %conv1 = zext i1 %cmp to i64
917 store i64 %conv1, i64* @globalVal3, align 8
921 define i64 @setbcr53(i16 signext %a, i16 signext %b) {
922 ; CHECK-LABEL: setbcr53:
923 ; CHECK: # %bb.0: # %entry
924 ; CHECK-NEXT: cmpw r3, r4
925 ; CHECK-NEXT: setbcr r3, gt
928 %cmp = icmp sle i16 %a, %b
929 %conv3 = zext i1 %cmp to i64
933 define dso_local void @setbcr54(i16 signext %a, i16 signext %b) {
934 ; CHECK-LE-LABEL: setbcr54:
935 ; CHECK-LE: # %bb.0: # %entry
936 ; CHECK-LE-NEXT: cmpw r3, r4
937 ; CHECK-LE-NEXT: setbcr r3, gt
938 ; CHECK-LE-NEXT: psth r3, globalVal4@PCREL(0), 1
941 ; CHECK-BE-LABEL: setbcr54:
942 ; CHECK-BE: # %bb.0: # %entry
943 ; CHECK-BE-NEXT: cmpw r3, r4
944 ; CHECK-BE-NEXT: addis r4, r2, globalVal4@toc@ha
945 ; CHECK-BE-NEXT: setbcr r3, gt
946 ; CHECK-BE-NEXT: sth r3, globalVal4@toc@l(r4)
949 %cmp = icmp sle i16 %a, %b
950 %conv3 = zext i1 %cmp to i16
951 store i16 %conv3, i16* @globalVal4, align 2
956 define i64 @setbcr55(i64 %a, i64 %b) {
957 ; CHECK-LABEL: setbcr55:
958 ; CHECK: # %bb.0: # %entry
959 ; CHECK-NEXT: cmpld r3, r4
960 ; CHECK-NEXT: setbcr r3, gt
963 %cmp = icmp ule i64 %a, %b
964 %conv1 = zext i1 %cmp to i64
969 define dso_local void @setbcr56(i64 %a, i64 %b) {
970 ; CHECK-LE-LABEL: setbcr56:
971 ; CHECK-LE: # %bb.0: # %entry
972 ; CHECK-LE-NEXT: cmpld r3, r4
973 ; CHECK-LE-NEXT: setbcr r3, gt
974 ; CHECK-LE-NEXT: pstd r3, globalVal3@PCREL(0), 1
977 ; CHECK-BE-LABEL: setbcr56:
978 ; CHECK-BE: # %bb.0: # %entry
979 ; CHECK-BE-NEXT: cmpld r3, r4
980 ; CHECK-BE-NEXT: addis r4, r2, globalVal3@toc@ha
981 ; CHECK-BE-NEXT: setbcr r3, gt
982 ; CHECK-BE-NEXT: std r3, globalVal3@toc@l(r4)
985 %cmp = icmp ule i64 %a, %b
986 %conv1 = zext i1 %cmp to i64
987 store i64 %conv1, i64* @globalVal3
991 define i64 @setbcr57(i64 %a, i64 %b) {
992 ; CHECK-LABEL: setbcr57:
993 ; CHECK: # %bb.0: # %entry
994 ; CHECK-NEXT: cmpd r3, r4
995 ; CHECK-NEXT: setbcr r3, eq
998 %cmp = icmp ne i64 %a, %b
999 %conv1 = zext i1 %cmp to i64
1003 define dso_local void @setbcr58(i64 %a, i64 %b) {
1004 ; CHECK-LE-LABEL: setbcr58:
1005 ; CHECK-LE: # %bb.0: # %entry
1006 ; CHECK-LE-NEXT: cmpd r3, r4
1007 ; CHECK-LE-NEXT: setbcr r3, eq
1008 ; CHECK-LE-NEXT: pstd r3, globalVal3@PCREL(0), 1
1009 ; CHECK-LE-NEXT: blr
1011 ; CHECK-BE-LABEL: setbcr58:
1012 ; CHECK-BE: # %bb.0: # %entry
1013 ; CHECK-BE-NEXT: cmpd r3, r4
1014 ; CHECK-BE-NEXT: addis r4, r2, globalVal3@toc@ha
1015 ; CHECK-BE-NEXT: setbcr r3, eq
1016 ; CHECK-BE-NEXT: std r3, globalVal3@toc@l(r4)
1017 ; CHECK-BE-NEXT: blr
1019 %cmp = icmp ne i64 %a, %b
1020 %conv1 = zext i1 %cmp to i64
1021 store i64 %conv1, i64* @globalVal3, align 8
1025 define i64 @setbcr59(i64 %a, i64 %b) {
1026 ; CHECK-LABEL: setbcr59:
1027 ; CHECK: # %bb.0: # %entry
1028 ; CHECK-NEXT: cmpd r3, r4
1029 ; CHECK-NEXT: setbcr r3, eq
1032 %cmp = icmp ne i64 %a, %b
1033 %conv1 = zext i1 %cmp to i64
1037 define dso_local void @setbcr60(i64 %a, i64 %b) {
1038 ; CHECK-LE-LABEL: setbcr60:
1039 ; CHECK-LE: # %bb.0: # %entry
1040 ; CHECK-LE-NEXT: cmpd r3, r4
1041 ; CHECK-LE-NEXT: setbcr r3, eq
1042 ; CHECK-LE-NEXT: pstd r3, globalVal3@PCREL(0), 1
1043 ; CHECK-LE-NEXT: blr
1045 ; CHECK-BE-LABEL: setbcr60:
1046 ; CHECK-BE: # %bb.0: # %entry
1047 ; CHECK-BE-NEXT: cmpd r3, r4
1048 ; CHECK-BE-NEXT: addis r4, r2, globalVal3@toc@ha
1049 ; CHECK-BE-NEXT: setbcr r3, eq
1050 ; CHECK-BE-NEXT: std r3, globalVal3@toc@l(r4)
1051 ; CHECK-BE-NEXT: blr
1053 %cmp = icmp ne i64 %a, %b
1054 %conv1 = zext i1 %cmp to i64
1055 store i64 %conv1, i64* @globalVal3, align 8