OSDN Git Service

[MIPS GlobalISel] Select global address
[android-x86/external-llvm.git] / test / CodeGen / Mips / mips16fpe.ll
1 ; RUN: llc -march=mipsel -mattr=mips16 -relocation-model=pic -O3 \
2 ; RUN:     -verify-machineinstrs < %s | FileCheck %s -check-prefix=16hf
3
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
43 define void @test_addsf3() nounwind {
44 entry:
45 ;16hf-LABEL: test_addsf3:
46   %0 = load float, float* @x, align 4
47   %1 = load float, float* @y, align 4
48   %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
54 define void @test_adddf3() nounwind {
55 entry:
56 ;16hf-LABEL: test_adddf3:
57   %0 = load double, double* @xd, align 8
58   %1 = load double, double* @yd, align 8
59   %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
65 define void @test_subsf3() nounwind {
66 entry:
67 ;16hf-LABEL: test_subsf3:
68   %0 = load float, float* @x, align 4
69   %1 = load float, float* @y, align 4
70   %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
76 define void @test_subdf3() nounwind {
77 entry:
78 ;16hf-LABEL: test_subdf3:
79   %0 = load double, double* @xd, align 8
80   %1 = load double, double* @yd, align 8
81   %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
87 define void @test_mulsf3() nounwind {
88 entry:
89 ;16hf-LABEL: test_mulsf3:
90   %0 = load float, float* @x, align 4
91   %1 = load float, float* @y, align 4
92   %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
98 define void @test_muldf3() nounwind {
99 entry:
100 ;16hf-LABEL: test_muldf3:
101   %0 = load double, double* @xd, align 8
102   %1 = load double, double* @yd, align 8
103   %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
109 define void @test_divsf3() nounwind {
110 entry:
111 ;16hf-LABEL: test_divsf3:
112   %0 = load float, float* @y, align 4
113   %1 = load float, float* @x, align 4
114   %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
120 define void @test_divdf3() nounwind {
121 entry:
122 ;16hf-LABEL: test_divdf3:
123   %0 = load double, double* @yd, align 8
124   %mul = fmul double %0, 2.000000e+00
125   %1 = load double, double* @xd, align 8
126   %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
132 define void @test_extendsfdf2() nounwind {
133 entry:
134 ;16hf-LABEL: test_extendsfdf2:
135   %0 = load float, float* @x, align 4
136   %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
142 define void @test_truncdfsf2() nounwind {
143 entry:
144 ;16hf-LABEL: test_truncdfsf2:
145   %0 = load double, double* @xd2, align 8
146   %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
152 define void @test_fix_truncsfsi() nounwind {
153 entry:
154 ;16hf-LABEL: test_fix_truncsfsi:
155   %0 = load float, float* @x, align 4
156   %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
162 define void @test_fix_truncdfsi() nounwind {
163 entry:
164 ;16hf-LABEL: test_fix_truncdfsi:
165   %0 = load double, double* @xd, align 8
166   %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
172 define void @test_floatsisf() nounwind {
173 entry:
174 ;16hf-LABEL: test_floatsisf:
175   %0 = load i32, i32* @si, align 4
176   %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
182 define void @test_floatsidf() nounwind {
183 entry:
184 ;16hf-LABEL: test_floatsidf:
185   %0 = load i32, i32* @si, align 4
186   %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
192 define void @test_floatunsisf() nounwind {
193 entry:
194 ;16hf-LABEL: test_floatunsisf:
195   %0 = load i32, i32* @ui, align 4
196   %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
202 define void @test_floatunsidf() nounwind {
203 entry:
204 ;16hf-LABEL: test_floatunsidf:
205   %0 = load i32, i32* @ui, align 4
206   %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
212 define void @test_eqsf2() nounwind {
213 entry:
214 ;16hf-LABEL: test_eqsf2:
215   %0 = load float, float* @x, align 4
216   %1 = load float, float* @xx, align 4
217   %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
224 define void @test_eqdf2() nounwind {
225 entry:
226 ;16hf-LABEL: test_eqdf2:
227   %0 = load double, double* @xd, align 8
228   %1 = load double, double* @xxd, align 8
229   %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
236 define void @test_nesf2() nounwind {
237 entry:
238 ;16hf-LABEL: test_nesf2:
239   %0 = load float, float* @x, align 4
240   %1 = load float, float* @y, align 4
241   %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
248 define void @test_nedf2() nounwind {
249 entry:
250 ;16hf-LABEL: test_nedf2:
251   %0 = load double, double* @xd, align 8
252   %1 = load double, double* @yd, align 8
253   %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
260 define void @test_gesf2() nounwind {
261 entry:
262 ;16hf-LABEL: test_gesf2:
263   %0 = load float, float* @x, align 4
264   %1 = load float, float* @xx, align 4
265   %cmp = fcmp oge float %0, %1
266   %2 = load float, float* @y, align 4
267   %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
275 define void @test_gedf2() nounwind {
276 entry:
277 ;16hf-LABEL: test_gedf2:
278   %0 = load double, double* @xd, align 8
279   %1 = load double, double* @xxd, align 8
280   %cmp = fcmp oge double %0, %1
281   %2 = load double, double* @yd, align 8
282   %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
290 define void @test_ltsf2() nounwind {
291 entry:
292 ;16hf-LABEL: test_ltsf2:
293   %0 = load float, float* @x, align 4
294   %1 = load float, float* @xx, align 4
295   %lnot = fcmp uge float %0, %1
296   %2 = load float, float* @y, align 4
297   %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
301 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_ltsf2)(${{[0-9]+}})
302 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_ltsf2)(${{[0-9]+}})
303   ret void
304 }
305
306 define void @test_ltdf2() nounwind {
307 entry:
308 ;16hf-LABEL: test_ltdf2:
309   %0 = load double, double* @xd, align 8
310   %1 = load double, double* @xxd, align 8
311   %lnot = fcmp uge double %0, %1
312   %2 = load double, double* @yd, align 8
313   %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
317 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_ltdf2)(${{[0-9]+}})
318 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_ltdf2)(${{[0-9]+}})
319   ret void
320 }
321
322 define void @test_lesf2() nounwind {
323 entry:
324 ;16hf-LABEL: test_lesf2:
325   %0 = load float, float* @x, align 4
326   %1 = load float, float* @xx, align 4
327   %cmp = fcmp ole float %0, %1
328   %2 = load float, float* @y, align 4
329   %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
337 define void @test_ledf2() nounwind {
338 entry:
339 ;16hf-LABEL: test_ledf2:
340   %0 = load double, double* @xd, align 8
341   %1 = load double, double* @xxd, align 8
342   %cmp = fcmp ole double %0, %1
343   %2 = load double, double* @yd, align 8
344   %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
352 define void @test_gtsf2() nounwind {
353 entry:
354 ;16hf-LABEL: test_gtsf2:
355   %0 = load float, float* @x, align 4
356   %1 = load float, float* @xx, align 4
357   %lnot = fcmp ule float %0, %1
358   %2 = load float, float* @y, align 4
359   %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
367 define void @test_gtdf2() nounwind {
368 entry:
369 ;16hf-LABEL: test_gtdf2:
370   %0 = load double, double* @xd, align 8
371   %1 = load double, double* @xxd, align 8
372   %lnot = fcmp ule double %0, %1
373   %2 = load double, double* @yd, align 8
374   %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