1 ; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
3 ; RUN: llc -O0 -mtriple=mipsel-linux-gnu -global-isel -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=FP32
4 ; RUN: llc -O0 -mtriple=mipsel-linux-gnu -mattr=+fp64,+mips32r2 -global-isel -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=FP64
6 define float @float_in_fpr(float %a, float %b) {
7 ; FP32-LABEL: name: float_in_fpr
9 ; FP32-NEXT: liveins: $f12, $f14
11 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
12 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $f14
13 ; FP32-NEXT: $f0 = COPY [[COPY1]](s32)
14 ; FP32-NEXT: RetRA implicit $f0
16 ; FP64-LABEL: name: float_in_fpr
18 ; FP64-NEXT: liveins: $f12, $f14
20 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
21 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $f14
22 ; FP64-NEXT: $f0 = COPY [[COPY1]](s32)
23 ; FP64-NEXT: RetRA implicit $f0
28 define double @double_in_fpr(double %a, double %b) {
29 ; FP32-LABEL: name: double_in_fpr
31 ; FP32-NEXT: liveins: $d6, $d7
33 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
34 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $d7
35 ; FP32-NEXT: $d0 = COPY [[COPY1]](s64)
36 ; FP32-NEXT: RetRA implicit $d0
38 ; FP64-LABEL: name: double_in_fpr
40 ; FP64-NEXT: liveins: $d12_64, $d14_64
42 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d12_64
43 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $d14_64
44 ; FP64-NEXT: $d0_64 = COPY [[COPY1]](s64)
45 ; FP64-NEXT: RetRA implicit $d0_64
50 define float @float_in_gpr(i32 %a, float %b) {
51 ; FP32-LABEL: name: float_in_gpr
53 ; FP32-NEXT: liveins: $a0, $a1
55 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
56 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
57 ; FP32-NEXT: $f0 = COPY [[COPY1]](s32)
58 ; FP32-NEXT: RetRA implicit $f0
60 ; FP64-LABEL: name: float_in_gpr
62 ; FP64-NEXT: liveins: $a0, $a1
64 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
65 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
66 ; FP64-NEXT: $f0 = COPY [[COPY1]](s32)
67 ; FP64-NEXT: RetRA implicit $f0
72 define double @double_in_gpr(i32 %a, double %b) {
73 ; FP32-LABEL: name: double_in_gpr
75 ; FP32-NEXT: liveins: $a0, $a2, $a3
77 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
78 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a2
79 ; FP32-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $a3
80 ; FP32-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)
81 ; FP32-NEXT: $d0 = COPY [[MV]](s64)
82 ; FP32-NEXT: RetRA implicit $d0
84 ; FP64-LABEL: name: double_in_gpr
86 ; FP64-NEXT: liveins: $a0, $a2, $a3
88 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
89 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a2
90 ; FP64-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $a3
91 ; FP64-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)
92 ; FP64-NEXT: $d0_64 = COPY [[MV]](s64)
93 ; FP64-NEXT: RetRA implicit $d0_64
98 define double @two_double_in_gpr(i32 %a, double %b, double %c) {
99 ; FP32-LABEL: name: two_double_in_gpr
101 ; FP32-NEXT: liveins: $a0, $a2, $a3
103 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
104 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a2
105 ; FP32-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $a3
106 ; FP32-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)
107 ; FP32-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
108 ; FP32-NEXT: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD [[FRAME_INDEX]](p0) :: (load (s64) from %fixed-stack.0)
109 ; FP32-NEXT: $d0 = COPY [[LOAD]](s64)
110 ; FP32-NEXT: RetRA implicit $d0
112 ; FP64-LABEL: name: two_double_in_gpr
114 ; FP64-NEXT: liveins: $a0, $a2, $a3
116 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
117 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a2
118 ; FP64-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $a3
119 ; FP64-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)
120 ; FP64-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
121 ; FP64-NEXT: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD [[FRAME_INDEX]](p0) :: (load (s64) from %fixed-stack.0)
122 ; FP64-NEXT: $d0_64 = COPY [[LOAD]](s64)
123 ; FP64-NEXT: RetRA implicit $d0_64
128 define float @call_float_in_fpr(float %a, float %b) {
129 ; FP32-LABEL: name: call_float_in_fpr
131 ; FP32-NEXT: liveins: $f12, $f14
133 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
134 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $f14
135 ; FP32-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
136 ; FP32-NEXT: $f12 = COPY [[COPY]](s32)
137 ; FP32-NEXT: $f14 = COPY [[COPY1]](s32)
138 ; FP32-NEXT: JAL @float_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $f12, implicit $f14, implicit-def $f0
139 ; FP32-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $f0
140 ; FP32-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
141 ; FP32-NEXT: $f0 = COPY [[COPY2]](s32)
142 ; FP32-NEXT: RetRA implicit $f0
144 ; FP64-LABEL: name: call_float_in_fpr
146 ; FP64-NEXT: liveins: $f12, $f14
148 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
149 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $f14
150 ; FP64-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
151 ; FP64-NEXT: $f12 = COPY [[COPY]](s32)
152 ; FP64-NEXT: $f14 = COPY [[COPY1]](s32)
153 ; FP64-NEXT: JAL @float_in_fpr, csr_o32_fp64, implicit-def $ra, implicit-def $sp, implicit $f12, implicit $f14, implicit-def $f0
154 ; FP64-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $f0
155 ; FP64-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
156 ; FP64-NEXT: $f0 = COPY [[COPY2]](s32)
157 ; FP64-NEXT: RetRA implicit $f0
159 %call = call float @float_in_fpr(float %a, float %b)
163 define double @call_double_in_fpr(double %a, double %b) {
164 ; FP32-LABEL: name: call_double_in_fpr
166 ; FP32-NEXT: liveins: $d6, $d7
168 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
169 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $d7
170 ; FP32-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
171 ; FP32-NEXT: $d6 = COPY [[COPY]](s64)
172 ; FP32-NEXT: $d7 = COPY [[COPY1]](s64)
173 ; FP32-NEXT: JAL @double_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $d6, implicit $d7, implicit-def $d0
174 ; FP32-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $d0
175 ; FP32-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
176 ; FP32-NEXT: $d0 = COPY [[COPY2]](s64)
177 ; FP32-NEXT: RetRA implicit $d0
179 ; FP64-LABEL: name: call_double_in_fpr
181 ; FP64-NEXT: liveins: $d12_64, $d14_64
183 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d12_64
184 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $d14_64
185 ; FP64-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
186 ; FP64-NEXT: $d12_64 = COPY [[COPY]](s64)
187 ; FP64-NEXT: $d14_64 = COPY [[COPY1]](s64)
188 ; FP64-NEXT: JAL @double_in_fpr, csr_o32_fp64, implicit-def $ra, implicit-def $sp, implicit $d12_64, implicit $d14_64, implicit-def $d0_64
189 ; FP64-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $d0_64
190 ; FP64-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
191 ; FP64-NEXT: $d0_64 = COPY [[COPY2]](s64)
192 ; FP64-NEXT: RetRA implicit $d0_64
194 %call = call double @double_in_fpr(double %a, double %b)
198 define float @call_float_in_gpr(i32 %a, float %b) {
199 ; FP32-LABEL: name: call_float_in_gpr
201 ; FP32-NEXT: liveins: $a0, $a1
203 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
204 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
205 ; FP32-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
206 ; FP32-NEXT: $a0 = COPY [[COPY]](s32)
207 ; FP32-NEXT: $a1 = COPY [[COPY1]](s32)
208 ; FP32-NEXT: JAL @float_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit $a1, implicit-def $f0
209 ; FP32-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $f0
210 ; FP32-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
211 ; FP32-NEXT: $f0 = COPY [[COPY2]](s32)
212 ; FP32-NEXT: RetRA implicit $f0
214 ; FP64-LABEL: name: call_float_in_gpr
216 ; FP64-NEXT: liveins: $a0, $a1
218 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
219 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
220 ; FP64-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
221 ; FP64-NEXT: $a0 = COPY [[COPY]](s32)
222 ; FP64-NEXT: $a1 = COPY [[COPY1]](s32)
223 ; FP64-NEXT: JAL @float_in_gpr, csr_o32_fp64, implicit-def $ra, implicit-def $sp, implicit $a0, implicit $a1, implicit-def $f0
224 ; FP64-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $f0
225 ; FP64-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
226 ; FP64-NEXT: $f0 = COPY [[COPY2]](s32)
227 ; FP64-NEXT: RetRA implicit $f0
229 %call = call float @float_in_gpr(i32 %a, float %b)
234 define double @call_double_in_gpr(i32 %a, double %b) {
235 ; FP32-LABEL: name: call_double_in_gpr
237 ; FP32-NEXT: liveins: $a0, $a2, $a3
239 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
240 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a2
241 ; FP32-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $a3
242 ; FP32-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)
243 ; FP32-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
244 ; FP32-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[MV]](s64)
245 ; FP32-NEXT: $a0 = COPY [[COPY]](s32)
246 ; FP32-NEXT: $a2 = COPY [[UV]](s32)
247 ; FP32-NEXT: $a3 = COPY [[UV1]](s32)
248 ; FP32-NEXT: JAL @double_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $d0
249 ; FP32-NEXT: [[COPY3:%[0-9]+]]:_(s64) = COPY $d0
250 ; FP32-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
251 ; FP32-NEXT: $d0 = COPY [[COPY3]](s64)
252 ; FP32-NEXT: RetRA implicit $d0
254 ; FP64-LABEL: name: call_double_in_gpr
256 ; FP64-NEXT: liveins: $a0, $a2, $a3
258 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
259 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a2
260 ; FP64-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $a3
261 ; FP64-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)
262 ; FP64-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
263 ; FP64-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[MV]](s64)
264 ; FP64-NEXT: $a0 = COPY [[COPY]](s32)
265 ; FP64-NEXT: $a2 = COPY [[UV]](s32)
266 ; FP64-NEXT: $a3 = COPY [[UV1]](s32)
267 ; FP64-NEXT: JAL @double_in_gpr, csr_o32_fp64, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $d0_64
268 ; FP64-NEXT: [[COPY3:%[0-9]+]]:_(s64) = COPY $d0_64
269 ; FP64-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
270 ; FP64-NEXT: $d0_64 = COPY [[COPY3]](s64)
271 ; FP64-NEXT: RetRA implicit $d0_64
273 %call = call double @double_in_gpr(i32 %a, double %b)