1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv64 -mattr=+c -verify-machineinstrs < %s \
3 ; RUN: | FileCheck -check-prefix=NOSFB %s
4 ; RUN: llc -mtriple=riscv64 -mcpu=sifive-u74 -verify-machineinstrs < %s \
5 ; RUN: | FileCheck -check-prefixes=SFB,NOZICOND %s
6 ; RUN: llc -mtriple=riscv64 -mcpu=sifive-u74 -mattr=+experimental-zicond \
7 ; RUN: -verify-machineinstrs < %s | FileCheck -check-prefixes=SFB,ZICOND %s
9 ; The sifive-7-series can predicate a mv.
11 define signext i32 @test1(i32 signext %x, i32 signext %y, i32 signext %z) {
14 ; NOSFB-NEXT: beqz a2, .LBB0_2
15 ; NOSFB-NEXT: # %bb.1:
16 ; NOSFB-NEXT: mv a0, a1
17 ; NOSFB-NEXT: .LBB0_2:
22 ; SFB-NEXT: beqz a2, .LBB0_2
27 %c = icmp eq i32 %z, 0
28 %b = select i1 %c, i32 %x, i32 %y
32 ; Same as above with select operands swapped.
33 define signext i32 @test2(i32 signext %x, i32 signext %y, i32 signext %z) {
36 ; NOSFB-NEXT: beqz a2, .LBB1_2
37 ; NOSFB-NEXT: # %bb.1:
38 ; NOSFB-NEXT: mv a1, a0
39 ; NOSFB-NEXT: .LBB1_2:
40 ; NOSFB-NEXT: mv a0, a1
45 ; SFB-NEXT: bnez a2, .LBB1_2
50 %c = icmp eq i32 %z, 0
51 %b = select i1 %c, i32 %y, i32 %x
55 ; Make sure we don't share the same basic block for two selects with the same
56 ; condition this would break the predication.
57 define signext i32 @test3(i32 signext %v, i32 signext %w, i32 signext %x, i32 signext %y, i32 signext %z) {
60 ; NOSFB-NEXT: beqz a4, .LBB2_2
61 ; NOSFB-NEXT: # %bb.1:
62 ; NOSFB-NEXT: mv a1, a0
63 ; NOSFB-NEXT: mv a2, a3
64 ; NOSFB-NEXT: .LBB2_2:
65 ; NOSFB-NEXT: addw a0, a1, a2
70 ; SFB-NEXT: bnez a4, .LBB2_2
74 ; SFB-NEXT: beqz a4, .LBB2_4
78 ; SFB-NEXT: addw a0, a0, a2
80 %c = icmp eq i32 %z, 0
81 %a = select i1 %c, i32 %w, i32 %v
82 %b = select i1 %c, i32 %x, i32 %y
87 ; Test with false value 0.
88 define signext i32 @test4(i32 signext %x, i32 signext %z) {
91 ; NOSFB-NEXT: snez a1, a1
92 ; NOSFB-NEXT: addi a1, a1, -1
93 ; NOSFB-NEXT: and a0, a0, a1
96 ; NOZICOND-LABEL: test4:
98 ; NOZICOND-NEXT: beqz a1, .LBB3_2
99 ; NOZICOND-NEXT: # %bb.1:
100 ; NOZICOND-NEXT: li a0, 0
101 ; NOZICOND-NEXT: .LBB3_2:
104 ; ZICOND-LABEL: test4:
106 ; ZICOND-NEXT: czero.nez a0, a0, a1
108 %c = icmp eq i32 %z, 0
109 %b = select i1 %c, i32 %x, i32 0
113 ; Same as above with select operands swapped.
114 define signext i32 @test5(i32 signext %x, i32 signext %z) {
115 ; NOSFB-LABEL: test5:
117 ; NOSFB-NEXT: seqz a1, a1
118 ; NOSFB-NEXT: addi a1, a1, -1
119 ; NOSFB-NEXT: and a0, a0, a1
122 ; NOZICOND-LABEL: test5:
124 ; NOZICOND-NEXT: bnez a1, .LBB4_2
125 ; NOZICOND-NEXT: # %bb.1:
126 ; NOZICOND-NEXT: li a0, 0
127 ; NOZICOND-NEXT: .LBB4_2:
130 ; ZICOND-LABEL: test5:
132 ; ZICOND-NEXT: czero.eqz a0, a0, a1
134 %c = icmp eq i32 %z, 0
135 %b = select i1 %c, i32 0, i32 %x
139 ; Test with false value -1.
140 define signext i32 @test6(i32 signext %x, i32 signext %z) {
141 ; NOSFB-LABEL: test6:
143 ; NOSFB-NEXT: seqz a1, a1
144 ; NOSFB-NEXT: addi a1, a1, -1
145 ; NOSFB-NEXT: or a0, a0, a1
150 ; SFB-NEXT: li a2, -1
151 ; SFB-NEXT: beqz a1, .LBB5_2
153 ; SFB-NEXT: mv a0, a2
156 %c = icmp eq i32 %z, 0
157 %b = select i1 %c, i32 %x, i32 -1
161 ; Same as above with select operands swapped.
162 define signext i32 @test7(i32 signext %x, i32 signext %z) {
163 ; NOSFB-LABEL: test7:
165 ; NOSFB-NEXT: snez a1, a1
166 ; NOSFB-NEXT: addi a1, a1, -1
167 ; NOSFB-NEXT: or a0, a0, a1
172 ; SFB-NEXT: li a2, -1
173 ; SFB-NEXT: bnez a1, .LBB6_2
175 ; SFB-NEXT: mv a0, a2
178 %c = icmp eq i32 %z, 0
179 %b = select i1 %c, i32 -1, i32 %x
183 define i16 @select_xor_1(i16 %A, i8 %cond) {
184 ; NOSFB-LABEL: select_xor_1:
185 ; NOSFB: # %bb.0: # %entry
186 ; NOSFB-NEXT: slli a1, a1, 63
187 ; NOSFB-NEXT: srai a1, a1, 63
188 ; NOSFB-NEXT: andi a1, a1, 43
189 ; NOSFB-NEXT: xor a0, a0, a1
192 ; SFB-LABEL: select_xor_1:
193 ; SFB: # %bb.0: # %entry
194 ; SFB-NEXT: andi a1, a1, 1
195 ; SFB-NEXT: beqz a1, .LBB7_2
196 ; SFB-NEXT: # %bb.1: # %entry
197 ; SFB-NEXT: xori a0, a0, 43
198 ; SFB-NEXT: .LBB7_2: # %entry
201 %and = and i8 %cond, 1
202 %cmp10 = icmp eq i8 %and, 0
204 %1 = select i1 %cmp10, i16 %A, i16 %0
208 ; Equivalent to above, but with icmp ne (and %cond, 1), 1 instead of
209 ; icmp eq (and %cond, 1), 0
210 define i16 @select_xor_1b(i16 %A, i8 %cond) {
211 ; NOSFB-LABEL: select_xor_1b:
212 ; NOSFB: # %bb.0: # %entry
213 ; NOSFB-NEXT: slli a1, a1, 63
214 ; NOSFB-NEXT: srai a1, a1, 63
215 ; NOSFB-NEXT: andi a1, a1, 43
216 ; NOSFB-NEXT: xor a0, a0, a1
219 ; SFB-LABEL: select_xor_1b:
220 ; SFB: # %bb.0: # %entry
221 ; SFB-NEXT: andi a1, a1, 1
222 ; SFB-NEXT: beqz a1, .LBB8_2
223 ; SFB-NEXT: # %bb.1: # %entry
224 ; SFB-NEXT: xori a0, a0, 43
225 ; SFB-NEXT: .LBB8_2: # %entry
228 %and = and i8 %cond, 1
229 %cmp10 = icmp ne i8 %and, 1
231 %1 = select i1 %cmp10, i16 %A, i16 %0
235 define i32 @select_xor_2(i32 %A, i32 %B, i8 %cond) {
236 ; NOSFB-LABEL: select_xor_2:
237 ; NOSFB: # %bb.0: # %entry
238 ; NOSFB-NEXT: slli a2, a2, 63
239 ; NOSFB-NEXT: srai a2, a2, 63
240 ; NOSFB-NEXT: and a1, a1, a2
241 ; NOSFB-NEXT: xor a0, a0, a1
244 ; SFB-LABEL: select_xor_2:
245 ; SFB: # %bb.0: # %entry
246 ; SFB-NEXT: andi a2, a2, 1
247 ; SFB-NEXT: beqz a2, .LBB9_2
248 ; SFB-NEXT: # %bb.1: # %entry
249 ; SFB-NEXT: xor a0, a0, a1
250 ; SFB-NEXT: .LBB9_2: # %entry
253 %and = and i8 %cond, 1
254 %cmp10 = icmp eq i8 %and, 0
256 %1 = select i1 %cmp10, i32 %A, i32 %0
260 ; Equivalent to above, but with icmp ne (and %cond, 1), 1 instead of
261 ; icmp eq (and %cond, 1), 0
262 define i32 @select_xor_2b(i32 %A, i32 %B, i8 %cond) {
263 ; NOSFB-LABEL: select_xor_2b:
264 ; NOSFB: # %bb.0: # %entry
265 ; NOSFB-NEXT: slli a2, a2, 63
266 ; NOSFB-NEXT: srai a2, a2, 63
267 ; NOSFB-NEXT: and a1, a1, a2
268 ; NOSFB-NEXT: xor a0, a0, a1
271 ; SFB-LABEL: select_xor_2b:
272 ; SFB: # %bb.0: # %entry
273 ; SFB-NEXT: andi a2, a2, 1
274 ; SFB-NEXT: beqz a2, .LBB10_2
275 ; SFB-NEXT: # %bb.1: # %entry
276 ; SFB-NEXT: xor a0, a0, a1
277 ; SFB-NEXT: .LBB10_2: # %entry
280 %and = and i8 %cond, 1
281 %cmp10 = icmp ne i8 %and, 1
283 %1 = select i1 %cmp10, i32 %A, i32 %0
287 define i32 @select_or(i32 %A, i32 %B, i8 %cond) {
288 ; NOSFB-LABEL: select_or:
289 ; NOSFB: # %bb.0: # %entry
290 ; NOSFB-NEXT: slli a2, a2, 63
291 ; NOSFB-NEXT: srai a2, a2, 63
292 ; NOSFB-NEXT: and a1, a1, a2
293 ; NOSFB-NEXT: or a0, a0, a1
296 ; SFB-LABEL: select_or:
297 ; SFB: # %bb.0: # %entry
298 ; SFB-NEXT: andi a2, a2, 1
299 ; SFB-NEXT: beqz a2, .LBB11_2
300 ; SFB-NEXT: # %bb.1: # %entry
301 ; SFB-NEXT: or a0, a0, a1
302 ; SFB-NEXT: .LBB11_2: # %entry
305 %and = and i8 %cond, 1
306 %cmp10 = icmp eq i8 %and, 0
308 %1 = select i1 %cmp10, i32 %A, i32 %0
312 ; Equivalent to above, but with icmp ne (and %cond, 1), 1 instead of
313 ; icmp eq (and %cond, 1), 0
314 define i32 @select_or_b(i32 %A, i32 %B, i8 %cond) {
315 ; NOSFB-LABEL: select_or_b:
316 ; NOSFB: # %bb.0: # %entry
317 ; NOSFB-NEXT: slli a2, a2, 63
318 ; NOSFB-NEXT: srai a2, a2, 63
319 ; NOSFB-NEXT: and a1, a1, a2
320 ; NOSFB-NEXT: or a0, a0, a1
323 ; SFB-LABEL: select_or_b:
324 ; SFB: # %bb.0: # %entry
325 ; SFB-NEXT: andi a2, a2, 1
326 ; SFB-NEXT: beqz a2, .LBB12_2
327 ; SFB-NEXT: # %bb.1: # %entry
328 ; SFB-NEXT: or a0, a0, a1
329 ; SFB-NEXT: .LBB12_2: # %entry
332 %and = and i8 %cond, 1
333 %cmp10 = icmp ne i8 %and, 1
335 %1 = select i1 %cmp10, i32 %A, i32 %0
339 define i32 @select_or_1(i32 %A, i32 %B, i32 %cond) {
340 ; NOSFB-LABEL: select_or_1:
341 ; NOSFB: # %bb.0: # %entry
342 ; NOSFB-NEXT: slli a2, a2, 63
343 ; NOSFB-NEXT: srai a2, a2, 63
344 ; NOSFB-NEXT: and a1, a1, a2
345 ; NOSFB-NEXT: or a0, a0, a1
348 ; SFB-LABEL: select_or_1:
349 ; SFB: # %bb.0: # %entry
350 ; SFB-NEXT: andi a2, a2, 1
351 ; SFB-NEXT: beqz a2, .LBB13_2
352 ; SFB-NEXT: # %bb.1: # %entry
353 ; SFB-NEXT: or a0, a0, a1
354 ; SFB-NEXT: .LBB13_2: # %entry
357 %and = and i32 %cond, 1
358 %cmp10 = icmp eq i32 %and, 0
360 %1 = select i1 %cmp10, i32 %A, i32 %0
364 ; Equivalent to above, but with icmp ne (and %cond, 1), 1 instead of
365 ; icmp eq (and %cond, 1), 0
366 define i32 @select_or_1b(i32 %A, i32 %B, i32 %cond) {
367 ; NOSFB-LABEL: select_or_1b:
368 ; NOSFB: # %bb.0: # %entry
369 ; NOSFB-NEXT: slli a2, a2, 63
370 ; NOSFB-NEXT: srai a2, a2, 63
371 ; NOSFB-NEXT: and a1, a1, a2
372 ; NOSFB-NEXT: or a0, a0, a1
375 ; SFB-LABEL: select_or_1b:
376 ; SFB: # %bb.0: # %entry
377 ; SFB-NEXT: andi a2, a2, 1
378 ; SFB-NEXT: beqz a2, .LBB14_2
379 ; SFB-NEXT: # %bb.1: # %entry
380 ; SFB-NEXT: or a0, a0, a1
381 ; SFB-NEXT: .LBB14_2: # %entry
384 %and = and i32 %cond, 1
385 %cmp10 = icmp ne i32 %and, 1
387 %1 = select i1 %cmp10, i32 %A, i32 %0
391 define void @sextw_removal_ccor(i1 %c, i32 signext %arg, i32 signext %arg1, i32 signext %arg2) nounwind {
392 ; NOSFB-LABEL: sextw_removal_ccor:
393 ; NOSFB: # %bb.0: # %bb
394 ; NOSFB-NEXT: addi sp, sp, -32
395 ; NOSFB-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
396 ; NOSFB-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
397 ; NOSFB-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
398 ; NOSFB-NEXT: mv s0, a2
399 ; NOSFB-NEXT: slli a0, a0, 63
400 ; NOSFB-NEXT: srai a0, a0, 63
401 ; NOSFB-NEXT: and a0, a0, a1
402 ; NOSFB-NEXT: or s1, a0, a3
403 ; NOSFB-NEXT: .LBB15_1: # %bb2
404 ; NOSFB-NEXT: # =>This Inner Loop Header: Depth=1
405 ; NOSFB-NEXT: mv a0, s1
406 ; NOSFB-NEXT: call bar@plt
407 ; NOSFB-NEXT: sllw s1, s1, s0
408 ; NOSFB-NEXT: bnez a0, .LBB15_1
409 ; NOSFB-NEXT: # %bb.2: # %bb7
410 ; NOSFB-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
411 ; NOSFB-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
412 ; NOSFB-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
413 ; NOSFB-NEXT: addi sp, sp, 32
416 ; SFB-LABEL: sextw_removal_ccor:
417 ; SFB: # %bb.0: # %bb
418 ; SFB-NEXT: addi sp, sp, -32
419 ; SFB-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
420 ; SFB-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
421 ; SFB-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
422 ; SFB-NEXT: mv s0, a3
423 ; SFB-NEXT: andi a0, a0, 1
424 ; SFB-NEXT: mv s1, a2
425 ; SFB-NEXT: beqz a0, .LBB15_4
426 ; SFB-NEXT: # %bb.3: # %bb
427 ; SFB-NEXT: or s0, a3, a1
428 ; SFB-NEXT: .LBB15_4: # %bb
429 ; SFB-NEXT: .LBB15_1: # %bb2
430 ; SFB-NEXT: # =>This Inner Loop Header: Depth=1
431 ; SFB-NEXT: mv a0, s0
432 ; SFB-NEXT: call bar@plt
433 ; SFB-NEXT: sllw s0, s0, s1
434 ; SFB-NEXT: bnez a0, .LBB15_1
435 ; SFB-NEXT: # %bb.2: # %bb7
436 ; SFB-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
437 ; SFB-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
438 ; SFB-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
439 ; SFB-NEXT: addi sp, sp, 32
442 %sel = select i1 %c, i32 %arg, i32 0
443 %or = or i32 %sel, %arg2
446 bb2: ; preds = %bb2, %bb
447 %i3 = phi i32 [ %or, %bb ], [ %i5, %bb2 ]
448 %i4 = tail call signext i32 @bar(i32 signext %i3)
449 %i5 = shl i32 %i3, %arg1
450 %i6 = icmp eq i32 %i4, 0
451 br i1 %i6, label %bb7, label %bb2
456 declare signext i32 @bar(i32 signext)
458 define void @sextw_removal_ccaddw(i1 %c, i32 signext %arg, i32 signext %arg1, i32 %arg2) nounwind {
459 ; NOSFB-LABEL: sextw_removal_ccaddw:
460 ; NOSFB: # %bb.0: # %bb
461 ; NOSFB-NEXT: addi sp, sp, -32
462 ; NOSFB-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
463 ; NOSFB-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
464 ; NOSFB-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
465 ; NOSFB-NEXT: mv s0, a2
466 ; NOSFB-NEXT: slli a0, a0, 63
467 ; NOSFB-NEXT: srai a0, a0, 63
468 ; NOSFB-NEXT: and a0, a0, a3
469 ; NOSFB-NEXT: addw s1, a0, a1
470 ; NOSFB-NEXT: .LBB16_1: # %bb2
471 ; NOSFB-NEXT: # =>This Inner Loop Header: Depth=1
472 ; NOSFB-NEXT: mv a0, s1
473 ; NOSFB-NEXT: call bar@plt
474 ; NOSFB-NEXT: sllw s1, s1, s0
475 ; NOSFB-NEXT: bnez a0, .LBB16_1
476 ; NOSFB-NEXT: # %bb.2: # %bb7
477 ; NOSFB-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
478 ; NOSFB-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
479 ; NOSFB-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
480 ; NOSFB-NEXT: addi sp, sp, 32
483 ; SFB-LABEL: sextw_removal_ccaddw:
484 ; SFB: # %bb.0: # %bb
485 ; SFB-NEXT: addi sp, sp, -32
486 ; SFB-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
487 ; SFB-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
488 ; SFB-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
489 ; SFB-NEXT: mv s0, a1
490 ; SFB-NEXT: andi a0, a0, 1
491 ; SFB-NEXT: mv s1, a2
492 ; SFB-NEXT: beqz a0, .LBB16_4
493 ; SFB-NEXT: # %bb.3: # %bb
494 ; SFB-NEXT: addw s0, a1, a3
495 ; SFB-NEXT: .LBB16_4: # %bb
496 ; SFB-NEXT: .LBB16_1: # %bb2
497 ; SFB-NEXT: # =>This Inner Loop Header: Depth=1
498 ; SFB-NEXT: mv a0, s0
499 ; SFB-NEXT: call bar@plt
500 ; SFB-NEXT: sllw s0, s0, s1
501 ; SFB-NEXT: bnez a0, .LBB16_1
502 ; SFB-NEXT: # %bb.2: # %bb7
503 ; SFB-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
504 ; SFB-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
505 ; SFB-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
506 ; SFB-NEXT: addi sp, sp, 32
509 %sel = select i1 %c, i32 %arg2, i32 0
510 %or = add i32 %sel, %arg
513 bb2: ; preds = %bb2, %bb
514 %i3 = phi i32 [ %or, %bb ], [ %i5, %bb2 ]
515 %i4 = tail call signext i32 @bar(i32 signext %i3)
516 %i5 = shl i32 %i3, %arg1
517 %i6 = icmp eq i32 %i4, 0
518 br i1 %i6, label %bb7, label %bb2
524 define i32 @select_sllw(i32 %A, i32 %B, i32 %C, i1 zeroext %cond) {
525 ; NOSFB-LABEL: select_sllw:
526 ; NOSFB: # %bb.0: # %entry
527 ; NOSFB-NEXT: bnez a3, .LBB17_2
528 ; NOSFB-NEXT: # %bb.1: # %entry
529 ; NOSFB-NEXT: sllw a2, a0, a1
530 ; NOSFB-NEXT: .LBB17_2: # %entry
531 ; NOSFB-NEXT: mv a0, a2
534 ; SFB-LABEL: select_sllw:
535 ; SFB: # %bb.0: # %entry
536 ; SFB-NEXT: bnez a3, .LBB17_2
537 ; SFB-NEXT: # %bb.1: # %entry
538 ; SFB-NEXT: sllw a2, a0, a1
539 ; SFB-NEXT: .LBB17_2: # %entry
540 ; SFB-NEXT: mv a0, a2
544 %1 = select i1 %cond, i32 %C, i32 %0
548 define i32 @select_srlw(i32 %A, i32 %B, i32 %C, i1 zeroext %cond) {
549 ; NOSFB-LABEL: select_srlw:
550 ; NOSFB: # %bb.0: # %entry
551 ; NOSFB-NEXT: bnez a3, .LBB18_2
552 ; NOSFB-NEXT: # %bb.1: # %entry
553 ; NOSFB-NEXT: srlw a2, a0, a1
554 ; NOSFB-NEXT: .LBB18_2: # %entry
555 ; NOSFB-NEXT: mv a0, a2
558 ; SFB-LABEL: select_srlw:
559 ; SFB: # %bb.0: # %entry
560 ; SFB-NEXT: bnez a3, .LBB18_2
561 ; SFB-NEXT: # %bb.1: # %entry
562 ; SFB-NEXT: srlw a2, a0, a1
563 ; SFB-NEXT: .LBB18_2: # %entry
564 ; SFB-NEXT: mv a0, a2
568 %1 = select i1 %cond, i32 %C, i32 %0
572 define i32 @select_sraw(i32 %A, i32 %B, i32 %C, i1 zeroext %cond) {
573 ; NOSFB-LABEL: select_sraw:
574 ; NOSFB: # %bb.0: # %entry
575 ; NOSFB-NEXT: bnez a3, .LBB19_2
576 ; NOSFB-NEXT: # %bb.1: # %entry
577 ; NOSFB-NEXT: sraw a2, a0, a1
578 ; NOSFB-NEXT: .LBB19_2: # %entry
579 ; NOSFB-NEXT: mv a0, a2
582 ; SFB-LABEL: select_sraw:
583 ; SFB: # %bb.0: # %entry
584 ; SFB-NEXT: bnez a3, .LBB19_2
585 ; SFB-NEXT: # %bb.1: # %entry
586 ; SFB-NEXT: sraw a2, a0, a1
587 ; SFB-NEXT: .LBB19_2: # %entry
588 ; SFB-NEXT: mv a0, a2
592 %1 = select i1 %cond, i32 %C, i32 %0
596 define i64 @select_sll(i64 %A, i64 %B, i64 %C, i1 zeroext %cond) {
597 ; NOSFB-LABEL: select_sll:
598 ; NOSFB: # %bb.0: # %entry
599 ; NOSFB-NEXT: bnez a3, .LBB20_2
600 ; NOSFB-NEXT: # %bb.1: # %entry
601 ; NOSFB-NEXT: sll a2, a0, a1
602 ; NOSFB-NEXT: .LBB20_2: # %entry
603 ; NOSFB-NEXT: mv a0, a2
606 ; SFB-LABEL: select_sll:
607 ; SFB: # %bb.0: # %entry
608 ; SFB-NEXT: bnez a3, .LBB20_2
609 ; SFB-NEXT: # %bb.1: # %entry
610 ; SFB-NEXT: sll a2, a0, a1
611 ; SFB-NEXT: .LBB20_2: # %entry
612 ; SFB-NEXT: mv a0, a2
616 %1 = select i1 %cond, i64 %C, i64 %0
620 define i64 @select_srl(i64 %A, i64 %B, i64 %C, i1 zeroext %cond) {
621 ; NOSFB-LABEL: select_srl:
622 ; NOSFB: # %bb.0: # %entry
623 ; NOSFB-NEXT: bnez a3, .LBB21_2
624 ; NOSFB-NEXT: # %bb.1: # %entry
625 ; NOSFB-NEXT: srl a2, a0, a1
626 ; NOSFB-NEXT: .LBB21_2: # %entry
627 ; NOSFB-NEXT: mv a0, a2
630 ; SFB-LABEL: select_srl:
631 ; SFB: # %bb.0: # %entry
632 ; SFB-NEXT: bnez a3, .LBB21_2
633 ; SFB-NEXT: # %bb.1: # %entry
634 ; SFB-NEXT: srl a2, a0, a1
635 ; SFB-NEXT: .LBB21_2: # %entry
636 ; SFB-NEXT: mv a0, a2
640 %1 = select i1 %cond, i64 %C, i64 %0
644 define i64 @select_sra(i64 %A, i64 %B, i64 %C, i1 zeroext %cond) {
645 ; NOSFB-LABEL: select_sra:
646 ; NOSFB: # %bb.0: # %entry
647 ; NOSFB-NEXT: bnez a3, .LBB22_2
648 ; NOSFB-NEXT: # %bb.1: # %entry
649 ; NOSFB-NEXT: sra a2, a0, a1
650 ; NOSFB-NEXT: .LBB22_2: # %entry
651 ; NOSFB-NEXT: mv a0, a2
654 ; SFB-LABEL: select_sra:
655 ; SFB: # %bb.0: # %entry
656 ; SFB-NEXT: bnez a3, .LBB22_2
657 ; SFB-NEXT: # %bb.1: # %entry
658 ; SFB-NEXT: sra a2, a0, a1
659 ; SFB-NEXT: .LBB22_2: # %entry
660 ; SFB-NEXT: mv a0, a2
664 %1 = select i1 %cond, i64 %C, i64 %0
668 define i32 @select_addiw(i32 %A, i32 %C, i1 zeroext %cond) {
669 ; NOSFB-LABEL: select_addiw:
670 ; NOSFB: # %bb.0: # %entry
671 ; NOSFB-NEXT: bnez a2, .LBB23_2
672 ; NOSFB-NEXT: # %bb.1: # %entry
673 ; NOSFB-NEXT: addiw a1, a0, 1234
674 ; NOSFB-NEXT: .LBB23_2: # %entry
675 ; NOSFB-NEXT: mv a0, a1
678 ; SFB-LABEL: select_addiw:
679 ; SFB: # %bb.0: # %entry
680 ; SFB-NEXT: bnez a2, .LBB23_2
681 ; SFB-NEXT: # %bb.1: # %entry
682 ; SFB-NEXT: addiw a1, a0, 1234
683 ; SFB-NEXT: .LBB23_2: # %entry
684 ; SFB-NEXT: mv a0, a1
687 %0 = add i32 %A, 1234
688 %1 = select i1 %cond, i32 %C, i32 %0
692 define i64 @select_addi(i64 %A, i64 %C, i1 zeroext %cond) {
693 ; NOSFB-LABEL: select_addi:
694 ; NOSFB: # %bb.0: # %entry
695 ; NOSFB-NEXT: bnez a2, .LBB24_2
696 ; NOSFB-NEXT: # %bb.1: # %entry
697 ; NOSFB-NEXT: addi a1, a0, 1234
698 ; NOSFB-NEXT: .LBB24_2: # %entry
699 ; NOSFB-NEXT: mv a0, a1
702 ; SFB-LABEL: select_addi:
703 ; SFB: # %bb.0: # %entry
704 ; SFB-NEXT: bnez a2, .LBB24_2
705 ; SFB-NEXT: # %bb.1: # %entry
706 ; SFB-NEXT: addi a1, a0, 1234
707 ; SFB-NEXT: .LBB24_2: # %entry
708 ; SFB-NEXT: mv a0, a1
711 %0 = add i64 %A, 1234
712 %1 = select i1 %cond, i64 %C, i64 %0
716 define i64 @select_andi(i64 %A, i64 %C, i1 zeroext %cond) {
717 ; NOSFB-LABEL: select_andi:
718 ; NOSFB: # %bb.0: # %entry
719 ; NOSFB-NEXT: bnez a2, .LBB25_2
720 ; NOSFB-NEXT: # %bb.1: # %entry
721 ; NOSFB-NEXT: andi a1, a0, 567
722 ; NOSFB-NEXT: .LBB25_2: # %entry
723 ; NOSFB-NEXT: mv a0, a1
726 ; SFB-LABEL: select_andi:
727 ; SFB: # %bb.0: # %entry
728 ; SFB-NEXT: bnez a2, .LBB25_2
729 ; SFB-NEXT: # %bb.1: # %entry
730 ; SFB-NEXT: andi a1, a0, 567
731 ; SFB-NEXT: .LBB25_2: # %entry
732 ; SFB-NEXT: mv a0, a1
736 %1 = select i1 %cond, i64 %C, i64 %0
740 define i64 @select_ori(i64 %A, i64 %C, i1 zeroext %cond) {
741 ; NOSFB-LABEL: select_ori:
742 ; NOSFB: # %bb.0: # %entry
743 ; NOSFB-NEXT: bnez a2, .LBB26_2
744 ; NOSFB-NEXT: # %bb.1: # %entry
745 ; NOSFB-NEXT: ori a1, a0, 890
746 ; NOSFB-NEXT: .LBB26_2: # %entry
747 ; NOSFB-NEXT: mv a0, a1
750 ; SFB-LABEL: select_ori:
751 ; SFB: # %bb.0: # %entry
752 ; SFB-NEXT: bnez a2, .LBB26_2
753 ; SFB-NEXT: # %bb.1: # %entry
754 ; SFB-NEXT: ori a1, a0, 890
755 ; SFB-NEXT: .LBB26_2: # %entry
756 ; SFB-NEXT: mv a0, a1
760 %1 = select i1 %cond, i64 %C, i64 %0
764 define i64 @select_xori(i64 %A, i64 %C, i1 zeroext %cond) {
765 ; NOSFB-LABEL: select_xori:
766 ; NOSFB: # %bb.0: # %entry
767 ; NOSFB-NEXT: bnez a2, .LBB27_2
768 ; NOSFB-NEXT: # %bb.1: # %entry
769 ; NOSFB-NEXT: xori a1, a0, 321
770 ; NOSFB-NEXT: .LBB27_2: # %entry
771 ; NOSFB-NEXT: mv a0, a1
774 ; SFB-LABEL: select_xori:
775 ; SFB: # %bb.0: # %entry
776 ; SFB-NEXT: bnez a2, .LBB27_2
777 ; SFB-NEXT: # %bb.1: # %entry
778 ; SFB-NEXT: xori a1, a0, 321
779 ; SFB-NEXT: .LBB27_2: # %entry
780 ; SFB-NEXT: mv a0, a1
784 %1 = select i1 %cond, i64 %C, i64 %0
788 define i64 @select_slli(i64 %A, i64 %C, i1 zeroext %cond) {
789 ; NOSFB-LABEL: select_slli:
790 ; NOSFB: # %bb.0: # %entry
791 ; NOSFB-NEXT: bnez a2, .LBB28_2
792 ; NOSFB-NEXT: # %bb.1: # %entry
793 ; NOSFB-NEXT: slli a1, a0, 32
794 ; NOSFB-NEXT: .LBB28_2: # %entry
795 ; NOSFB-NEXT: mv a0, a1
798 ; SFB-LABEL: select_slli:
799 ; SFB: # %bb.0: # %entry
800 ; SFB-NEXT: bnez a2, .LBB28_2
801 ; SFB-NEXT: # %bb.1: # %entry
802 ; SFB-NEXT: slli a1, a0, 32
803 ; SFB-NEXT: .LBB28_2: # %entry
804 ; SFB-NEXT: mv a0, a1
808 %1 = select i1 %cond, i64 %C, i64 %0
812 define i64 @select_srli(i64 %A, i64 %C, i1 zeroext %cond) {
813 ; NOSFB-LABEL: select_srli:
814 ; NOSFB: # %bb.0: # %entry
815 ; NOSFB-NEXT: bnez a2, .LBB29_2
816 ; NOSFB-NEXT: # %bb.1: # %entry
817 ; NOSFB-NEXT: srli a1, a0, 35
818 ; NOSFB-NEXT: .LBB29_2: # %entry
819 ; NOSFB-NEXT: mv a0, a1
822 ; SFB-LABEL: select_srli:
823 ; SFB: # %bb.0: # %entry
824 ; SFB-NEXT: bnez a2, .LBB29_2
825 ; SFB-NEXT: # %bb.1: # %entry
826 ; SFB-NEXT: srli a1, a0, 35
827 ; SFB-NEXT: .LBB29_2: # %entry
828 ; SFB-NEXT: mv a0, a1
832 %1 = select i1 %cond, i64 %C, i64 %0
836 define i64 @select_srai(i64 %A, i64 %C, i1 zeroext %cond) {
837 ; NOSFB-LABEL: select_srai:
838 ; NOSFB: # %bb.0: # %entry
839 ; NOSFB-NEXT: bnez a2, .LBB30_2
840 ; NOSFB-NEXT: # %bb.1: # %entry
841 ; NOSFB-NEXT: srai a1, a0, 63
842 ; NOSFB-NEXT: .LBB30_2: # %entry
843 ; NOSFB-NEXT: mv a0, a1
846 ; SFB-LABEL: select_srai:
847 ; SFB: # %bb.0: # %entry
848 ; SFB-NEXT: bnez a2, .LBB30_2
849 ; SFB-NEXT: # %bb.1: # %entry
850 ; SFB-NEXT: srai a1, a0, 63
851 ; SFB-NEXT: .LBB30_2: # %entry
852 ; SFB-NEXT: mv a0, a1
856 %1 = select i1 %cond, i64 %C, i64 %0
860 define i32 @select_slliw(i32 %A, i32 %C, i1 zeroext %cond) {
861 ; NOSFB-LABEL: select_slliw:
862 ; NOSFB: # %bb.0: # %entry
863 ; NOSFB-NEXT: bnez a2, .LBB31_2
864 ; NOSFB-NEXT: # %bb.1: # %entry
865 ; NOSFB-NEXT: slliw a1, a0, 3
866 ; NOSFB-NEXT: .LBB31_2: # %entry
867 ; NOSFB-NEXT: mv a0, a1
870 ; SFB-LABEL: select_slliw:
871 ; SFB: # %bb.0: # %entry
872 ; SFB-NEXT: bnez a2, .LBB31_2
873 ; SFB-NEXT: # %bb.1: # %entry
874 ; SFB-NEXT: slliw a1, a0, 3
875 ; SFB-NEXT: .LBB31_2: # %entry
876 ; SFB-NEXT: mv a0, a1
880 %1 = select i1 %cond, i32 %C, i32 %0
884 define i32 @select_srliw(i32 %A, i32 %C, i1 zeroext %cond) {
885 ; NOSFB-LABEL: select_srliw:
886 ; NOSFB: # %bb.0: # %entry
887 ; NOSFB-NEXT: bnez a2, .LBB32_2
888 ; NOSFB-NEXT: # %bb.1: # %entry
889 ; NOSFB-NEXT: srliw a1, a0, 17
890 ; NOSFB-NEXT: .LBB32_2: # %entry
891 ; NOSFB-NEXT: mv a0, a1
894 ; SFB-LABEL: select_srliw:
895 ; SFB: # %bb.0: # %entry
896 ; SFB-NEXT: bnez a2, .LBB32_2
897 ; SFB-NEXT: # %bb.1: # %entry
898 ; SFB-NEXT: srliw a1, a0, 17
899 ; SFB-NEXT: .LBB32_2: # %entry
900 ; SFB-NEXT: mv a0, a1
904 %1 = select i1 %cond, i32 %C, i32 %0
908 define i32 @select_sraiw(i32 %A, i32 %C, i1 zeroext %cond) {
909 ; NOSFB-LABEL: select_sraiw:
910 ; NOSFB: # %bb.0: # %entry
911 ; NOSFB-NEXT: bnez a2, .LBB33_2
912 ; NOSFB-NEXT: # %bb.1: # %entry
913 ; NOSFB-NEXT: sraiw a1, a0, 31
914 ; NOSFB-NEXT: .LBB33_2: # %entry
915 ; NOSFB-NEXT: mv a0, a1
918 ; SFB-LABEL: select_sraiw:
919 ; SFB: # %bb.0: # %entry
920 ; SFB-NEXT: bnez a2, .LBB33_2
921 ; SFB-NEXT: # %bb.1: # %entry
922 ; SFB-NEXT: sraiw a1, a0, 31
923 ; SFB-NEXT: .LBB33_2: # %entry
924 ; SFB-NEXT: mv a0, a1
928 %1 = select i1 %cond, i32 %C, i32 %0