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 3, 42
194 ; ISEL-NEXT: li 4, 421
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 3, 42
202 ; NO_ISEL-NEXT: li 4, 421
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 3, 42
217 ; ISEL-NEXT: li 4, 421
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 3, 42
225 ; NO_ISEL-NEXT: li 4, 421
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 3, 42
240 ; ISEL-NEXT: li 4, 421
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 3, 42
248 ; NO_ISEL-NEXT: li 4, 421
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
264 ; 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 3, 28
273 ; NO_ISEL-NEXT: li 4, 1
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 3, 18
289 ; ISEL-NEXT: li 4, -9
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 3, 18
297 ; NO_ISEL-NEXT: li 4, -9
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 3, 2
321 ; NO_ISEL-NEXT: li 4, 9
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 3, 115
337 ; ISEL-NEXT: li 4, -20
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 3, 115
345 ; NO_ISEL-NEXT: li 4, -20
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
405 ; 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 3, 4
413 ; NO_ISEL-NEXT: li 4, 50
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
451 ; 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 3, 3
459 ; NO_ISEL-NEXT: li 4, -4
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
475 ; 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 3, 5
483 ; NO_ISEL-NEXT: li 4, 120
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
510 ; 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 3, 5
518 ; NO_ISEL-NEXT: li 4, 120
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 3, 23
545 ; ISEL-NEXT: li 4, -3
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 3, 23
553 ; NO_ISEL-NEXT: li 4, -3
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 3, 18
569 ; ISEL-NEXT: li 4, -7
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 3, 18
577 ; NO_ISEL-NEXT: li 4, -7
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 3, -32
593 ; ISEL-NEXT: li 4, -128
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 3, -32
601 ; NO_ISEL-NEXT: li 4, -128
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 ; ALL-LABEL: shl_constant_sel_constants:
615 ; ALL-NEXT: clrlwi 3, 3, 31
617 ; ALL-NEXT: xori 3, 3, 3
618 ; ALL-NEXT: slw 3, 4, 3
620 %sel = select i1 %cond, i8 2, i8 3
625 define i8 @sel_constants_lshr_constant(i1 %cond) {
626 ; ISEL-LABEL: sel_constants_lshr_constant:
628 ; ISEL-NEXT: andi. 3, 3, 1
631 ; ISEL-NEXT: iselgt 3, 4, 3
634 ; NO_ISEL-LABEL: sel_constants_lshr_constant:
636 ; NO_ISEL-NEXT: andi. 3, 3, 1
637 ; NO_ISEL-NEXT: li 3, 0
638 ; NO_ISEL-NEXT: li 4, 7
639 ; NO_ISEL-NEXT: bc 12, 1, .LBB38_1
641 ; NO_ISEL-NEXT: .LBB38_1:
642 ; NO_ISEL-NEXT: addi 3, 4, 0
644 %sel = select i1 %cond, i8 -4, i8 23
645 %bo = lshr i8 %sel, 5
649 define i8 @lshr_constant_sel_constants(i1 %cond) {
650 ; ALL-LABEL: lshr_constant_sel_constants:
652 ; ALL-NEXT: clrlwi 3, 3, 31
654 ; ALL-NEXT: xori 3, 3, 3
655 ; ALL-NEXT: srw 3, 4, 3
657 %sel = select i1 %cond, i8 2, i8 3
658 %bo = lshr i8 64, %sel
663 define i8 @sel_constants_ashr_constant(i1 %cond) {
664 ; ALL-LABEL: sel_constants_ashr_constant:
666 ; ALL-NEXT: clrlwi 3, 3, 31
669 %sel = select i1 %cond, i8 -4, i8 23
670 %bo = ashr i8 %sel, 5
674 define i8 @ashr_constant_sel_constants(i1 %cond) {
675 ; ALL-LABEL: ashr_constant_sel_constants:
677 ; ALL-NEXT: clrlwi 3, 3, 31
678 ; ALL-NEXT: li 4, -128
679 ; ALL-NEXT: xori 3, 3, 3
680 ; ALL-NEXT: sraw 3, 4, 3
682 %sel = select i1 %cond, i8 2, i8 3
683 %bo = ashr i8 128, %sel
687 define double @sel_constants_fadd_constant(i1 %cond) {
688 ; ISEL-LABEL: sel_constants_fadd_constant:
690 ; ISEL-NEXT: andi. 3, 3, 1
691 ; ISEL-NEXT: addis 3, 2, .LCPI42_0@toc@ha
692 ; ISEL-NEXT: addis 4, 2, .LCPI42_1@toc@ha
693 ; ISEL-NEXT: addi 3, 3, .LCPI42_0@toc@l
694 ; ISEL-NEXT: addi 4, 4, .LCPI42_1@toc@l
695 ; ISEL-NEXT: iselgt 3, 4, 3
696 ; ISEL-NEXT: lfd 1, 0(3)
699 ; NO_ISEL-LABEL: sel_constants_fadd_constant:
701 ; NO_ISEL-NEXT: andi. 3, 3, 1
702 ; NO_ISEL-NEXT: addis 3, 2, .LCPI42_0@toc@ha
703 ; NO_ISEL-NEXT: addis 4, 2, .LCPI42_1@toc@ha
704 ; NO_ISEL-NEXT: addi 3, 3, .LCPI42_0@toc@l
705 ; NO_ISEL-NEXT: addi 4, 4, .LCPI42_1@toc@l
706 ; NO_ISEL-NEXT: bc 12, 1, .LBB42_1
707 ; NO_ISEL-NEXT: b .LBB42_2
708 ; NO_ISEL-NEXT: .LBB42_1:
709 ; NO_ISEL-NEXT: addi 3, 4, 0
710 ; NO_ISEL-NEXT: .LBB42_2:
711 ; NO_ISEL-NEXT: lfd 1, 0(3)
713 %sel = select i1 %cond, double -4.0, double 23.3
714 %bo = fadd double %sel, 5.1
718 define double @sel_constants_fsub_constant(i1 %cond) {
719 ; ISEL-LABEL: sel_constants_fsub_constant:
721 ; ISEL-NEXT: andi. 3, 3, 1
722 ; ISEL-NEXT: addis 3, 2, .LCPI43_0@toc@ha
723 ; ISEL-NEXT: addis 4, 2, .LCPI43_1@toc@ha
724 ; ISEL-NEXT: addi 3, 3, .LCPI43_0@toc@l
725 ; ISEL-NEXT: addi 4, 4, .LCPI43_1@toc@l
726 ; ISEL-NEXT: iselgt 3, 4, 3
727 ; ISEL-NEXT: lfd 1, 0(3)
730 ; NO_ISEL-LABEL: sel_constants_fsub_constant:
732 ; NO_ISEL-NEXT: andi. 3, 3, 1
733 ; NO_ISEL-NEXT: addis 3, 2, .LCPI43_0@toc@ha
734 ; NO_ISEL-NEXT: addis 4, 2, .LCPI43_1@toc@ha
735 ; NO_ISEL-NEXT: addi 3, 3, .LCPI43_0@toc@l
736 ; NO_ISEL-NEXT: addi 4, 4, .LCPI43_1@toc@l
737 ; NO_ISEL-NEXT: bc 12, 1, .LBB43_1
738 ; NO_ISEL-NEXT: b .LBB43_2
739 ; NO_ISEL-NEXT: .LBB43_1:
740 ; NO_ISEL-NEXT: addi 3, 4, 0
741 ; NO_ISEL-NEXT: .LBB43_2:
742 ; NO_ISEL-NEXT: lfd 1, 0(3)
744 %sel = select i1 %cond, double -4.0, double 23.3
745 %bo = fsub double %sel, 5.1
749 define double @fsub_constant_sel_constants(i1 %cond) {
750 ; ISEL-LABEL: fsub_constant_sel_constants:
752 ; ISEL-NEXT: andi. 3, 3, 1
753 ; ISEL-NEXT: addis 3, 2, .LCPI44_0@toc@ha
754 ; ISEL-NEXT: addis 4, 2, .LCPI44_1@toc@ha
755 ; ISEL-NEXT: addi 3, 3, .LCPI44_0@toc@l
756 ; ISEL-NEXT: addi 4, 4, .LCPI44_1@toc@l
757 ; ISEL-NEXT: iselgt 3, 4, 3
758 ; ISEL-NEXT: lfd 1, 0(3)
761 ; NO_ISEL-LABEL: fsub_constant_sel_constants:
763 ; NO_ISEL-NEXT: andi. 3, 3, 1
764 ; NO_ISEL-NEXT: addis 3, 2, .LCPI44_0@toc@ha
765 ; NO_ISEL-NEXT: addis 4, 2, .LCPI44_1@toc@ha
766 ; NO_ISEL-NEXT: addi 3, 3, .LCPI44_0@toc@l
767 ; NO_ISEL-NEXT: addi 4, 4, .LCPI44_1@toc@l
768 ; NO_ISEL-NEXT: bc 12, 1, .LBB44_1
769 ; NO_ISEL-NEXT: b .LBB44_2
770 ; NO_ISEL-NEXT: .LBB44_1:
771 ; NO_ISEL-NEXT: addi 3, 4, 0
772 ; NO_ISEL-NEXT: .LBB44_2:
773 ; NO_ISEL-NEXT: lfd 1, 0(3)
775 %sel = select i1 %cond, double -4.0, double 23.3
776 %bo = fsub double 5.1, %sel
780 define double @sel_constants_fmul_constant(i1 %cond) {
781 ; ISEL-LABEL: sel_constants_fmul_constant:
783 ; ISEL-NEXT: andi. 3, 3, 1
784 ; ISEL-NEXT: addis 3, 2, .LCPI45_0@toc@ha
785 ; ISEL-NEXT: addis 4, 2, .LCPI45_1@toc@ha
786 ; ISEL-NEXT: addi 3, 3, .LCPI45_0@toc@l
787 ; ISEL-NEXT: addi 4, 4, .LCPI45_1@toc@l
788 ; ISEL-NEXT: iselgt 3, 4, 3
789 ; ISEL-NEXT: lfd 1, 0(3)
792 ; NO_ISEL-LABEL: sel_constants_fmul_constant:
794 ; NO_ISEL-NEXT: andi. 3, 3, 1
795 ; NO_ISEL-NEXT: addis 3, 2, .LCPI45_0@toc@ha
796 ; NO_ISEL-NEXT: addis 4, 2, .LCPI45_1@toc@ha
797 ; NO_ISEL-NEXT: addi 3, 3, .LCPI45_0@toc@l
798 ; NO_ISEL-NEXT: addi 4, 4, .LCPI45_1@toc@l
799 ; NO_ISEL-NEXT: bc 12, 1, .LBB45_1
800 ; NO_ISEL-NEXT: b .LBB45_2
801 ; NO_ISEL-NEXT: .LBB45_1:
802 ; NO_ISEL-NEXT: addi 3, 4, 0
803 ; NO_ISEL-NEXT: .LBB45_2:
804 ; NO_ISEL-NEXT: lfd 1, 0(3)
806 %sel = select i1 %cond, double -4.0, double 23.3
807 %bo = fmul double %sel, 5.1
811 define double @sel_constants_fdiv_constant(i1 %cond) {
812 ; ISEL-LABEL: sel_constants_fdiv_constant:
814 ; ISEL-NEXT: andi. 3, 3, 1
815 ; ISEL-NEXT: addis 3, 2, .LCPI46_0@toc@ha
816 ; ISEL-NEXT: addis 4, 2, .LCPI46_1@toc@ha
817 ; ISEL-NEXT: addi 3, 3, .LCPI46_0@toc@l
818 ; ISEL-NEXT: addi 4, 4, .LCPI46_1@toc@l
819 ; ISEL-NEXT: iselgt 3, 4, 3
820 ; ISEL-NEXT: lfd 1, 0(3)
823 ; NO_ISEL-LABEL: sel_constants_fdiv_constant:
825 ; NO_ISEL-NEXT: andi. 3, 3, 1
826 ; NO_ISEL-NEXT: addis 3, 2, .LCPI46_0@toc@ha
827 ; NO_ISEL-NEXT: addis 4, 2, .LCPI46_1@toc@ha
828 ; NO_ISEL-NEXT: addi 3, 3, .LCPI46_0@toc@l
829 ; NO_ISEL-NEXT: addi 4, 4, .LCPI46_1@toc@l
830 ; NO_ISEL-NEXT: bc 12, 1, .LBB46_1
831 ; NO_ISEL-NEXT: b .LBB46_2
832 ; NO_ISEL-NEXT: .LBB46_1:
833 ; NO_ISEL-NEXT: addi 3, 4, 0
834 ; NO_ISEL-NEXT: .LBB46_2:
835 ; NO_ISEL-NEXT: lfd 1, 0(3)
837 %sel = select i1 %cond, double -4.0, double 23.3
838 %bo = fdiv double %sel, 5.1
842 define double @fdiv_constant_sel_constants(i1 %cond) {
843 ; ISEL-LABEL: fdiv_constant_sel_constants:
845 ; ISEL-NEXT: andi. 3, 3, 1
846 ; ISEL-NEXT: addis 3, 2, .LCPI47_0@toc@ha
847 ; ISEL-NEXT: addis 4, 2, .LCPI47_1@toc@ha
848 ; ISEL-NEXT: addi 3, 3, .LCPI47_0@toc@l
849 ; ISEL-NEXT: addi 4, 4, .LCPI47_1@toc@l
850 ; ISEL-NEXT: iselgt 3, 4, 3
851 ; ISEL-NEXT: lfd 1, 0(3)
854 ; NO_ISEL-LABEL: fdiv_constant_sel_constants:
856 ; NO_ISEL-NEXT: andi. 3, 3, 1
857 ; NO_ISEL-NEXT: addis 3, 2, .LCPI47_0@toc@ha
858 ; NO_ISEL-NEXT: addis 4, 2, .LCPI47_1@toc@ha
859 ; NO_ISEL-NEXT: addi 3, 3, .LCPI47_0@toc@l
860 ; NO_ISEL-NEXT: addi 4, 4, .LCPI47_1@toc@l
861 ; NO_ISEL-NEXT: bc 12, 1, .LBB47_1
862 ; NO_ISEL-NEXT: b .LBB47_2
863 ; NO_ISEL-NEXT: .LBB47_1:
864 ; NO_ISEL-NEXT: addi 3, 4, 0
865 ; NO_ISEL-NEXT: .LBB47_2:
866 ; NO_ISEL-NEXT: lfd 1, 0(3)
868 %sel = select i1 %cond, double -4.0, double 23.3
869 %bo = fdiv double 5.1, %sel
873 define double @sel_constants_frem_constant(i1 %cond) {
874 ; ALL-LABEL: sel_constants_frem_constant:
876 ; ALL-NEXT: andi. 3, 3, 1
877 ; ALL-NEXT: bc 12, 1, .LBB48_2
879 ; ALL-NEXT: addis 3, 2, .LCPI48_0@toc@ha
880 ; ALL-NEXT: lfd 1, .LCPI48_0@toc@l(3)
881 ; ALL-NEXT: # kill: def $f1 killed $f1 killed $vsl1
883 ; ALL-NEXT: .LBB48_2:
884 ; ALL-NEXT: vspltisw 2, -4
885 ; ALL-NEXT: xvcvsxwdp 1, 34
886 ; ALL-NEXT: # kill: def $f1 killed $f1 killed $vsl1
888 %sel = select i1 %cond, double -4.0, double 23.3
889 %bo = frem double %sel, 5.1
893 define double @frem_constant_sel_constants(i1 %cond) {
894 ; ISEL-LABEL: frem_constant_sel_constants:
896 ; ISEL-NEXT: andi. 3, 3, 1
897 ; ISEL-NEXT: addis 3, 2, .LCPI49_0@toc@ha
898 ; ISEL-NEXT: addis 4, 2, .LCPI49_1@toc@ha
899 ; ISEL-NEXT: addi 3, 3, .LCPI49_0@toc@l
900 ; ISEL-NEXT: addi 4, 4, .LCPI49_1@toc@l
901 ; ISEL-NEXT: iselgt 3, 4, 3
902 ; ISEL-NEXT: lfd 1, 0(3)
905 ; NO_ISEL-LABEL: frem_constant_sel_constants:
907 ; NO_ISEL-NEXT: andi. 3, 3, 1
908 ; NO_ISEL-NEXT: addis 3, 2, .LCPI49_0@toc@ha
909 ; NO_ISEL-NEXT: addis 4, 2, .LCPI49_1@toc@ha
910 ; NO_ISEL-NEXT: addi 3, 3, .LCPI49_0@toc@l
911 ; NO_ISEL-NEXT: addi 4, 4, .LCPI49_1@toc@l
912 ; NO_ISEL-NEXT: bc 12, 1, .LBB49_1
913 ; NO_ISEL-NEXT: b .LBB49_2
914 ; NO_ISEL-NEXT: .LBB49_1:
915 ; NO_ISEL-NEXT: addi 3, 4, 0
916 ; NO_ISEL-NEXT: .LBB49_2:
917 ; NO_ISEL-NEXT: lfd 1, 0(3)
919 %sel = select i1 %cond, double -4.0, double 23.3
920 %bo = frem double 5.1, %sel