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
4--- |
5
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}
14
15...
16---
17name:            float_in_fpr
18alignment:       2
19legalized:       true
20regBankSelected: true
21tracksRegLiveness: true
22body:             |
23  bb.1.entry:
24    liveins: $f12, $f14
25
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
37    $f0 = COPY %1(s32)
38    RetRA implicit $f0
39
40...
41---
42name:            double_in_fpr
43alignment:       2
44legalized:       true
45regBankSelected: true
46tracksRegLiveness: true
47body:             |
48  bb.1.entry:
49    liveins: $d6, $d7
50
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
62    $d0 = COPY %1(s64)
63    RetRA implicit $d0
64
65...
66---
67name:            float_in_gpr
68alignment:       2
69legalized:       true
70regBankSelected: true
71tracksRegLiveness: true
72body:             |
73  bb.1.entry:
74    liveins: $a0, $a1
75
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
87    $f0 = COPY %1(s32)
88    RetRA implicit $f0
89
90...
91---
92name:            double_in_gpr
93alignment:       2
94legalized:       true
95regBankSelected: true
96tracksRegLiveness: true
97body:             |
98  bb.1.entry:
99    liveins: $a0, $a2, $a3
100
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
112    $d0 = COPY %1(s64)
113    RetRA implicit $d0
114
115...
116---
117name:            call_float_in_fpr
118alignment:       2
119legalized:       true
120regBankSelected: true
121tracksRegLiveness: true
122body:             |
123  bb.1.entry:
124    liveins: $f12, $f14
125
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
153    $f12 = COPY %0(s32)
154    $f14 = COPY %1(s32)
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
158    $f0 = COPY %2(s32)
159    RetRA implicit $f0
160
161...
162---
163name:            call_double_in_fpr
164alignment:       2
165legalized:       true
166regBankSelected: true
167tracksRegLiveness: true
168body:             |
169  bb.1.entry:
170    liveins: $d6, $d7
171
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
199    $d6 = COPY %0(s64)
200    $d7 = COPY %1(s64)
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
204    $d0 = COPY %2(s64)
205    RetRA implicit $d0
206
207...
208---
209name:            call_float_in_gpr
210alignment:       2
211legalized:       true
212regBankSelected: true
213tracksRegLiveness: true
214body:             |
215  bb.1.entry:
216    liveins: $a0, $a1
217
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
245    $a0 = COPY %0(s32)
246    $a1 = MFC1 %1(s32)
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
250    $f0 = COPY %2(s32)
251    RetRA implicit $f0
252
253...
254---
255name:            call_double_in_gpr
256alignment:       2
257legalized:       true
258regBankSelected: true
259tracksRegLiveness: true
260body:             |
261  bb.1.entry:
262    liveins: $a0, $a2, $a3
263
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
293    $a0 = COPY %0(s32)
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
299    $d0 = COPY %2(s64)
300    RetRA implicit $d0
301
302...
303
304