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 ; ISEL-LABEL: select_0_or_neg1:
73 ; ISEL-NEXT: andi. 3, 3, 1
74 ; ISEL-NEXT: oris 3, 4, 65535
75 ; ISEL-NEXT: ori 3, 3, 65535
76 ; ISEL-NEXT: isel 3, 0, 3, 1
79 ; NO_ISEL-LABEL: select_0_or_neg1:
81 ; NO_ISEL-NEXT: li 4, 0
82 ; NO_ISEL-NEXT: andi. 3, 3, 1
83 ; NO_ISEL-NEXT: oris 3, 4, 65535
84 ; NO_ISEL-NEXT: ori 3, 3, 65535
85 ; NO_ISEL-NEXT: bc 12, 1, .LBB6_1
87 ; NO_ISEL-NEXT: .LBB6_1:
88 ; NO_ISEL-NEXT: addi 3, 0, 0
90 %sel = select i1 %cond, i32 0, i32 -1
94 define i32 @select_0_or_neg1_zeroext(i1 zeroext %cond) {
95 ; ISEL-LABEL: select_0_or_neg1_zeroext:
98 ; ISEL-NEXT: andi. 3, 3, 1
99 ; ISEL-NEXT: oris 3, 4, 65535
100 ; ISEL-NEXT: ori 3, 3, 65535
101 ; ISEL-NEXT: isel 3, 0, 3, 1
104 ; NO_ISEL-LABEL: select_0_or_neg1_zeroext:
106 ; NO_ISEL-NEXT: li 4, 0
107 ; NO_ISEL-NEXT: andi. 3, 3, 1
108 ; NO_ISEL-NEXT: oris 3, 4, 65535
109 ; NO_ISEL-NEXT: ori 3, 3, 65535
110 ; NO_ISEL-NEXT: bc 12, 1, .LBB7_1
112 ; NO_ISEL-NEXT: .LBB7_1:
113 ; NO_ISEL-NEXT: addi 3, 0, 0
115 %sel = select i1 %cond, i32 0, i32 -1
119 define i32 @select_0_or_neg1_signext(i1 signext %cond) {
120 ; ISEL-LABEL: select_0_or_neg1_signext:
123 ; ISEL-NEXT: andi. 3, 3, 1
124 ; ISEL-NEXT: oris 3, 4, 65535
125 ; ISEL-NEXT: ori 3, 3, 65535
126 ; ISEL-NEXT: isel 3, 0, 3, 1
129 ; NO_ISEL-LABEL: select_0_or_neg1_signext:
131 ; NO_ISEL-NEXT: li 4, 0
132 ; NO_ISEL-NEXT: andi. 3, 3, 1
133 ; NO_ISEL-NEXT: oris 3, 4, 65535
134 ; NO_ISEL-NEXT: ori 3, 3, 65535
135 ; NO_ISEL-NEXT: bc 12, 1, .LBB8_1
137 ; NO_ISEL-NEXT: .LBB8_1:
138 ; NO_ISEL-NEXT: addi 3, 0, 0
140 %sel = select i1 %cond, i32 0, i32 -1
144 ; select Cond, -1, 0 --> sext (Cond)
146 define i32 @select_neg1_or_0(i1 %cond) {
147 ; ISEL-LABEL: select_neg1_or_0:
150 ; ISEL-NEXT: andi. 3, 3, 1
151 ; ISEL-NEXT: oris 3, 4, 65535
152 ; ISEL-NEXT: ori 3, 3, 65535
153 ; ISEL-NEXT: isel 3, 3, 4, 1
156 ; NO_ISEL-LABEL: select_neg1_or_0:
158 ; NO_ISEL-NEXT: li 4, 0
159 ; NO_ISEL-NEXT: andi. 3, 3, 1
160 ; NO_ISEL-NEXT: oris 3, 4, 65535
161 ; NO_ISEL-NEXT: ori 3, 3, 65535
162 ; NO_ISEL-NEXT: bclr 12, 1, 0
163 ; NO_ISEL-NEXT: # BB#1:
164 ; NO_ISEL-NEXT: ori 3, 4, 0
166 %sel = select i1 %cond, i32 -1, i32 0
170 define i32 @select_neg1_or_0_zeroext(i1 zeroext %cond) {
171 ; ISEL-LABEL: select_neg1_or_0_zeroext:
174 ; ISEL-NEXT: andi. 3, 3, 1
175 ; ISEL-NEXT: oris 3, 4, 65535
176 ; ISEL-NEXT: ori 3, 3, 65535
177 ; ISEL-NEXT: isel 3, 3, 4, 1
180 ; NO_ISEL-LABEL: select_neg1_or_0_zeroext:
182 ; NO_ISEL-NEXT: li 4, 0
183 ; NO_ISEL-NEXT: andi. 3, 3, 1
184 ; NO_ISEL-NEXT: oris 3, 4, 65535
185 ; NO_ISEL-NEXT: ori 3, 3, 65535
186 ; NO_ISEL-NEXT: bclr 12, 1, 0
187 ; NO_ISEL-NEXT: # BB#1:
188 ; NO_ISEL-NEXT: ori 3, 4, 0
190 %sel = select i1 %cond, i32 -1, i32 0
194 define i32 @select_neg1_or_0_signext(i1 signext %cond) {
195 ; ISEL-LABEL: select_neg1_or_0_signext:
198 ; ISEL-NEXT: andi. 3, 3, 1
199 ; ISEL-NEXT: oris 3, 4, 65535
200 ; ISEL-NEXT: ori 3, 3, 65535
201 ; ISEL-NEXT: isel 3, 3, 4, 1
204 ; NO_ISEL-LABEL: select_neg1_or_0_signext:
206 ; NO_ISEL-NEXT: li 4, 0
207 ; NO_ISEL-NEXT: andi. 3, 3, 1
208 ; NO_ISEL-NEXT: oris 3, 4, 65535
209 ; NO_ISEL-NEXT: ori 3, 3, 65535
210 ; NO_ISEL-NEXT: bclr 12, 1, 0
211 ; NO_ISEL-NEXT: # BB#1:
212 ; NO_ISEL-NEXT: ori 3, 4, 0
214 %sel = select i1 %cond, i32 -1, i32 0
218 ; select Cond, C+1, C --> add (zext Cond), C
220 define i32 @select_Cplus1_C(i1 %cond) {
221 ; ALL-LABEL: select_Cplus1_C:
223 ; ALL-NEXT: clrldi 3, 3, 63
224 ; ALL-NEXT: addi 3, 3, 41
226 %sel = select i1 %cond, i32 42, i32 41
230 define i32 @select_Cplus1_C_zeroext(i1 zeroext %cond) {
231 ; ALL-LABEL: select_Cplus1_C_zeroext:
233 ; ALL-NEXT: addi 3, 3, 41
235 %sel = select i1 %cond, i32 42, i32 41
239 define i32 @select_Cplus1_C_signext(i1 signext %cond) {
240 ; ALL-LABEL: select_Cplus1_C_signext:
242 ; ALL-NEXT: subfic 3, 3, 41
244 %sel = select i1 %cond, i32 42, i32 41
248 ; select Cond, C, C+1 --> add (sext Cond), C
250 define i32 @select_C_Cplus1(i1 %cond) {
251 ; ALL-LABEL: select_C_Cplus1:
253 ; ALL-NEXT: clrldi 3, 3, 63
254 ; ALL-NEXT: subfic 3, 3, 42
256 %sel = select i1 %cond, i32 41, i32 42
260 define i32 @select_C_Cplus1_zeroext(i1 zeroext %cond) {
261 ; ALL-LABEL: select_C_Cplus1_zeroext:
263 ; ALL-NEXT: subfic 3, 3, 42
265 %sel = select i1 %cond, i32 41, i32 42
269 define i32 @select_C_Cplus1_signext(i1 signext %cond) {
270 ; ALL-LABEL: select_C_Cplus1_signext:
272 ; ALL-NEXT: addi 3, 3, 42
274 %sel = select i1 %cond, i32 41, i32 42
278 ; In general, select of 2 constants could be:
279 ; select Cond, C1, C2 --> add (mul (zext Cond), C1-C2), C2 --> add (and (sext Cond), C1-C2), C2
281 define i32 @select_C1_C2(i1 %cond) {
282 ; ISEL-LABEL: select_C1_C2:
284 ; ISEL-NEXT: andi. 3, 3, 1
285 ; ISEL-NEXT: li 4, 421
286 ; ISEL-NEXT: li 3, 42
287 ; ISEL-NEXT: isel 3, 4, 3, 1
290 ; NO_ISEL-LABEL: select_C1_C2:
292 ; NO_ISEL-NEXT: andi. 3, 3, 1
293 ; NO_ISEL-NEXT: li 4, 421
294 ; NO_ISEL-NEXT: li 3, 42
295 ; NO_ISEL-NEXT: bc 12, 1, .LBB18_1
297 ; NO_ISEL-NEXT: .LBB18_1:
298 ; NO_ISEL-NEXT: addi 3, 4, 0
300 %sel = select i1 %cond, i32 421, i32 42
304 define i32 @select_C1_C2_zeroext(i1 zeroext %cond) {
305 ; ISEL-LABEL: select_C1_C2_zeroext:
307 ; ISEL-NEXT: andi. 3, 3, 1
308 ; ISEL-NEXT: li 4, 421
309 ; ISEL-NEXT: li 3, 42
310 ; ISEL-NEXT: isel 3, 4, 3, 1
313 ; NO_ISEL-LABEL: select_C1_C2_zeroext:
315 ; NO_ISEL-NEXT: andi. 3, 3, 1
316 ; NO_ISEL-NEXT: li 4, 421
317 ; NO_ISEL-NEXT: li 3, 42
318 ; NO_ISEL-NEXT: bc 12, 1, .LBB19_1
320 ; NO_ISEL-NEXT: .LBB19_1:
321 ; NO_ISEL-NEXT: addi 3, 4, 0
323 %sel = select i1 %cond, i32 421, i32 42
327 define i32 @select_C1_C2_signext(i1 signext %cond) {
328 ; ISEL-LABEL: select_C1_C2_signext:
330 ; ISEL-NEXT: andi. 3, 3, 1
331 ; ISEL-NEXT: li 4, 421
332 ; ISEL-NEXT: li 3, 42
333 ; ISEL-NEXT: isel 3, 4, 3, 1
336 ; NO_ISEL-LABEL: select_C1_C2_signext:
338 ; NO_ISEL-NEXT: andi. 3, 3, 1
339 ; NO_ISEL-NEXT: li 4, 421
340 ; NO_ISEL-NEXT: li 3, 42
341 ; NO_ISEL-NEXT: bc 12, 1, .LBB20_1
343 ; NO_ISEL-NEXT: .LBB20_1:
344 ; NO_ISEL-NEXT: addi 3, 4, 0
346 %sel = select i1 %cond, i32 421, i32 42
350 ; A binary operator with constant after the select should always get folded into the select.
352 define i8 @sel_constants_add_constant(i1 %cond) {
353 ; ISEL-LABEL: sel_constants_add_constant:
355 ; ISEL-NEXT: andi. 3, 3, 1
357 ; ISEL-NEXT: li 3, 28
358 ; ISEL-NEXT: isel 3, 4, 3, 1
361 ; NO_ISEL-LABEL: sel_constants_add_constant:
363 ; NO_ISEL-NEXT: andi. 3, 3, 1
364 ; NO_ISEL-NEXT: li 4, 1
365 ; NO_ISEL-NEXT: li 3, 28
366 ; NO_ISEL-NEXT: bc 12, 1, .LBB21_1
368 ; NO_ISEL-NEXT: .LBB21_1:
369 ; NO_ISEL-NEXT: addi 3, 4, 0
371 %sel = select i1 %cond, i8 -4, i8 23
376 define i8 @sel_constants_sub_constant(i1 %cond) {
377 ; ISEL-LABEL: sel_constants_sub_constant:
380 ; ISEL-NEXT: andi. 3, 3, 1
381 ; ISEL-NEXT: oris 3, 4, 65535
382 ; ISEL-NEXT: li 4, 18
383 ; ISEL-NEXT: ori 3, 3, 65527
384 ; ISEL-NEXT: isel 3, 3, 4, 1
387 ; NO_ISEL-LABEL: sel_constants_sub_constant:
389 ; NO_ISEL-NEXT: li 4, 0
390 ; NO_ISEL-NEXT: andi. 3, 3, 1
391 ; NO_ISEL-NEXT: oris 3, 4, 65535
392 ; NO_ISEL-NEXT: li 4, 18
393 ; NO_ISEL-NEXT: ori 3, 3, 65527
394 ; NO_ISEL-NEXT: bclr 12, 1, 0
395 ; NO_ISEL-NEXT: # BB#1:
396 ; NO_ISEL-NEXT: ori 3, 4, 0
398 %sel = select i1 %cond, i8 -4, i8 23
403 define i8 @sel_constants_mul_constant(i1 %cond) {
404 ; ISEL-LABEL: sel_constants_mul_constant:
406 ; ISEL-NEXT: lis 4, 16383
407 ; ISEL-NEXT: andi. 3, 3, 1
408 ; ISEL-NEXT: ori 3, 4, 65531
409 ; ISEL-NEXT: li 4, 115
410 ; ISEL-NEXT: sldi 3, 3, 2
411 ; ISEL-NEXT: isel 3, 3, 4, 1
414 ; NO_ISEL-LABEL: sel_constants_mul_constant:
416 ; NO_ISEL-NEXT: lis 4, 16383
417 ; NO_ISEL-NEXT: andi. 3, 3, 1
418 ; NO_ISEL-NEXT: ori 3, 4, 65531
419 ; NO_ISEL-NEXT: li 4, 115
420 ; NO_ISEL-NEXT: sldi 3, 3, 2
421 ; NO_ISEL-NEXT: bclr 12, 1, 0
422 ; NO_ISEL-NEXT: # BB#1:
423 ; NO_ISEL-NEXT: ori 3, 4, 0
425 %sel = select i1 %cond, i8 -4, i8 23
430 define i8 @sel_constants_sdiv_constant(i1 %cond) {
431 ; ISEL-LABEL: sel_constants_sdiv_constant:
433 ; ISEL-NEXT: andi. 3, 3, 1
435 ; ISEL-NEXT: isel 3, 0, 3, 1
438 ; NO_ISEL-LABEL: sel_constants_sdiv_constant:
440 ; NO_ISEL-NEXT: andi. 3, 3, 1
441 ; NO_ISEL-NEXT: li 3, 4
442 ; NO_ISEL-NEXT: bc 12, 1, .LBB24_1
444 ; NO_ISEL-NEXT: .LBB24_1:
445 ; NO_ISEL-NEXT: addi 3, 0, 0
447 %sel = select i1 %cond, i8 -4, i8 23
448 %bo = sdiv i8 %sel, 5
452 define i8 @sel_constants_udiv_constant(i1 %cond) {
453 ; ISEL-LABEL: sel_constants_udiv_constant:
455 ; ISEL-NEXT: andi. 3, 3, 1
456 ; ISEL-NEXT: li 4, 50
458 ; ISEL-NEXT: isel 3, 4, 3, 1
461 ; NO_ISEL-LABEL: sel_constants_udiv_constant:
463 ; NO_ISEL-NEXT: andi. 3, 3, 1
464 ; NO_ISEL-NEXT: li 4, 50
465 ; NO_ISEL-NEXT: li 3, 4
466 ; NO_ISEL-NEXT: bc 12, 1, .LBB25_1
468 ; NO_ISEL-NEXT: .LBB25_1:
469 ; NO_ISEL-NEXT: addi 3, 4, 0
471 %sel = select i1 %cond, i8 -4, i8 23
472 %bo = udiv i8 %sel, 5
476 define i8 @sel_constants_srem_constant(i1 %cond) {
477 ; ISEL-LABEL: sel_constants_srem_constant:
479 ; ISEL-NEXT: lis 4, 16383
480 ; ISEL-NEXT: andi. 3, 3, 1
481 ; ISEL-NEXT: ori 3, 4, 65535
483 ; ISEL-NEXT: sldi 3, 3, 2
484 ; ISEL-NEXT: isel 3, 3, 4, 1
487 ; NO_ISEL-LABEL: sel_constants_srem_constant:
489 ; NO_ISEL-NEXT: lis 4, 16383
490 ; NO_ISEL-NEXT: andi. 3, 3, 1
491 ; NO_ISEL-NEXT: ori 3, 4, 65535
492 ; NO_ISEL-NEXT: li 4, 3
493 ; NO_ISEL-NEXT: sldi 3, 3, 2
494 ; NO_ISEL-NEXT: bclr 12, 1, 0
495 ; NO_ISEL-NEXT: # BB#1:
496 ; NO_ISEL-NEXT: ori 3, 4, 0
498 %sel = select i1 %cond, i8 -4, i8 23
499 %bo = srem i8 %sel, 5
503 define i8 @sel_constants_urem_constant(i1 %cond) {
504 ; ALL-LABEL: sel_constants_urem_constant:
506 ; ALL-NEXT: rlwinm 3, 3, 0, 31, 31
507 ; ALL-NEXT: subfic 3, 3, 3
509 %sel = select i1 %cond, i8 -4, i8 23
510 %bo = urem i8 %sel, 5
514 define i8 @sel_constants_and_constant(i1 %cond) {
515 ; ALL-LABEL: sel_constants_and_constant:
517 ; ALL-NEXT: rlwinm 3, 3, 0, 31, 31
518 ; ALL-NEXT: subfic 3, 3, 5
520 %sel = select i1 %cond, i8 -4, i8 23
525 define i8 @sel_constants_or_constant(i1 %cond) {
526 ; ISEL-LABEL: sel_constants_or_constant:
529 ; ISEL-NEXT: andi. 3, 3, 1
530 ; ISEL-NEXT: oris 3, 4, 65535
531 ; ISEL-NEXT: li 4, 23
532 ; ISEL-NEXT: ori 3, 3, 65533
533 ; ISEL-NEXT: isel 3, 3, 4, 1
536 ; NO_ISEL-LABEL: sel_constants_or_constant:
538 ; NO_ISEL-NEXT: li 4, 0
539 ; NO_ISEL-NEXT: andi. 3, 3, 1
540 ; NO_ISEL-NEXT: oris 3, 4, 65535
541 ; NO_ISEL-NEXT: li 4, 23
542 ; NO_ISEL-NEXT: ori 3, 3, 65533
543 ; NO_ISEL-NEXT: bclr 12, 1, 0
544 ; NO_ISEL-NEXT: # BB#1:
545 ; NO_ISEL-NEXT: ori 3, 4, 0
547 %sel = select i1 %cond, i8 -4, i8 23
552 define i8 @sel_constants_xor_constant(i1 %cond) {
553 ; ISEL-LABEL: sel_constants_xor_constant:
556 ; ISEL-NEXT: andi. 3, 3, 1
557 ; ISEL-NEXT: oris 3, 4, 65535
558 ; ISEL-NEXT: li 4, 18
559 ; ISEL-NEXT: ori 3, 3, 65529
560 ; ISEL-NEXT: isel 3, 3, 4, 1
563 ; NO_ISEL-LABEL: sel_constants_xor_constant:
565 ; NO_ISEL-NEXT: li 4, 0
566 ; NO_ISEL-NEXT: andi. 3, 3, 1
567 ; NO_ISEL-NEXT: oris 3, 4, 65535
568 ; NO_ISEL-NEXT: li 4, 18
569 ; NO_ISEL-NEXT: ori 3, 3, 65529
570 ; NO_ISEL-NEXT: bclr 12, 1, 0
571 ; NO_ISEL-NEXT: # BB#1:
572 ; NO_ISEL-NEXT: ori 3, 4, 0
574 %sel = select i1 %cond, i8 -4, i8 23
579 define i8 @sel_constants_shl_constant(i1 %cond) {
580 ; ISEL-LABEL: sel_constants_shl_constant:
582 ; ISEL-NEXT: lis 5, 511
583 ; ISEL-NEXT: lis 4, 2047
584 ; ISEL-NEXT: andi. 3, 3, 1
585 ; ISEL-NEXT: ori 3, 4, 65535
586 ; ISEL-NEXT: ori 12, 5, 65535
587 ; ISEL-NEXT: sldi 3, 3, 5
588 ; ISEL-NEXT: sldi 4, 12, 7
589 ; ISEL-NEXT: isel 3, 4, 3, 1
592 ; NO_ISEL-LABEL: sel_constants_shl_constant:
594 ; NO_ISEL-NEXT: lis 5, 511
595 ; NO_ISEL-NEXT: lis 4, 2047
596 ; NO_ISEL-NEXT: andi. 3, 3, 1
597 ; NO_ISEL-NEXT: ori 3, 4, 65535
598 ; NO_ISEL-NEXT: ori 12, 5, 65535
599 ; NO_ISEL-NEXT: sldi 3, 3, 5
600 ; NO_ISEL-NEXT: sldi 4, 12, 7
601 ; NO_ISEL-NEXT: bc 12, 1, .LBB31_1
603 ; NO_ISEL-NEXT: .LBB31_1:
604 ; NO_ISEL-NEXT: addi 3, 4, 0
606 %sel = select i1 %cond, i8 -4, i8 23
611 define i8 @sel_constants_lshr_constant(i1 %cond) {
612 ; ISEL-LABEL: sel_constants_lshr_constant:
614 ; ISEL-NEXT: andi. 3, 3, 1
617 ; ISEL-NEXT: isel 3, 4, 3, 1
620 ; NO_ISEL-LABEL: sel_constants_lshr_constant:
622 ; NO_ISEL-NEXT: andi. 3, 3, 1
623 ; NO_ISEL-NEXT: li 4, 7
624 ; NO_ISEL-NEXT: li 3, 0
625 ; NO_ISEL-NEXT: bc 12, 1, .LBB32_1
627 ; NO_ISEL-NEXT: .LBB32_1:
628 ; NO_ISEL-NEXT: addi 3, 4, 0
630 %sel = select i1 %cond, i8 -4, i8 23
631 %bo = lshr i8 %sel, 5
635 define i8 @sel_constants_ashr_constant(i1 %cond) {
636 ; ALL-LABEL: sel_constants_ashr_constant:
638 ; ALL-NEXT: clrldi 3, 3, 63
641 %sel = select i1 %cond, i8 -4, i8 23
642 %bo = ashr i8 %sel, 5
646 define double @sel_constants_fadd_constant(i1 %cond) {
647 ; ISEL-LABEL: sel_constants_fadd_constant:
649 ; ISEL-NEXT: andi. 3, 3, 1
650 ; ISEL-NEXT: addis 4, 2, .LCPI34_0@toc@ha
651 ; ISEL-NEXT: addis 3, 2, .LCPI34_1@toc@ha
652 ; ISEL-NEXT: addi 4, 4, .LCPI34_0@toc@l
653 ; ISEL-NEXT: addi 3, 3, .LCPI34_1@toc@l
654 ; ISEL-NEXT: isel 3, 3, 4, 1
655 ; ISEL-NEXT: lxsdx 1, 0, 3
658 ; NO_ISEL-LABEL: sel_constants_fadd_constant:
660 ; NO_ISEL-NEXT: andi. 3, 3, 1
661 ; NO_ISEL-NEXT: addis 4, 2, .LCPI34_0@toc@ha
662 ; NO_ISEL-NEXT: addis 3, 2, .LCPI34_1@toc@ha
663 ; NO_ISEL-NEXT: addi 4, 4, .LCPI34_0@toc@l
664 ; NO_ISEL-NEXT: addi 3, 3, .LCPI34_1@toc@l
665 ; NO_ISEL-NEXT: bc 12, 1, .LBB34_2
666 ; NO_ISEL-NEXT: # BB#1:
667 ; NO_ISEL-NEXT: ori 3, 4, 0
668 ; NO_ISEL-NEXT: b .LBB34_2
669 ; NO_ISEL-NEXT: .LBB34_2:
670 ; NO_ISEL-NEXT: lxsdx 1, 0, 3
672 %sel = select i1 %cond, double -4.0, double 23.3
673 %bo = fadd double %sel, 5.1
677 define double @sel_constants_fsub_constant(i1 %cond) {
678 ; ISEL-LABEL: sel_constants_fsub_constant:
680 ; ISEL-NEXT: andi. 3, 3, 1
681 ; ISEL-NEXT: addis 4, 2, .LCPI35_0@toc@ha
682 ; ISEL-NEXT: addis 3, 2, .LCPI35_1@toc@ha
683 ; ISEL-NEXT: addi 4, 4, .LCPI35_0@toc@l
684 ; ISEL-NEXT: addi 3, 3, .LCPI35_1@toc@l
685 ; ISEL-NEXT: isel 3, 3, 4, 1
686 ; ISEL-NEXT: lxsdx 1, 0, 3
689 ; NO_ISEL-LABEL: sel_constants_fsub_constant:
691 ; NO_ISEL-NEXT: andi. 3, 3, 1
692 ; NO_ISEL-NEXT: addis 4, 2, .LCPI35_0@toc@ha
693 ; NO_ISEL-NEXT: addis 3, 2, .LCPI35_1@toc@ha
694 ; NO_ISEL-NEXT: addi 4, 4, .LCPI35_0@toc@l
695 ; NO_ISEL-NEXT: addi 3, 3, .LCPI35_1@toc@l
696 ; NO_ISEL-NEXT: bc 12, 1, .LBB35_2
697 ; NO_ISEL-NEXT: # BB#1:
698 ; NO_ISEL-NEXT: ori 3, 4, 0
699 ; NO_ISEL-NEXT: b .LBB35_2
700 ; NO_ISEL-NEXT: .LBB35_2:
701 ; NO_ISEL-NEXT: lxsdx 1, 0, 3
703 %sel = select i1 %cond, double -4.0, double 23.3
704 %bo = fsub double %sel, 5.1
708 define double @sel_constants_fmul_constant(i1 %cond) {
709 ; ISEL-LABEL: sel_constants_fmul_constant:
711 ; ISEL-NEXT: andi. 3, 3, 1
712 ; ISEL-NEXT: addis 4, 2, .LCPI36_0@toc@ha
713 ; ISEL-NEXT: addis 3, 2, .LCPI36_1@toc@ha
714 ; ISEL-NEXT: addi 4, 4, .LCPI36_0@toc@l
715 ; ISEL-NEXT: addi 3, 3, .LCPI36_1@toc@l
716 ; ISEL-NEXT: isel 3, 3, 4, 1
717 ; ISEL-NEXT: lxsdx 1, 0, 3
720 ; NO_ISEL-LABEL: sel_constants_fmul_constant:
722 ; NO_ISEL-NEXT: andi. 3, 3, 1
723 ; NO_ISEL-NEXT: addis 4, 2, .LCPI36_0@toc@ha
724 ; NO_ISEL-NEXT: addis 3, 2, .LCPI36_1@toc@ha
725 ; NO_ISEL-NEXT: addi 4, 4, .LCPI36_0@toc@l
726 ; NO_ISEL-NEXT: addi 3, 3, .LCPI36_1@toc@l
727 ; NO_ISEL-NEXT: bc 12, 1, .LBB36_2
728 ; NO_ISEL-NEXT: # BB#1:
729 ; NO_ISEL-NEXT: ori 3, 4, 0
730 ; NO_ISEL-NEXT: b .LBB36_2
731 ; NO_ISEL-NEXT: .LBB36_2:
732 ; NO_ISEL-NEXT: lxsdx 1, 0, 3
734 %sel = select i1 %cond, double -4.0, double 23.3
735 %bo = fmul double %sel, 5.1
739 define double @sel_constants_fdiv_constant(i1 %cond) {
740 ; ISEL-LABEL: sel_constants_fdiv_constant:
742 ; ISEL-NEXT: andi. 3, 3, 1
743 ; ISEL-NEXT: addis 4, 2, .LCPI37_0@toc@ha
744 ; ISEL-NEXT: addis 3, 2, .LCPI37_1@toc@ha
745 ; ISEL-NEXT: addi 4, 4, .LCPI37_0@toc@l
746 ; ISEL-NEXT: addi 3, 3, .LCPI37_1@toc@l
747 ; ISEL-NEXT: isel 3, 3, 4, 1
748 ; ISEL-NEXT: lxsdx 1, 0, 3
751 ; NO_ISEL-LABEL: sel_constants_fdiv_constant:
753 ; NO_ISEL-NEXT: andi. 3, 3, 1
754 ; NO_ISEL-NEXT: addis 4, 2, .LCPI37_0@toc@ha
755 ; NO_ISEL-NEXT: addis 3, 2, .LCPI37_1@toc@ha
756 ; NO_ISEL-NEXT: addi 4, 4, .LCPI37_0@toc@l
757 ; NO_ISEL-NEXT: addi 3, 3, .LCPI37_1@toc@l
758 ; NO_ISEL-NEXT: bc 12, 1, .LBB37_2
759 ; NO_ISEL-NEXT: # BB#1:
760 ; NO_ISEL-NEXT: ori 3, 4, 0
761 ; NO_ISEL-NEXT: b .LBB37_2
762 ; NO_ISEL-NEXT: .LBB37_2:
763 ; NO_ISEL-NEXT: lxsdx 1, 0, 3
765 %sel = select i1 %cond, double -4.0, double 23.3
766 %bo = fdiv double %sel, 5.1
770 define double @sel_constants_frem_constant(i1 %cond) {
771 ; ALL-LABEL: sel_constants_frem_constant:
773 ; ALL-NEXT: andi. 3, 3, 1
774 ; ALL-NEXT: bc 12, 1, .LBB38_2
776 ; ALL-NEXT: addis 3, 2, .LCPI38_0@toc@ha
777 ; ALL-NEXT: addi 3, 3, .LCPI38_0@toc@l
778 ; ALL-NEXT: lxsdx 1, 0, 3
780 ; ALL-NEXT: .LBB38_2:
781 ; ALL-NEXT: addis 3, 2, .LCPI38_1@toc@ha
782 ; ALL-NEXT: addi 3, 3, .LCPI38_1@toc@l
783 ; ALL-NEXT: lxsspx 1, 0, 3
785 %sel = select i1 %cond, double -4.0, double 23.3
786 %bo = frem double %sel, 5.1