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: [[MTC1_:%[0-9]+]]:fgr32 = MTC1 $a1
79 ; FP32: $f0 = COPY [[MTC1_]]
80 ; FP32: RetRA implicit $f0
81 ; FP64-LABEL: name: float_in_gpr
82 ; FP64: liveins: $a0, $a1
83 ; FP64: [[MTC1_:%[0-9]+]]:fgr32 = MTC1 $a1
84 ; FP64: $f0 = COPY [[MTC1_]]
85 ; FP64: RetRA implicit $f0
86 %1:fgr32(s32) = MTC1 $a1
96 tracksRegLiveness: true
99 liveins: $a0, $a2, $a3
101 ; FP32-LABEL: name: double_in_gpr
102 ; FP32: liveins: $a0, $a2, $a3
103 ; FP32: [[BuildPairF64_:%[0-9]+]]:afgr64 = BuildPairF64 $a2, $a3
104 ; FP32: $d0 = COPY [[BuildPairF64_]]
105 ; FP32: RetRA implicit $d0
106 ; FP64-LABEL: name: double_in_gpr
107 ; FP64: liveins: $a0, $a2, $a3
108 ; FP64: [[BuildPairF64_:%[0-9]+]]:afgr64 = BuildPairF64 $a2, $a3
109 ; FP64: $d0 = COPY [[BuildPairF64_]]
110 ; FP64: RetRA implicit $d0
111 %1:afgr64(s64) = BuildPairF64 $a2, $a3
117 name: call_float_in_fpr
120 regBankSelected: true
121 tracksRegLiveness: true
126 ; FP32-LABEL: name: call_float_in_fpr
127 ; FP32: liveins: $f12, $f14
128 ; FP32: [[COPY:%[0-9]+]]:fgr32 = COPY $f12
129 ; FP32: [[COPY1:%[0-9]+]]:fgr32 = COPY $f14
130 ; FP32: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
131 ; FP32: $f12 = COPY [[COPY]]
132 ; FP32: $f14 = COPY [[COPY1]]
133 ; FP32: JAL @float_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $f12, implicit $f14, implicit-def $f0
134 ; FP32: [[COPY2:%[0-9]+]]:fgr32 = COPY $f0
135 ; FP32: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
136 ; FP32: $f0 = COPY [[COPY2]]
137 ; FP32: RetRA implicit $f0
138 ; FP64-LABEL: name: call_float_in_fpr
139 ; FP64: liveins: $f12, $f14
140 ; FP64: [[COPY:%[0-9]+]]:fgr32 = COPY $f12
141 ; FP64: [[COPY1:%[0-9]+]]:fgr32 = COPY $f14
142 ; FP64: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
143 ; FP64: $f12 = COPY [[COPY]]
144 ; FP64: $f14 = COPY [[COPY1]]
145 ; FP64: JAL @float_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $f12, implicit $f14, implicit-def $f0
146 ; FP64: [[COPY2:%[0-9]+]]:fgr32 = COPY $f0
147 ; FP64: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
148 ; FP64: $f0 = COPY [[COPY2]]
149 ; FP64: RetRA implicit $f0
150 %0:fprb(s32) = COPY $f12
151 %1:fprb(s32) = COPY $f14
152 ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
155 JAL @float_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $f12, implicit $f14, implicit-def $f0
156 %2:fprb(s32) = COPY $f0
157 ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
163 name: call_double_in_fpr
166 regBankSelected: true
167 tracksRegLiveness: true
172 ; FP32-LABEL: name: call_double_in_fpr
173 ; FP32: liveins: $d6, $d7
174 ; FP32: [[COPY:%[0-9]+]]:afgr64 = COPY $d6
175 ; FP32: [[COPY1:%[0-9]+]]:afgr64 = COPY $d7
176 ; FP32: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
177 ; FP32: $d6 = COPY [[COPY]]
178 ; FP32: $d7 = COPY [[COPY1]]
179 ; FP32: JAL @double_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $d6, implicit $d7, implicit-def $d0
180 ; FP32: [[COPY2:%[0-9]+]]:afgr64 = COPY $d0
181 ; FP32: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
182 ; FP32: $d0 = COPY [[COPY2]]
183 ; FP32: RetRA implicit $d0
184 ; FP64-LABEL: name: call_double_in_fpr
185 ; FP64: liveins: $d6, $d7
186 ; FP64: [[COPY:%[0-9]+]]:fgr64 = COPY $d6
187 ; FP64: [[COPY1:%[0-9]+]]:fgr64 = COPY $d7
188 ; FP64: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
189 ; FP64: $d6 = COPY [[COPY]]
190 ; FP64: $d7 = COPY [[COPY1]]
191 ; FP64: JAL @double_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $d6, implicit $d7, implicit-def $d0
192 ; FP64: [[COPY2:%[0-9]+]]:fgr64 = COPY $d0
193 ; FP64: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
194 ; FP64: $d0 = COPY [[COPY2]]
195 ; FP64: RetRA implicit $d0
196 %0:fprb(s64) = COPY $d6
197 %1:fprb(s64) = COPY $d7
198 ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
201 JAL @double_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $d6, implicit $d7, implicit-def $d0
202 %2:fprb(s64) = COPY $d0
203 ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
209 name: call_float_in_gpr
212 regBankSelected: true
213 tracksRegLiveness: true
218 ; FP32-LABEL: name: call_float_in_gpr
219 ; FP32: liveins: $a0, $a1
220 ; FP32: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
221 ; FP32: [[MTC1_:%[0-9]+]]:fgr32 = MTC1 $a1
222 ; FP32: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
223 ; FP32: $a0 = COPY [[COPY]]
224 ; FP32: $a1 = MFC1 [[MTC1_]]
225 ; FP32: JAL @float_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $f0
226 ; FP32: [[COPY1:%[0-9]+]]:fgr32 = COPY $f0
227 ; FP32: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
228 ; FP32: $f0 = COPY [[COPY1]]
229 ; FP32: RetRA implicit $f0
230 ; FP64-LABEL: name: call_float_in_gpr
231 ; FP64: liveins: $a0, $a1
232 ; FP64: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
233 ; FP64: [[MTC1_:%[0-9]+]]:fgr32 = MTC1 $a1
234 ; FP64: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
235 ; FP64: $a0 = COPY [[COPY]]
236 ; FP64: $a1 = MFC1 [[MTC1_]]
237 ; FP64: JAL @float_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $f0
238 ; FP64: [[COPY1:%[0-9]+]]:fgr32 = COPY $f0
239 ; FP64: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
240 ; FP64: $f0 = COPY [[COPY1]]
241 ; FP64: RetRA implicit $f0
242 %0:gprb(s32) = COPY $a0
243 %1:fgr32(s32) = MTC1 $a1
244 ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
247 JAL @float_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $f0
248 %2:fprb(s32) = COPY $f0
249 ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
255 name: call_double_in_gpr
258 regBankSelected: true
259 tracksRegLiveness: true
262 liveins: $a0, $a2, $a3
264 ; FP32-LABEL: name: call_double_in_gpr
265 ; FP32: liveins: $a0, $a2, $a3
266 ; FP32: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
267 ; FP32: [[BuildPairF64_:%[0-9]+]]:afgr64 = BuildPairF64 $a2, $a3
268 ; FP32: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
269 ; FP32: $a0 = COPY [[COPY]]
270 ; FP32: $a3 = ExtractElementF64 [[BuildPairF64_]], 1
271 ; FP32: $a2 = ExtractElementF64 [[BuildPairF64_]], 0
272 ; FP32: JAL @double_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $d0
273 ; FP32: [[COPY1:%[0-9]+]]:afgr64 = COPY $d0
274 ; FP32: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
275 ; FP32: $d0 = COPY [[COPY1]]
276 ; FP32: RetRA implicit $d0
277 ; FP64-LABEL: name: call_double_in_gpr
278 ; FP64: liveins: $a0, $a2, $a3
279 ; FP64: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
280 ; FP64: [[BuildPairF64_:%[0-9]+]]:afgr64 = BuildPairF64 $a2, $a3
281 ; FP64: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
282 ; FP64: $a0 = COPY [[COPY]]
283 ; FP64: $a3 = ExtractElementF64 [[BuildPairF64_]], 1
284 ; FP64: $a2 = ExtractElementF64 [[BuildPairF64_]], 0
285 ; FP64: JAL @double_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $d0
286 ; FP64: [[COPY1:%[0-9]+]]:fgr64 = COPY $d0
287 ; FP64: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
288 ; FP64: $d0 = COPY [[COPY1]]
289 ; FP64: RetRA implicit $d0
290 %0:gprb(s32) = COPY $a0
291 %1:afgr64(s64) = BuildPairF64 $a2, $a3
292 ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
294 $a3 = ExtractElementF64 %1(s64), 1
295 $a2 = ExtractElementF64 %1(s64), 0
296 JAL @double_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $d0
297 %2:fprb(s64) = COPY $d0
298 ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp