1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=powerpc64le-unknown-unknown -verify-machineinstrs -mattr=+isel | FileCheck %s --check-prefix=ALL --check-prefix=ISEL
3 ; RUN: llc < %s -mtriple=powerpc64le-unknown-unknown -verify-machineinstrs -mattr=-isel | FileCheck %s --check-prefix=ALL --check-prefix=NO_ISEL
5 ; Select of constants: control flow / conditional moves can always be replaced by logic+math (but may not be worth it?).
6 ; Test the zeroext/signext variants of each pattern to see if that makes a difference.
8 ; select Cond, 0, 1 --> zext (!Cond)
10 define i32 @select_0_or_1(i1 %cond) {
11 ; ALL-LABEL: select_0_or_1:
14 ; ALL-NEXT: clrldi 3, 3, 63
16 %sel = select i1 %cond, i32 0, i32 1
20 define i32 @select_0_or_1_zeroext(i1 zeroext %cond) {
21 ; ALL-LABEL: select_0_or_1_zeroext:
23 ; ALL-NEXT: xori 3, 3, 1
25 %sel = select i1 %cond, i32 0, i32 1
29 define i32 @select_0_or_1_signext(i1 signext %cond) {
30 ; ALL-LABEL: select_0_or_1_signext:
33 ; ALL-NEXT: clrldi 3, 3, 63
35 %sel = select i1 %cond, i32 0, i32 1
39 ; select Cond, 1, 0 --> zext (Cond)
41 define i32 @select_1_or_0(i1 %cond) {
42 ; ALL-LABEL: select_1_or_0:
44 ; ALL-NEXT: clrldi 3, 3, 63
46 %sel = select i1 %cond, i32 1, i32 0
50 define i32 @select_1_or_0_zeroext(i1 zeroext %cond) {
51 ; ALL-LABEL: select_1_or_0_zeroext:
54 %sel = select i1 %cond, i32 1, i32 0
58 define i32 @select_1_or_0_signext(i1 signext %cond) {
59 ; ALL-LABEL: select_1_or_0_signext:
61 ; ALL-NEXT: clrldi 3, 3, 63
63 %sel = select i1 %cond, i32 1, i32 0
67 ; select Cond, 0, -1 --> sext (!Cond)
69 define i32 @select_0_or_neg1(i1 %cond) {
70 ; ALL-LABEL: select_0_or_neg1:
72 ; ALL-NEXT: clrldi 3, 3, 63
73 ; ALL-NEXT: addi 3, 3, -1
75 %sel = select i1 %cond, i32 0, i32 -1
79 define i32 @select_0_or_neg1_zeroext(i1 zeroext %cond) {
80 ; ALL-LABEL: select_0_or_neg1_zeroext:
82 ; ALL-NEXT: addi 3, 3, -1
84 %sel = select i1 %cond, i32 0, i32 -1
88 define i32 @select_0_or_neg1_signext(i1 signext %cond) {
89 ; ALL-LABEL: select_0_or_neg1_signext:
93 %sel = select i1 %cond, i32 0, i32 -1
97 ; select Cond, -1, 0 --> sext (Cond)
99 define i32 @select_neg1_or_0(i1 %cond) {
100 ; ALL-LABEL: select_neg1_or_0:
102 ; ALL-NEXT: clrldi 3, 3, 63
105 %sel = select i1 %cond, i32 -1, i32 0
109 define i32 @select_neg1_or_0_zeroext(i1 zeroext %cond) {
110 ; ALL-LABEL: select_neg1_or_0_zeroext:
114 %sel = select i1 %cond, i32 -1, i32 0
118 define i32 @select_neg1_or_0_signext(i1 signext %cond) {
119 ; ALL-LABEL: select_neg1_or_0_signext:
122 %sel = select i1 %cond, i32 -1, i32 0
126 ; select Cond, C+1, C --> add (zext Cond), C
128 define i32 @select_Cplus1_C(i1 %cond) {
129 ; ALL-LABEL: select_Cplus1_C:
131 ; ALL-NEXT: clrldi 3, 3, 63
132 ; ALL-NEXT: addi 3, 3, 41
134 %sel = select i1 %cond, i32 42, i32 41
138 define i32 @select_Cplus1_C_zeroext(i1 zeroext %cond) {
139 ; ALL-LABEL: select_Cplus1_C_zeroext:
141 ; ALL-NEXT: addi 3, 3, 41
143 %sel = select i1 %cond, i32 42, i32 41
147 define i32 @select_Cplus1_C_signext(i1 signext %cond) {
148 ; ALL-LABEL: select_Cplus1_C_signext:
150 ; ALL-NEXT: subfic 3, 3, 41
152 %sel = select i1 %cond, i32 42, i32 41
156 ; select Cond, C, C+1 --> add (sext Cond), C
158 define i32 @select_C_Cplus1(i1 %cond) {
159 ; ALL-LABEL: select_C_Cplus1:
161 ; ALL-NEXT: clrldi 3, 3, 63
162 ; ALL-NEXT: subfic 3, 3, 42
164 %sel = select i1 %cond, i32 41, i32 42
168 define i32 @select_C_Cplus1_zeroext(i1 zeroext %cond) {
169 ; ALL-LABEL: select_C_Cplus1_zeroext:
171 ; ALL-NEXT: subfic 3, 3, 42
173 %sel = select i1 %cond, i32 41, i32 42
177 define i32 @select_C_Cplus1_signext(i1 signext %cond) {
178 ; ALL-LABEL: select_C_Cplus1_signext:
180 ; ALL-NEXT: addi 3, 3, 42
182 %sel = select i1 %cond, i32 41, i32 42
186 ; In general, select of 2 constants could be:
187 ; select Cond, C1, C2 --> add (mul (zext Cond), C1-C2), C2 --> add (and (sext Cond), C1-C2), C2
189 define i32 @select_C1_C2(i1 %cond) {
190 ; ISEL-LABEL: select_C1_C2:
192 ; ISEL-NEXT: andi. 3, 3, 1
193 ; ISEL-NEXT: li 4, 421
194 ; ISEL-NEXT: li 3, 42
195 ; ISEL-NEXT: iselgt 3, 4, 3
198 ; NO_ISEL-LABEL: select_C1_C2:
200 ; NO_ISEL-NEXT: andi. 3, 3, 1
201 ; NO_ISEL-NEXT: li 4, 421
202 ; NO_ISEL-NEXT: li 3, 42
203 ; NO_ISEL-NEXT: bc 12, 1, .LBB18_1
205 ; NO_ISEL-NEXT: .LBB18_1:
206 ; NO_ISEL-NEXT: addi 3, 4, 0
208 %sel = select i1 %cond, i32 421, i32 42
212 define i32 @select_C1_C2_zeroext(i1 zeroext %cond) {
213 ; ISEL-LABEL: select_C1_C2_zeroext:
215 ; ISEL-NEXT: andi. 3, 3, 1
216 ; ISEL-NEXT: li 4, 421
217 ; ISEL-NEXT: li 3, 42
218 ; ISEL-NEXT: iselgt 3, 4, 3
221 ; NO_ISEL-LABEL: select_C1_C2_zeroext:
223 ; NO_ISEL-NEXT: andi. 3, 3, 1
224 ; NO_ISEL-NEXT: li 4, 421
225 ; NO_ISEL-NEXT: li 3, 42
226 ; NO_ISEL-NEXT: bc 12, 1, .LBB19_1
228 ; NO_ISEL-NEXT: .LBB19_1:
229 ; NO_ISEL-NEXT: addi 3, 4, 0
231 %sel = select i1 %cond, i32 421, i32 42
235 define i32 @select_C1_C2_signext(i1 signext %cond) {
236 ; ISEL-LABEL: select_C1_C2_signext:
238 ; ISEL-NEXT: andi. 3, 3, 1
239 ; ISEL-NEXT: li 4, 421
240 ; ISEL-NEXT: li 3, 42
241 ; ISEL-NEXT: iselgt 3, 4, 3
244 ; NO_ISEL-LABEL: select_C1_C2_signext:
246 ; NO_ISEL-NEXT: andi. 3, 3, 1
247 ; NO_ISEL-NEXT: li 4, 421
248 ; NO_ISEL-NEXT: li 3, 42
249 ; NO_ISEL-NEXT: bc 12, 1, .LBB20_1
251 ; NO_ISEL-NEXT: .LBB20_1:
252 ; NO_ISEL-NEXT: addi 3, 4, 0
254 %sel = select i1 %cond, i32 421, i32 42
258 ; A binary operator with constant after the select should always get folded into the select.
260 define i8 @sel_constants_add_constant(i1 %cond) {
261 ; ISEL-LABEL: sel_constants_add_constant:
263 ; ISEL-NEXT: andi. 3, 3, 1
265 ; ISEL-NEXT: li 3, 28
266 ; ISEL-NEXT: iselgt 3, 4, 3
269 ; NO_ISEL-LABEL: sel_constants_add_constant:
271 ; NO_ISEL-NEXT: andi. 3, 3, 1
272 ; NO_ISEL-NEXT: li 4, 1
273 ; NO_ISEL-NEXT: li 3, 28
274 ; NO_ISEL-NEXT: bc 12, 1, .LBB21_1
276 ; NO_ISEL-NEXT: .LBB21_1:
277 ; NO_ISEL-NEXT: addi 3, 4, 0
279 %sel = select i1 %cond, i8 -4, i8 23
284 define i8 @sel_constants_sub_constant(i1 %cond) {
285 ; ISEL-LABEL: sel_constants_sub_constant:
287 ; ISEL-NEXT: andi. 3, 3, 1
288 ; ISEL-NEXT: li 4, -9
289 ; ISEL-NEXT: li 3, 18
290 ; ISEL-NEXT: iselgt 3, 4, 3
293 ; NO_ISEL-LABEL: sel_constants_sub_constant:
295 ; NO_ISEL-NEXT: andi. 3, 3, 1
296 ; NO_ISEL-NEXT: li 4, -9
297 ; NO_ISEL-NEXT: li 3, 18
298 ; NO_ISEL-NEXT: bc 12, 1, .LBB22_1
300 ; NO_ISEL-NEXT: .LBB22_1:
301 ; NO_ISEL-NEXT: addi 3, 4, 0
303 %sel = select i1 %cond, i8 -4, i8 23
308 define i8 @sel_constants_sub_constant_sel_constants(i1 %cond) {
309 ; ISEL-LABEL: sel_constants_sub_constant_sel_constants:
311 ; ISEL-NEXT: andi. 3, 3, 1
314 ; ISEL-NEXT: iselgt 3, 4, 3
317 ; NO_ISEL-LABEL: sel_constants_sub_constant_sel_constants:
319 ; NO_ISEL-NEXT: andi. 3, 3, 1
320 ; NO_ISEL-NEXT: li 4, 9
321 ; NO_ISEL-NEXT: li 3, 2
322 ; NO_ISEL-NEXT: bc 12, 1, .LBB23_1
324 ; NO_ISEL-NEXT: .LBB23_1:
325 ; NO_ISEL-NEXT: addi 3, 4, 0
327 %sel = select i1 %cond, i8 -4, i8 3
332 define i8 @sel_constants_mul_constant(i1 %cond) {
333 ; ISEL-LABEL: sel_constants_mul_constant:
335 ; ISEL-NEXT: andi. 3, 3, 1
336 ; ISEL-NEXT: li 4, -20
337 ; ISEL-NEXT: li 3, 115
338 ; ISEL-NEXT: iselgt 3, 4, 3
341 ; NO_ISEL-LABEL: sel_constants_mul_constant:
343 ; NO_ISEL-NEXT: andi. 3, 3, 1
344 ; NO_ISEL-NEXT: li 4, -20
345 ; NO_ISEL-NEXT: li 3, 115
346 ; NO_ISEL-NEXT: bc 12, 1, .LBB24_1
348 ; NO_ISEL-NEXT: .LBB24_1:
349 ; NO_ISEL-NEXT: addi 3, 4, 0
351 %sel = select i1 %cond, i8 -4, i8 23
356 define i8 @sel_constants_sdiv_constant(i1 %cond) {
357 ; ISEL-LABEL: sel_constants_sdiv_constant:
359 ; ISEL-NEXT: andi. 3, 3, 1
361 ; ISEL-NEXT: iselgt 3, 0, 3
364 ; NO_ISEL-LABEL: sel_constants_sdiv_constant:
366 ; NO_ISEL-NEXT: andi. 3, 3, 1
367 ; NO_ISEL-NEXT: li 3, 4
368 ; NO_ISEL-NEXT: bc 12, 1, .LBB25_1
370 ; NO_ISEL-NEXT: .LBB25_1:
371 ; NO_ISEL-NEXT: li 3, 0
373 %sel = select i1 %cond, i8 -4, i8 23
374 %bo = sdiv i8 %sel, 5
378 define i8 @sdiv_constant_sel_constants(i1 %cond) {
379 ; ISEL-LABEL: sdiv_constant_sel_constants:
381 ; ISEL-NEXT: andi. 3, 3, 1
383 ; ISEL-NEXT: iselgt 3, 0, 3
386 ; NO_ISEL-LABEL: sdiv_constant_sel_constants:
388 ; NO_ISEL-NEXT: andi. 3, 3, 1
389 ; NO_ISEL-NEXT: li 3, 5
390 ; NO_ISEL-NEXT: bc 12, 1, .LBB26_1
392 ; NO_ISEL-NEXT: .LBB26_1:
393 ; NO_ISEL-NEXT: li 3, 0
395 %sel = select i1 %cond, i8 121, i8 23
396 %bo = sdiv i8 120, %sel
400 define i8 @sel_constants_udiv_constant(i1 %cond) {
401 ; ISEL-LABEL: sel_constants_udiv_constant:
403 ; ISEL-NEXT: andi. 3, 3, 1
404 ; ISEL-NEXT: li 4, 50
406 ; ISEL-NEXT: iselgt 3, 4, 3
409 ; NO_ISEL-LABEL: sel_constants_udiv_constant:
411 ; NO_ISEL-NEXT: andi. 3, 3, 1
412 ; NO_ISEL-NEXT: li 4, 50
413 ; NO_ISEL-NEXT: li 3, 4
414 ; NO_ISEL-NEXT: bc 12, 1, .LBB27_1
416 ; NO_ISEL-NEXT: .LBB27_1:
417 ; NO_ISEL-NEXT: addi 3, 4, 0
419 %sel = select i1 %cond, i8 -4, i8 23
420 %bo = udiv i8 %sel, 5
424 define i8 @udiv_constant_sel_constants(i1 %cond) {
425 ; ISEL-LABEL: udiv_constant_sel_constants:
427 ; ISEL-NEXT: andi. 3, 3, 1
429 ; ISEL-NEXT: iselgt 3, 0, 3
432 ; NO_ISEL-LABEL: udiv_constant_sel_constants:
434 ; NO_ISEL-NEXT: andi. 3, 3, 1
435 ; NO_ISEL-NEXT: li 3, 5
436 ; NO_ISEL-NEXT: bc 12, 1, .LBB28_1
438 ; NO_ISEL-NEXT: .LBB28_1:
439 ; NO_ISEL-NEXT: li 3, 0
441 %sel = select i1 %cond, i8 -4, i8 23
442 %bo = udiv i8 120, %sel
446 define i8 @sel_constants_srem_constant(i1 %cond) {
447 ; ISEL-LABEL: sel_constants_srem_constant:
449 ; ISEL-NEXT: andi. 3, 3, 1
450 ; ISEL-NEXT: li 4, -4
452 ; ISEL-NEXT: iselgt 3, 4, 3
455 ; NO_ISEL-LABEL: sel_constants_srem_constant:
457 ; NO_ISEL-NEXT: andi. 3, 3, 1
458 ; NO_ISEL-NEXT: li 4, -4
459 ; NO_ISEL-NEXT: li 3, 3
460 ; NO_ISEL-NEXT: bc 12, 1, .LBB29_1
462 ; NO_ISEL-NEXT: .LBB29_1:
463 ; NO_ISEL-NEXT: addi 3, 4, 0
465 %sel = select i1 %cond, i8 -4, i8 23
466 %bo = srem i8 %sel, 5
470 define i8 @srem_constant_sel_constants(i1 %cond) {
471 ; ISEL-LABEL: srem_constant_sel_constants:
473 ; ISEL-NEXT: andi. 3, 3, 1
474 ; ISEL-NEXT: li 4, 120
476 ; ISEL-NEXT: iselgt 3, 4, 3
479 ; NO_ISEL-LABEL: srem_constant_sel_constants:
481 ; NO_ISEL-NEXT: andi. 3, 3, 1
482 ; NO_ISEL-NEXT: li 4, 120
483 ; NO_ISEL-NEXT: li 3, 5
484 ; NO_ISEL-NEXT: bc 12, 1, .LBB30_1
486 ; NO_ISEL-NEXT: .LBB30_1:
487 ; NO_ISEL-NEXT: addi 3, 4, 0
489 %sel = select i1 %cond, i8 121, i8 23
490 %bo = srem i8 120, %sel
494 define i8 @sel_constants_urem_constant(i1 %cond) {
495 ; ALL-LABEL: sel_constants_urem_constant:
497 ; ALL-NEXT: clrldi 3, 3, 63
498 ; ALL-NEXT: xori 3, 3, 3
500 %sel = select i1 %cond, i8 -4, i8 23
501 %bo = urem i8 %sel, 5
505 define i8 @urem_constant_sel_constants(i1 %cond) {
506 ; ISEL-LABEL: urem_constant_sel_constants:
508 ; ISEL-NEXT: andi. 3, 3, 1
509 ; ISEL-NEXT: li 4, 120
511 ; ISEL-NEXT: iselgt 3, 4, 3
514 ; NO_ISEL-LABEL: urem_constant_sel_constants:
516 ; NO_ISEL-NEXT: andi. 3, 3, 1
517 ; NO_ISEL-NEXT: li 4, 120
518 ; NO_ISEL-NEXT: li 3, 5
519 ; NO_ISEL-NEXT: bc 12, 1, .LBB32_1
521 ; NO_ISEL-NEXT: .LBB32_1:
522 ; NO_ISEL-NEXT: addi 3, 4, 0
524 %sel = select i1 %cond, i8 -4, i8 23
525 %bo = urem i8 120, %sel
529 define i8 @sel_constants_and_constant(i1 %cond) {
530 ; ALL-LABEL: sel_constants_and_constant:
532 ; ALL-NEXT: clrldi 3, 3, 63
533 ; ALL-NEXT: xori 3, 3, 5
535 %sel = select i1 %cond, i8 -4, i8 23
540 define i8 @sel_constants_or_constant(i1 %cond) {
541 ; ISEL-LABEL: sel_constants_or_constant:
543 ; ISEL-NEXT: andi. 3, 3, 1
544 ; ISEL-NEXT: li 4, -3
545 ; ISEL-NEXT: li 3, 23
546 ; ISEL-NEXT: iselgt 3, 4, 3
549 ; NO_ISEL-LABEL: sel_constants_or_constant:
551 ; NO_ISEL-NEXT: andi. 3, 3, 1
552 ; NO_ISEL-NEXT: li 4, -3
553 ; NO_ISEL-NEXT: li 3, 23
554 ; NO_ISEL-NEXT: bc 12, 1, .LBB34_1
556 ; NO_ISEL-NEXT: .LBB34_1:
557 ; NO_ISEL-NEXT: addi 3, 4, 0
559 %sel = select i1 %cond, i8 -4, i8 23
564 define i8 @sel_constants_xor_constant(i1 %cond) {
565 ; ISEL-LABEL: sel_constants_xor_constant:
567 ; ISEL-NEXT: andi. 3, 3, 1
568 ; ISEL-NEXT: li 4, -7
569 ; ISEL-NEXT: li 3, 18
570 ; ISEL-NEXT: iselgt 3, 4, 3
573 ; NO_ISEL-LABEL: sel_constants_xor_constant:
575 ; NO_ISEL-NEXT: andi. 3, 3, 1
576 ; NO_ISEL-NEXT: li 4, -7
577 ; NO_ISEL-NEXT: li 3, 18
578 ; NO_ISEL-NEXT: bc 12, 1, .LBB35_1
580 ; NO_ISEL-NEXT: .LBB35_1:
581 ; NO_ISEL-NEXT: addi 3, 4, 0
583 %sel = select i1 %cond, i8 -4, i8 23
588 define i8 @sel_constants_shl_constant(i1 %cond) {
589 ; ISEL-LABEL: sel_constants_shl_constant:
591 ; ISEL-NEXT: andi. 3, 3, 1
592 ; ISEL-NEXT: li 4, -128
593 ; ISEL-NEXT: li 3, -32
594 ; ISEL-NEXT: iselgt 3, 4, 3
597 ; NO_ISEL-LABEL: sel_constants_shl_constant:
599 ; NO_ISEL-NEXT: andi. 3, 3, 1
600 ; NO_ISEL-NEXT: li 4, -128
601 ; NO_ISEL-NEXT: li 3, -32
602 ; NO_ISEL-NEXT: bc 12, 1, .LBB36_1
604 ; NO_ISEL-NEXT: .LBB36_1:
605 ; NO_ISEL-NEXT: addi 3, 4, 0
607 %sel = select i1 %cond, i8 -4, i8 23
612 define i8 @shl_constant_sel_constants(i1 %cond) {
613 ; ISEL-LABEL: shl_constant_sel_constants:
615 ; ISEL-NEXT: andi. 3, 3, 1
618 ; ISEL-NEXT: iselgt 3, 4, 3
621 ; NO_ISEL-LABEL: shl_constant_sel_constants:
623 ; NO_ISEL-NEXT: andi. 3, 3, 1
624 ; NO_ISEL-NEXT: li 4, 4
625 ; NO_ISEL-NEXT: li 3, 8
626 ; NO_ISEL-NEXT: bc 12, 1, .LBB37_1
628 ; NO_ISEL-NEXT: .LBB37_1:
629 ; NO_ISEL-NEXT: addi 3, 4, 0
631 %sel = select i1 %cond, i8 2, i8 3
636 define i8 @sel_constants_lshr_constant(i1 %cond) {
637 ; ISEL-LABEL: sel_constants_lshr_constant:
639 ; ISEL-NEXT: andi. 3, 3, 1
642 ; ISEL-NEXT: iselgt 3, 4, 3
645 ; NO_ISEL-LABEL: sel_constants_lshr_constant:
647 ; NO_ISEL-NEXT: andi. 3, 3, 1
648 ; NO_ISEL-NEXT: li 4, 7
649 ; NO_ISEL-NEXT: li 3, 0
650 ; NO_ISEL-NEXT: bc 12, 1, .LBB38_1
652 ; NO_ISEL-NEXT: .LBB38_1:
653 ; NO_ISEL-NEXT: addi 3, 4, 0
655 %sel = select i1 %cond, i8 -4, i8 23
656 %bo = lshr i8 %sel, 5
660 define i8 @lshr_constant_sel_constants(i1 %cond) {
661 ; ISEL-LABEL: lshr_constant_sel_constants:
663 ; ISEL-NEXT: andi. 3, 3, 1
664 ; ISEL-NEXT: li 4, 16
666 ; ISEL-NEXT: iselgt 3, 4, 3
669 ; NO_ISEL-LABEL: lshr_constant_sel_constants:
671 ; NO_ISEL-NEXT: andi. 3, 3, 1
672 ; NO_ISEL-NEXT: li 4, 16
673 ; NO_ISEL-NEXT: li 3, 8
674 ; NO_ISEL-NEXT: bc 12, 1, .LBB39_1
676 ; NO_ISEL-NEXT: .LBB39_1:
677 ; NO_ISEL-NEXT: addi 3, 4, 0
679 %sel = select i1 %cond, i8 2, i8 3
680 %bo = lshr i8 64, %sel
685 define i8 @sel_constants_ashr_constant(i1 %cond) {
686 ; ALL-LABEL: sel_constants_ashr_constant:
688 ; ALL-NEXT: clrldi 3, 3, 63
691 %sel = select i1 %cond, i8 -4, i8 23
692 %bo = ashr i8 %sel, 5
696 define i8 @ashr_constant_sel_constants(i1 %cond) {
697 ; ISEL-LABEL: ashr_constant_sel_constants:
699 ; ISEL-NEXT: andi. 3, 3, 1
700 ; ISEL-NEXT: li 4, -32
701 ; ISEL-NEXT: li 3, -16
702 ; ISEL-NEXT: iselgt 3, 4, 3
705 ; NO_ISEL-LABEL: ashr_constant_sel_constants:
707 ; NO_ISEL-NEXT: andi. 3, 3, 1
708 ; NO_ISEL-NEXT: li 4, -32
709 ; NO_ISEL-NEXT: li 3, -16
710 ; NO_ISEL-NEXT: bc 12, 1, .LBB41_1
712 ; NO_ISEL-NEXT: .LBB41_1:
713 ; NO_ISEL-NEXT: addi 3, 4, 0
715 %sel = select i1 %cond, i8 2, i8 3
716 %bo = ashr i8 128, %sel
720 define double @sel_constants_fadd_constant(i1 %cond) {
721 ; ISEL-LABEL: sel_constants_fadd_constant:
723 ; ISEL-NEXT: andi. 3, 3, 1
724 ; ISEL-NEXT: addis 4, 2, .LCPI42_0@toc@ha
725 ; ISEL-NEXT: addis 3, 2, .LCPI42_1@toc@ha
726 ; ISEL-NEXT: addi 4, 4, .LCPI42_0@toc@l
727 ; ISEL-NEXT: addi 3, 3, .LCPI42_1@toc@l
728 ; ISEL-NEXT: iselgt 3, 3, 4
729 ; ISEL-NEXT: lfd 1, 0(3)
732 ; NO_ISEL-LABEL: sel_constants_fadd_constant:
734 ; NO_ISEL-NEXT: andi. 3, 3, 1
735 ; NO_ISEL-NEXT: addis 4, 2, .LCPI42_0@toc@ha
736 ; NO_ISEL-NEXT: addis 3, 2, .LCPI42_1@toc@ha
737 ; NO_ISEL-NEXT: addi 4, 4, .LCPI42_0@toc@l
738 ; NO_ISEL-NEXT: addi 3, 3, .LCPI42_1@toc@l
739 ; NO_ISEL-NEXT: bc 12, 1, .LBB42_2
740 ; NO_ISEL-NEXT: # %bb.1:
741 ; NO_ISEL-NEXT: ori 3, 4, 0
742 ; NO_ISEL-NEXT: b .LBB42_2
743 ; NO_ISEL-NEXT: .LBB42_2:
744 ; NO_ISEL-NEXT: lfd 1, 0(3)
746 %sel = select i1 %cond, double -4.0, double 23.3
747 %bo = fadd double %sel, 5.1
751 define double @sel_constants_fsub_constant(i1 %cond) {
752 ; ISEL-LABEL: sel_constants_fsub_constant:
754 ; ISEL-NEXT: andi. 3, 3, 1
755 ; ISEL-NEXT: addis 4, 2, .LCPI43_0@toc@ha
756 ; ISEL-NEXT: addis 3, 2, .LCPI43_1@toc@ha
757 ; ISEL-NEXT: addi 4, 4, .LCPI43_0@toc@l
758 ; ISEL-NEXT: addi 3, 3, .LCPI43_1@toc@l
759 ; ISEL-NEXT: iselgt 3, 3, 4
760 ; ISEL-NEXT: lfd 1, 0(3)
763 ; NO_ISEL-LABEL: sel_constants_fsub_constant:
765 ; NO_ISEL-NEXT: andi. 3, 3, 1
766 ; NO_ISEL-NEXT: addis 4, 2, .LCPI43_0@toc@ha
767 ; NO_ISEL-NEXT: addis 3, 2, .LCPI43_1@toc@ha
768 ; NO_ISEL-NEXT: addi 4, 4, .LCPI43_0@toc@l
769 ; NO_ISEL-NEXT: addi 3, 3, .LCPI43_1@toc@l
770 ; NO_ISEL-NEXT: bc 12, 1, .LBB43_2
771 ; NO_ISEL-NEXT: # %bb.1:
772 ; NO_ISEL-NEXT: ori 3, 4, 0
773 ; NO_ISEL-NEXT: b .LBB43_2
774 ; NO_ISEL-NEXT: .LBB43_2:
775 ; NO_ISEL-NEXT: lfd 1, 0(3)
777 %sel = select i1 %cond, double -4.0, double 23.3
778 %bo = fsub double %sel, 5.1
782 define double @fsub_constant_sel_constants(i1 %cond) {
783 ; ISEL-LABEL: fsub_constant_sel_constants:
785 ; ISEL-NEXT: andi. 3, 3, 1
786 ; ISEL-NEXT: addis 4, 2, .LCPI44_0@toc@ha
787 ; ISEL-NEXT: addis 3, 2, .LCPI44_1@toc@ha
788 ; ISEL-NEXT: addi 4, 4, .LCPI44_0@toc@l
789 ; ISEL-NEXT: addi 3, 3, .LCPI44_1@toc@l
790 ; ISEL-NEXT: iselgt 3, 3, 4
791 ; ISEL-NEXT: lfd 1, 0(3)
794 ; NO_ISEL-LABEL: fsub_constant_sel_constants:
796 ; NO_ISEL-NEXT: andi. 3, 3, 1
797 ; NO_ISEL-NEXT: addis 4, 2, .LCPI44_0@toc@ha
798 ; NO_ISEL-NEXT: addis 3, 2, .LCPI44_1@toc@ha
799 ; NO_ISEL-NEXT: addi 4, 4, .LCPI44_0@toc@l
800 ; NO_ISEL-NEXT: addi 3, 3, .LCPI44_1@toc@l
801 ; NO_ISEL-NEXT: bc 12, 1, .LBB44_2
802 ; NO_ISEL-NEXT: # %bb.1:
803 ; NO_ISEL-NEXT: ori 3, 4, 0
804 ; NO_ISEL-NEXT: b .LBB44_2
805 ; NO_ISEL-NEXT: .LBB44_2:
806 ; NO_ISEL-NEXT: lfd 1, 0(3)
808 %sel = select i1 %cond, double -4.0, double 23.3
809 %bo = fsub double 5.1, %sel
813 define double @sel_constants_fmul_constant(i1 %cond) {
814 ; ISEL-LABEL: sel_constants_fmul_constant:
816 ; ISEL-NEXT: andi. 3, 3, 1
817 ; ISEL-NEXT: addis 4, 2, .LCPI45_0@toc@ha
818 ; ISEL-NEXT: addis 3, 2, .LCPI45_1@toc@ha
819 ; ISEL-NEXT: addi 4, 4, .LCPI45_0@toc@l
820 ; ISEL-NEXT: addi 3, 3, .LCPI45_1@toc@l
821 ; ISEL-NEXT: iselgt 3, 3, 4
822 ; ISEL-NEXT: lfd 1, 0(3)
825 ; NO_ISEL-LABEL: sel_constants_fmul_constant:
827 ; NO_ISEL-NEXT: andi. 3, 3, 1
828 ; NO_ISEL-NEXT: addis 4, 2, .LCPI45_0@toc@ha
829 ; NO_ISEL-NEXT: addis 3, 2, .LCPI45_1@toc@ha
830 ; NO_ISEL-NEXT: addi 4, 4, .LCPI45_0@toc@l
831 ; NO_ISEL-NEXT: addi 3, 3, .LCPI45_1@toc@l
832 ; NO_ISEL-NEXT: bc 12, 1, .LBB45_2
833 ; NO_ISEL-NEXT: # %bb.1:
834 ; NO_ISEL-NEXT: ori 3, 4, 0
835 ; NO_ISEL-NEXT: b .LBB45_2
836 ; NO_ISEL-NEXT: .LBB45_2:
837 ; NO_ISEL-NEXT: lfd 1, 0(3)
839 %sel = select i1 %cond, double -4.0, double 23.3
840 %bo = fmul double %sel, 5.1
844 define double @sel_constants_fdiv_constant(i1 %cond) {
845 ; ISEL-LABEL: sel_constants_fdiv_constant:
847 ; ISEL-NEXT: andi. 3, 3, 1
848 ; ISEL-NEXT: addis 4, 2, .LCPI46_0@toc@ha
849 ; ISEL-NEXT: addis 3, 2, .LCPI46_1@toc@ha
850 ; ISEL-NEXT: addi 4, 4, .LCPI46_0@toc@l
851 ; ISEL-NEXT: addi 3, 3, .LCPI46_1@toc@l
852 ; ISEL-NEXT: iselgt 3, 3, 4
853 ; ISEL-NEXT: lfd 1, 0(3)
856 ; NO_ISEL-LABEL: sel_constants_fdiv_constant:
858 ; NO_ISEL-NEXT: andi. 3, 3, 1
859 ; NO_ISEL-NEXT: addis 4, 2, .LCPI46_0@toc@ha
860 ; NO_ISEL-NEXT: addis 3, 2, .LCPI46_1@toc@ha
861 ; NO_ISEL-NEXT: addi 4, 4, .LCPI46_0@toc@l
862 ; NO_ISEL-NEXT: addi 3, 3, .LCPI46_1@toc@l
863 ; NO_ISEL-NEXT: bc 12, 1, .LBB46_2
864 ; NO_ISEL-NEXT: # %bb.1:
865 ; NO_ISEL-NEXT: ori 3, 4, 0
866 ; NO_ISEL-NEXT: b .LBB46_2
867 ; NO_ISEL-NEXT: .LBB46_2:
868 ; NO_ISEL-NEXT: lfd 1, 0(3)
870 %sel = select i1 %cond, double -4.0, double 23.3
871 %bo = fdiv double %sel, 5.1
875 define double @fdiv_constant_sel_constants(i1 %cond) {
876 ; ISEL-LABEL: fdiv_constant_sel_constants:
878 ; ISEL-NEXT: andi. 3, 3, 1
879 ; ISEL-NEXT: addis 4, 2, .LCPI47_0@toc@ha
880 ; ISEL-NEXT: addis 3, 2, .LCPI47_1@toc@ha
881 ; ISEL-NEXT: addi 4, 4, .LCPI47_0@toc@l
882 ; ISEL-NEXT: addi 3, 3, .LCPI47_1@toc@l
883 ; ISEL-NEXT: iselgt 3, 3, 4
884 ; ISEL-NEXT: lfd 1, 0(3)
887 ; NO_ISEL-LABEL: fdiv_constant_sel_constants:
889 ; NO_ISEL-NEXT: andi. 3, 3, 1
890 ; NO_ISEL-NEXT: addis 4, 2, .LCPI47_0@toc@ha
891 ; NO_ISEL-NEXT: addis 3, 2, .LCPI47_1@toc@ha
892 ; NO_ISEL-NEXT: addi 4, 4, .LCPI47_0@toc@l
893 ; NO_ISEL-NEXT: addi 3, 3, .LCPI47_1@toc@l
894 ; NO_ISEL-NEXT: bc 12, 1, .LBB47_2
895 ; NO_ISEL-NEXT: # %bb.1:
896 ; NO_ISEL-NEXT: ori 3, 4, 0
897 ; NO_ISEL-NEXT: b .LBB47_2
898 ; NO_ISEL-NEXT: .LBB47_2:
899 ; NO_ISEL-NEXT: lfd 1, 0(3)
901 %sel = select i1 %cond, double -4.0, double 23.3
902 %bo = fdiv double 5.1, %sel
906 define double @sel_constants_frem_constant(i1 %cond) {
907 ; ALL-LABEL: sel_constants_frem_constant:
909 ; ALL-NEXT: andi. 3, 3, 1
910 ; ALL-NEXT: bc 12, 1, .LBB48_2
912 ; ALL-NEXT: addis 3, 2, .LCPI48_0@toc@ha
913 ; ALL-NEXT: lfd 1, .LCPI48_0@toc@l(3)
914 ; ALL-NEXT: # kill: def $f1 killed $f1 killed $vsl1
916 ; ALL-NEXT: .LBB48_2:
917 ; ALL-NEXT: vspltisw 2, -4
918 ; ALL-NEXT: xvcvsxwdp 1, 34
919 ; ALL-NEXT: # kill: def $f1 killed $f1 killed $vsl1
921 %sel = select i1 %cond, double -4.0, double 23.3
922 %bo = frem double %sel, 5.1
926 define double @frem_constant_sel_constants(i1 %cond) {
927 ; ISEL-LABEL: frem_constant_sel_constants:
929 ; ISEL-NEXT: andi. 3, 3, 1
930 ; ISEL-NEXT: addis 4, 2, .LCPI49_0@toc@ha
931 ; ISEL-NEXT: addis 3, 2, .LCPI49_1@toc@ha
932 ; ISEL-NEXT: addi 4, 4, .LCPI49_0@toc@l
933 ; ISEL-NEXT: addi 3, 3, .LCPI49_1@toc@l
934 ; ISEL-NEXT: iselgt 3, 3, 4
935 ; ISEL-NEXT: lfd 1, 0(3)
938 ; NO_ISEL-LABEL: frem_constant_sel_constants:
940 ; NO_ISEL-NEXT: andi. 3, 3, 1
941 ; NO_ISEL-NEXT: addis 4, 2, .LCPI49_0@toc@ha
942 ; NO_ISEL-NEXT: addis 3, 2, .LCPI49_1@toc@ha
943 ; NO_ISEL-NEXT: addi 4, 4, .LCPI49_0@toc@l
944 ; NO_ISEL-NEXT: addi 3, 3, .LCPI49_1@toc@l
945 ; NO_ISEL-NEXT: bc 12, 1, .LBB49_2
946 ; NO_ISEL-NEXT: # %bb.1:
947 ; NO_ISEL-NEXT: ori 3, 4, 0
948 ; NO_ISEL-NEXT: b .LBB49_2
949 ; NO_ISEL-NEXT: .LBB49_2:
950 ; NO_ISEL-NEXT: lfd 1, 0(3)
952 %sel = select i1 %cond, double -4.0, double 23.3
953 %bo = frem double 5.1, %sel