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:
73 ; ALL-NEXT: clrldi 3, 3, 63
76 %sel = select i1 %cond, i32 0, i32 -1
80 define i32 @select_0_or_neg1_zeroext(i1 zeroext %cond) {
81 ; ALL-LABEL: select_0_or_neg1_zeroext:
83 ; ALL-NEXT: xori 3, 3, 1
86 %sel = select i1 %cond, i32 0, i32 -1
90 define i32 @select_0_or_neg1_signext(i1 signext %cond) {
91 ; ALL-LABEL: select_0_or_neg1_signext:
95 %sel = select i1 %cond, i32 0, i32 -1
99 ; select Cond, -1, 0 --> sext (Cond)
101 define i32 @select_neg1_or_0(i1 %cond) {
102 ; ALL-LABEL: select_neg1_or_0:
104 ; ALL-NEXT: clrldi 3, 3, 63
107 %sel = select i1 %cond, i32 -1, i32 0
111 define i32 @select_neg1_or_0_zeroext(i1 zeroext %cond) {
112 ; ALL-LABEL: select_neg1_or_0_zeroext:
116 %sel = select i1 %cond, i32 -1, i32 0
120 define i32 @select_neg1_or_0_signext(i1 signext %cond) {
121 ; ALL-LABEL: select_neg1_or_0_signext:
124 %sel = select i1 %cond, i32 -1, i32 0
128 ; select Cond, C+1, C --> add (zext Cond), C
130 define i32 @select_Cplus1_C(i1 %cond) {
131 ; ALL-LABEL: select_Cplus1_C:
133 ; ALL-NEXT: clrldi 3, 3, 63
134 ; ALL-NEXT: addi 3, 3, 41
136 %sel = select i1 %cond, i32 42, i32 41
140 define i32 @select_Cplus1_C_zeroext(i1 zeroext %cond) {
141 ; ALL-LABEL: select_Cplus1_C_zeroext:
143 ; ALL-NEXT: addi 3, 3, 41
145 %sel = select i1 %cond, i32 42, i32 41
149 define i32 @select_Cplus1_C_signext(i1 signext %cond) {
150 ; ALL-LABEL: select_Cplus1_C_signext:
152 ; ALL-NEXT: subfic 3, 3, 41
154 %sel = select i1 %cond, i32 42, i32 41
158 ; select Cond, C, C+1 --> add (sext Cond), C
160 define i32 @select_C_Cplus1(i1 %cond) {
161 ; ALL-LABEL: select_C_Cplus1:
163 ; ALL-NEXT: clrldi 3, 3, 63
164 ; ALL-NEXT: subfic 3, 3, 42
166 %sel = select i1 %cond, i32 41, i32 42
170 define i32 @select_C_Cplus1_zeroext(i1 zeroext %cond) {
171 ; ALL-LABEL: select_C_Cplus1_zeroext:
173 ; ALL-NEXT: subfic 3, 3, 42
175 %sel = select i1 %cond, i32 41, i32 42
179 define i32 @select_C_Cplus1_signext(i1 signext %cond) {
180 ; ALL-LABEL: select_C_Cplus1_signext:
182 ; ALL-NEXT: addi 3, 3, 42
184 %sel = select i1 %cond, i32 41, i32 42
188 ; In general, select of 2 constants could be:
189 ; select Cond, C1, C2 --> add (mul (zext Cond), C1-C2), C2 --> add (and (sext Cond), C1-C2), C2
191 define i32 @select_C1_C2(i1 %cond) {
192 ; ISEL-LABEL: select_C1_C2:
194 ; ISEL-NEXT: andi. 3, 3, 1
195 ; ISEL-NEXT: li 4, 421
196 ; ISEL-NEXT: li 3, 42
197 ; ISEL-NEXT: isel 3, 4, 3, 1
200 ; NO_ISEL-LABEL: select_C1_C2:
202 ; NO_ISEL-NEXT: andi. 3, 3, 1
203 ; NO_ISEL-NEXT: li 4, 421
204 ; NO_ISEL-NEXT: li 3, 42
205 ; NO_ISEL-NEXT: bc 12, 1, .LBB18_1
207 ; NO_ISEL-NEXT: .LBB18_1:
208 ; NO_ISEL-NEXT: addi 3, 4, 0
210 %sel = select i1 %cond, i32 421, i32 42
214 define i32 @select_C1_C2_zeroext(i1 zeroext %cond) {
215 ; ISEL-LABEL: select_C1_C2_zeroext:
217 ; ISEL-NEXT: andi. 3, 3, 1
218 ; ISEL-NEXT: li 4, 421
219 ; ISEL-NEXT: li 3, 42
220 ; ISEL-NEXT: isel 3, 4, 3, 1
223 ; NO_ISEL-LABEL: select_C1_C2_zeroext:
225 ; NO_ISEL-NEXT: andi. 3, 3, 1
226 ; NO_ISEL-NEXT: li 4, 421
227 ; NO_ISEL-NEXT: li 3, 42
228 ; NO_ISEL-NEXT: bc 12, 1, .LBB19_1
230 ; NO_ISEL-NEXT: .LBB19_1:
231 ; NO_ISEL-NEXT: addi 3, 4, 0
233 %sel = select i1 %cond, i32 421, i32 42
237 define i32 @select_C1_C2_signext(i1 signext %cond) {
238 ; ISEL-LABEL: select_C1_C2_signext:
240 ; ISEL-NEXT: andi. 3, 3, 1
241 ; ISEL-NEXT: li 4, 421
242 ; ISEL-NEXT: li 3, 42
243 ; ISEL-NEXT: isel 3, 4, 3, 1
246 ; NO_ISEL-LABEL: select_C1_C2_signext:
248 ; NO_ISEL-NEXT: andi. 3, 3, 1
249 ; NO_ISEL-NEXT: li 4, 421
250 ; NO_ISEL-NEXT: li 3, 42
251 ; NO_ISEL-NEXT: bc 12, 1, .LBB20_1
253 ; NO_ISEL-NEXT: .LBB20_1:
254 ; NO_ISEL-NEXT: addi 3, 4, 0
256 %sel = select i1 %cond, i32 421, i32 42
260 ; A binary operator with constant after the select should always get folded into the select.
262 define i8 @sel_constants_add_constant(i1 %cond) {
263 ; ISEL-LABEL: sel_constants_add_constant:
265 ; ISEL-NEXT: andi. 3, 3, 1
267 ; ISEL-NEXT: li 3, 28
268 ; ISEL-NEXT: isel 3, 4, 3, 1
271 ; NO_ISEL-LABEL: sel_constants_add_constant:
273 ; NO_ISEL-NEXT: andi. 3, 3, 1
274 ; NO_ISEL-NEXT: li 4, 1
275 ; NO_ISEL-NEXT: li 3, 28
276 ; NO_ISEL-NEXT: bc 12, 1, .LBB21_1
278 ; NO_ISEL-NEXT: .LBB21_1:
279 ; NO_ISEL-NEXT: addi 3, 4, 0
281 %sel = select i1 %cond, i8 -4, i8 23
286 define i8 @sel_constants_sub_constant(i1 %cond) {
287 ; ISEL-LABEL: sel_constants_sub_constant:
289 ; ISEL-NEXT: andi. 3, 3, 1
290 ; ISEL-NEXT: li 4, -9
291 ; ISEL-NEXT: li 3, 18
292 ; ISEL-NEXT: isel 3, 4, 3, 1
295 ; NO_ISEL-LABEL: sel_constants_sub_constant:
297 ; NO_ISEL-NEXT: andi. 3, 3, 1
298 ; NO_ISEL-NEXT: li 4, -9
299 ; NO_ISEL-NEXT: li 3, 18
300 ; NO_ISEL-NEXT: bc 12, 1, .LBB22_1
302 ; NO_ISEL-NEXT: .LBB22_1:
303 ; NO_ISEL-NEXT: addi 3, 4, 0
305 %sel = select i1 %cond, i8 -4, i8 23
310 define i8 @sel_constants_sub_constant_sel_constants(i1 %cond) {
311 ; ISEL-LABEL: sel_constants_sub_constant_sel_constants:
313 ; ISEL-NEXT: andi. 3, 3, 1
316 ; ISEL-NEXT: isel 3, 4, 3, 1
319 ; NO_ISEL-LABEL: sel_constants_sub_constant_sel_constants:
321 ; NO_ISEL-NEXT: andi. 3, 3, 1
322 ; NO_ISEL-NEXT: li 4, 9
323 ; NO_ISEL-NEXT: li 3, 2
324 ; NO_ISEL-NEXT: bc 12, 1, .LBB23_1
326 ; NO_ISEL-NEXT: .LBB23_1:
327 ; NO_ISEL-NEXT: addi 3, 4, 0
329 %sel = select i1 %cond, i8 -4, i8 3
334 define i8 @sel_constants_mul_constant(i1 %cond) {
335 ; ISEL-LABEL: sel_constants_mul_constant:
337 ; ISEL-NEXT: andi. 3, 3, 1
338 ; ISEL-NEXT: li 4, -20
339 ; ISEL-NEXT: li 3, 115
340 ; ISEL-NEXT: isel 3, 4, 3, 1
343 ; NO_ISEL-LABEL: sel_constants_mul_constant:
345 ; NO_ISEL-NEXT: andi. 3, 3, 1
346 ; NO_ISEL-NEXT: li 4, -20
347 ; NO_ISEL-NEXT: li 3, 115
348 ; NO_ISEL-NEXT: bc 12, 1, .LBB24_1
350 ; NO_ISEL-NEXT: .LBB24_1:
351 ; NO_ISEL-NEXT: addi 3, 4, 0
353 %sel = select i1 %cond, i8 -4, i8 23
358 define i8 @sel_constants_sdiv_constant(i1 %cond) {
359 ; ISEL-LABEL: sel_constants_sdiv_constant:
361 ; ISEL-NEXT: andi. 3, 3, 1
363 ; ISEL-NEXT: isel 3, 0, 3, 1
366 ; NO_ISEL-LABEL: sel_constants_sdiv_constant:
368 ; NO_ISEL-NEXT: andi. 3, 3, 1
369 ; NO_ISEL-NEXT: li 3, 4
370 ; NO_ISEL-NEXT: bc 12, 1, .LBB25_1
372 ; NO_ISEL-NEXT: .LBB25_1:
373 ; NO_ISEL-NEXT: addi 3, 0, 0
375 %sel = select i1 %cond, i8 -4, i8 23
376 %bo = sdiv i8 %sel, 5
380 define i8 @sdiv_constant_sel_constants(i1 %cond) {
381 ; ISEL-LABEL: sdiv_constant_sel_constants:
383 ; ISEL-NEXT: andi. 3, 3, 1
385 ; ISEL-NEXT: isel 3, 0, 3, 1
388 ; NO_ISEL-LABEL: sdiv_constant_sel_constants:
390 ; NO_ISEL-NEXT: andi. 3, 3, 1
391 ; NO_ISEL-NEXT: li 3, 5
392 ; NO_ISEL-NEXT: bc 12, 1, .LBB26_1
394 ; NO_ISEL-NEXT: .LBB26_1:
395 ; NO_ISEL-NEXT: addi 3, 0, 0
397 %sel = select i1 %cond, i8 121, i8 23
398 %bo = sdiv i8 120, %sel
402 define i8 @sel_constants_udiv_constant(i1 %cond) {
403 ; ISEL-LABEL: sel_constants_udiv_constant:
405 ; ISEL-NEXT: andi. 3, 3, 1
406 ; ISEL-NEXT: li 4, 50
408 ; ISEL-NEXT: isel 3, 4, 3, 1
411 ; NO_ISEL-LABEL: sel_constants_udiv_constant:
413 ; NO_ISEL-NEXT: andi. 3, 3, 1
414 ; NO_ISEL-NEXT: li 4, 50
415 ; NO_ISEL-NEXT: li 3, 4
416 ; NO_ISEL-NEXT: bc 12, 1, .LBB27_1
418 ; NO_ISEL-NEXT: .LBB27_1:
419 ; NO_ISEL-NEXT: addi 3, 4, 0
421 %sel = select i1 %cond, i8 -4, i8 23
422 %bo = udiv i8 %sel, 5
426 define i8 @udiv_constant_sel_constants(i1 %cond) {
427 ; ISEL-LABEL: udiv_constant_sel_constants:
429 ; ISEL-NEXT: andi. 3, 3, 1
431 ; ISEL-NEXT: isel 3, 0, 3, 1
434 ; NO_ISEL-LABEL: udiv_constant_sel_constants:
436 ; NO_ISEL-NEXT: andi. 3, 3, 1
437 ; NO_ISEL-NEXT: li 3, 5
438 ; NO_ISEL-NEXT: bc 12, 1, .LBB28_1
440 ; NO_ISEL-NEXT: .LBB28_1:
441 ; NO_ISEL-NEXT: addi 3, 0, 0
443 %sel = select i1 %cond, i8 -4, i8 23
444 %bo = udiv i8 120, %sel
448 define i8 @sel_constants_srem_constant(i1 %cond) {
449 ; ISEL-LABEL: sel_constants_srem_constant:
451 ; ISEL-NEXT: andi. 3, 3, 1
452 ; ISEL-NEXT: li 4, -4
454 ; ISEL-NEXT: isel 3, 4, 3, 1
457 ; NO_ISEL-LABEL: sel_constants_srem_constant:
459 ; NO_ISEL-NEXT: andi. 3, 3, 1
460 ; NO_ISEL-NEXT: li 4, -4
461 ; NO_ISEL-NEXT: li 3, 3
462 ; NO_ISEL-NEXT: bc 12, 1, .LBB29_1
464 ; NO_ISEL-NEXT: .LBB29_1:
465 ; NO_ISEL-NEXT: addi 3, 4, 0
467 %sel = select i1 %cond, i8 -4, i8 23
468 %bo = srem i8 %sel, 5
472 define i8 @srem_constant_sel_constants(i1 %cond) {
473 ; ISEL-LABEL: srem_constant_sel_constants:
475 ; ISEL-NEXT: andi. 3, 3, 1
476 ; ISEL-NEXT: li 4, 120
478 ; ISEL-NEXT: isel 3, 4, 3, 1
481 ; NO_ISEL-LABEL: srem_constant_sel_constants:
483 ; NO_ISEL-NEXT: andi. 3, 3, 1
484 ; NO_ISEL-NEXT: li 4, 120
485 ; NO_ISEL-NEXT: li 3, 5
486 ; NO_ISEL-NEXT: bc 12, 1, .LBB30_1
488 ; NO_ISEL-NEXT: .LBB30_1:
489 ; NO_ISEL-NEXT: addi 3, 4, 0
491 %sel = select i1 %cond, i8 121, i8 23
492 %bo = srem i8 120, %sel
496 define i8 @sel_constants_urem_constant(i1 %cond) {
497 ; ALL-LABEL: sel_constants_urem_constant:
499 ; ALL-NEXT: clrldi 3, 3, 63
500 ; ALL-NEXT: subfic 3, 3, 3
502 %sel = select i1 %cond, i8 -4, i8 23
503 %bo = urem i8 %sel, 5
507 define i8 @urem_constant_sel_constants(i1 %cond) {
508 ; ISEL-LABEL: urem_constant_sel_constants:
510 ; ISEL-NEXT: andi. 3, 3, 1
511 ; ISEL-NEXT: li 4, 120
513 ; ISEL-NEXT: isel 3, 4, 3, 1
516 ; NO_ISEL-LABEL: urem_constant_sel_constants:
518 ; NO_ISEL-NEXT: andi. 3, 3, 1
519 ; NO_ISEL-NEXT: li 4, 120
520 ; NO_ISEL-NEXT: li 3, 5
521 ; NO_ISEL-NEXT: bc 12, 1, .LBB32_1
523 ; NO_ISEL-NEXT: .LBB32_1:
524 ; NO_ISEL-NEXT: addi 3, 4, 0
526 %sel = select i1 %cond, i8 -4, i8 23
527 %bo = urem i8 120, %sel
531 define i8 @sel_constants_and_constant(i1 %cond) {
532 ; ALL-LABEL: sel_constants_and_constant:
534 ; ALL-NEXT: clrldi 3, 3, 63
535 ; ALL-NEXT: subfic 3, 3, 5
537 %sel = select i1 %cond, i8 -4, i8 23
542 define i8 @sel_constants_or_constant(i1 %cond) {
543 ; ISEL-LABEL: sel_constants_or_constant:
545 ; ISEL-NEXT: andi. 3, 3, 1
546 ; ISEL-NEXT: li 4, -3
547 ; ISEL-NEXT: li 3, 23
548 ; ISEL-NEXT: isel 3, 4, 3, 1
551 ; NO_ISEL-LABEL: sel_constants_or_constant:
553 ; NO_ISEL-NEXT: andi. 3, 3, 1
554 ; NO_ISEL-NEXT: li 4, -3
555 ; NO_ISEL-NEXT: li 3, 23
556 ; NO_ISEL-NEXT: bc 12, 1, .LBB34_1
558 ; NO_ISEL-NEXT: .LBB34_1:
559 ; NO_ISEL-NEXT: addi 3, 4, 0
561 %sel = select i1 %cond, i8 -4, i8 23
566 define i8 @sel_constants_xor_constant(i1 %cond) {
567 ; ISEL-LABEL: sel_constants_xor_constant:
569 ; ISEL-NEXT: andi. 3, 3, 1
570 ; ISEL-NEXT: li 4, -7
571 ; ISEL-NEXT: li 3, 18
572 ; ISEL-NEXT: isel 3, 4, 3, 1
575 ; NO_ISEL-LABEL: sel_constants_xor_constant:
577 ; NO_ISEL-NEXT: andi. 3, 3, 1
578 ; NO_ISEL-NEXT: li 4, -7
579 ; NO_ISEL-NEXT: li 3, 18
580 ; NO_ISEL-NEXT: bc 12, 1, .LBB35_1
582 ; NO_ISEL-NEXT: .LBB35_1:
583 ; NO_ISEL-NEXT: addi 3, 4, 0
585 %sel = select i1 %cond, i8 -4, i8 23
590 define i8 @sel_constants_shl_constant(i1 %cond) {
591 ; ISEL-LABEL: sel_constants_shl_constant:
593 ; ISEL-NEXT: andi. 3, 3, 1
594 ; ISEL-NEXT: li 4, -128
595 ; ISEL-NEXT: li 3, -32
596 ; ISEL-NEXT: isel 3, 4, 3, 1
599 ; NO_ISEL-LABEL: sel_constants_shl_constant:
601 ; NO_ISEL-NEXT: andi. 3, 3, 1
602 ; NO_ISEL-NEXT: li 4, -128
603 ; NO_ISEL-NEXT: li 3, -32
604 ; NO_ISEL-NEXT: bc 12, 1, .LBB36_1
606 ; NO_ISEL-NEXT: .LBB36_1:
607 ; NO_ISEL-NEXT: addi 3, 4, 0
609 %sel = select i1 %cond, i8 -4, i8 23
614 define i8 @shl_constant_sel_constants(i1 %cond) {
615 ; ALL-LABEL: shl_constant_sel_constants:
617 ; ALL-NEXT: rlwinm 3, 3, 0, 31, 31
619 ; ALL-NEXT: subfic 3, 3, 3
620 ; ALL-NEXT: slw 3, 4, 3
622 %sel = select i1 %cond, i8 2, i8 3
627 define i8 @sel_constants_lshr_constant(i1 %cond) {
628 ; ISEL-LABEL: sel_constants_lshr_constant:
630 ; ISEL-NEXT: andi. 3, 3, 1
633 ; ISEL-NEXT: isel 3, 4, 3, 1
636 ; NO_ISEL-LABEL: sel_constants_lshr_constant:
638 ; NO_ISEL-NEXT: andi. 3, 3, 1
639 ; NO_ISEL-NEXT: li 4, 7
640 ; NO_ISEL-NEXT: li 3, 0
641 ; NO_ISEL-NEXT: bc 12, 1, .LBB38_1
643 ; NO_ISEL-NEXT: .LBB38_1:
644 ; NO_ISEL-NEXT: addi 3, 4, 0
646 %sel = select i1 %cond, i8 -4, i8 23
647 %bo = lshr i8 %sel, 5
651 define i8 @lshr_constant_sel_constants(i1 %cond) {
652 ; ALL-LABEL: lshr_constant_sel_constants:
654 ; ALL-NEXT: rlwinm 3, 3, 0, 31, 31
656 ; ALL-NEXT: subfic 3, 3, 3
657 ; ALL-NEXT: srw 3, 4, 3
659 %sel = select i1 %cond, i8 2, i8 3
660 %bo = lshr i8 64, %sel
665 define i8 @sel_constants_ashr_constant(i1 %cond) {
666 ; ALL-LABEL: sel_constants_ashr_constant:
668 ; ALL-NEXT: clrldi 3, 3, 63
671 %sel = select i1 %cond, i8 -4, i8 23
672 %bo = ashr i8 %sel, 5
676 define i8 @ashr_constant_sel_constants(i1 %cond) {
677 ; ALL-LABEL: ashr_constant_sel_constants:
679 ; ALL-NEXT: rlwinm 3, 3, 0, 31, 31
680 ; ALL-NEXT: li 4, -128
681 ; ALL-NEXT: subfic 3, 3, 3
682 ; ALL-NEXT: sraw 3, 4, 3
684 %sel = select i1 %cond, i8 2, i8 3
685 %bo = ashr i8 128, %sel
689 define double @sel_constants_fadd_constant(i1 %cond) {
690 ; ISEL-LABEL: sel_constants_fadd_constant:
692 ; ISEL-NEXT: andi. 3, 3, 1
693 ; ISEL-NEXT: addis 4, 2, .LCPI42_0@toc@ha
694 ; ISEL-NEXT: addis 3, 2, .LCPI42_1@toc@ha
695 ; ISEL-NEXT: addi 4, 4, .LCPI42_0@toc@l
696 ; ISEL-NEXT: addi 3, 3, .LCPI42_1@toc@l
697 ; ISEL-NEXT: isel 3, 3, 4, 1
698 ; ISEL-NEXT: lfdx 1, 0, 3
701 ; NO_ISEL-LABEL: sel_constants_fadd_constant:
703 ; NO_ISEL-NEXT: andi. 3, 3, 1
704 ; NO_ISEL-NEXT: addis 4, 2, .LCPI42_0@toc@ha
705 ; NO_ISEL-NEXT: addis 3, 2, .LCPI42_1@toc@ha
706 ; NO_ISEL-NEXT: addi 4, 4, .LCPI42_0@toc@l
707 ; NO_ISEL-NEXT: addi 3, 3, .LCPI42_1@toc@l
708 ; NO_ISEL-NEXT: bc 12, 1, .LBB42_2
709 ; NO_ISEL-NEXT: # %bb.1:
710 ; NO_ISEL-NEXT: ori 3, 4, 0
711 ; NO_ISEL-NEXT: b .LBB42_2
712 ; NO_ISEL-NEXT: .LBB42_2:
713 ; NO_ISEL-NEXT: lfdx 1, 0, 3
715 %sel = select i1 %cond, double -4.0, double 23.3
716 %bo = fadd double %sel, 5.1
720 define double @sel_constants_fsub_constant(i1 %cond) {
721 ; ISEL-LABEL: sel_constants_fsub_constant:
723 ; ISEL-NEXT: andi. 3, 3, 1
724 ; ISEL-NEXT: addis 4, 2, .LCPI43_0@toc@ha
725 ; ISEL-NEXT: addis 3, 2, .LCPI43_1@toc@ha
726 ; ISEL-NEXT: addi 4, 4, .LCPI43_0@toc@l
727 ; ISEL-NEXT: addi 3, 3, .LCPI43_1@toc@l
728 ; ISEL-NEXT: isel 3, 3, 4, 1
729 ; ISEL-NEXT: lfdx 1, 0, 3
732 ; NO_ISEL-LABEL: sel_constants_fsub_constant:
734 ; NO_ISEL-NEXT: andi. 3, 3, 1
735 ; NO_ISEL-NEXT: addis 4, 2, .LCPI43_0@toc@ha
736 ; NO_ISEL-NEXT: addis 3, 2, .LCPI43_1@toc@ha
737 ; NO_ISEL-NEXT: addi 4, 4, .LCPI43_0@toc@l
738 ; NO_ISEL-NEXT: addi 3, 3, .LCPI43_1@toc@l
739 ; NO_ISEL-NEXT: bc 12, 1, .LBB43_2
740 ; NO_ISEL-NEXT: # %bb.1:
741 ; NO_ISEL-NEXT: ori 3, 4, 0
742 ; NO_ISEL-NEXT: b .LBB43_2
743 ; NO_ISEL-NEXT: .LBB43_2:
744 ; NO_ISEL-NEXT: lfdx 1, 0, 3
746 %sel = select i1 %cond, double -4.0, double 23.3
747 %bo = fsub double %sel, 5.1
751 define double @fsub_constant_sel_constants(i1 %cond) {
752 ; ISEL-LABEL: fsub_constant_sel_constants:
754 ; ISEL-NEXT: andi. 3, 3, 1
755 ; ISEL-NEXT: addis 4, 2, .LCPI44_0@toc@ha
756 ; ISEL-NEXT: addis 3, 2, .LCPI44_1@toc@ha
757 ; ISEL-NEXT: addi 4, 4, .LCPI44_0@toc@l
758 ; ISEL-NEXT: addi 3, 3, .LCPI44_1@toc@l
759 ; ISEL-NEXT: isel 3, 3, 4, 1
760 ; ISEL-NEXT: lfdx 1, 0, 3
763 ; NO_ISEL-LABEL: fsub_constant_sel_constants:
765 ; NO_ISEL-NEXT: andi. 3, 3, 1
766 ; NO_ISEL-NEXT: addis 4, 2, .LCPI44_0@toc@ha
767 ; NO_ISEL-NEXT: addis 3, 2, .LCPI44_1@toc@ha
768 ; NO_ISEL-NEXT: addi 4, 4, .LCPI44_0@toc@l
769 ; NO_ISEL-NEXT: addi 3, 3, .LCPI44_1@toc@l
770 ; NO_ISEL-NEXT: bc 12, 1, .LBB44_2
771 ; NO_ISEL-NEXT: # %bb.1:
772 ; NO_ISEL-NEXT: ori 3, 4, 0
773 ; NO_ISEL-NEXT: b .LBB44_2
774 ; NO_ISEL-NEXT: .LBB44_2:
775 ; NO_ISEL-NEXT: lfdx 1, 0, 3
777 %sel = select i1 %cond, double -4.0, double 23.3
778 %bo = fsub double 5.1, %sel
782 define double @sel_constants_fmul_constant(i1 %cond) {
783 ; ISEL-LABEL: sel_constants_fmul_constant:
785 ; ISEL-NEXT: andi. 3, 3, 1
786 ; ISEL-NEXT: addis 4, 2, .LCPI45_0@toc@ha
787 ; ISEL-NEXT: addis 3, 2, .LCPI45_1@toc@ha
788 ; ISEL-NEXT: addi 4, 4, .LCPI45_0@toc@l
789 ; ISEL-NEXT: addi 3, 3, .LCPI45_1@toc@l
790 ; ISEL-NEXT: isel 3, 3, 4, 1
791 ; ISEL-NEXT: lfdx 1, 0, 3
794 ; NO_ISEL-LABEL: sel_constants_fmul_constant:
796 ; NO_ISEL-NEXT: andi. 3, 3, 1
797 ; NO_ISEL-NEXT: addis 4, 2, .LCPI45_0@toc@ha
798 ; NO_ISEL-NEXT: addis 3, 2, .LCPI45_1@toc@ha
799 ; NO_ISEL-NEXT: addi 4, 4, .LCPI45_0@toc@l
800 ; NO_ISEL-NEXT: addi 3, 3, .LCPI45_1@toc@l
801 ; NO_ISEL-NEXT: bc 12, 1, .LBB45_2
802 ; NO_ISEL-NEXT: # %bb.1:
803 ; NO_ISEL-NEXT: ori 3, 4, 0
804 ; NO_ISEL-NEXT: b .LBB45_2
805 ; NO_ISEL-NEXT: .LBB45_2:
806 ; NO_ISEL-NEXT: lfdx 1, 0, 3
808 %sel = select i1 %cond, double -4.0, double 23.3
809 %bo = fmul double %sel, 5.1
813 define double @sel_constants_fdiv_constant(i1 %cond) {
814 ; ISEL-LABEL: sel_constants_fdiv_constant:
816 ; ISEL-NEXT: andi. 3, 3, 1
817 ; ISEL-NEXT: addis 4, 2, .LCPI46_0@toc@ha
818 ; ISEL-NEXT: addis 3, 2, .LCPI46_1@toc@ha
819 ; ISEL-NEXT: addi 4, 4, .LCPI46_0@toc@l
820 ; ISEL-NEXT: addi 3, 3, .LCPI46_1@toc@l
821 ; ISEL-NEXT: isel 3, 3, 4, 1
822 ; ISEL-NEXT: lfdx 1, 0, 3
825 ; NO_ISEL-LABEL: sel_constants_fdiv_constant:
827 ; NO_ISEL-NEXT: andi. 3, 3, 1
828 ; NO_ISEL-NEXT: addis 4, 2, .LCPI46_0@toc@ha
829 ; NO_ISEL-NEXT: addis 3, 2, .LCPI46_1@toc@ha
830 ; NO_ISEL-NEXT: addi 4, 4, .LCPI46_0@toc@l
831 ; NO_ISEL-NEXT: addi 3, 3, .LCPI46_1@toc@l
832 ; NO_ISEL-NEXT: bc 12, 1, .LBB46_2
833 ; NO_ISEL-NEXT: # %bb.1:
834 ; NO_ISEL-NEXT: ori 3, 4, 0
835 ; NO_ISEL-NEXT: b .LBB46_2
836 ; NO_ISEL-NEXT: .LBB46_2:
837 ; NO_ISEL-NEXT: lfdx 1, 0, 3
839 %sel = select i1 %cond, double -4.0, double 23.3
840 %bo = fdiv double %sel, 5.1
844 define double @fdiv_constant_sel_constants(i1 %cond) {
845 ; ISEL-LABEL: fdiv_constant_sel_constants:
847 ; ISEL-NEXT: andi. 3, 3, 1
848 ; ISEL-NEXT: addis 4, 2, .LCPI47_0@toc@ha
849 ; ISEL-NEXT: addis 3, 2, .LCPI47_1@toc@ha
850 ; ISEL-NEXT: addi 4, 4, .LCPI47_0@toc@l
851 ; ISEL-NEXT: addi 3, 3, .LCPI47_1@toc@l
852 ; ISEL-NEXT: isel 3, 3, 4, 1
853 ; ISEL-NEXT: lfdx 1, 0, 3
856 ; NO_ISEL-LABEL: fdiv_constant_sel_constants:
858 ; NO_ISEL-NEXT: andi. 3, 3, 1
859 ; NO_ISEL-NEXT: addis 4, 2, .LCPI47_0@toc@ha
860 ; NO_ISEL-NEXT: addis 3, 2, .LCPI47_1@toc@ha
861 ; NO_ISEL-NEXT: addi 4, 4, .LCPI47_0@toc@l
862 ; NO_ISEL-NEXT: addi 3, 3, .LCPI47_1@toc@l
863 ; NO_ISEL-NEXT: bc 12, 1, .LBB47_2
864 ; NO_ISEL-NEXT: # %bb.1:
865 ; NO_ISEL-NEXT: ori 3, 4, 0
866 ; NO_ISEL-NEXT: b .LBB47_2
867 ; NO_ISEL-NEXT: .LBB47_2:
868 ; NO_ISEL-NEXT: lfdx 1, 0, 3
870 %sel = select i1 %cond, double -4.0, double 23.3
871 %bo = fdiv double 5.1, %sel
875 define double @sel_constants_frem_constant(i1 %cond) {
876 ; ALL-LABEL: sel_constants_frem_constant:
878 ; ALL-NEXT: andi. 3, 3, 1
879 ; ALL-NEXT: bc 12, 1, .LBB48_2
881 ; ALL-NEXT: addis 3, 2, .LCPI48_0@toc@ha
882 ; ALL-NEXT: lfd 1, .LCPI48_0@toc@l(3)
884 ; ALL-NEXT: .LBB48_2:
885 ; ALL-NEXT: addis 3, 2, .LCPI48_1@toc@ha
886 ; ALL-NEXT: lfs 1, .LCPI48_1@toc@l(3)
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 4, 2, .LCPI49_0@toc@ha
898 ; ISEL-NEXT: addis 3, 2, .LCPI49_1@toc@ha
899 ; ISEL-NEXT: addi 4, 4, .LCPI49_0@toc@l
900 ; ISEL-NEXT: addi 3, 3, .LCPI49_1@toc@l
901 ; ISEL-NEXT: isel 3, 3, 4, 1
902 ; ISEL-NEXT: lfdx 1, 0, 3
905 ; NO_ISEL-LABEL: frem_constant_sel_constants:
907 ; NO_ISEL-NEXT: andi. 3, 3, 1
908 ; NO_ISEL-NEXT: addis 4, 2, .LCPI49_0@toc@ha
909 ; NO_ISEL-NEXT: addis 3, 2, .LCPI49_1@toc@ha
910 ; NO_ISEL-NEXT: addi 4, 4, .LCPI49_0@toc@l
911 ; NO_ISEL-NEXT: addi 3, 3, .LCPI49_1@toc@l
912 ; NO_ISEL-NEXT: bc 12, 1, .LBB49_2
913 ; NO_ISEL-NEXT: # %bb.1:
914 ; NO_ISEL-NEXT: ori 3, 4, 0
915 ; NO_ISEL-NEXT: b .LBB49_2
916 ; NO_ISEL-NEXT: .LBB49_2:
917 ; NO_ISEL-NEXT: lfdx 1, 0, 3
919 %sel = select i1 %cond, double -4.0, double 23.3
920 %bo = frem double 5.1, %sel