1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv64 -mattr=+d -run-pass=regbankselect \
3 # RUN: -disable-gisel-legality-check -simplify-mir -verify-machineinstrs %s \
4 # RUN: -o - | FileCheck -check-prefix=RV32I %s
9 tracksRegLiveness: true
12 liveins: $x10, $f10_f, $f11_f
14 ; RV32I-LABEL: name: fp_select_s32
15 ; RV32I: liveins: $x10, $f10_f, $f11_f
17 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10
18 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:fprb(s32) = COPY $f10_f
19 ; RV32I-NEXT: [[COPY2:%[0-9]+]]:fprb(s32) = COPY $f11_f
20 ; RV32I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 1
21 ; RV32I-NEXT: [[AND:%[0-9]+]]:gprb(s64) = G_AND [[COPY]], [[C]]
22 ; RV32I-NEXT: [[SELECT:%[0-9]+]]:fprb(s32) = G_SELECT [[AND]](s64), [[COPY1]], [[COPY2]]
23 ; RV32I-NEXT: $f10_f = COPY [[SELECT]](s32)
24 ; RV32I-NEXT: PseudoRET implicit $f10_f
26 %4:_(s32) = COPY $f10_f
27 %5:_(s32) = COPY $f11_f
28 %12:_(s64) = G_CONSTANT i64 1
29 %11:_(s64) = G_AND %3, %12
30 %10:_(s32) = G_SELECT %11(s64), %4(s32), %5
31 $f10_f = COPY %10(s32)
32 PseudoRET implicit $f10_f
38 tracksRegLiveness: true
41 liveins: $x10, $f10_d, $f11_d
43 ; RV32I-LABEL: name: fp_select_s64
44 ; RV32I: liveins: $x10, $f10_d, $f11_d
46 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10
47 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:fprb(s64) = COPY $f10_d
48 ; RV32I-NEXT: [[COPY2:%[0-9]+]]:fprb(s64) = COPY $f11_d
49 ; RV32I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 1
50 ; RV32I-NEXT: [[AND:%[0-9]+]]:gprb(s64) = G_AND [[COPY]], [[C]]
51 ; RV32I-NEXT: [[SELECT:%[0-9]+]]:fprb(s64) = G_SELECT [[AND]](s64), [[COPY1]], [[COPY2]]
52 ; RV32I-NEXT: $f10_d = COPY [[SELECT]](s64)
53 ; RV32I-NEXT: PseudoRET implicit $f10_d
55 %4:_(s64) = COPY $f10_d
56 %5:_(s64) = COPY $f11_d
57 %12:_(s64) = G_CONSTANT i64 1
58 %11:_(s64) = G_AND %3, %12
59 %10:_(s64) = G_SELECT %11(s64), %4, %5
60 $f10_d = COPY %10(s64)
61 PseudoRET implicit $f10_d
65 name: fp_select_gpr_use_s32
67 tracksRegLiveness: true
70 liveins: $x10, $f10_f, $f11_f
72 ; RV32I-LABEL: name: fp_select_gpr_use_s32
73 ; RV32I: liveins: $x10, $f10_f, $f11_f
75 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10
76 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:fprb(s32) = COPY $f10_f
77 ; RV32I-NEXT: [[COPY2:%[0-9]+]]:fprb(s32) = COPY $f11_f
78 ; RV32I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 1
79 ; RV32I-NEXT: [[AND:%[0-9]+]]:gprb(s64) = G_AND [[COPY]], [[C]]
80 ; RV32I-NEXT: [[SELECT:%[0-9]+]]:fprb(s32) = G_SELECT [[AND]](s64), [[COPY1]], [[COPY2]]
81 ; RV32I-NEXT: [[COPY3:%[0-9]+]]:gprb(s32) = COPY [[SELECT]](s32)
82 ; RV32I-NEXT: [[ANYEXT:%[0-9]+]]:gprb(s64) = G_ANYEXT [[COPY3]](s32)
83 ; RV32I-NEXT: $x10 = COPY [[ANYEXT]](s64)
84 ; RV32I-NEXT: PseudoRET implicit $x10
86 %4:_(s32) = COPY $f10_f
87 %5:_(s32) = COPY $f11_f
88 %12:_(s64) = G_CONSTANT i64 1
89 %11:_(s64) = G_AND %3, %12
90 %10:_(s32) = G_SELECT %11(s64), %4(s32), %5
91 %13:_(s64) = G_ANYEXT %10(s32)
93 PseudoRET implicit $x10
97 name: fp_select_gpr_use_s64
99 tracksRegLiveness: true
102 liveins: $x10, $f10_d, $f11_d
104 ; RV32I-LABEL: name: fp_select_gpr_use_s64
105 ; RV32I: liveins: $x10, $f10_d, $f11_d
107 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10
108 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:fprb(s64) = COPY $f10_d
109 ; RV32I-NEXT: [[COPY2:%[0-9]+]]:fprb(s64) = COPY $f11_d
110 ; RV32I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 1
111 ; RV32I-NEXT: [[AND:%[0-9]+]]:gprb(s64) = G_AND [[COPY]], [[C]]
112 ; RV32I-NEXT: [[SELECT:%[0-9]+]]:fprb(s64) = G_SELECT [[AND]](s64), [[COPY1]], [[COPY2]]
113 ; RV32I-NEXT: $x10 = COPY [[SELECT]](s64)
114 ; RV32I-NEXT: PseudoRET implicit $x10
115 %3:_(s64) = COPY $x10
116 %4:_(s64) = COPY $f10_d
117 %5:_(s64) = COPY $f11_d
118 %12:_(s64) = G_CONSTANT i64 1
119 %11:_(s64) = G_AND %3, %12
120 %10:_(s64) = G_SELECT %11(s64), %4, %5
122 PseudoRET implicit $x10
126 name: fp_select_gpr_def_s32
128 tracksRegLiveness: true
131 liveins: $x10, $x11, $f10_f
133 ; RV32I-LABEL: name: fp_select_gpr_def_s32
134 ; RV32I: liveins: $x10, $x11, $f10_f
136 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10
137 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:fprb(s32) = COPY $f10_f
138 ; RV32I-NEXT: [[COPY2:%[0-9]+]]:gprb(s64) = COPY $x11
139 ; RV32I-NEXT: [[TRUNC:%[0-9]+]]:gprb(s32) = G_TRUNC [[COPY2]](s64)
140 ; RV32I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 1
141 ; RV32I-NEXT: [[AND:%[0-9]+]]:gprb(s64) = G_AND [[COPY]], [[C]]
142 ; RV32I-NEXT: [[COPY3:%[0-9]+]]:fprb(s32) = COPY [[TRUNC]](s32)
143 ; RV32I-NEXT: [[SELECT:%[0-9]+]]:fprb(s32) = G_SELECT [[AND]](s64), [[COPY3]], [[COPY1]]
144 ; RV32I-NEXT: $f10_f = COPY [[SELECT]](s32)
145 ; RV32I-NEXT: PseudoRET implicit $f10_f
146 %3:_(s64) = COPY $x10
147 %4:_(s32) = COPY $f10_f
148 %5:_(s64) = COPY $x11
149 %6:_(s32) = G_TRUNC %5(s64)
150 %12:_(s64) = G_CONSTANT i64 1
151 %11:_(s64) = G_AND %3, %12
152 %10:_(s32) = G_SELECT %11(s64), %6(s32), %4
153 $f10_f = COPY %10(s32)
154 PseudoRET implicit $f10_f
158 name: fp_select_gpr_def_s64
160 tracksRegLiveness: true
163 liveins: $x10, $x11, $f10_d
165 ; RV32I-LABEL: name: fp_select_gpr_def_s64
166 ; RV32I: liveins: $x10, $x11, $f10_d
168 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10
169 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:fprb(s64) = COPY $f10_d
170 ; RV32I-NEXT: [[COPY2:%[0-9]+]]:gprb(s64) = COPY $x11
171 ; RV32I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 1
172 ; RV32I-NEXT: [[AND:%[0-9]+]]:gprb(s64) = G_AND [[COPY]], [[C]]
173 ; RV32I-NEXT: [[COPY3:%[0-9]+]]:fprb(s64) = COPY [[COPY2]](s64)
174 ; RV32I-NEXT: [[SELECT:%[0-9]+]]:fprb(s64) = G_SELECT [[AND]](s64), [[COPY1]], [[COPY3]]
175 ; RV32I-NEXT: $f10_d = COPY [[SELECT]](s64)
176 ; RV32I-NEXT: PseudoRET implicit $f10_d
177 %3:_(s64) = COPY $x10
178 %4:_(s64) = COPY $f10_d
179 %5:_(s64) = COPY $x11
180 %12:_(s64) = G_CONSTANT i64 1
181 %11:_(s64) = G_AND %3, %12
182 %10:_(s64) = G_SELECT %11(s64), %4, %5
183 $f10_d = COPY %10(s64)
184 PseudoRET implicit $f10_d
188 name: fp_select_only_fpr_use_s64
190 tracksRegLiveness: true
193 liveins: $x10, $x11, $x12
195 ; RV32I-LABEL: name: fp_select_only_fpr_use_s64
196 ; RV32I: liveins: $x10, $x11, $x12
198 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10
199 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11
200 ; RV32I-NEXT: [[COPY2:%[0-9]+]]:gprb(s64) = COPY $x12
201 ; RV32I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 1
202 ; RV32I-NEXT: [[AND:%[0-9]+]]:gprb(s64) = G_AND [[COPY]], [[C]]
203 ; RV32I-NEXT: [[SELECT:%[0-9]+]]:gprb(s64) = G_SELECT [[AND]](s64), [[COPY1]], [[COPY2]]
204 ; RV32I-NEXT: $f10_d = COPY [[SELECT]](s64)
205 ; RV32I-NEXT: PseudoRET implicit $f10_d
206 %3:_(s64) = COPY $x10
207 %4:_(s64) = COPY $x11
208 %5:_(s64) = COPY $x12
209 %12:_(s64) = G_CONSTANT i64 1
210 %11:_(s64) = G_AND %3, %12
211 %10:_(s64) = G_SELECT %11(s64), %4, %5
212 $f10_d = COPY %10(s64)
213 PseudoRET implicit $f10_d
217 name: fp_select_only_one_fpr_def_s64
219 tracksRegLiveness: true
222 liveins: $x10, $x11, $f10_d
224 ; RV32I-LABEL: name: fp_select_only_one_fpr_def_s64
225 ; RV32I: liveins: $x10, $x11, $f10_d
227 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10
228 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:fprb(s64) = COPY $f10_d
229 ; RV32I-NEXT: [[COPY2:%[0-9]+]]:gprb(s64) = COPY $x11
230 ; RV32I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 1
231 ; RV32I-NEXT: [[AND:%[0-9]+]]:gprb(s64) = G_AND [[COPY]], [[C]]
232 ; RV32I-NEXT: [[COPY3:%[0-9]+]]:gprb(s64) = COPY [[COPY1]](s64)
233 ; RV32I-NEXT: [[SELECT:%[0-9]+]]:gprb(s64) = G_SELECT [[AND]](s64), [[COPY3]], [[COPY2]]
234 ; RV32I-NEXT: $x10 = COPY [[SELECT]](s64)
235 ; RV32I-NEXT: PseudoRET implicit $x10
236 %3:_(s64) = COPY $x10
237 %4:_(s64) = COPY $f10_d
238 %5:_(s64) = COPY $x11
239 %12:_(s64) = G_CONSTANT i64 1
240 %11:_(s64) = G_AND %3, %12
241 %10:_(s64) = G_SELECT %11(s64), %4, %5
243 PseudoRET implicit $x10