# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=riscv32 -mattr=+d -run-pass=regbankselect \
# RUN: -disable-gisel-legality-check -simplify-mir -verify-machineinstrs %s \
# RUN: -o - | FileCheck -check-prefix=RV32I %s
---
name: fp_select_s32
legalized: true
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10, $f10_f, $f11_f
; RV32I-LABEL: name: fp_select_s32
; RV32I: liveins: $x10, $f10_f, $f11_f
; RV32I-NEXT: {{ $}}
; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
; RV32I-NEXT: [[COPY1:%[0-9]+]]:fprb(s32) = COPY $f10_f
; RV32I-NEXT: [[COPY2:%[0-9]+]]:fprb(s32) = COPY $f11_f
; RV32I-NEXT: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
; RV32I-NEXT: [[AND:%[0-9]+]]:gprb(s32) = G_AND [[COPY]], [[C]]
; RV32I-NEXT: [[SELECT:%[0-9]+]]:fprb(s32) = G_SELECT [[AND]](s32), [[COPY1]], [[COPY2]]
; RV32I-NEXT: $f10_f = COPY [[SELECT]](s32)
; RV32I-NEXT: PseudoRET implicit $f10_f
%3:_(s32) = COPY $x10
%4:_(s32) = COPY $f10_f
%5:_(s32) = COPY $f11_f
%12:_(s32) = G_CONSTANT i32 1
%11:_(s32) = G_AND %3, %12
%10:_(s32) = G_SELECT %11(s32), %4, %5
$f10_f = COPY %10(s32)
PseudoRET implicit $f10_f
...
---
name: fp_select_s64
legalized: true
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10, $f10_d, $f11_d
; RV32I-LABEL: name: fp_select_s64
; RV32I: liveins: $x10, $f10_d, $f11_d
; RV32I-NEXT: {{ $}}
; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
; RV32I-NEXT: [[COPY1:%[0-9]+]]:fprb(s64) = COPY $f10_d
; RV32I-NEXT: [[COPY2:%[0-9]+]]:fprb(s64) = COPY $f11_d
; RV32I-NEXT: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
; RV32I-NEXT: [[AND:%[0-9]+]]:gprb(s32) = G_AND [[COPY]], [[C]]
; RV32I-NEXT: [[SELECT:%[0-9]+]]:fprb(s64) = G_SELECT [[AND]](s32), [[COPY1]], [[COPY2]]
; RV32I-NEXT: $f10_d = COPY [[SELECT]](s64)
; RV32I-NEXT: PseudoRET implicit $f10_d
%3:_(s32) = COPY $x10
%4:_(s64) = COPY $f10_d
%5:_(s64) = COPY $f11_d
%12:_(s32) = G_CONSTANT i32 1
%11:_(s32) = G_AND %3, %12
%10:_(s64) = G_SELECT %11(s32), %4, %5
$f10_d = COPY %10(s64)
PseudoRET implicit $f10_d
...
---
name: fp_select_gpr_use_s32
legalized: true
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10, $f10_f, $f11_f
; RV32I-LABEL: name: fp_select_gpr_use_s32
; RV32I: liveins: $x10, $f10_f, $f11_f
; RV32I-NEXT: {{ $}}
; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
; RV32I-NEXT: [[COPY1:%[0-9]+]]:fprb(s32) = COPY $f10_f
; RV32I-NEXT: [[COPY2:%[0-9]+]]:fprb(s32) = COPY $f11_f
; RV32I-NEXT: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
; RV32I-NEXT: [[AND:%[0-9]+]]:gprb(s32) = G_AND [[COPY]], [[C]]
; RV32I-NEXT: [[SELECT:%[0-9]+]]:fprb(s32) = G_SELECT [[AND]](s32), [[COPY1]], [[COPY2]]
; RV32I-NEXT: $x10 = COPY [[SELECT]](s32)
; RV32I-NEXT: PseudoRET implicit $x10
%3:_(s32) = COPY $x10
%4:_(s32) = COPY $f10_f
%5:_(s32) = COPY $f11_f
%12:_(s32) = G_CONSTANT i32 1
%11:_(s32) = G_AND %3, %12
%10:_(s32) = G_SELECT %11(s32), %4, %5
$x10 = COPY %10(s32)
PseudoRET implicit $x10
...
---
name: fp_select_gpr_def_s32
legalized: true
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10, $x11, $f10_f
; RV32I-LABEL: name: fp_select_gpr_def_s32
; RV32I: liveins: $x10, $x11, $f10_f
; RV32I-NEXT: {{ $}}
; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
; RV32I-NEXT: [[COPY1:%[0-9]+]]:fprb(s32) = COPY $f10_f
; RV32I-NEXT: [[COPY2:%[0-9]+]]:gprb(s32) = COPY $x11
; RV32I-NEXT: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
; RV32I-NEXT: [[AND:%[0-9]+]]:gprb(s32) = G_AND [[COPY]], [[C]]
; RV32I-NEXT: [[COPY3:%[0-9]+]]:fprb(s32) = COPY [[COPY2]](s32)
; RV32I-NEXT: [[SELECT:%[0-9]+]]:fprb(s32) = G_SELECT [[AND]](s32), [[COPY1]], [[COPY3]]
; RV32I-NEXT: $f10_f = COPY [[SELECT]](s32)
; RV32I-NEXT: PseudoRET implicit $f10_f
%3:_(s32) = COPY $x10
%4:_(s32) = COPY $f10_f
%5:_(s32) = COPY $x11
%12:_(s32) = G_CONSTANT i32 1
%11:_(s32) = G_AND %3, %12
%10:_(s32) = G_SELECT %11(s32), %4, %5
$f10_f = COPY %10(s32)
PseudoRET implicit $f10_f
...
---
name: fp_select_only_fpr_use_s32
legalized: true
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10, $x11, $x12
; RV32I-LABEL: name: fp_select_only_fpr_use_s32
; RV32I: liveins: $x10, $x11, $x12
; RV32I-NEXT: {{ $}}
; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11
; RV32I-NEXT: [[COPY2:%[0-9]+]]:gprb(s32) = COPY $x12
; RV32I-NEXT: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
; RV32I-NEXT: [[AND:%[0-9]+]]:gprb(s32) = G_AND [[COPY]], [[C]]
; RV32I-NEXT: [[SELECT:%[0-9]+]]:gprb(s32) = G_SELECT [[AND]](s32), [[COPY1]], [[COPY2]]
; RV32I-NEXT: $f10_f = COPY [[SELECT]](s32)
; RV32I-NEXT: PseudoRET implicit $f10_f
%3:_(s32) = COPY $x10
%4:_(s32) = COPY $x11
%5:_(s32) = COPY $x12
%12:_(s32) = G_CONSTANT i32 1
%11:_(s32) = G_AND %3, %12
%10:_(s32) = G_SELECT %11(s32), %4, %5
$f10_f = COPY %10(s32)
PseudoRET implicit $f10_f
...
---
name: fp_select_only_one_fpr_def_s32
legalized: true
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10, $x11, $f10_f
; RV32I-LABEL: name: fp_select_only_one_fpr_def_s32
; RV32I: liveins: $x10, $x11, $f10_f
; RV32I-NEXT: {{ $}}
; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
; RV32I-NEXT: [[COPY1:%[0-9]+]]:fprb(s32) = COPY $f10_f
; RV32I-NEXT: [[COPY2:%[0-9]+]]:gprb(s32) = COPY $x11
; RV32I-NEXT: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
; RV32I-NEXT: [[AND:%[0-9]+]]:gprb(s32) = G_AND [[COPY]], [[C]]
; RV32I-NEXT: [[COPY3:%[0-9]+]]:gprb(s32) = COPY [[COPY1]](s32)
; RV32I-NEXT: [[SELECT:%[0-9]+]]:gprb(s32) = G_SELECT [[AND]](s32), [[COPY3]], [[COPY2]]
; RV32I-NEXT: $x10 = COPY [[SELECT]](s32)
; RV32I-NEXT: PseudoRET implicit $x10
%3:_(s32) = COPY $x10
%4:_(s32) = COPY $f10_f
%5:_(s32) = COPY $x11
%12:_(s32) = G_CONSTANT i32 1
%11:_(s32) = G_AND %3, %12
%10:_(s32) = G_SELECT %11(s32), %4, %5
$x10 = COPY %10(s32)
PseudoRET implicit $x10
...