Home | History | Annotate | Download | only in PowerPC
      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
      4 
      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.
      7 
      8 ; select Cond, 0, 1 --> zext (!Cond)
      9 
     10 define i32 @select_0_or_1(i1 %cond) {
     11 ; ALL-LABEL: select_0_or_1:
     12 ; ALL:       # %bb.0:
     13 ; ALL-NEXT:    not 3, 3
     14 ; ALL-NEXT:    clrldi 3, 3, 63
     15 ; ALL-NEXT:    blr
     16   %sel = select i1 %cond, i32 0, i32 1
     17   ret i32 %sel
     18 }
     19 
     20 define i32 @select_0_or_1_zeroext(i1 zeroext %cond) {
     21 ; ALL-LABEL: select_0_or_1_zeroext:
     22 ; ALL:       # %bb.0:
     23 ; ALL-NEXT:    xori 3, 3, 1
     24 ; ALL-NEXT:    blr
     25   %sel = select i1 %cond, i32 0, i32 1
     26   ret i32 %sel
     27 }
     28 
     29 define i32 @select_0_or_1_signext(i1 signext %cond) {
     30 ; ALL-LABEL: select_0_or_1_signext:
     31 ; ALL:       # %bb.0:
     32 ; ALL-NEXT:    not 3, 3
     33 ; ALL-NEXT:    clrldi 3, 3, 63
     34 ; ALL-NEXT:    blr
     35   %sel = select i1 %cond, i32 0, i32 1
     36   ret i32 %sel
     37 }
     38 
     39 ; select Cond, 1, 0 --> zext (Cond)
     40 
     41 define i32 @select_1_or_0(i1 %cond) {
     42 ; ALL-LABEL: select_1_or_0:
     43 ; ALL:       # %bb.0:
     44 ; ALL-NEXT:    clrldi 3, 3, 63
     45 ; ALL-NEXT:    blr
     46   %sel = select i1 %cond, i32 1, i32 0
     47   ret i32 %sel
     48 }
     49 
     50 define i32 @select_1_or_0_zeroext(i1 zeroext %cond) {
     51 ; ALL-LABEL: select_1_or_0_zeroext:
     52 ; ALL:       # %bb.0:
     53 ; ALL-NEXT:    blr
     54   %sel = select i1 %cond, i32 1, i32 0
     55   ret i32 %sel
     56 }
     57 
     58 define i32 @select_1_or_0_signext(i1 signext %cond) {
     59 ; ALL-LABEL: select_1_or_0_signext:
     60 ; ALL:       # %bb.0:
     61 ; ALL-NEXT:    clrldi 3, 3, 63
     62 ; ALL-NEXT:    blr
     63   %sel = select i1 %cond, i32 1, i32 0
     64   ret i32 %sel
     65 }
     66 
     67 ; select Cond, 0, -1 --> sext (!Cond)
     68 
     69 define i32 @select_0_or_neg1(i1 %cond) {
     70 ; ISEL-LABEL: select_0_or_neg1:
     71 ; ISEL:       # %bb.0:
     72 ; ISEL-NEXT:    li 4, 0
     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
     77 ; ISEL-NEXT:    blr
     78 ;
     79 ; NO_ISEL-LABEL: select_0_or_neg1:
     80 ; NO_ISEL:       # %bb.0:
     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
     86 ; NO_ISEL-NEXT:    blr
     87 ; NO_ISEL-NEXT:  .LBB6_1:
     88 ; NO_ISEL-NEXT:    addi 3, 0, 0
     89 ; NO_ISEL-NEXT:    blr
     90   %sel = select i1 %cond, i32 0, i32 -1
     91   ret i32 %sel
     92 }
     93 
     94 define i32 @select_0_or_neg1_zeroext(i1 zeroext %cond) {
     95 ; ISEL-LABEL: select_0_or_neg1_zeroext:
     96 ; ISEL:       # %bb.0:
     97 ; ISEL-NEXT:    li 4, 0
     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
    102 ; ISEL-NEXT:    blr
    103 ;
    104 ; NO_ISEL-LABEL: select_0_or_neg1_zeroext:
    105 ; NO_ISEL:       # %bb.0:
    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
    111 ; NO_ISEL-NEXT:    blr
    112 ; NO_ISEL-NEXT:  .LBB7_1:
    113 ; NO_ISEL-NEXT:    addi 3, 0, 0
    114 ; NO_ISEL-NEXT:    blr
    115   %sel = select i1 %cond, i32 0, i32 -1
    116   ret i32 %sel
    117 }
    118 
    119 define i32 @select_0_or_neg1_signext(i1 signext %cond) {
    120 ; ISEL-LABEL: select_0_or_neg1_signext:
    121 ; ISEL:       # %bb.0:
    122 ; ISEL-NEXT:    li 4, 0
    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
    127 ; ISEL-NEXT:    blr
    128 ;
    129 ; NO_ISEL-LABEL: select_0_or_neg1_signext:
    130 ; NO_ISEL:       # %bb.0:
    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
    136 ; NO_ISEL-NEXT:    blr
    137 ; NO_ISEL-NEXT:  .LBB8_1:
    138 ; NO_ISEL-NEXT:    addi 3, 0, 0
    139 ; NO_ISEL-NEXT:    blr
    140   %sel = select i1 %cond, i32 0, i32 -1
    141   ret i32 %sel
    142 }
    143 
    144 ; select Cond, -1, 0 --> sext (Cond)
    145 
    146 define i32 @select_neg1_or_0(i1 %cond) {
    147 ; ISEL-LABEL: select_neg1_or_0:
    148 ; ISEL:       # %bb.0:
    149 ; ISEL-NEXT:    li 4, 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
    154 ; ISEL-NEXT:    blr
    155 ;
    156 ; NO_ISEL-LABEL: select_neg1_or_0:
    157 ; NO_ISEL:       # %bb.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
    165 ; NO_ISEL-NEXT:    blr
    166   %sel = select i1 %cond, i32 -1, i32 0
    167   ret i32 %sel
    168 }
    169 
    170 define i32 @select_neg1_or_0_zeroext(i1 zeroext %cond) {
    171 ; ISEL-LABEL: select_neg1_or_0_zeroext:
    172 ; ISEL:       # %bb.0:
    173 ; ISEL-NEXT:    li 4, 0
    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
    178 ; ISEL-NEXT:    blr
    179 ;
    180 ; NO_ISEL-LABEL: select_neg1_or_0_zeroext:
    181 ; NO_ISEL:       # %bb.0:
    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
    189 ; NO_ISEL-NEXT:    blr
    190   %sel = select i1 %cond, i32 -1, i32 0
    191   ret i32 %sel
    192 }
    193 
    194 define i32 @select_neg1_or_0_signext(i1 signext %cond) {
    195 ; ISEL-LABEL: select_neg1_or_0_signext:
    196 ; ISEL:       # %bb.0:
    197 ; ISEL-NEXT:    li 4, 0
    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
    202 ; ISEL-NEXT:    blr
    203 ;
    204 ; NO_ISEL-LABEL: select_neg1_or_0_signext:
    205 ; NO_ISEL:       # %bb.0:
    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
    213 ; NO_ISEL-NEXT:    blr
    214   %sel = select i1 %cond, i32 -1, i32 0
    215   ret i32 %sel
    216 }
    217 
    218 ; select Cond, C+1, C --> add (zext Cond), C
    219 
    220 define i32 @select_Cplus1_C(i1 %cond) {
    221 ; ALL-LABEL: select_Cplus1_C:
    222 ; ALL:       # %bb.0:
    223 ; ALL-NEXT:    clrldi 3, 3, 63
    224 ; ALL-NEXT:    addi 3, 3, 41
    225 ; ALL-NEXT:    blr
    226   %sel = select i1 %cond, i32 42, i32 41
    227   ret i32 %sel
    228 }
    229 
    230 define i32 @select_Cplus1_C_zeroext(i1 zeroext %cond) {
    231 ; ALL-LABEL: select_Cplus1_C_zeroext:
    232 ; ALL:       # %bb.0:
    233 ; ALL-NEXT:    addi 3, 3, 41
    234 ; ALL-NEXT:    blr
    235   %sel = select i1 %cond, i32 42, i32 41
    236   ret i32 %sel
    237 }
    238 
    239 define i32 @select_Cplus1_C_signext(i1 signext %cond) {
    240 ; ALL-LABEL: select_Cplus1_C_signext:
    241 ; ALL:       # %bb.0:
    242 ; ALL-NEXT:    subfic 3, 3, 41
    243 ; ALL-NEXT:    blr
    244   %sel = select i1 %cond, i32 42, i32 41
    245   ret i32 %sel
    246 }
    247 
    248 ; select Cond, C, C+1 --> add (sext Cond), C
    249 
    250 define i32 @select_C_Cplus1(i1 %cond) {
    251 ; ALL-LABEL: select_C_Cplus1:
    252 ; ALL:       # %bb.0:
    253 ; ALL-NEXT:    clrldi 3, 3, 63
    254 ; ALL-NEXT:    subfic 3, 3, 42
    255 ; ALL-NEXT:    blr
    256   %sel = select i1 %cond, i32 41, i32 42
    257   ret i32 %sel
    258 }
    259 
    260 define i32 @select_C_Cplus1_zeroext(i1 zeroext %cond) {
    261 ; ALL-LABEL: select_C_Cplus1_zeroext:
    262 ; ALL:       # %bb.0:
    263 ; ALL-NEXT:    subfic 3, 3, 42
    264 ; ALL-NEXT:    blr
    265   %sel = select i1 %cond, i32 41, i32 42
    266   ret i32 %sel
    267 }
    268 
    269 define i32 @select_C_Cplus1_signext(i1 signext %cond) {
    270 ; ALL-LABEL: select_C_Cplus1_signext:
    271 ; ALL:       # %bb.0:
    272 ; ALL-NEXT:    addi 3, 3, 42
    273 ; ALL-NEXT:    blr
    274   %sel = select i1 %cond, i32 41, i32 42
    275   ret i32 %sel
    276 }
    277 
    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
    280 
    281 define i32 @select_C1_C2(i1 %cond) {
    282 ; ISEL-LABEL: select_C1_C2:
    283 ; ISEL:       # %bb.0:
    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
    288 ; ISEL-NEXT:    blr
    289 ;
    290 ; NO_ISEL-LABEL: select_C1_C2:
    291 ; NO_ISEL:       # %bb.0:
    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
    296 ; NO_ISEL-NEXT:    blr
    297 ; NO_ISEL-NEXT:  .LBB18_1:
    298 ; NO_ISEL-NEXT:    addi 3, 4, 0
    299 ; NO_ISEL-NEXT:    blr
    300   %sel = select i1 %cond, i32 421, i32 42
    301   ret i32 %sel
    302 }
    303 
    304 define i32 @select_C1_C2_zeroext(i1 zeroext %cond) {
    305 ; ISEL-LABEL: select_C1_C2_zeroext:
    306 ; ISEL:       # %bb.0:
    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
    311 ; ISEL-NEXT:    blr
    312 ;
    313 ; NO_ISEL-LABEL: select_C1_C2_zeroext:
    314 ; NO_ISEL:       # %bb.0:
    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
    319 ; NO_ISEL-NEXT:    blr
    320 ; NO_ISEL-NEXT:  .LBB19_1:
    321 ; NO_ISEL-NEXT:    addi 3, 4, 0
    322 ; NO_ISEL-NEXT:    blr
    323   %sel = select i1 %cond, i32 421, i32 42
    324   ret i32 %sel
    325 }
    326 
    327 define i32 @select_C1_C2_signext(i1 signext %cond) {
    328 ; ISEL-LABEL: select_C1_C2_signext:
    329 ; ISEL:       # %bb.0:
    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
    334 ; ISEL-NEXT:    blr
    335 ;
    336 ; NO_ISEL-LABEL: select_C1_C2_signext:
    337 ; NO_ISEL:       # %bb.0:
    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
    342 ; NO_ISEL-NEXT:    blr
    343 ; NO_ISEL-NEXT:  .LBB20_1:
    344 ; NO_ISEL-NEXT:    addi 3, 4, 0
    345 ; NO_ISEL-NEXT:    blr
    346   %sel = select i1 %cond, i32 421, i32 42
    347   ret i32 %sel
    348 }
    349 
    350 ; A binary operator with constant after the select should always get folded into the select.
    351 
    352 define i8 @sel_constants_add_constant(i1 %cond) {
    353 ; ISEL-LABEL: sel_constants_add_constant:
    354 ; ISEL:       # %bb.0:
    355 ; ISEL-NEXT:    andi. 3, 3, 1
    356 ; ISEL-NEXT:    li 4, 1
    357 ; ISEL-NEXT:    li 3, 28
    358 ; ISEL-NEXT:    isel 3, 4, 3, 1
    359 ; ISEL-NEXT:    blr
    360 ;
    361 ; NO_ISEL-LABEL: sel_constants_add_constant:
    362 ; NO_ISEL:       # %bb.0:
    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
    367 ; NO_ISEL-NEXT:    blr
    368 ; NO_ISEL-NEXT:  .LBB21_1:
    369 ; NO_ISEL-NEXT:    addi 3, 4, 0
    370 ; NO_ISEL-NEXT:    blr
    371   %sel = select i1 %cond, i8 -4, i8 23
    372   %bo = add i8 %sel, 5
    373   ret i8 %bo
    374 }
    375 
    376 define i8 @sel_constants_sub_constant(i1 %cond) {
    377 ; ISEL-LABEL: sel_constants_sub_constant:
    378 ; ISEL:       # %bb.0:
    379 ; ISEL-NEXT:    li 4, 0
    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
    385 ; ISEL-NEXT:    blr
    386 ;
    387 ; NO_ISEL-LABEL: sel_constants_sub_constant:
    388 ; NO_ISEL:       # %bb.0:
    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
    397 ; NO_ISEL-NEXT:    blr
    398   %sel = select i1 %cond, i8 -4, i8 23
    399   %bo = sub i8 %sel, 5
    400   ret i8 %bo
    401 }
    402 
    403 define i8 @sel_constants_sub_constant_sel_constants(i1 %cond) {
    404 ; ISEL-LABEL: sel_constants_sub_constant_sel_constants:
    405 ; ISEL:       # %bb.0:
    406 ; ISEL-NEXT:    andi. 3, 3, 1
    407 ; ISEL-NEXT:    li 4, 9
    408 ; ISEL-NEXT:    li 3, 2
    409 ; ISEL-NEXT:    isel 3, 4, 3, 1
    410 ; ISEL-NEXT:    blr
    411 ;
    412 ; NO_ISEL-LABEL: sel_constants_sub_constant_sel_constants:
    413 ; NO_ISEL:       # %bb.0:
    414 ; NO_ISEL-NEXT:    andi. 3, 3, 1
    415 ; NO_ISEL-NEXT:    li 4, 9
    416 ; NO_ISEL-NEXT:    li 3, 2
    417 ; NO_ISEL-NEXT:    bc 12, 1, .LBB23_1
    418 ; NO_ISEL-NEXT:    blr
    419 ; NO_ISEL-NEXT:  .LBB23_1:
    420 ; NO_ISEL-NEXT:    addi 3, 4, 0
    421 ; NO_ISEL-NEXT:    blr
    422   %sel = select i1 %cond, i8 -4, i8 3
    423   %bo = sub i8 5, %sel
    424   ret i8 %bo
    425 }
    426 
    427 define i8 @sel_constants_mul_constant(i1 %cond) {
    428 ; ISEL-LABEL: sel_constants_mul_constant:
    429 ; ISEL:       # %bb.0:
    430 ; ISEL-NEXT:    lis 4, 16383
    431 ; ISEL-NEXT:    andi. 3, 3, 1
    432 ; ISEL-NEXT:    ori 3, 4, 65531
    433 ; ISEL-NEXT:    li 4, 115
    434 ; ISEL-NEXT:    sldi 3, 3, 2
    435 ; ISEL-NEXT:    isel 3, 3, 4, 1
    436 ; ISEL-NEXT:    blr
    437 ;
    438 ; NO_ISEL-LABEL: sel_constants_mul_constant:
    439 ; NO_ISEL:       # %bb.0:
    440 ; NO_ISEL-NEXT:    lis 4, 16383
    441 ; NO_ISEL-NEXT:    andi. 3, 3, 1
    442 ; NO_ISEL-NEXT:    ori 3, 4, 65531
    443 ; NO_ISEL-NEXT:    li 4, 115
    444 ; NO_ISEL-NEXT:    sldi 3, 3, 2
    445 ; NO_ISEL-NEXT:    bclr 12, 1, 0
    446 ; NO_ISEL-NEXT:  # %bb.1:
    447 ; NO_ISEL-NEXT:    ori 3, 4, 0
    448 ; NO_ISEL-NEXT:    blr
    449   %sel = select i1 %cond, i8 -4, i8 23
    450   %bo = mul i8 %sel, 5
    451   ret i8 %bo
    452 }
    453 
    454 define i8 @sel_constants_sdiv_constant(i1 %cond) {
    455 ; ISEL-LABEL: sel_constants_sdiv_constant:
    456 ; ISEL:       # %bb.0:
    457 ; ISEL-NEXT:    andi. 3, 3, 1
    458 ; ISEL-NEXT:    li 3, 4
    459 ; ISEL-NEXT:    isel 3, 0, 3, 1
    460 ; ISEL-NEXT:    blr
    461 ;
    462 ; NO_ISEL-LABEL: sel_constants_sdiv_constant:
    463 ; NO_ISEL:       # %bb.0:
    464 ; NO_ISEL-NEXT:    andi. 3, 3, 1
    465 ; NO_ISEL-NEXT:    li 3, 4
    466 ; NO_ISEL-NEXT:    bc 12, 1, .LBB25_1
    467 ; NO_ISEL-NEXT:    blr
    468 ; NO_ISEL-NEXT:  .LBB25_1:
    469 ; NO_ISEL-NEXT:    addi 3, 0, 0
    470 ; NO_ISEL-NEXT:    blr
    471   %sel = select i1 %cond, i8 -4, i8 23
    472   %bo = sdiv i8 %sel, 5
    473   ret i8 %bo
    474 }
    475 
    476 define i8 @sdiv_constant_sel_constants(i1 %cond) {
    477 ; ISEL-LABEL: sdiv_constant_sel_constants:
    478 ; ISEL:       # %bb.0:
    479 ; ISEL-NEXT:    andi. 3, 3, 1
    480 ; ISEL-NEXT:    li 3, 5
    481 ; ISEL-NEXT:    isel 3, 0, 3, 1
    482 ; ISEL-NEXT:    blr
    483 ;
    484 ; NO_ISEL-LABEL: sdiv_constant_sel_constants:
    485 ; NO_ISEL:       # %bb.0:
    486 ; NO_ISEL-NEXT:    andi. 3, 3, 1
    487 ; NO_ISEL-NEXT:    li 3, 5
    488 ; NO_ISEL-NEXT:    bc 12, 1, .LBB26_1
    489 ; NO_ISEL-NEXT:    blr
    490 ; NO_ISEL-NEXT:  .LBB26_1:
    491 ; NO_ISEL-NEXT:    addi 3, 0, 0
    492 ; NO_ISEL-NEXT:    blr
    493   %sel = select i1 %cond, i8 121, i8 23
    494   %bo = sdiv i8 120, %sel
    495   ret i8 %bo
    496 }
    497 
    498 define i8 @sel_constants_udiv_constant(i1 %cond) {
    499 ; ISEL-LABEL: sel_constants_udiv_constant:
    500 ; ISEL:       # %bb.0:
    501 ; ISEL-NEXT:    andi. 3, 3, 1
    502 ; ISEL-NEXT:    li 4, 50
    503 ; ISEL-NEXT:    li 3, 4
    504 ; ISEL-NEXT:    isel 3, 4, 3, 1
    505 ; ISEL-NEXT:    blr
    506 ;
    507 ; NO_ISEL-LABEL: sel_constants_udiv_constant:
    508 ; NO_ISEL:       # %bb.0:
    509 ; NO_ISEL-NEXT:    andi. 3, 3, 1
    510 ; NO_ISEL-NEXT:    li 4, 50
    511 ; NO_ISEL-NEXT:    li 3, 4
    512 ; NO_ISEL-NEXT:    bc 12, 1, .LBB27_1
    513 ; NO_ISEL-NEXT:    blr
    514 ; NO_ISEL-NEXT:  .LBB27_1:
    515 ; NO_ISEL-NEXT:    addi 3, 4, 0
    516 ; NO_ISEL-NEXT:    blr
    517   %sel = select i1 %cond, i8 -4, i8 23
    518   %bo = udiv i8 %sel, 5
    519   ret i8 %bo
    520 }
    521 
    522 define i8 @udiv_constant_sel_constants(i1 %cond) {
    523 ; ISEL-LABEL: udiv_constant_sel_constants:
    524 ; ISEL:       # %bb.0:
    525 ; ISEL-NEXT:    andi. 3, 3, 1
    526 ; ISEL-NEXT:    li 3, 5
    527 ; ISEL-NEXT:    isel 3, 0, 3, 1
    528 ; ISEL-NEXT:    blr
    529 ;
    530 ; NO_ISEL-LABEL: udiv_constant_sel_constants:
    531 ; NO_ISEL:       # %bb.0:
    532 ; NO_ISEL-NEXT:    andi. 3, 3, 1
    533 ; NO_ISEL-NEXT:    li 3, 5
    534 ; NO_ISEL-NEXT:    bc 12, 1, .LBB28_1
    535 ; NO_ISEL-NEXT:    blr
    536 ; NO_ISEL-NEXT:  .LBB28_1:
    537 ; NO_ISEL-NEXT:    addi 3, 0, 0
    538 ; NO_ISEL-NEXT:    blr
    539   %sel = select i1 %cond, i8 -4, i8 23
    540   %bo = udiv i8 120, %sel
    541   ret i8 %bo
    542 }
    543 
    544 define i8 @sel_constants_srem_constant(i1 %cond) {
    545 ; ISEL-LABEL: sel_constants_srem_constant:
    546 ; ISEL:       # %bb.0:
    547 ; ISEL-NEXT:    lis 4, 16383
    548 ; ISEL-NEXT:    andi. 3, 3, 1
    549 ; ISEL-NEXT:    ori 3, 4, 65535
    550 ; ISEL-NEXT:    li 4, 3
    551 ; ISEL-NEXT:    sldi 3, 3, 2
    552 ; ISEL-NEXT:    isel 3, 3, 4, 1
    553 ; ISEL-NEXT:    blr
    554 ;
    555 ; NO_ISEL-LABEL: sel_constants_srem_constant:
    556 ; NO_ISEL:       # %bb.0:
    557 ; NO_ISEL-NEXT:    lis 4, 16383
    558 ; NO_ISEL-NEXT:    andi. 3, 3, 1
    559 ; NO_ISEL-NEXT:    ori 3, 4, 65535
    560 ; NO_ISEL-NEXT:    li 4, 3
    561 ; NO_ISEL-NEXT:    sldi 3, 3, 2
    562 ; NO_ISEL-NEXT:    bclr 12, 1, 0
    563 ; NO_ISEL-NEXT:  # %bb.1:
    564 ; NO_ISEL-NEXT:    ori 3, 4, 0
    565 ; NO_ISEL-NEXT:    blr
    566   %sel = select i1 %cond, i8 -4, i8 23
    567   %bo = srem i8 %sel, 5
    568   ret i8 %bo
    569 }
    570 
    571 define i8 @srem_constant_sel_constants(i1 %cond) {
    572 ; ISEL-LABEL: srem_constant_sel_constants:
    573 ; ISEL:       # %bb.0:
    574 ; ISEL-NEXT:    andi. 3, 3, 1
    575 ; ISEL-NEXT:    li 4, 120
    576 ; ISEL-NEXT:    li 3, 5
    577 ; ISEL-NEXT:    isel 3, 4, 3, 1
    578 ; ISEL-NEXT:    blr
    579 ;
    580 ; NO_ISEL-LABEL: srem_constant_sel_constants:
    581 ; NO_ISEL:       # %bb.0:
    582 ; NO_ISEL-NEXT:    andi. 3, 3, 1
    583 ; NO_ISEL-NEXT:    li 4, 120
    584 ; NO_ISEL-NEXT:    li 3, 5
    585 ; NO_ISEL-NEXT:    bc 12, 1, .LBB30_1
    586 ; NO_ISEL-NEXT:    blr
    587 ; NO_ISEL-NEXT:  .LBB30_1:
    588 ; NO_ISEL-NEXT:    addi 3, 4, 0
    589 ; NO_ISEL-NEXT:    blr
    590   %sel = select i1 %cond, i8 121, i8 23
    591   %bo = srem i8 120, %sel
    592   ret i8 %bo
    593 }
    594 
    595 define i8 @sel_constants_urem_constant(i1 %cond) {
    596 ; ALL-LABEL: sel_constants_urem_constant:
    597 ; ALL:       # %bb.0:
    598 ; ALL-NEXT:    rlwinm 3, 3, 0, 31, 31
    599 ; ALL-NEXT:    subfic 3, 3, 3
    600 ; ALL-NEXT:    blr
    601   %sel = select i1 %cond, i8 -4, i8 23
    602   %bo = urem i8 %sel, 5
    603   ret i8 %bo
    604 }
    605 
    606 define i8 @urem_constant_sel_constants(i1 %cond) {
    607 ; ISEL-LABEL: urem_constant_sel_constants:
    608 ; ISEL:       # %bb.0:
    609 ; ISEL-NEXT:    andi. 3, 3, 1
    610 ; ISEL-NEXT:    li 4, 120
    611 ; ISEL-NEXT:    li 3, 5
    612 ; ISEL-NEXT:    isel 3, 4, 3, 1
    613 ; ISEL-NEXT:    blr
    614 ;
    615 ; NO_ISEL-LABEL: urem_constant_sel_constants:
    616 ; NO_ISEL:       # %bb.0:
    617 ; NO_ISEL-NEXT:    andi. 3, 3, 1
    618 ; NO_ISEL-NEXT:    li 4, 120
    619 ; NO_ISEL-NEXT:    li 3, 5
    620 ; NO_ISEL-NEXT:    bc 12, 1, .LBB32_1
    621 ; NO_ISEL-NEXT:    blr
    622 ; NO_ISEL-NEXT:  .LBB32_1:
    623 ; NO_ISEL-NEXT:    addi 3, 4, 0
    624 ; NO_ISEL-NEXT:    blr
    625   %sel = select i1 %cond, i8 -4, i8 23
    626   %bo = urem i8 120, %sel
    627   ret i8 %bo
    628 }
    629 
    630 define i8 @sel_constants_and_constant(i1 %cond) {
    631 ; ALL-LABEL: sel_constants_and_constant:
    632 ; ALL:       # %bb.0:
    633 ; ALL-NEXT:    rlwinm 3, 3, 0, 31, 31
    634 ; ALL-NEXT:    subfic 3, 3, 5
    635 ; ALL-NEXT:    blr
    636   %sel = select i1 %cond, i8 -4, i8 23
    637   %bo = and i8 %sel, 5
    638   ret i8 %bo
    639 }
    640 
    641 define i8 @sel_constants_or_constant(i1 %cond) {
    642 ; ISEL-LABEL: sel_constants_or_constant:
    643 ; ISEL:       # %bb.0:
    644 ; ISEL-NEXT:    li 4, 0
    645 ; ISEL-NEXT:    andi. 3, 3, 1
    646 ; ISEL-NEXT:    oris 3, 4, 65535
    647 ; ISEL-NEXT:    li 4, 23
    648 ; ISEL-NEXT:    ori 3, 3, 65533
    649 ; ISEL-NEXT:    isel 3, 3, 4, 1
    650 ; ISEL-NEXT:    blr
    651 ;
    652 ; NO_ISEL-LABEL: sel_constants_or_constant:
    653 ; NO_ISEL:       # %bb.0:
    654 ; NO_ISEL-NEXT:    li 4, 0
    655 ; NO_ISEL-NEXT:    andi. 3, 3, 1
    656 ; NO_ISEL-NEXT:    oris 3, 4, 65535
    657 ; NO_ISEL-NEXT:    li 4, 23
    658 ; NO_ISEL-NEXT:    ori 3, 3, 65533
    659 ; NO_ISEL-NEXT:    bclr 12, 1, 0
    660 ; NO_ISEL-NEXT:  # %bb.1:
    661 ; NO_ISEL-NEXT:    ori 3, 4, 0
    662 ; NO_ISEL-NEXT:    blr
    663   %sel = select i1 %cond, i8 -4, i8 23
    664   %bo = or i8 %sel, 5
    665   ret i8 %bo
    666 }
    667 
    668 define i8 @sel_constants_xor_constant(i1 %cond) {
    669 ; ISEL-LABEL: sel_constants_xor_constant:
    670 ; ISEL:       # %bb.0:
    671 ; ISEL-NEXT:    li 4, 0
    672 ; ISEL-NEXT:    andi. 3, 3, 1
    673 ; ISEL-NEXT:    oris 3, 4, 65535
    674 ; ISEL-NEXT:    li 4, 18
    675 ; ISEL-NEXT:    ori 3, 3, 65529
    676 ; ISEL-NEXT:    isel 3, 3, 4, 1
    677 ; ISEL-NEXT:    blr
    678 ;
    679 ; NO_ISEL-LABEL: sel_constants_xor_constant:
    680 ; NO_ISEL:       # %bb.0:
    681 ; NO_ISEL-NEXT:    li 4, 0
    682 ; NO_ISEL-NEXT:    andi. 3, 3, 1
    683 ; NO_ISEL-NEXT:    oris 3, 4, 65535
    684 ; NO_ISEL-NEXT:    li 4, 18
    685 ; NO_ISEL-NEXT:    ori 3, 3, 65529
    686 ; NO_ISEL-NEXT:    bclr 12, 1, 0
    687 ; NO_ISEL-NEXT:  # %bb.1:
    688 ; NO_ISEL-NEXT:    ori 3, 4, 0
    689 ; NO_ISEL-NEXT:    blr
    690   %sel = select i1 %cond, i8 -4, i8 23
    691   %bo = xor i8 %sel, 5
    692   ret i8 %bo
    693 }
    694 
    695 define i8 @sel_constants_shl_constant(i1 %cond) {
    696 ; ISEL-LABEL: sel_constants_shl_constant:
    697 ; ISEL:       # %bb.0:
    698 ; ISEL-NEXT:    lis 4, 2047
    699 ; ISEL-NEXT:    lis 5, 511
    700 ; ISEL-NEXT:    andi. 3, 3, 1
    701 ; ISEL-NEXT:    ori 3, 4, 65535
    702 ; ISEL-NEXT:    ori 4, 5, 65535
    703 ; ISEL-NEXT:    sldi 3, 3, 5
    704 ; ISEL-NEXT:    sldi 4, 4, 7
    705 ; ISEL-NEXT:    isel 3, 4, 3, 1
    706 ; ISEL-NEXT:    blr
    707 ;
    708 ; NO_ISEL-LABEL: sel_constants_shl_constant:
    709 ; NO_ISEL:       # %bb.0:
    710 ; NO_ISEL-NEXT:    lis 4, 2047
    711 ; NO_ISEL-NEXT:    lis 5, 511
    712 ; NO_ISEL-NEXT:    andi. 3, 3, 1
    713 ; NO_ISEL-NEXT:    ori 3, 4, 65535
    714 ; NO_ISEL-NEXT:    ori 4, 5, 65535
    715 ; NO_ISEL-NEXT:    sldi 3, 3, 5
    716 ; NO_ISEL-NEXT:    sldi 4, 4, 7
    717 ; NO_ISEL-NEXT:    bc 12, 1, .LBB36_1
    718 ; NO_ISEL-NEXT:    blr
    719 ; NO_ISEL-NEXT:  .LBB36_1:
    720 ; NO_ISEL-NEXT:    addi 3, 4, 0
    721 ; NO_ISEL-NEXT:    blr
    722   %sel = select i1 %cond, i8 -4, i8 23
    723   %bo = shl i8 %sel, 5
    724   ret i8 %bo
    725 }
    726 
    727 define i8 @shl_constant_sel_constants(i1 %cond) {
    728 ; ALL-LABEL: shl_constant_sel_constants:
    729 ; ALL:       # %bb.0:
    730 ; ALL-NEXT:    rlwinm 3, 3, 0, 31, 31
    731 ; ALL-NEXT:    li 4, 1
    732 ; ALL-NEXT:    subfic 3, 3, 3
    733 ; ALL-NEXT:    slw 3, 4, 3
    734 ; ALL-NEXT:    blr
    735   %sel = select i1 %cond, i8 2, i8 3
    736   %bo = shl i8 1, %sel
    737   ret i8 %bo
    738 }
    739 
    740 define i8 @sel_constants_lshr_constant(i1 %cond) {
    741 ; ISEL-LABEL: sel_constants_lshr_constant:
    742 ; ISEL:       # %bb.0:
    743 ; ISEL-NEXT:    andi. 3, 3, 1
    744 ; ISEL-NEXT:    li 4, 7
    745 ; ISEL-NEXT:    li 3, 0
    746 ; ISEL-NEXT:    isel 3, 4, 3, 1
    747 ; ISEL-NEXT:    blr
    748 ;
    749 ; NO_ISEL-LABEL: sel_constants_lshr_constant:
    750 ; NO_ISEL:       # %bb.0:
    751 ; NO_ISEL-NEXT:    andi. 3, 3, 1
    752 ; NO_ISEL-NEXT:    li 4, 7
    753 ; NO_ISEL-NEXT:    li 3, 0
    754 ; NO_ISEL-NEXT:    bc 12, 1, .LBB38_1
    755 ; NO_ISEL-NEXT:    blr
    756 ; NO_ISEL-NEXT:  .LBB38_1:
    757 ; NO_ISEL-NEXT:    addi 3, 4, 0
    758 ; NO_ISEL-NEXT:    blr
    759   %sel = select i1 %cond, i8 -4, i8 23
    760   %bo = lshr i8 %sel, 5
    761   ret i8 %bo
    762 }
    763 
    764 define i8 @lshr_constant_sel_constants(i1 %cond) {
    765 ; ALL-LABEL: lshr_constant_sel_constants:
    766 ; ALL:       # %bb.0:
    767 ; ALL-NEXT:    rlwinm 3, 3, 0, 31, 31
    768 ; ALL-NEXT:    li 4, 64
    769 ; ALL-NEXT:    subfic 3, 3, 3
    770 ; ALL-NEXT:    srw 3, 4, 3
    771 ; ALL-NEXT:    blr
    772   %sel = select i1 %cond, i8 2, i8 3
    773   %bo = lshr i8 64, %sel
    774   ret i8 %bo
    775 }
    776 
    777 
    778 define i8 @sel_constants_ashr_constant(i1 %cond) {
    779 ; ALL-LABEL: sel_constants_ashr_constant:
    780 ; ALL:       # %bb.0:
    781 ; ALL-NEXT:    clrldi 3, 3, 63
    782 ; ALL-NEXT:    neg 3, 3
    783 ; ALL-NEXT:    blr
    784   %sel = select i1 %cond, i8 -4, i8 23
    785   %bo = ashr i8 %sel, 5
    786   ret i8 %bo
    787 }
    788 
    789 define i8 @ashr_constant_sel_constants(i1 %cond) {
    790 ; ALL-LABEL: ashr_constant_sel_constants:
    791 ; ALL:       # %bb.0:
    792 ; ALL-NEXT:    rlwinm 3, 3, 0, 31, 31
    793 ; ALL-NEXT:    li 4, -128
    794 ; ALL-NEXT:    subfic 3, 3, 3
    795 ; ALL-NEXT:    sraw 3, 4, 3
    796 ; ALL-NEXT:    blr
    797   %sel = select i1 %cond, i8 2, i8 3
    798   %bo = ashr i8 128, %sel
    799   ret i8 %bo
    800 }
    801 
    802 define double @sel_constants_fadd_constant(i1 %cond) {
    803 ; ISEL-LABEL: sel_constants_fadd_constant:
    804 ; ISEL:       # %bb.0:
    805 ; ISEL-NEXT:    andi. 3, 3, 1
    806 ; ISEL-NEXT:    addis 4, 2, .LCPI42_0@toc@ha
    807 ; ISEL-NEXT:    addis 3, 2, .LCPI42_1@toc@ha
    808 ; ISEL-NEXT:    addi 4, 4, .LCPI42_0@toc@l
    809 ; ISEL-NEXT:    addi 3, 3, .LCPI42_1@toc@l
    810 ; ISEL-NEXT:    isel 3, 3, 4, 1
    811 ; ISEL-NEXT:    lfdx 1, 0, 3
    812 ; ISEL-NEXT:    blr
    813 ;
    814 ; NO_ISEL-LABEL: sel_constants_fadd_constant:
    815 ; NO_ISEL:       # %bb.0:
    816 ; NO_ISEL-NEXT:    andi. 3, 3, 1
    817 ; NO_ISEL-NEXT:    addis 4, 2, .LCPI42_0@toc@ha
    818 ; NO_ISEL-NEXT:    addis 3, 2, .LCPI42_1@toc@ha
    819 ; NO_ISEL-NEXT:    addi 4, 4, .LCPI42_0@toc@l
    820 ; NO_ISEL-NEXT:    addi 3, 3, .LCPI42_1@toc@l
    821 ; NO_ISEL-NEXT:    bc 12, 1, .LBB42_2
    822 ; NO_ISEL-NEXT:  # %bb.1:
    823 ; NO_ISEL-NEXT:    ori 3, 4, 0
    824 ; NO_ISEL-NEXT:    b .LBB42_2
    825 ; NO_ISEL-NEXT:  .LBB42_2:
    826 ; NO_ISEL-NEXT:    lfdx 1, 0, 3
    827 ; NO_ISEL-NEXT:    blr
    828   %sel = select i1 %cond, double -4.0, double 23.3
    829   %bo = fadd double %sel, 5.1
    830   ret double %bo
    831 }
    832 
    833 define double @sel_constants_fsub_constant(i1 %cond) {
    834 ; ISEL-LABEL: sel_constants_fsub_constant:
    835 ; ISEL:       # %bb.0:
    836 ; ISEL-NEXT:    andi. 3, 3, 1
    837 ; ISEL-NEXT:    addis 4, 2, .LCPI43_0@toc@ha
    838 ; ISEL-NEXT:    addis 3, 2, .LCPI43_1@toc@ha
    839 ; ISEL-NEXT:    addi 4, 4, .LCPI43_0@toc@l
    840 ; ISEL-NEXT:    addi 3, 3, .LCPI43_1@toc@l
    841 ; ISEL-NEXT:    isel 3, 3, 4, 1
    842 ; ISEL-NEXT:    lfdx 1, 0, 3
    843 ; ISEL-NEXT:    blr
    844 ;
    845 ; NO_ISEL-LABEL: sel_constants_fsub_constant:
    846 ; NO_ISEL:       # %bb.0:
    847 ; NO_ISEL-NEXT:    andi. 3, 3, 1
    848 ; NO_ISEL-NEXT:    addis 4, 2, .LCPI43_0@toc@ha
    849 ; NO_ISEL-NEXT:    addis 3, 2, .LCPI43_1@toc@ha
    850 ; NO_ISEL-NEXT:    addi 4, 4, .LCPI43_0@toc@l
    851 ; NO_ISEL-NEXT:    addi 3, 3, .LCPI43_1@toc@l
    852 ; NO_ISEL-NEXT:    bc 12, 1, .LBB43_2
    853 ; NO_ISEL-NEXT:  # %bb.1:
    854 ; NO_ISEL-NEXT:    ori 3, 4, 0
    855 ; NO_ISEL-NEXT:    b .LBB43_2
    856 ; NO_ISEL-NEXT:  .LBB43_2:
    857 ; NO_ISEL-NEXT:    lfdx 1, 0, 3
    858 ; NO_ISEL-NEXT:    blr
    859   %sel = select i1 %cond, double -4.0, double 23.3
    860   %bo = fsub double %sel, 5.1
    861   ret double %bo
    862 }
    863 
    864 define double @fsub_constant_sel_constants(i1 %cond) {
    865 ; ISEL-LABEL: fsub_constant_sel_constants:
    866 ; ISEL:       # %bb.0:
    867 ; ISEL-NEXT:    andi. 3, 3, 1
    868 ; ISEL-NEXT:    addis 4, 2, .LCPI44_0@toc@ha
    869 ; ISEL-NEXT:    addis 3, 2, .LCPI44_1@toc@ha
    870 ; ISEL-NEXT:    addi 4, 4, .LCPI44_0@toc@l
    871 ; ISEL-NEXT:    addi 3, 3, .LCPI44_1@toc@l
    872 ; ISEL-NEXT:    isel 3, 3, 4, 1
    873 ; ISEL-NEXT:    lfdx 1, 0, 3
    874 ; ISEL-NEXT:    blr
    875 ;
    876 ; NO_ISEL-LABEL: fsub_constant_sel_constants:
    877 ; NO_ISEL:       # %bb.0:
    878 ; NO_ISEL-NEXT:    andi. 3, 3, 1
    879 ; NO_ISEL-NEXT:    addis 4, 2, .LCPI44_0@toc@ha
    880 ; NO_ISEL-NEXT:    addis 3, 2, .LCPI44_1@toc@ha
    881 ; NO_ISEL-NEXT:    addi 4, 4, .LCPI44_0@toc@l
    882 ; NO_ISEL-NEXT:    addi 3, 3, .LCPI44_1@toc@l
    883 ; NO_ISEL-NEXT:    bc 12, 1, .LBB44_2
    884 ; NO_ISEL-NEXT:  # %bb.1:
    885 ; NO_ISEL-NEXT:    ori 3, 4, 0
    886 ; NO_ISEL-NEXT:    b .LBB44_2
    887 ; NO_ISEL-NEXT:  .LBB44_2:
    888 ; NO_ISEL-NEXT:    lfdx 1, 0, 3
    889 ; NO_ISEL-NEXT:    blr
    890   %sel = select i1 %cond, double -4.0, double 23.3
    891   %bo = fsub double 5.1, %sel
    892   ret double %bo
    893 }
    894 
    895 define double @sel_constants_fmul_constant(i1 %cond) {
    896 ; ISEL-LABEL: sel_constants_fmul_constant:
    897 ; ISEL:       # %bb.0:
    898 ; ISEL-NEXT:    andi. 3, 3, 1
    899 ; ISEL-NEXT:    addis 4, 2, .LCPI45_0@toc@ha
    900 ; ISEL-NEXT:    addis 3, 2, .LCPI45_1@toc@ha
    901 ; ISEL-NEXT:    addi 4, 4, .LCPI45_0@toc@l
    902 ; ISEL-NEXT:    addi 3, 3, .LCPI45_1@toc@l
    903 ; ISEL-NEXT:    isel 3, 3, 4, 1
    904 ; ISEL-NEXT:    lfdx 1, 0, 3
    905 ; ISEL-NEXT:    blr
    906 ;
    907 ; NO_ISEL-LABEL: sel_constants_fmul_constant:
    908 ; NO_ISEL:       # %bb.0:
    909 ; NO_ISEL-NEXT:    andi. 3, 3, 1
    910 ; NO_ISEL-NEXT:    addis 4, 2, .LCPI45_0@toc@ha
    911 ; NO_ISEL-NEXT:    addis 3, 2, .LCPI45_1@toc@ha
    912 ; NO_ISEL-NEXT:    addi 4, 4, .LCPI45_0@toc@l
    913 ; NO_ISEL-NEXT:    addi 3, 3, .LCPI45_1@toc@l
    914 ; NO_ISEL-NEXT:    bc 12, 1, .LBB45_2
    915 ; NO_ISEL-NEXT:  # %bb.1:
    916 ; NO_ISEL-NEXT:    ori 3, 4, 0
    917 ; NO_ISEL-NEXT:    b .LBB45_2
    918 ; NO_ISEL-NEXT:  .LBB45_2:
    919 ; NO_ISEL-NEXT:    lfdx 1, 0, 3
    920 ; NO_ISEL-NEXT:    blr
    921   %sel = select i1 %cond, double -4.0, double 23.3
    922   %bo = fmul double %sel, 5.1
    923   ret double %bo
    924 }
    925 
    926 define double @sel_constants_fdiv_constant(i1 %cond) {
    927 ; ISEL-LABEL: sel_constants_fdiv_constant:
    928 ; ISEL:       # %bb.0:
    929 ; ISEL-NEXT:    andi. 3, 3, 1
    930 ; ISEL-NEXT:    addis 4, 2, .LCPI46_0@toc@ha
    931 ; ISEL-NEXT:    addis 3, 2, .LCPI46_1@toc@ha
    932 ; ISEL-NEXT:    addi 4, 4, .LCPI46_0@toc@l
    933 ; ISEL-NEXT:    addi 3, 3, .LCPI46_1@toc@l
    934 ; ISEL-NEXT:    isel 3, 3, 4, 1
    935 ; ISEL-NEXT:    lfdx 1, 0, 3
    936 ; ISEL-NEXT:    blr
    937 ;
    938 ; NO_ISEL-LABEL: sel_constants_fdiv_constant:
    939 ; NO_ISEL:       # %bb.0:
    940 ; NO_ISEL-NEXT:    andi. 3, 3, 1
    941 ; NO_ISEL-NEXT:    addis 4, 2, .LCPI46_0@toc@ha
    942 ; NO_ISEL-NEXT:    addis 3, 2, .LCPI46_1@toc@ha
    943 ; NO_ISEL-NEXT:    addi 4, 4, .LCPI46_0@toc@l
    944 ; NO_ISEL-NEXT:    addi 3, 3, .LCPI46_1@toc@l
    945 ; NO_ISEL-NEXT:    bc 12, 1, .LBB46_2
    946 ; NO_ISEL-NEXT:  # %bb.1:
    947 ; NO_ISEL-NEXT:    ori 3, 4, 0
    948 ; NO_ISEL-NEXT:    b .LBB46_2
    949 ; NO_ISEL-NEXT:  .LBB46_2:
    950 ; NO_ISEL-NEXT:    lfdx 1, 0, 3
    951 ; NO_ISEL-NEXT:    blr
    952   %sel = select i1 %cond, double -4.0, double 23.3
    953   %bo = fdiv double %sel, 5.1
    954   ret double %bo
    955 }
    956 
    957 define double @fdiv_constant_sel_constants(i1 %cond) {
    958 ; ISEL-LABEL: fdiv_constant_sel_constants:
    959 ; ISEL:       # %bb.0:
    960 ; ISEL-NEXT:    andi. 3, 3, 1
    961 ; ISEL-NEXT:    addis 4, 2, .LCPI47_0@toc@ha
    962 ; ISEL-NEXT:    addis 3, 2, .LCPI47_1@toc@ha
    963 ; ISEL-NEXT:    addi 4, 4, .LCPI47_0@toc@l
    964 ; ISEL-NEXT:    addi 3, 3, .LCPI47_1@toc@l
    965 ; ISEL-NEXT:    isel 3, 3, 4, 1
    966 ; ISEL-NEXT:    lfdx 1, 0, 3
    967 ; ISEL-NEXT:    blr
    968 ;
    969 ; NO_ISEL-LABEL: fdiv_constant_sel_constants:
    970 ; NO_ISEL:       # %bb.0:
    971 ; NO_ISEL-NEXT:    andi. 3, 3, 1
    972 ; NO_ISEL-NEXT:    addis 4, 2, .LCPI47_0@toc@ha
    973 ; NO_ISEL-NEXT:    addis 3, 2, .LCPI47_1@toc@ha
    974 ; NO_ISEL-NEXT:    addi 4, 4, .LCPI47_0@toc@l
    975 ; NO_ISEL-NEXT:    addi 3, 3, .LCPI47_1@toc@l
    976 ; NO_ISEL-NEXT:    bc 12, 1, .LBB47_2
    977 ; NO_ISEL-NEXT:  # %bb.1:
    978 ; NO_ISEL-NEXT:    ori 3, 4, 0
    979 ; NO_ISEL-NEXT:    b .LBB47_2
    980 ; NO_ISEL-NEXT:  .LBB47_2:
    981 ; NO_ISEL-NEXT:    lfdx 1, 0, 3
    982 ; NO_ISEL-NEXT:    blr
    983   %sel = select i1 %cond, double -4.0, double 23.3
    984   %bo = fdiv double 5.1, %sel
    985   ret double %bo
    986 }
    987 
    988 define double @sel_constants_frem_constant(i1 %cond) {
    989 ; ALL-LABEL: sel_constants_frem_constant:
    990 ; ALL:       # %bb.0:
    991 ; ALL-NEXT:    andi. 3, 3, 1
    992 ; ALL-NEXT:    bc 12, 1, .LBB48_2
    993 ; ALL-NEXT:  # %bb.1:
    994 ; ALL-NEXT:    addis 3, 2, .LCPI48_0@toc@ha
    995 ; ALL-NEXT:    addi 3, 3, .LCPI48_0@toc@l
    996 ; ALL-NEXT:    lfdx 1, 0, 3
    997 ; ALL-NEXT:    blr
    998 ; ALL-NEXT:  .LBB48_2:
    999 ; ALL-NEXT:    addis 3, 2, .LCPI48_1@toc@ha
   1000 ; ALL-NEXT:    addi 3, 3, .LCPI48_1@toc@l
   1001 ; ALL-NEXT:    lfsx 1, 0, 3
   1002 ; ALL-NEXT:    blr
   1003   %sel = select i1 %cond, double -4.0, double 23.3
   1004   %bo = frem double %sel, 5.1
   1005   ret double %bo
   1006 }
   1007 
   1008 define double @frem_constant_sel_constants(i1 %cond) {
   1009 ; ISEL-LABEL: frem_constant_sel_constants:
   1010 ; ISEL:       # %bb.0:
   1011 ; ISEL-NEXT:    andi. 3, 3, 1
   1012 ; ISEL-NEXT:    addis 4, 2, .LCPI49_0@toc@ha
   1013 ; ISEL-NEXT:    addis 3, 2, .LCPI49_1@toc@ha
   1014 ; ISEL-NEXT:    addi 4, 4, .LCPI49_0@toc@l
   1015 ; ISEL-NEXT:    addi 3, 3, .LCPI49_1@toc@l
   1016 ; ISEL-NEXT:    isel 3, 3, 4, 1
   1017 ; ISEL-NEXT:    lfdx 1, 0, 3
   1018 ; ISEL-NEXT:    blr
   1019 ;
   1020 ; NO_ISEL-LABEL: frem_constant_sel_constants:
   1021 ; NO_ISEL:       # %bb.0:
   1022 ; NO_ISEL-NEXT:    andi. 3, 3, 1
   1023 ; NO_ISEL-NEXT:    addis 4, 2, .LCPI49_0@toc@ha
   1024 ; NO_ISEL-NEXT:    addis 3, 2, .LCPI49_1@toc@ha
   1025 ; NO_ISEL-NEXT:    addi 4, 4, .LCPI49_0@toc@l
   1026 ; NO_ISEL-NEXT:    addi 3, 3, .LCPI49_1@toc@l
   1027 ; NO_ISEL-NEXT:    bc 12, 1, .LBB49_2
   1028 ; NO_ISEL-NEXT:  # %bb.1:
   1029 ; NO_ISEL-NEXT:    ori 3, 4, 0
   1030 ; NO_ISEL-NEXT:    b .LBB49_2
   1031 ; NO_ISEL-NEXT:  .LBB49_2:
   1032 ; NO_ISEL-NEXT:    lfdx 1, 0, 3
   1033 ; NO_ISEL-NEXT:    blr
   1034   %sel = select i1 %cond, double -4.0, double 23.3
   1035   %bo = frem double 5.1, %sel
   1036   ret double %bo
   1037 }
   1038