1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=mipsel-linux-gnu -run-pass=regbankselect -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=FP32
3 # RUN: llc -O0 -mtriple=mipsel-linux-gnu -mattr=+fp64,+mips32r2 -run-pass=regbankselect -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=FP64
7 define void @float_in_fpr() {entry: ret void}
8 define void @double_in_fpr() {entry: ret void}
9 define void @float_in_gpr() {entry: ret void}
10 define void @double_in_gpr() {entry: ret void}
11 define void @call_float_in_fpr() {entry: ret void}
12 define void @call_double_in_fpr() {entry: ret void}
13 define void @call_float_in_gpr() {entry: ret void}
14 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]+]]:fprb(s32) = COPY $f14
29 ; FP32: $f0 = COPY [[COPY]](s32)
30 ; FP32: RetRA implicit $f0
31 ; FP64-LABEL: name: float_in_fpr
32 ; FP64: liveins: $f12, $f14
33 ; FP64: [[COPY:%[0-9]+]]:fprb(s32) = COPY $f14
34 ; FP64: $f0 = COPY [[COPY]](s32)
35 ; FP64: RetRA implicit $f0
45 tracksRegLiveness: true
50 ; FP32-LABEL: name: double_in_fpr
51 ; FP32: liveins: $d6, $d7
52 ; FP32: [[COPY:%[0-9]+]]:fprb(s64) = COPY $d7
53 ; FP32: $d0 = COPY [[COPY]](s64)
54 ; FP32: RetRA implicit $d0
55 ; FP64-LABEL: name: double_in_fpr
56 ; FP64: liveins: $d6, $d7
57 ; FP64: [[COPY:%[0-9]+]]:fprb(s64) = COPY $d7
58 ; FP64: $d0 = COPY [[COPY]](s64)
59 ; FP64: RetRA implicit $d0
69 tracksRegLiveness: true
74 ; FP32-LABEL: name: float_in_gpr
75 ; FP32: liveins: $a0, $a1
76 ; FP32: [[MTC1_:%[0-9]+]]:fgr32(s32) = MTC1 $a1
77 ; FP32: $f0 = COPY [[MTC1_]](s32)
78 ; FP32: RetRA implicit $f0
79 ; FP64-LABEL: name: float_in_gpr
80 ; FP64: liveins: $a0, $a1
81 ; FP64: [[MTC1_:%[0-9]+]]:fgr32(s32) = MTC1 $a1
82 ; FP64: $f0 = COPY [[MTC1_]](s32)
83 ; FP64: RetRA implicit $f0
84 %1:fgr32(s32) = MTC1 $a1
93 tracksRegLiveness: true
96 liveins: $a0, $a2, $a3
98 ; FP32-LABEL: name: double_in_gpr
99 ; FP32: liveins: $a0, $a2, $a3
100 ; FP32: [[BuildPairF64_:%[0-9]+]]:afgr64(s64) = BuildPairF64 $a2, $a3
101 ; FP32: $d0 = COPY [[BuildPairF64_]](s64)
102 ; FP32: RetRA implicit $d0
103 ; FP64-LABEL: name: double_in_gpr
104 ; FP64: liveins: $a0, $a2, $a3
105 ; FP64: [[BuildPairF64_:%[0-9]+]]:afgr64(s64) = BuildPairF64 $a2, $a3
106 ; FP64: $d0 = COPY [[BuildPairF64_]](s64)
107 ; FP64: RetRA implicit $d0
108 %1:afgr64(s64) = BuildPairF64 $a2, $a3
114 name: call_float_in_fpr
117 tracksRegLiveness: true
122 ; FP32-LABEL: name: call_float_in_fpr
123 ; FP32: liveins: $f12, $f14
124 ; FP32: [[COPY:%[0-9]+]]:fprb(s32) = COPY $f12
125 ; FP32: [[COPY1:%[0-9]+]]:fprb(s32) = COPY $f14
126 ; FP32: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
127 ; FP32: $f12 = COPY [[COPY]](s32)
128 ; FP32: $f14 = COPY [[COPY1]](s32)
129 ; FP32: JAL @float_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $f12, implicit $f14, implicit-def $f0
130 ; FP32: [[COPY2:%[0-9]+]]:fprb(s32) = COPY $f0
131 ; FP32: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
132 ; FP32: $f0 = COPY [[COPY2]](s32)
133 ; FP32: RetRA implicit $f0
134 ; FP64-LABEL: name: call_float_in_fpr
135 ; FP64: liveins: $f12, $f14
136 ; FP64: [[COPY:%[0-9]+]]:fprb(s32) = COPY $f12
137 ; FP64: [[COPY1:%[0-9]+]]:fprb(s32) = COPY $f14
138 ; FP64: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
139 ; FP64: $f12 = COPY [[COPY]](s32)
140 ; FP64: $f14 = COPY [[COPY1]](s32)
141 ; FP64: JAL @float_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $f12, implicit $f14, implicit-def $f0
142 ; FP64: [[COPY2:%[0-9]+]]:fprb(s32) = COPY $f0
143 ; FP64: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
144 ; FP64: $f0 = COPY [[COPY2]](s32)
145 ; FP64: RetRA implicit $f0
146 %0:_(s32) = COPY $f12
147 %1:_(s32) = COPY $f14
148 ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
151 JAL @float_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $f12, implicit $f14, implicit-def $f0
153 ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
159 name: call_double_in_fpr
162 tracksRegLiveness: true
167 ; FP32-LABEL: name: call_double_in_fpr
168 ; FP32: liveins: $d6, $d7
169 ; FP32: [[COPY:%[0-9]+]]:fprb(s64) = COPY $d6
170 ; FP32: [[COPY1:%[0-9]+]]:fprb(s64) = COPY $d7
171 ; FP32: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
172 ; FP32: $d6 = COPY [[COPY]](s64)
173 ; FP32: $d7 = COPY [[COPY1]](s64)
174 ; FP32: JAL @double_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $d6, implicit $d7, implicit-def $d0
175 ; FP32: [[COPY2:%[0-9]+]]:fprb(s64) = COPY $d0
176 ; FP32: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
177 ; FP32: $d0 = COPY [[COPY2]](s64)
178 ; FP32: RetRA implicit $d0
179 ; FP64-LABEL: name: call_double_in_fpr
180 ; FP64: liveins: $d6, $d7
181 ; FP64: [[COPY:%[0-9]+]]:fprb(s64) = COPY $d6
182 ; FP64: [[COPY1:%[0-9]+]]:fprb(s64) = COPY $d7
183 ; FP64: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
184 ; FP64: $d6 = COPY [[COPY]](s64)
185 ; FP64: $d7 = COPY [[COPY1]](s64)
186 ; FP64: JAL @double_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $d6, implicit $d7, implicit-def $d0
187 ; FP64: [[COPY2:%[0-9]+]]:fprb(s64) = COPY $d0
188 ; FP64: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
189 ; FP64: $d0 = COPY [[COPY2]](s64)
190 ; FP64: RetRA implicit $d0
193 ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
196 JAL @double_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $d6, implicit $d7, implicit-def $d0
198 ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
204 name: call_float_in_gpr
207 tracksRegLiveness: true
212 ; FP32-LABEL: name: call_float_in_gpr
213 ; FP32: liveins: $a0, $a1
214 ; FP32: [[COPY:%[0-9]+]]:gprb(s32) = COPY $a0
215 ; FP32: [[MTC1_:%[0-9]+]]:fgr32(s32) = MTC1 $a1
216 ; FP32: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
217 ; FP32: $a0 = COPY [[COPY]](s32)
218 ; FP32: $a1 = MFC1 [[MTC1_]](s32)
219 ; FP32: JAL @float_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $f0
220 ; FP32: [[COPY1:%[0-9]+]]:fprb(s32) = COPY $f0
221 ; FP32: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
222 ; FP32: $f0 = COPY [[COPY1]](s32)
223 ; FP32: RetRA implicit $f0
224 ; FP64-LABEL: name: call_float_in_gpr
225 ; FP64: liveins: $a0, $a1
226 ; FP64: [[COPY:%[0-9]+]]:gprb(s32) = COPY $a0
227 ; FP64: [[MTC1_:%[0-9]+]]:fgr32(s32) = MTC1 $a1
228 ; FP64: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
229 ; FP64: $a0 = COPY [[COPY]](s32)
230 ; FP64: $a1 = MFC1 [[MTC1_]](s32)
231 ; FP64: JAL @float_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $f0
232 ; FP64: [[COPY1:%[0-9]+]]:fprb(s32) = COPY $f0
233 ; FP64: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
234 ; FP64: $f0 = COPY [[COPY1]](s32)
235 ; FP64: RetRA implicit $f0
237 %1:fgr32(s32) = MTC1 $a1
238 ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
241 JAL @float_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $f0
243 ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
249 name: call_double_in_gpr
252 tracksRegLiveness: true
255 liveins: $a0, $a2, $a3
257 ; FP32-LABEL: name: call_double_in_gpr
258 ; FP32: liveins: $a0, $a2, $a3
259 ; FP32: [[COPY:%[0-9]+]]:gprb(s32) = COPY $a0
260 ; FP32: [[BuildPairF64_:%[0-9]+]]:afgr64(s64) = BuildPairF64 $a2, $a3
261 ; FP32: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
262 ; FP32: $a0 = COPY [[COPY]](s32)
263 ; FP32: $a3 = ExtractElementF64 [[BuildPairF64_]](s64), 1
264 ; FP32: $a2 = ExtractElementF64 [[BuildPairF64_]](s64), 0
265 ; FP32: JAL @double_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $d0
266 ; FP32: [[COPY1:%[0-9]+]]:fprb(s64) = COPY $d0
267 ; FP32: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
268 ; FP32: $d0 = COPY [[COPY1]](s64)
269 ; FP32: RetRA implicit $d0
270 ; FP64-LABEL: name: call_double_in_gpr
271 ; FP64: liveins: $a0, $a2, $a3
272 ; FP64: [[COPY:%[0-9]+]]:gprb(s32) = COPY $a0
273 ; FP64: [[BuildPairF64_:%[0-9]+]]:afgr64(s64) = BuildPairF64 $a2, $a3
274 ; FP64: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
275 ; FP64: $a0 = COPY [[COPY]](s32)
276 ; FP64: $a3 = ExtractElementF64 [[BuildPairF64_]](s64), 1
277 ; FP64: $a2 = ExtractElementF64 [[BuildPairF64_]](s64), 0
278 ; FP64: JAL @double_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $d0
279 ; FP64: [[COPY1:%[0-9]+]]:fprb(s64) = COPY $d0
280 ; FP64: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
281 ; FP64: $d0 = COPY [[COPY1]](s64)
282 ; FP64: RetRA implicit $d0
284 %1:afgr64(s64) = BuildPairF64 $a2, $a3
285 ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
287 $a3 = ExtractElementF64 %1(s64), 1
288 $a2 = ExtractElementF64 %1(s64), 0
289 JAL @double_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $d0
291 ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp