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: [[MTC1_:%[0-9]+]]:fgr32(s32) = MTC1 $a1
50 ; FP32: $f0 = COPY [[MTC1_]](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: [[MTC1_:%[0-9]+]]:fgr32(s32) = MTC1 $a1
57 ; FP64: $f0 = COPY [[MTC1_]](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: [[BuildPairF64_:%[0-9]+]]:afgr64(s64) = BuildPairF64 $a2, $a3
69 ; FP32: $d0 = COPY [[BuildPairF64_]](s64)
70 ; FP32: RetRA implicit $d0
71 ; FP64-LABEL: name: double_in_gpr
73 ; FP64: liveins: $a0, $a2, $a3
74 ; FP64: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
75 ; FP64: [[BuildPairF64_64_:%[0-9]+]]:fgr64(s64) = BuildPairF64_64 $a2, $a3
76 ; FP64: $d0_64 = COPY [[BuildPairF64_64_]](s64)
77 ; FP64: RetRA implicit $d0_64
82 define float @call_float_in_fpr(float %a, float %b) {
83 ; FP32-LABEL: name: call_float_in_fpr
85 ; FP32: liveins: $f12, $f14
86 ; FP32: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
87 ; FP32: [[COPY1:%[0-9]+]]:_(s32) = COPY $f14
88 ; FP32: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
89 ; FP32: $f12 = COPY [[COPY]](s32)
90 ; FP32: $f14 = COPY [[COPY1]](s32)
91 ; FP32: JAL @float_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $f12, implicit $f14, implicit-def $f0
92 ; FP32: [[COPY2:%[0-9]+]]:_(s32) = COPY $f0
93 ; FP32: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
94 ; FP32: $f0 = COPY [[COPY2]](s32)
95 ; FP32: RetRA implicit $f0
96 ; FP64-LABEL: name: call_float_in_fpr
98 ; FP64: liveins: $f12, $f14
99 ; FP64: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
100 ; FP64: [[COPY1:%[0-9]+]]:_(s32) = COPY $f14
101 ; FP64: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
102 ; FP64: $f12 = COPY [[COPY]](s32)
103 ; FP64: $f14 = COPY [[COPY1]](s32)
104 ; FP64: JAL @float_in_fpr, csr_o32_fp64, implicit-def $ra, implicit-def $sp, implicit $f12, implicit $f14, implicit-def $f0
105 ; FP64: [[COPY2:%[0-9]+]]:_(s32) = COPY $f0
106 ; FP64: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
107 ; FP64: $f0 = COPY [[COPY2]](s32)
108 ; FP64: RetRA implicit $f0
110 %call = call float @float_in_fpr(float %a, float %b)
114 define double @call_double_in_fpr(double %a, double %b) {
115 ; FP32-LABEL: name: call_double_in_fpr
117 ; FP32: liveins: $d6, $d7
118 ; FP32: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
119 ; FP32: [[COPY1:%[0-9]+]]:_(s64) = COPY $d7
120 ; FP32: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
121 ; FP32: $d6 = COPY [[COPY]](s64)
122 ; FP32: $d7 = COPY [[COPY1]](s64)
123 ; FP32: JAL @double_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $d6, implicit $d7, implicit-def $d0
124 ; FP32: [[COPY2:%[0-9]+]]:_(s64) = COPY $d0
125 ; FP32: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
126 ; FP32: $d0 = COPY [[COPY2]](s64)
127 ; FP32: RetRA implicit $d0
128 ; FP64-LABEL: name: call_double_in_fpr
130 ; FP64: liveins: $d12_64, $d14_64
131 ; FP64: [[COPY:%[0-9]+]]:_(s64) = COPY $d12_64
132 ; FP64: [[COPY1:%[0-9]+]]:_(s64) = COPY $d14_64
133 ; FP64: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
134 ; FP64: $d12_64 = COPY [[COPY]](s64)
135 ; FP64: $d14_64 = COPY [[COPY1]](s64)
136 ; FP64: JAL @double_in_fpr, csr_o32_fp64, implicit-def $ra, implicit-def $sp, implicit $d12_64, implicit $d14_64, implicit-def $d0_64
137 ; FP64: [[COPY2:%[0-9]+]]:_(s64) = COPY $d0_64
138 ; FP64: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
139 ; FP64: $d0_64 = COPY [[COPY2]](s64)
140 ; FP64: RetRA implicit $d0_64
142 %call = call double @double_in_fpr(double %a, double %b)
146 define float @call_float_in_gpr(i32 %a, float %b) {
147 ; FP32-LABEL: name: call_float_in_gpr
149 ; FP32: liveins: $a0, $a1
150 ; FP32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
151 ; FP32: [[MTC1_:%[0-9]+]]:fgr32(s32) = MTC1 $a1
152 ; FP32: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
153 ; FP32: $a0 = COPY [[COPY]](s32)
154 ; FP32: $a1 = MFC1 [[MTC1_]](s32)
155 ; FP32: JAL @float_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $f0
156 ; FP32: [[COPY1:%[0-9]+]]:_(s32) = COPY $f0
157 ; FP32: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
158 ; FP32: $f0 = COPY [[COPY1]](s32)
159 ; FP32: RetRA implicit $f0
160 ; FP64-LABEL: name: call_float_in_gpr
162 ; FP64: liveins: $a0, $a1
163 ; FP64: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
164 ; FP64: [[MTC1_:%[0-9]+]]:fgr32(s32) = MTC1 $a1
165 ; FP64: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
166 ; FP64: $a0 = COPY [[COPY]](s32)
167 ; FP64: $a1 = MFC1 [[MTC1_]](s32)
168 ; FP64: JAL @float_in_gpr, csr_o32_fp64, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $f0
169 ; FP64: [[COPY1:%[0-9]+]]:_(s32) = COPY $f0
170 ; FP64: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
171 ; FP64: $f0 = COPY [[COPY1]](s32)
172 ; FP64: RetRA implicit $f0
174 %call = call float @float_in_gpr(i32 %a, float %b)
179 define double @call_double_in_gpr(i32 %a, double %b) {
180 ; FP32-LABEL: name: call_double_in_gpr
182 ; FP32: liveins: $a0, $a2, $a3
183 ; FP32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
184 ; FP32: [[BuildPairF64_:%[0-9]+]]:afgr64(s64) = BuildPairF64 $a2, $a3
185 ; FP32: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
186 ; FP32: $a0 = COPY [[COPY]](s32)
187 ; FP32: $a3 = ExtractElementF64 [[BuildPairF64_]](s64), 1
188 ; FP32: $a2 = ExtractElementF64 [[BuildPairF64_]](s64), 0
189 ; FP32: JAL @double_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $d0
190 ; FP32: [[COPY1:%[0-9]+]]:_(s64) = COPY $d0
191 ; FP32: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
192 ; FP32: $d0 = COPY [[COPY1]](s64)
193 ; FP32: RetRA implicit $d0
194 ; FP64-LABEL: name: call_double_in_gpr
196 ; FP64: liveins: $a0, $a2, $a3
197 ; FP64: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
198 ; FP64: [[BuildPairF64_64_:%[0-9]+]]:fgr64(s64) = BuildPairF64_64 $a2, $a3
199 ; FP64: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
200 ; FP64: $a0 = COPY [[COPY]](s32)
201 ; FP64: $a3 = ExtractElementF64_64 [[BuildPairF64_64_]](s64), 1
202 ; FP64: $a2 = ExtractElementF64_64 [[BuildPairF64_64_]](s64), 0
203 ; FP64: JAL @double_in_gpr, csr_o32_fp64, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $d0_64
204 ; FP64: [[COPY1:%[0-9]+]]:_(s64) = COPY $d0_64
205 ; FP64: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
206 ; FP64: $d0_64 = COPY [[COPY1]](s64)
207 ; FP64: RetRA implicit $d0_64
209 %call = call double @double_in_gpr(i32 %a, double %b)