Stackmap shadows should consider call returns a branch target.
[oota-llvm.git] / test / CodeGen / Mips / mips16fpe.ll
1 ; RUN: llc  -march=mipsel -mcpu=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=16hf
2
3 @x = global float 5.000000e+00, align 4
4 @y = global float 1.500000e+01, align 4
5 @xd = global double 6.000000e+00, align 8
6 @yd = global double 1.800000e+01, align 8
7 @two = global i32 2, align 4
8 @addsf3_result = common global float 0.000000e+00, align 4
9 @adddf3_result = common global double 0.000000e+00, align 8
10 @subsf3_result = common global float 0.000000e+00, align 4
11 @subdf3_result = common global double 0.000000e+00, align 8
12 @mulsf3_result = common global float 0.000000e+00, align 4
13 @muldf3_result = common global double 0.000000e+00, align 8
14 @divsf3_result = common global float 0.000000e+00, align 4
15 @divdf3_result = common global double 0.000000e+00, align 8
16 @extendsfdf2_result = common global double 0.000000e+00, align 8
17 @xd2 = global double 0x40147E6B74B4CF6A, align 8
18 @truncdfsf2_result = common global float 0.000000e+00, align 4
19 @fix_truncsfsi_result = common global i32 0, align 4
20 @fix_truncdfsi_result = common global i32 0, align 4
21 @si = global i32 -9, align 4
22 @ui = global i32 9, align 4
23 @floatsisf_result = common global float 0.000000e+00, align 4
24 @floatsidf_result = common global double 0.000000e+00, align 8
25 @floatunsisf_result = common global float 0.000000e+00, align 4
26 @floatunsidf_result = common global double 0.000000e+00, align 8
27 @xx = global float 5.000000e+00, align 4
28 @eqsf2_result = common global i32 0, align 4
29 @xxd = global double 6.000000e+00, align 8
30 @eqdf2_result = common global i32 0, align 4
31 @nesf2_result = common global i32 0, align 4
32 @nedf2_result = common global i32 0, align 4
33 @gesf2_result = common global i32 0, align 4
34 @gedf2_result = common global i32 0, align 4
35 @ltsf2_result = common global i32 0, align 4
36 @ltdf2_result = common global i32 0, align 4
37 @lesf2_result = common global i32 0, align 4
38 @ledf2_result = common global i32 0, align 4
39 @gtsf2_result = common global i32 0, align 4
40 @gtdf2_result = common global i32 0, align 4
41
42 define void @test_addsf3() nounwind {
43 entry:
44 ;16hf-LABEL: test_addsf3:
45   %0 = load float* @x, align 4
46   %1 = load float* @y, align 4
47   %add = fadd float %0, %1
48   store float %add, float* @addsf3_result, align 4
49 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_addsf3)(${{[0-9]+}})
50   ret void
51 }
52
53 define void @test_adddf3() nounwind {
54 entry:
55 ;16hf-LABEL: test_adddf3:
56   %0 = load double* @xd, align 8
57   %1 = load double* @yd, align 8
58   %add = fadd double %0, %1
59   store double %add, double* @adddf3_result, align 8
60 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_adddf3)(${{[0-9]+}})
61   ret void
62 }
63
64 define void @test_subsf3() nounwind {
65 entry:
66 ;16hf-LABEL: test_subsf3:
67   %0 = load float* @x, align 4
68   %1 = load float* @y, align 4
69   %sub = fsub float %0, %1
70   store float %sub, float* @subsf3_result, align 4
71 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_subsf3)(${{[0-9]+}})
72   ret void
73 }
74
75 define void @test_subdf3() nounwind {
76 entry:
77 ;16hf-LABEL: test_subdf3:
78   %0 = load double* @xd, align 8
79   %1 = load double* @yd, align 8
80   %sub = fsub double %0, %1
81   store double %sub, double* @subdf3_result, align 8
82 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_subdf3)(${{[0-9]+}})
83   ret void
84 }
85
86 define void @test_mulsf3() nounwind {
87 entry:
88 ;16hf-LABEL: test_mulsf3:
89   %0 = load float* @x, align 4
90   %1 = load float* @y, align 4
91   %mul = fmul float %0, %1
92   store float %mul, float* @mulsf3_result, align 4
93 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_mulsf3)(${{[0-9]+}})
94   ret void
95 }
96
97 define void @test_muldf3() nounwind {
98 entry:
99 ;16hf-LABEL: test_muldf3:
100   %0 = load double* @xd, align 8
101   %1 = load double* @yd, align 8
102   %mul = fmul double %0, %1
103   store double %mul, double* @muldf3_result, align 8
104 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_muldf3)(${{[0-9]+}})
105   ret void
106 }
107
108 define void @test_divsf3() nounwind {
109 entry:
110 ;16hf-LABEL: test_divsf3:
111   %0 = load float* @y, align 4
112   %1 = load float* @x, align 4
113   %div = fdiv float %0, %1
114   store float %div, float* @divsf3_result, align 4
115 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_divsf3)(${{[0-9]+}})
116   ret void
117 }
118
119 define void @test_divdf3() nounwind {
120 entry:
121 ;16hf-LABEL: test_divdf3:
122   %0 = load double* @yd, align 8
123   %mul = fmul double %0, 2.000000e+00
124   %1 = load double* @xd, align 8
125   %div = fdiv double %mul, %1
126   store double %div, double* @divdf3_result, align 8
127 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_divdf3)(${{[0-9]+}})
128   ret void
129 }
130
131 define void @test_extendsfdf2() nounwind {
132 entry:
133 ;16hf-LABEL: test_extendsfdf2:
134   %0 = load float* @x, align 4
135   %conv = fpext float %0 to double
136   store double %conv, double* @extendsfdf2_result, align 8
137 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_extendsfdf2)(${{[0-9]+}})
138   ret void
139 }
140
141 define void @test_truncdfsf2() nounwind {
142 entry:
143 ;16hf-LABEL: test_truncdfsf2:
144   %0 = load double* @xd2, align 8
145   %conv = fptrunc double %0 to float
146   store float %conv, float* @truncdfsf2_result, align 4
147 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_truncdfsf2)(${{[0-9]+}})
148   ret void
149 }
150
151 define void @test_fix_truncsfsi() nounwind {
152 entry:
153 ;16hf-LABEL: test_fix_truncsfsi:
154   %0 = load float* @x, align 4
155   %conv = fptosi float %0 to i32
156   store i32 %conv, i32* @fix_truncsfsi_result, align 4
157 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_fix_truncsfsi)(${{[0-9]+}})
158   ret void
159 }
160
161 define void @test_fix_truncdfsi() nounwind {
162 entry:
163 ;16hf-LABEL: test_fix_truncdfsi:
164   %0 = load double* @xd, align 8
165   %conv = fptosi double %0 to i32
166   store i32 %conv, i32* @fix_truncdfsi_result, align 4
167 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_fix_truncdfsi)(${{[0-9]+}})
168   ret void
169 }
170
171 define void @test_floatsisf() nounwind {
172 entry:
173 ;16hf-LABEL: test_floatsisf:
174   %0 = load i32* @si, align 4
175   %conv = sitofp i32 %0 to float
176   store float %conv, float* @floatsisf_result, align 4
177 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_floatsisf)(${{[0-9]+}})
178   ret void
179 }
180
181 define void @test_floatsidf() nounwind {
182 entry:
183 ;16hf-LABEL: test_floatsidf:
184   %0 = load i32* @si, align 4
185   %conv = sitofp i32 %0 to double
186   store double %conv, double* @floatsidf_result, align 8
187 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_floatsidf)(${{[0-9]+}})
188   ret void
189 }
190
191 define void @test_floatunsisf() nounwind {
192 entry:
193 ;16hf-LABEL: test_floatunsisf:
194   %0 = load i32* @ui, align 4
195   %conv = uitofp i32 %0 to float
196   store float %conv, float* @floatunsisf_result, align 4
197 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_floatunsisf)(${{[0-9]+}})
198   ret void
199 }
200
201 define void @test_floatunsidf() nounwind {
202 entry:
203 ;16hf-LABEL: test_floatunsidf:
204   %0 = load i32* @ui, align 4
205   %conv = uitofp i32 %0 to double
206   store double %conv, double* @floatunsidf_result, align 8
207 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_floatunsidf)(${{[0-9]+}})
208   ret void
209 }
210
211 define void @test_eqsf2() nounwind {
212 entry:
213 ;16hf-LABEL: test_eqsf2:
214   %0 = load float* @x, align 4
215   %1 = load float* @xx, align 4
216   %cmp = fcmp oeq float %0, %1
217   %conv = zext i1 %cmp to i32
218   store i32 %conv, i32* @eqsf2_result, align 4
219 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_eqsf2)(${{[0-9]+}})
220   ret void
221 }
222
223 define void @test_eqdf2() nounwind {
224 entry:
225 ;16hf-LABEL: test_eqdf2:
226   %0 = load double* @xd, align 8
227   %1 = load double* @xxd, align 8
228   %cmp = fcmp oeq double %0, %1
229   %conv = zext i1 %cmp to i32
230   store i32 %conv, i32* @eqdf2_result, align 4
231 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_eqdf2)(${{[0-9]+}})
232   ret void
233 }
234
235 define void @test_nesf2() nounwind {
236 entry:
237 ;16hf-LABEL: test_nesf2:
238   %0 = load float* @x, align 4
239   %1 = load float* @y, align 4
240   %cmp = fcmp une float %0, %1
241   %conv = zext i1 %cmp to i32
242   store i32 %conv, i32* @nesf2_result, align 4
243 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_nesf2)(${{[0-9]+}})
244   ret void
245 }
246
247 define void @test_nedf2() nounwind {
248 entry:
249 ;16hf-LABEL: test_nedf2:
250   %0 = load double* @xd, align 8
251   %1 = load double* @yd, align 8
252   %cmp = fcmp une double %0, %1
253   %conv = zext i1 %cmp to i32
254   store i32 %conv, i32* @nedf2_result, align 4
255 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_nedf2)(${{[0-9]+}})
256   ret void
257 }
258
259 define void @test_gesf2() nounwind {
260 entry:
261 ;16hf-LABEL: test_gesf2:
262   %0 = load float* @x, align 4
263   %1 = load float* @xx, align 4
264   %cmp = fcmp oge float %0, %1
265   %2 = load float* @y, align 4
266   %cmp1 = fcmp oge float %2, %0
267   %and3 = and i1 %cmp, %cmp1
268   %and = zext i1 %and3 to i32
269   store i32 %and, i32* @gesf2_result, align 4
270 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_gesf2)(${{[0-9]+}})
271   ret void
272 }
273
274 define void @test_gedf2() nounwind {
275 entry:
276 ;16hf-LABEL: test_gedf2:
277   %0 = load double* @xd, align 8
278   %1 = load double* @xxd, align 8
279   %cmp = fcmp oge double %0, %1
280   %2 = load double* @yd, align 8
281   %cmp1 = fcmp oge double %2, %0
282   %and3 = and i1 %cmp, %cmp1
283   %and = zext i1 %and3 to i32
284   store i32 %and, i32* @gedf2_result, align 4
285 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_gedf2)(${{[0-9]+}})
286   ret void
287 }
288
289 define void @test_ltsf2() nounwind {
290 entry:
291 ;16hf-LABEL: test_ltsf2:
292   %0 = load float* @x, align 4
293   %1 = load float* @xx, align 4
294   %lnot = fcmp uge float %0, %1
295   %2 = load float* @y, align 4
296   %cmp1 = fcmp olt float %0, %2
297   %and2 = and i1 %lnot, %cmp1
298   %and = zext i1 %and2 to i32
299   store i32 %and, i32* @ltsf2_result, align 4
300 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_unordsf2)(${{[0-9]+}})
301 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_ltsf2)(${{[0-9]+}})
302   ret void
303 }
304
305 define void @test_ltdf2() nounwind {
306 entry:
307 ;16hf-LABEL: test_ltdf2:
308   %0 = load double* @xd, align 8
309   %1 = load double* @xxd, align 8
310   %lnot = fcmp uge double %0, %1
311   %2 = load double* @yd, align 8
312   %cmp1 = fcmp olt double %0, %2
313   %and2 = and i1 %lnot, %cmp1
314   %and = zext i1 %and2 to i32
315   store i32 %and, i32* @ltdf2_result, align 4
316 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_unorddf2)(${{[0-9]+}})
317 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_ltdf2)(${{[0-9]+}})
318   ret void
319 }
320
321 define void @test_lesf2() nounwind {
322 entry:
323 ;16hf-LABEL: test_lesf2:
324   %0 = load float* @x, align 4
325   %1 = load float* @xx, align 4
326   %cmp = fcmp ole float %0, %1
327   %2 = load float* @y, align 4
328   %cmp1 = fcmp ole float %0, %2
329   %and3 = and i1 %cmp, %cmp1
330   %and = zext i1 %and3 to i32
331   store i32 %and, i32* @lesf2_result, align 4
332 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_lesf2)(${{[0-9]+}})
333   ret void
334 }
335
336 define void @test_ledf2() nounwind {
337 entry:
338 ;16hf-LABEL: test_ledf2:
339   %0 = load double* @xd, align 8
340   %1 = load double* @xxd, align 8
341   %cmp = fcmp ole double %0, %1
342   %2 = load double* @yd, align 8
343   %cmp1 = fcmp ole double %0, %2
344   %and3 = and i1 %cmp, %cmp1
345   %and = zext i1 %and3 to i32
346   store i32 %and, i32* @ledf2_result, align 4
347 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_ledf2)(${{[0-9]+}})
348   ret void
349 }
350
351 define void @test_gtsf2() nounwind {
352 entry:
353 ;16hf-LABEL: test_gtsf2:
354   %0 = load float* @x, align 4
355   %1 = load float* @xx, align 4
356   %lnot = fcmp ule float %0, %1
357   %2 = load float* @y, align 4
358   %cmp1 = fcmp ogt float %2, %0
359   %and2 = and i1 %lnot, %cmp1
360   %and = zext i1 %and2 to i32
361   store i32 %and, i32* @gtsf2_result, align 4
362 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_gtsf2)(${{[0-9]+}})
363   ret void
364 }
365
366 define void @test_gtdf2() nounwind {
367 entry:
368 ;16hf-LABEL: test_gtdf2:
369   %0 = load double* @xd, align 8
370   %1 = load double* @xxd, align 8
371   %lnot = fcmp ule double %0, %1
372   %2 = load double* @yd, align 8
373   %cmp1 = fcmp ogt double %2, %0
374   %and2 = and i1 %lnot, %cmp1
375   %and = zext i1 %and2 to i32
376   store i32 %and, i32* @gtdf2_result, align 4
377 ;16hf:  lw      ${{[0-9]+}}, %call16(__mips16_gtdf2)(${{[0-9]+}})
378   ret void
379 }
380
381