1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=mipsel-linux-gnu -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=FP32
3 # RUN: llc -O0 -mtriple=mipsel-linux-gnu -mattr=+fp64,+mips32r2 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=FP64
6 define void @float_in_fpr() {entry: ret void}
7 define void @double_in_fpr() {entry: ret void}
8 define void @float_in_gpr() {entry: ret void}
9 define void @double_in_gpr() {entry: ret void}
10 define void @call_float_in_fpr() {entry: ret void}
11 define void @call_double_in_fpr() {entry: ret void}
12 define void @call_float_in_gpr() {entry: ret void}
13 define void @call_double_in_gpr() {entry: ret void}
21 tracksRegLiveness: true
26 ; FP32-LABEL: name: float_in_fpr
27 ; FP32: liveins: $f12, $f14
28 ; FP32: [[COPY:%[0-9]+]]:fgr32 = COPY $f14
29 ; FP32: $f0 = COPY [[COPY]]
30 ; FP32: RetRA implicit $f0
31 ; FP64-LABEL: name: float_in_fpr
32 ; FP64: liveins: $f12, $f14
33 ; FP64: [[COPY:%[0-9]+]]:fgr32 = COPY $f14
34 ; FP64: $f0 = COPY [[COPY]]
35 ; FP64: RetRA implicit $f0
36 %1:fprb(s32) = COPY $f14
46 tracksRegLiveness: true
51 ; FP32-LABEL: name: double_in_fpr
52 ; FP32: liveins: $d6, $d7
53 ; FP32: [[COPY:%[0-9]+]]:afgr64 = COPY $d7
54 ; FP32: $d0 = COPY [[COPY]]
55 ; FP32: RetRA implicit $d0
56 ; FP64-LABEL: name: double_in_fpr
57 ; FP64: liveins: $d6, $d7
58 ; FP64: [[COPY:%[0-9]+]]:fgr64 = COPY $d7
59 ; FP64: $d0 = COPY [[COPY]]
60 ; FP64: RetRA implicit $d0
61 %1:fprb(s64) = COPY $d7
71 tracksRegLiveness: true
76 ; FP32-LABEL: name: float_in_gpr
77 ; FP32: liveins: $a0, $a1
78 ; FP32: [[COPY:%[0-9]+]]:gpr32 = COPY $a1
79 ; FP32: $f0 = COPY [[COPY]]
80 ; FP32: RetRA implicit $f0
81 ; FP64-LABEL: name: float_in_gpr
82 ; FP64: liveins: $a0, $a1
83 ; FP64: [[COPY:%[0-9]+]]:gpr32 = COPY $a1
84 ; FP64: $f0 = COPY [[COPY]]
85 ; FP64: RetRA implicit $f0
86 %1:gprb(s32) = COPY $a1
96 tracksRegLiveness: true
99 liveins: $a0, $a2, $a3
101 ; FP32-LABEL: name: double_in_gpr
102 ; FP32: liveins: $a0, $a2, $a3
103 ; FP32: [[COPY:%[0-9]+]]:gpr32 = COPY $a2
104 ; FP32: [[COPY1:%[0-9]+]]:gpr32 = COPY $a3
105 ; FP32: [[BuildPairF64_:%[0-9]+]]:afgr64 = BuildPairF64 [[COPY]], [[COPY1]]
106 ; FP32: $d0 = COPY [[BuildPairF64_]]
107 ; FP32: RetRA implicit $d0
108 ; FP64-LABEL: name: double_in_gpr
109 ; FP64: liveins: $a0, $a2, $a3
110 ; FP64: [[COPY:%[0-9]+]]:gpr32 = COPY $a2
111 ; FP64: [[COPY1:%[0-9]+]]:gpr32 = COPY $a3
112 ; FP64: [[BuildPairF64_64_:%[0-9]+]]:fgr64 = BuildPairF64_64 [[COPY]], [[COPY1]]
113 ; FP64: $d0 = COPY [[BuildPairF64_64_]]
114 ; FP64: RetRA implicit $d0
115 %2:gprb(s32) = COPY $a2
116 %3:gprb(s32) = COPY $a3
117 %1:fprb(s64) = G_MERGE_VALUES %2(s32), %3(s32)
123 name: call_float_in_fpr
126 regBankSelected: true
127 tracksRegLiveness: true
132 ; FP32-LABEL: name: call_float_in_fpr
133 ; FP32: liveins: $f12, $f14
134 ; FP32: [[COPY:%[0-9]+]]:fgr32 = COPY $f12
135 ; FP32: [[COPY1:%[0-9]+]]:fgr32 = COPY $f14
136 ; FP32: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
137 ; FP32: $f12 = COPY [[COPY]]
138 ; FP32: $f14 = COPY [[COPY1]]
139 ; FP32: JAL @float_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $f12, implicit $f14, implicit-def $f0
140 ; FP32: [[COPY2:%[0-9]+]]:fgr32 = COPY $f0
141 ; FP32: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
142 ; FP32: $f0 = COPY [[COPY2]]
143 ; FP32: RetRA implicit $f0
144 ; FP64-LABEL: name: call_float_in_fpr
145 ; FP64: liveins: $f12, $f14
146 ; FP64: [[COPY:%[0-9]+]]:fgr32 = COPY $f12
147 ; FP64: [[COPY1:%[0-9]+]]:fgr32 = COPY $f14
148 ; FP64: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
149 ; FP64: $f12 = COPY [[COPY]]
150 ; FP64: $f14 = COPY [[COPY1]]
151 ; FP64: JAL @float_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $f12, implicit $f14, implicit-def $f0
152 ; FP64: [[COPY2:%[0-9]+]]:fgr32 = COPY $f0
153 ; FP64: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
154 ; FP64: $f0 = COPY [[COPY2]]
155 ; FP64: RetRA implicit $f0
156 %0:fprb(s32) = COPY $f12
157 %1:fprb(s32) = COPY $f14
158 ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
161 JAL @float_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $f12, implicit $f14, implicit-def $f0
162 %2:fprb(s32) = COPY $f0
163 ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
169 name: call_double_in_fpr
172 regBankSelected: true
173 tracksRegLiveness: true
178 ; FP32-LABEL: name: call_double_in_fpr
179 ; FP32: liveins: $d6, $d7
180 ; FP32: [[COPY:%[0-9]+]]:afgr64 = COPY $d6
181 ; FP32: [[COPY1:%[0-9]+]]:afgr64 = COPY $d7
182 ; FP32: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
183 ; FP32: $d6 = COPY [[COPY]]
184 ; FP32: $d7 = COPY [[COPY1]]
185 ; FP32: JAL @double_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $d6, implicit $d7, implicit-def $d0
186 ; FP32: [[COPY2:%[0-9]+]]:afgr64 = COPY $d0
187 ; FP32: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
188 ; FP32: $d0 = COPY [[COPY2]]
189 ; FP32: RetRA implicit $d0
190 ; FP64-LABEL: name: call_double_in_fpr
191 ; FP64: liveins: $d6, $d7
192 ; FP64: [[COPY:%[0-9]+]]:fgr64 = COPY $d6
193 ; FP64: [[COPY1:%[0-9]+]]:fgr64 = COPY $d7
194 ; FP64: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
195 ; FP64: $d6 = COPY [[COPY]]
196 ; FP64: $d7 = COPY [[COPY1]]
197 ; FP64: JAL @double_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $d6, implicit $d7, implicit-def $d0
198 ; FP64: [[COPY2:%[0-9]+]]:fgr64 = COPY $d0
199 ; FP64: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
200 ; FP64: $d0 = COPY [[COPY2]]
201 ; FP64: RetRA implicit $d0
202 %0:fprb(s64) = COPY $d6
203 %1:fprb(s64) = COPY $d7
204 ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
207 JAL @double_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $d6, implicit $d7, implicit-def $d0
208 %2:fprb(s64) = COPY $d0
209 ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
215 name: call_float_in_gpr
218 regBankSelected: true
219 tracksRegLiveness: true
224 ; FP32-LABEL: name: call_float_in_gpr
225 ; FP32: liveins: $a0, $a1
226 ; FP32: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
227 ; FP32: [[COPY1:%[0-9]+]]:gpr32 = COPY $a1
228 ; FP32: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
229 ; FP32: $a0 = COPY [[COPY]]
230 ; FP32: $a1 = COPY [[COPY1]]
231 ; FP32: JAL @float_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $f0
232 ; FP32: [[COPY2:%[0-9]+]]:fgr32 = COPY $f0
233 ; FP32: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
234 ; FP32: $f0 = COPY [[COPY2]]
235 ; FP32: RetRA implicit $f0
236 ; FP64-LABEL: name: call_float_in_gpr
237 ; FP64: liveins: $a0, $a1
238 ; FP64: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
239 ; FP64: [[COPY1:%[0-9]+]]:gpr32 = COPY $a1
240 ; FP64: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
241 ; FP64: $a0 = COPY [[COPY]]
242 ; FP64: $a1 = COPY [[COPY1]]
243 ; FP64: JAL @float_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $f0
244 ; FP64: [[COPY2:%[0-9]+]]:fgr32 = COPY $f0
245 ; FP64: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
246 ; FP64: $f0 = COPY [[COPY2]]
247 ; FP64: RetRA implicit $f0
248 %0:gprb(s32) = COPY $a0
249 %1:gprb(s32) = COPY $a1
250 ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
253 JAL @float_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $f0
254 %2:fprb(s32) = COPY $f0
255 ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
261 name: call_double_in_gpr
264 regBankSelected: true
265 tracksRegLiveness: true
268 liveins: $a0, $a2, $a3
270 ; FP32-LABEL: name: call_double_in_gpr
271 ; FP32: liveins: $a0, $a2, $a3
272 ; FP32: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
273 ; FP32: [[COPY1:%[0-9]+]]:gpr32 = COPY $a2
274 ; FP32: [[COPY2:%[0-9]+]]:gpr32 = COPY $a3
275 ; FP32: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
276 ; FP32: $a0 = COPY [[COPY]]
277 ; FP32: $a2 = COPY [[COPY1]]
278 ; FP32: $a3 = COPY [[COPY2]]
279 ; FP32: JAL @double_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $d0
280 ; FP32: [[COPY3:%[0-9]+]]:afgr64 = COPY $d0
281 ; FP32: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
282 ; FP32: $d0 = COPY [[COPY3]]
283 ; FP32: RetRA implicit $d0
284 ; FP64-LABEL: name: call_double_in_gpr
285 ; FP64: liveins: $a0, $a2, $a3
286 ; FP64: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
287 ; FP64: [[COPY1:%[0-9]+]]:gpr32 = COPY $a2
288 ; FP64: [[COPY2:%[0-9]+]]:gpr32 = COPY $a3
289 ; FP64: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
290 ; FP64: $a0 = COPY [[COPY]]
291 ; FP64: $a2 = COPY [[COPY1]]
292 ; FP64: $a3 = COPY [[COPY2]]
293 ; FP64: JAL @double_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $d0
294 ; FP64: [[COPY3:%[0-9]+]]:fgr64 = COPY $d0
295 ; FP64: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
296 ; FP64: $d0 = COPY [[COPY3]]
297 ; FP64: RetRA implicit $d0
298 %0:gprb(s32) = COPY $a0
299 %2:gprb(s32) = COPY $a2
300 %3:gprb(s32) = COPY $a3
301 ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
305 JAL @double_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $d0
306 %4:fprb(s64) = COPY $d0
307 ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp