blob: b8f1d945f3564c3acc94df8681b58ee5b7be3df3 [file] [log] [blame]
Daniel Sanders2f2ab512016-05-19 10:42:14 +00001; RUN: llc -march=mipsel -mattr=mips16 -relocation-model=pic -O3 \
2; RUN: -verify-machineinstrs < %s | FileCheck %s -check-prefix=16hf
Reed Kotler5fdeb212012-12-15 00:20:05 +00003
4@x = global float 5.000000e+00, align 4
5@y = global float 1.500000e+01, align 4
6@xd = global double 6.000000e+00, align 8
7@yd = global double 1.800000e+01, align 8
8@two = global i32 2, align 4
9@addsf3_result = common global float 0.000000e+00, align 4
10@adddf3_result = common global double 0.000000e+00, align 8
11@subsf3_result = common global float 0.000000e+00, align 4
12@subdf3_result = common global double 0.000000e+00, align 8
13@mulsf3_result = common global float 0.000000e+00, align 4
14@muldf3_result = common global double 0.000000e+00, align 8
15@divsf3_result = common global float 0.000000e+00, align 4
16@divdf3_result = common global double 0.000000e+00, align 8
17@extendsfdf2_result = common global double 0.000000e+00, align 8
18@xd2 = global double 0x40147E6B74B4CF6A, align 8
19@truncdfsf2_result = common global float 0.000000e+00, align 4
20@fix_truncsfsi_result = common global i32 0, align 4
21@fix_truncdfsi_result = common global i32 0, align 4
22@si = global i32 -9, align 4
23@ui = global i32 9, align 4
24@floatsisf_result = common global float 0.000000e+00, align 4
25@floatsidf_result = common global double 0.000000e+00, align 8
26@floatunsisf_result = common global float 0.000000e+00, align 4
27@floatunsidf_result = common global double 0.000000e+00, align 8
28@xx = global float 5.000000e+00, align 4
29@eqsf2_result = common global i32 0, align 4
30@xxd = global double 6.000000e+00, align 8
31@eqdf2_result = common global i32 0, align 4
32@nesf2_result = common global i32 0, align 4
33@nedf2_result = common global i32 0, align 4
34@gesf2_result = common global i32 0, align 4
35@gedf2_result = common global i32 0, align 4
36@ltsf2_result = common global i32 0, align 4
37@ltdf2_result = common global i32 0, align 4
38@lesf2_result = common global i32 0, align 4
39@ledf2_result = common global i32 0, align 4
40@gtsf2_result = common global i32 0, align 4
41@gtdf2_result = common global i32 0, align 4
42
43define void @test_addsf3() nounwind {
44entry:
Stephen Lind24ab202013-07-14 06:24:09 +000045;16hf-LABEL: test_addsf3:
David Blaikiea79ac142015-02-27 21:17:42 +000046 %0 = load float, float* @x, align 4
47 %1 = load float, float* @y, align 4
Reed Kotler5fdeb212012-12-15 00:20:05 +000048 %add = fadd float %0, %1
49 store float %add, float* @addsf3_result, align 4
50;16hf: lw ${{[0-9]+}}, %call16(__mips16_addsf3)(${{[0-9]+}})
51 ret void
52}
53
54define void @test_adddf3() nounwind {
55entry:
Stephen Lind24ab202013-07-14 06:24:09 +000056;16hf-LABEL: test_adddf3:
David Blaikiea79ac142015-02-27 21:17:42 +000057 %0 = load double, double* @xd, align 8
58 %1 = load double, double* @yd, align 8
Reed Kotler5fdeb212012-12-15 00:20:05 +000059 %add = fadd double %0, %1
60 store double %add, double* @adddf3_result, align 8
61;16hf: lw ${{[0-9]+}}, %call16(__mips16_adddf3)(${{[0-9]+}})
62 ret void
63}
64
65define void @test_subsf3() nounwind {
66entry:
Stephen Lind24ab202013-07-14 06:24:09 +000067;16hf-LABEL: test_subsf3:
David Blaikiea79ac142015-02-27 21:17:42 +000068 %0 = load float, float* @x, align 4
69 %1 = load float, float* @y, align 4
Reed Kotler5fdeb212012-12-15 00:20:05 +000070 %sub = fsub float %0, %1
71 store float %sub, float* @subsf3_result, align 4
72;16hf: lw ${{[0-9]+}}, %call16(__mips16_subsf3)(${{[0-9]+}})
73 ret void
74}
75
76define void @test_subdf3() nounwind {
77entry:
Stephen Lind24ab202013-07-14 06:24:09 +000078;16hf-LABEL: test_subdf3:
David Blaikiea79ac142015-02-27 21:17:42 +000079 %0 = load double, double* @xd, align 8
80 %1 = load double, double* @yd, align 8
Reed Kotler5fdeb212012-12-15 00:20:05 +000081 %sub = fsub double %0, %1
82 store double %sub, double* @subdf3_result, align 8
83;16hf: lw ${{[0-9]+}}, %call16(__mips16_subdf3)(${{[0-9]+}})
84 ret void
85}
86
87define void @test_mulsf3() nounwind {
88entry:
Stephen Lind24ab202013-07-14 06:24:09 +000089;16hf-LABEL: test_mulsf3:
David Blaikiea79ac142015-02-27 21:17:42 +000090 %0 = load float, float* @x, align 4
91 %1 = load float, float* @y, align 4
Reed Kotler5fdeb212012-12-15 00:20:05 +000092 %mul = fmul float %0, %1
93 store float %mul, float* @mulsf3_result, align 4
94;16hf: lw ${{[0-9]+}}, %call16(__mips16_mulsf3)(${{[0-9]+}})
95 ret void
96}
97
98define void @test_muldf3() nounwind {
99entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000100;16hf-LABEL: test_muldf3:
David Blaikiea79ac142015-02-27 21:17:42 +0000101 %0 = load double, double* @xd, align 8
102 %1 = load double, double* @yd, align 8
Reed Kotler5fdeb212012-12-15 00:20:05 +0000103 %mul = fmul double %0, %1
104 store double %mul, double* @muldf3_result, align 8
105;16hf: lw ${{[0-9]+}}, %call16(__mips16_muldf3)(${{[0-9]+}})
106 ret void
107}
108
109define void @test_divsf3() nounwind {
110entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000111;16hf-LABEL: test_divsf3:
David Blaikiea79ac142015-02-27 21:17:42 +0000112 %0 = load float, float* @y, align 4
113 %1 = load float, float* @x, align 4
Reed Kotler5fdeb212012-12-15 00:20:05 +0000114 %div = fdiv float %0, %1
115 store float %div, float* @divsf3_result, align 4
116;16hf: lw ${{[0-9]+}}, %call16(__mips16_divsf3)(${{[0-9]+}})
117 ret void
118}
119
120define void @test_divdf3() nounwind {
121entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000122;16hf-LABEL: test_divdf3:
David Blaikiea79ac142015-02-27 21:17:42 +0000123 %0 = load double, double* @yd, align 8
Reed Kotler5fdeb212012-12-15 00:20:05 +0000124 %mul = fmul double %0, 2.000000e+00
David Blaikiea79ac142015-02-27 21:17:42 +0000125 %1 = load double, double* @xd, align 8
Reed Kotler5fdeb212012-12-15 00:20:05 +0000126 %div = fdiv double %mul, %1
127 store double %div, double* @divdf3_result, align 8
128;16hf: lw ${{[0-9]+}}, %call16(__mips16_divdf3)(${{[0-9]+}})
129 ret void
130}
131
132define void @test_extendsfdf2() nounwind {
133entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000134;16hf-LABEL: test_extendsfdf2:
David Blaikiea79ac142015-02-27 21:17:42 +0000135 %0 = load float, float* @x, align 4
Reed Kotler5fdeb212012-12-15 00:20:05 +0000136 %conv = fpext float %0 to double
137 store double %conv, double* @extendsfdf2_result, align 8
138;16hf: lw ${{[0-9]+}}, %call16(__mips16_extendsfdf2)(${{[0-9]+}})
139 ret void
140}
141
142define void @test_truncdfsf2() nounwind {
143entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000144;16hf-LABEL: test_truncdfsf2:
David Blaikiea79ac142015-02-27 21:17:42 +0000145 %0 = load double, double* @xd2, align 8
Reed Kotler5fdeb212012-12-15 00:20:05 +0000146 %conv = fptrunc double %0 to float
147 store float %conv, float* @truncdfsf2_result, align 4
148;16hf: lw ${{[0-9]+}}, %call16(__mips16_truncdfsf2)(${{[0-9]+}})
149 ret void
150}
151
152define void @test_fix_truncsfsi() nounwind {
153entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000154;16hf-LABEL: test_fix_truncsfsi:
David Blaikiea79ac142015-02-27 21:17:42 +0000155 %0 = load float, float* @x, align 4
Reed Kotler5fdeb212012-12-15 00:20:05 +0000156 %conv = fptosi float %0 to i32
157 store i32 %conv, i32* @fix_truncsfsi_result, align 4
158;16hf: lw ${{[0-9]+}}, %call16(__mips16_fix_truncsfsi)(${{[0-9]+}})
159 ret void
160}
161
162define void @test_fix_truncdfsi() nounwind {
163entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000164;16hf-LABEL: test_fix_truncdfsi:
David Blaikiea79ac142015-02-27 21:17:42 +0000165 %0 = load double, double* @xd, align 8
Reed Kotler5fdeb212012-12-15 00:20:05 +0000166 %conv = fptosi double %0 to i32
167 store i32 %conv, i32* @fix_truncdfsi_result, align 4
168;16hf: lw ${{[0-9]+}}, %call16(__mips16_fix_truncdfsi)(${{[0-9]+}})
169 ret void
170}
171
172define void @test_floatsisf() nounwind {
173entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000174;16hf-LABEL: test_floatsisf:
David Blaikiea79ac142015-02-27 21:17:42 +0000175 %0 = load i32, i32* @si, align 4
Reed Kotler5fdeb212012-12-15 00:20:05 +0000176 %conv = sitofp i32 %0 to float
177 store float %conv, float* @floatsisf_result, align 4
178;16hf: lw ${{[0-9]+}}, %call16(__mips16_floatsisf)(${{[0-9]+}})
179 ret void
180}
181
182define void @test_floatsidf() nounwind {
183entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000184;16hf-LABEL: test_floatsidf:
David Blaikiea79ac142015-02-27 21:17:42 +0000185 %0 = load i32, i32* @si, align 4
Reed Kotler5fdeb212012-12-15 00:20:05 +0000186 %conv = sitofp i32 %0 to double
187 store double %conv, double* @floatsidf_result, align 8
188;16hf: lw ${{[0-9]+}}, %call16(__mips16_floatsidf)(${{[0-9]+}})
189 ret void
190}
191
192define void @test_floatunsisf() nounwind {
193entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000194;16hf-LABEL: test_floatunsisf:
David Blaikiea79ac142015-02-27 21:17:42 +0000195 %0 = load i32, i32* @ui, align 4
Reed Kotler5fdeb212012-12-15 00:20:05 +0000196 %conv = uitofp i32 %0 to float
197 store float %conv, float* @floatunsisf_result, align 4
198;16hf: lw ${{[0-9]+}}, %call16(__mips16_floatunsisf)(${{[0-9]+}})
199 ret void
200}
201
202define void @test_floatunsidf() nounwind {
203entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000204;16hf-LABEL: test_floatunsidf:
David Blaikiea79ac142015-02-27 21:17:42 +0000205 %0 = load i32, i32* @ui, align 4
Reed Kotler5fdeb212012-12-15 00:20:05 +0000206 %conv = uitofp i32 %0 to double
207 store double %conv, double* @floatunsidf_result, align 8
208;16hf: lw ${{[0-9]+}}, %call16(__mips16_floatunsidf)(${{[0-9]+}})
209 ret void
210}
211
212define void @test_eqsf2() nounwind {
213entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000214;16hf-LABEL: test_eqsf2:
David Blaikiea79ac142015-02-27 21:17:42 +0000215 %0 = load float, float* @x, align 4
216 %1 = load float, float* @xx, align 4
Reed Kotler5fdeb212012-12-15 00:20:05 +0000217 %cmp = fcmp oeq float %0, %1
218 %conv = zext i1 %cmp to i32
219 store i32 %conv, i32* @eqsf2_result, align 4
220;16hf: lw ${{[0-9]+}}, %call16(__mips16_eqsf2)(${{[0-9]+}})
221 ret void
222}
223
224define void @test_eqdf2() nounwind {
225entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000226;16hf-LABEL: test_eqdf2:
David Blaikiea79ac142015-02-27 21:17:42 +0000227 %0 = load double, double* @xd, align 8
228 %1 = load double, double* @xxd, align 8
Reed Kotler5fdeb212012-12-15 00:20:05 +0000229 %cmp = fcmp oeq double %0, %1
230 %conv = zext i1 %cmp to i32
231 store i32 %conv, i32* @eqdf2_result, align 4
232;16hf: lw ${{[0-9]+}}, %call16(__mips16_eqdf2)(${{[0-9]+}})
233 ret void
234}
235
236define void @test_nesf2() nounwind {
237entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000238;16hf-LABEL: test_nesf2:
David Blaikiea79ac142015-02-27 21:17:42 +0000239 %0 = load float, float* @x, align 4
240 %1 = load float, float* @y, align 4
Reed Kotler5fdeb212012-12-15 00:20:05 +0000241 %cmp = fcmp une float %0, %1
242 %conv = zext i1 %cmp to i32
243 store i32 %conv, i32* @nesf2_result, align 4
244;16hf: lw ${{[0-9]+}}, %call16(__mips16_nesf2)(${{[0-9]+}})
245 ret void
246}
247
248define void @test_nedf2() nounwind {
249entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000250;16hf-LABEL: test_nedf2:
David Blaikiea79ac142015-02-27 21:17:42 +0000251 %0 = load double, double* @xd, align 8
252 %1 = load double, double* @yd, align 8
Reed Kotler5fdeb212012-12-15 00:20:05 +0000253 %cmp = fcmp une double %0, %1
254 %conv = zext i1 %cmp to i32
255 store i32 %conv, i32* @nedf2_result, align 4
256;16hf: lw ${{[0-9]+}}, %call16(__mips16_nedf2)(${{[0-9]+}})
257 ret void
258}
259
260define void @test_gesf2() nounwind {
261entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000262;16hf-LABEL: test_gesf2:
David Blaikiea79ac142015-02-27 21:17:42 +0000263 %0 = load float, float* @x, align 4
264 %1 = load float, float* @xx, align 4
Reed Kotler5fdeb212012-12-15 00:20:05 +0000265 %cmp = fcmp oge float %0, %1
David Blaikiea79ac142015-02-27 21:17:42 +0000266 %2 = load float, float* @y, align 4
Reed Kotler5fdeb212012-12-15 00:20:05 +0000267 %cmp1 = fcmp oge float %2, %0
268 %and3 = and i1 %cmp, %cmp1
269 %and = zext i1 %and3 to i32
270 store i32 %and, i32* @gesf2_result, align 4
271;16hf: lw ${{[0-9]+}}, %call16(__mips16_gesf2)(${{[0-9]+}})
272 ret void
273}
274
275define void @test_gedf2() nounwind {
276entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000277;16hf-LABEL: test_gedf2:
David Blaikiea79ac142015-02-27 21:17:42 +0000278 %0 = load double, double* @xd, align 8
279 %1 = load double, double* @xxd, align 8
Reed Kotler5fdeb212012-12-15 00:20:05 +0000280 %cmp = fcmp oge double %0, %1
David Blaikiea79ac142015-02-27 21:17:42 +0000281 %2 = load double, double* @yd, align 8
Reed Kotler5fdeb212012-12-15 00:20:05 +0000282 %cmp1 = fcmp oge double %2, %0
283 %and3 = and i1 %cmp, %cmp1
284 %and = zext i1 %and3 to i32
285 store i32 %and, i32* @gedf2_result, align 4
286;16hf: lw ${{[0-9]+}}, %call16(__mips16_gedf2)(${{[0-9]+}})
287 ret void
288}
289
290define void @test_ltsf2() nounwind {
291entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000292;16hf-LABEL: test_ltsf2:
David Blaikiea79ac142015-02-27 21:17:42 +0000293 %0 = load float, float* @x, align 4
294 %1 = load float, float* @xx, align 4
Reed Kotler5fdeb212012-12-15 00:20:05 +0000295 %lnot = fcmp uge float %0, %1
David Blaikiea79ac142015-02-27 21:17:42 +0000296 %2 = load float, float* @y, align 4
Reed Kotler5fdeb212012-12-15 00:20:05 +0000297 %cmp1 = fcmp olt float %0, %2
298 %and2 = and i1 %lnot, %cmp1
299 %and = zext i1 %and2 to i32
300 store i32 %and, i32* @ltsf2_result, align 4
Alexey Bataevb9288602015-07-15 08:39:35 +0000301;16hf: lw ${{[0-9]+}}, %call16(__mips16_ltsf2)(${{[0-9]+}})
Reed Kotler5fdeb212012-12-15 00:20:05 +0000302;16hf: lw ${{[0-9]+}}, %call16(__mips16_ltsf2)(${{[0-9]+}})
303 ret void
304}
305
306define void @test_ltdf2() nounwind {
307entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000308;16hf-LABEL: test_ltdf2:
David Blaikiea79ac142015-02-27 21:17:42 +0000309 %0 = load double, double* @xd, align 8
310 %1 = load double, double* @xxd, align 8
Reed Kotler5fdeb212012-12-15 00:20:05 +0000311 %lnot = fcmp uge double %0, %1
David Blaikiea79ac142015-02-27 21:17:42 +0000312 %2 = load double, double* @yd, align 8
Reed Kotler5fdeb212012-12-15 00:20:05 +0000313 %cmp1 = fcmp olt double %0, %2
314 %and2 = and i1 %lnot, %cmp1
315 %and = zext i1 %and2 to i32
316 store i32 %and, i32* @ltdf2_result, align 4
Alexey Bataevb9288602015-07-15 08:39:35 +0000317;16hf: lw ${{[0-9]+}}, %call16(__mips16_ltdf2)(${{[0-9]+}})
Reed Kotler5fdeb212012-12-15 00:20:05 +0000318;16hf: lw ${{[0-9]+}}, %call16(__mips16_ltdf2)(${{[0-9]+}})
319 ret void
320}
321
322define void @test_lesf2() nounwind {
323entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000324;16hf-LABEL: test_lesf2:
David Blaikiea79ac142015-02-27 21:17:42 +0000325 %0 = load float, float* @x, align 4
326 %1 = load float, float* @xx, align 4
Reed Kotler5fdeb212012-12-15 00:20:05 +0000327 %cmp = fcmp ole float %0, %1
David Blaikiea79ac142015-02-27 21:17:42 +0000328 %2 = load float, float* @y, align 4
Reed Kotler5fdeb212012-12-15 00:20:05 +0000329 %cmp1 = fcmp ole float %0, %2
330 %and3 = and i1 %cmp, %cmp1
331 %and = zext i1 %and3 to i32
332 store i32 %and, i32* @lesf2_result, align 4
333;16hf: lw ${{[0-9]+}}, %call16(__mips16_lesf2)(${{[0-9]+}})
334 ret void
335}
336
337define void @test_ledf2() nounwind {
338entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000339;16hf-LABEL: test_ledf2:
David Blaikiea79ac142015-02-27 21:17:42 +0000340 %0 = load double, double* @xd, align 8
341 %1 = load double, double* @xxd, align 8
Reed Kotler5fdeb212012-12-15 00:20:05 +0000342 %cmp = fcmp ole double %0, %1
David Blaikiea79ac142015-02-27 21:17:42 +0000343 %2 = load double, double* @yd, align 8
Reed Kotler5fdeb212012-12-15 00:20:05 +0000344 %cmp1 = fcmp ole double %0, %2
345 %and3 = and i1 %cmp, %cmp1
346 %and = zext i1 %and3 to i32
347 store i32 %and, i32* @ledf2_result, align 4
348;16hf: lw ${{[0-9]+}}, %call16(__mips16_ledf2)(${{[0-9]+}})
349 ret void
350}
351
352define void @test_gtsf2() nounwind {
353entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000354;16hf-LABEL: test_gtsf2:
David Blaikiea79ac142015-02-27 21:17:42 +0000355 %0 = load float, float* @x, align 4
356 %1 = load float, float* @xx, align 4
Reed Kotler5fdeb212012-12-15 00:20:05 +0000357 %lnot = fcmp ule float %0, %1
David Blaikiea79ac142015-02-27 21:17:42 +0000358 %2 = load float, float* @y, align 4
Reed Kotler5fdeb212012-12-15 00:20:05 +0000359 %cmp1 = fcmp ogt float %2, %0
360 %and2 = and i1 %lnot, %cmp1
361 %and = zext i1 %and2 to i32
362 store i32 %and, i32* @gtsf2_result, align 4
363;16hf: lw ${{[0-9]+}}, %call16(__mips16_gtsf2)(${{[0-9]+}})
364 ret void
365}
366
367define void @test_gtdf2() nounwind {
368entry:
Stephen Lind24ab202013-07-14 06:24:09 +0000369;16hf-LABEL: test_gtdf2:
David Blaikiea79ac142015-02-27 21:17:42 +0000370 %0 = load double, double* @xd, align 8
371 %1 = load double, double* @xxd, align 8
Reed Kotler5fdeb212012-12-15 00:20:05 +0000372 %lnot = fcmp ule double %0, %1
David Blaikiea79ac142015-02-27 21:17:42 +0000373 %2 = load double, double* @yd, align 8
Reed Kotler5fdeb212012-12-15 00:20:05 +0000374 %cmp1 = fcmp ogt double %2, %0
375 %and2 = and i1 %lnot, %cmp1
376 %and = zext i1 %and2 to i32
377 store i32 %and, i32* @gtdf2_result, align 4
378;16hf: lw ${{[0-9]+}}, %call16(__mips16_gtdf2)(${{[0-9]+}})
379 ret void
380}
381
382