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: liveins: $f12, $f14
10 ; FP32: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
11 ; FP32: [[COPY1:%[0-9]+]]:_(s32) = COPY $f14
12 ; FP32: $f0 = COPY [[COPY1]](s32)
13 ; FP32: RetRA implicit $f0
14 ; FP64-LABEL: name: float_in_fpr
16 ; FP64: liveins: $f12, $f14
17 ; FP64: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
18 ; FP64: [[COPY1:%[0-9]+]]:_(s32) = COPY $f14
19 ; FP64: $f0 = COPY [[COPY1]](s32)
20 ; FP64: RetRA implicit $f0
25 define double @double_in_fpr(double %a, double %b) {
26 ; FP32-LABEL: name: double_in_fpr
28 ; FP32: liveins: $d6, $d7
29 ; FP32: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
30 ; FP32: [[COPY1:%[0-9]+]]:_(s64) = COPY $d7
31 ; FP32: $d0 = COPY [[COPY1]](s64)
32 ; FP32: RetRA implicit $d0
33 ; FP64-LABEL: name: double_in_fpr
35 ; FP64: liveins: $d12_64, $d14_64
36 ; FP64: [[COPY:%[0-9]+]]:_(s64) = COPY $d12_64
37 ; FP64: [[COPY1:%[0-9]+]]:_(s64) = COPY $d14_64
38 ; FP64: $d0_64 = COPY [[COPY1]](s64)
39 ; FP64: RetRA implicit $d0_64
44 define float @float_in_gpr(i32 %a, float %b) {
45 ; FP32-LABEL: name: float_in_gpr
47 ; FP32: liveins: $a0, $a1
48 ; FP32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
49 ; FP32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
50 ; FP32: $f0 = COPY [[COPY1]](s32)
51 ; FP32: RetRA implicit $f0
52 ; FP64-LABEL: name: float_in_gpr
54 ; FP64: liveins: $a0, $a1
55 ; FP64: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
56 ; FP64: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
57 ; FP64: $f0 = COPY [[COPY1]](s32)
58 ; FP64: RetRA implicit $f0
63 define double @double_in_gpr(i32 %a, double %b) {
64 ; FP32-LABEL: name: double_in_gpr
66 ; FP32: liveins: $a0, $a2, $a3
67 ; FP32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
68 ; FP32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a2
69 ; FP32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a3
70 ; FP32: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)
71 ; FP32: $d0 = COPY [[MV]](s64)
72 ; FP32: RetRA implicit $d0
73 ; FP64-LABEL: name: double_in_gpr
75 ; FP64: liveins: $a0, $a2, $a3
76 ; FP64: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
77 ; FP64: [[COPY1:%[0-9]+]]:_(s32) = COPY $a2
78 ; FP64: [[COPY2:%[0-9]+]]:_(s32) = COPY $a3
79 ; FP64: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)
80 ; FP64: $d0_64 = COPY [[MV]](s64)
81 ; FP64: RetRA implicit $d0_64
86 define float @call_float_in_fpr(float %a, float %b) {
87 ; FP32-LABEL: name: call_float_in_fpr
89 ; FP32: liveins: $f12, $f14
90 ; FP32: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
91 ; FP32: [[COPY1:%[0-9]+]]:_(s32) = COPY $f14
92 ; FP32: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
93 ; FP32: $f12 = COPY [[COPY]](s32)
94 ; FP32: $f14 = COPY [[COPY1]](s32)
95 ; FP32: JAL @float_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $f12, implicit $f14, implicit-def $f0
96 ; FP32: [[COPY2:%[0-9]+]]:_(s32) = COPY $f0
97 ; FP32: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
98 ; FP32: $f0 = COPY [[COPY2]](s32)
99 ; FP32: RetRA implicit $f0
100 ; FP64-LABEL: name: call_float_in_fpr
102 ; FP64: liveins: $f12, $f14
103 ; FP64: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
104 ; FP64: [[COPY1:%[0-9]+]]:_(s32) = COPY $f14
105 ; FP64: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
106 ; FP64: $f12 = COPY [[COPY]](s32)
107 ; FP64: $f14 = COPY [[COPY1]](s32)
108 ; FP64: JAL @float_in_fpr, csr_o32_fp64, implicit-def $ra, implicit-def $sp, implicit $f12, implicit $f14, implicit-def $f0
109 ; FP64: [[COPY2:%[0-9]+]]:_(s32) = COPY $f0
110 ; FP64: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
111 ; FP64: $f0 = COPY [[COPY2]](s32)
112 ; FP64: RetRA implicit $f0
114 %call = call float @float_in_fpr(float %a, float %b)
118 define double @call_double_in_fpr(double %a, double %b) {
119 ; FP32-LABEL: name: call_double_in_fpr
121 ; FP32: liveins: $d6, $d7
122 ; FP32: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
123 ; FP32: [[COPY1:%[0-9]+]]:_(s64) = COPY $d7
124 ; FP32: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
125 ; FP32: $d6 = COPY [[COPY]](s64)
126 ; FP32: $d7 = COPY [[COPY1]](s64)
127 ; FP32: JAL @double_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $d6, implicit $d7, implicit-def $d0
128 ; FP32: [[COPY2:%[0-9]+]]:_(s64) = COPY $d0
129 ; FP32: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
130 ; FP32: $d0 = COPY [[COPY2]](s64)
131 ; FP32: RetRA implicit $d0
132 ; FP64-LABEL: name: call_double_in_fpr
134 ; FP64: liveins: $d12_64, $d14_64
135 ; FP64: [[COPY:%[0-9]+]]:_(s64) = COPY $d12_64
136 ; FP64: [[COPY1:%[0-9]+]]:_(s64) = COPY $d14_64
137 ; FP64: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
138 ; FP64: $d12_64 = COPY [[COPY]](s64)
139 ; FP64: $d14_64 = COPY [[COPY1]](s64)
140 ; FP64: JAL @double_in_fpr, csr_o32_fp64, implicit-def $ra, implicit-def $sp, implicit $d12_64, implicit $d14_64, implicit-def $d0_64
141 ; FP64: [[COPY2:%[0-9]+]]:_(s64) = COPY $d0_64
142 ; FP64: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
143 ; FP64: $d0_64 = COPY [[COPY2]](s64)
144 ; FP64: RetRA implicit $d0_64
146 %call = call double @double_in_fpr(double %a, double %b)
150 define float @call_float_in_gpr(i32 %a, float %b) {
151 ; FP32-LABEL: name: call_float_in_gpr
153 ; FP32: liveins: $a0, $a1
154 ; FP32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
155 ; FP32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
156 ; FP32: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
157 ; FP32: $a0 = COPY [[COPY]](s32)
158 ; FP32: $a1 = COPY [[COPY1]](s32)
159 ; FP32: JAL @float_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit $a1, implicit-def $f0
160 ; FP32: [[COPY2:%[0-9]+]]:_(s32) = COPY $f0
161 ; FP32: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
162 ; FP32: $f0 = COPY [[COPY2]](s32)
163 ; FP32: RetRA implicit $f0
164 ; FP64-LABEL: name: call_float_in_gpr
166 ; FP64: liveins: $a0, $a1
167 ; FP64: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
168 ; FP64: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
169 ; FP64: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
170 ; FP64: $a0 = COPY [[COPY]](s32)
171 ; FP64: $a1 = COPY [[COPY1]](s32)
172 ; FP64: JAL @float_in_gpr, csr_o32_fp64, implicit-def $ra, implicit-def $sp, implicit $a0, implicit $a1, implicit-def $f0
173 ; FP64: [[COPY2:%[0-9]+]]:_(s32) = COPY $f0
174 ; FP64: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
175 ; FP64: $f0 = COPY [[COPY2]](s32)
176 ; FP64: RetRA implicit $f0
178 %call = call float @float_in_gpr(i32 %a, float %b)
183 define double @call_double_in_gpr(i32 %a, double %b) {
184 ; FP32-LABEL: name: call_double_in_gpr
186 ; FP32: liveins: $a0, $a2, $a3
187 ; FP32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
188 ; FP32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a2
189 ; FP32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a3
190 ; FP32: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)
191 ; FP32: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
192 ; FP32: $a0 = COPY [[COPY]](s32)
193 ; FP32: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[MV]](s64)
194 ; FP32: $a2 = COPY [[UV]](s32)
195 ; FP32: $a3 = COPY [[UV1]](s32)
196 ; FP32: JAL @double_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $d0
197 ; FP32: [[COPY3:%[0-9]+]]:_(s64) = COPY $d0
198 ; FP32: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
199 ; FP32: $d0 = COPY [[COPY3]](s64)
200 ; FP32: RetRA implicit $d0
201 ; FP64-LABEL: name: call_double_in_gpr
203 ; FP64: liveins: $a0, $a2, $a3
204 ; FP64: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
205 ; FP64: [[COPY1:%[0-9]+]]:_(s32) = COPY $a2
206 ; FP64: [[COPY2:%[0-9]+]]:_(s32) = COPY $a3
207 ; FP64: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)
208 ; FP64: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
209 ; FP64: $a0 = COPY [[COPY]](s32)
210 ; FP64: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[MV]](s64)
211 ; FP64: $a2 = COPY [[UV]](s32)
212 ; FP64: $a3 = COPY [[UV1]](s32)
213 ; FP64: JAL @double_in_gpr, csr_o32_fp64, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $d0_64
214 ; FP64: [[COPY3:%[0-9]+]]:_(s64) = COPY $d0_64
215 ; FP64: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
216 ; FP64: $d0_64 = COPY [[COPY3]](s64)
217 ; FP64: RetRA implicit $d0_64
219 %call = call double @double_in_gpr(i32 %a, double %b)