Stackmap shadows should consider call returns a branch target.
[oota-llvm.git] / test / CodeGen / Mips / fp16instrinsmc.ll
1 ; RUN: llc -mtriple=mipsel-linux-gnu -march=mipsel -mcpu=mips16 -relocation-model=pic < %s | FileCheck %s -check-prefix=pic
2 ; RUN: llc -mtriple=mipsel-linux-gnu -march=mipsel -mcpu=mips16 -relocation-model=static -mips32-function-mask=1010111 -mips-os16 < %s | FileCheck %s -check-prefix=fmask
3
4 @x = global float 1.500000e+00, align 4
5 @xn = global float -1.900000e+01, align 4
6 @negone = global float -1.000000e+00, align 4
7 @one = global float 1.000000e+00, align 4
8 @xd = global double 0x40048B0A8EA4481E, align 8
9 @xdn = global double 0xC0311F9ADD373963, align 8
10 @negoned = global double -1.000000e+00, align 8
11 @oned = global float 1.000000e+00, align 4
12 @y = common global float 0.000000e+00, align 4
13 @yd = common global double 0.000000e+00, align 8
14
15 ; Function Attrs: nounwind
16 define void @foo1() #0 {
17 ; fmask: .ent foo1
18 ; fmask: .set   noreorder
19 ; fmask: .set   nomacro
20 ; fmask: .set   noat
21 ; fmask: .set   at
22 ; fmask: .set   macro
23 ; fmask: .set   reorder
24 ; fmask: .end   foo1
25 entry:
26   %0 = load float* @x, align 4
27   %1 = load float* @one, align 4
28   %call = call float @copysignf(float %0, float %1) #2
29   store float %call, float* @y, align 4
30   ret void
31 }
32
33 ; Function Attrs: nounwind readnone
34 declare float @copysignf(float, float) #1
35
36 ; Function Attrs: nounwind
37 define void @foo2() #0 {
38 ; fmask:        .ent    foo2
39 ; fmask:        save    {{.*}}
40 ; fmask:        .end    foo2
41 entry:
42   %0 = load float* @x, align 4
43   %1 = load float* @negone, align 4
44   %call = call float @copysignf(float %0, float %1) #2
45   store float %call, float* @y, align 4
46   ret void
47 }
48
49 ; Function Attrs: nounwind
50 define void @foo3() #0 {
51 entry:
52 ; fmask: .ent foo3
53 ; fmask: .set   noreorder
54 ; fmask: .set   nomacro
55 ; fmask: .set   noat
56 ; fmask: .set   at
57 ; fmask: .set   macro
58 ; fmask: .set   reorder
59 ; fmask: .end   foo3
60   %0 = load double* @xd, align 8
61   %1 = load float* @oned, align 4
62   %conv = fpext float %1 to double
63   %call = call double @copysign(double %0, double %conv) #2
64   store double %call, double* @yd, align 8
65   ret void
66 }
67
68 ; Function Attrs: nounwind readnone
69 declare double @copysign(double, double) #1
70
71 ; Function Attrs: nounwind
72 define void @foo4() #0 {
73 entry:
74 ; fmask:        .ent    foo4
75 ; fmask:        save    {{.*}}
76 ; fmask:        .end    foo4
77   %0 = load double* @xd, align 8
78   %1 = load double* @negoned, align 8
79   %call = call double @copysign(double %0, double %1) #2
80   store double %call, double* @yd, align 8
81   ret void
82 }
83
84 ; Function Attrs: nounwind
85 define void @foo5() #0 {
86 entry:
87   %0 = load float* @xn, align 4
88   %call = call float @fabsf(float %0) #2
89   store float %call, float* @y, align 4
90   ret void
91 }
92
93 ; Function Attrs: nounwind readnone
94 declare float @fabsf(float) #1
95
96 ; Function Attrs: nounwind
97 define void @foo6() #0 {
98 entry:
99   %0 = load double* @xdn, align 8
100   %call = call double @fabs(double %0) #2
101   store double %call, double* @yd, align 8
102   ret void
103 }
104
105 ; Function Attrs: nounwind readnone
106 declare double @fabs(double) #1
107
108 ; Function Attrs: nounwind
109 define void @foo7() #0 {
110 entry:
111   %0 = load float* @x, align 4
112   %call = call float @sinf(float %0) #3
113 ;pic:   lw      ${{[0-9]+}}, %call16(sinf)(${{[0-9]+}})
114 ;pic:   lw      ${{[0-9]+}}, %got(__mips16_call_stub_sf_1)(${{[0-9]+}})
115   store float %call, float* @y, align 4
116   ret void
117 }
118
119 ; Function Attrs: nounwind
120 declare float @sinf(float) #0
121
122 ; Function Attrs: nounwind
123 define void @foo8() #0 {
124 entry:
125   %0 = load double* @xd, align 8
126   %call = call double @sin(double %0) #3
127 ;pic:   lw      ${{[0-9]+}}, %call16(sin)(${{[0-9]+}})
128 ;pic:   lw      ${{[0-9]+}}, %got(__mips16_call_stub_df_2)(${{[0-9]+}})
129   store double %call, double* @yd, align 8
130   ret void
131 }
132
133 ; Function Attrs: nounwind
134 declare double @sin(double) #0
135
136 ; Function Attrs: nounwind
137 define void @foo9() #0 {
138 entry:
139   %0 = load float* @x, align 4
140   %call = call float @cosf(float %0) #3
141 ;pic:   lw      ${{[0-9]+}}, %call16(cosf)(${{[0-9]+}})
142 ;pic:   lw      ${{[0-9]+}}, %got(__mips16_call_stub_sf_1)(${{[0-9]+}})
143   store float %call, float* @y, align 4
144   ret void
145 }
146
147 ; Function Attrs: nounwind
148 declare float @cosf(float) #0
149
150 ; Function Attrs: nounwind
151 define void @foo10() #0 {
152 entry:
153   %0 = load double* @xd, align 8
154   %call = call double @cos(double %0) #3
155 ;pic:   lw      ${{[0-9]+}}, %call16(cos)(${{[0-9]+}})
156 ;pic:   lw      ${{[0-9]+}}, %got(__mips16_call_stub_df_2)(${{[0-9]+}})
157   store double %call, double* @yd, align 8
158   ret void
159 }
160
161 ; Function Attrs: nounwind
162 declare double @cos(double) #0
163
164 ; Function Attrs: nounwind
165 define void @foo11() #0 {
166 entry:
167   %0 = load float* @x, align 4
168   %call = call float @sqrtf(float %0) #3
169 ;pic:   lw      ${{[0-9]+}}, %call16(sqrtf)(${{[0-9]+}})
170 ;pic:   lw      ${{[0-9]+}}, %got(__mips16_call_stub_sf_1)(${{[0-9]+}})
171   store float %call, float* @y, align 4
172   ret void
173 }
174
175 ; Function Attrs: nounwind
176 declare float @sqrtf(float) #0
177
178 ; Function Attrs: nounwind
179 define void @foo12() #0 {
180 entry:
181   %0 = load double* @xd, align 8
182   %call = call double @sqrt(double %0) #3
183 ;pic:   lw      ${{[0-9]+}}, %call16(sqrt)(${{[0-9]+}})
184 ;pic:   lw      ${{[0-9]+}}, %got(__mips16_call_stub_df_2)(${{[0-9]+}})
185   store double %call, double* @yd, align 8
186   ret void
187 }
188
189 ; Function Attrs: nounwind
190 declare double @sqrt(double) #0
191
192 ; Function Attrs: nounwind
193 define void @foo13() #0 {
194 entry:
195   %0 = load float* @x, align 4
196   %call = call float @floorf(float %0) #2
197 ;pic:   lw      ${{[0-9]+}}, %call16(floorf)(${{[0-9]+}})
198 ;pic:   lw      ${{[0-9]+}}, %got(__mips16_call_stub_sf_1)(${{[0-9]+}})
199   store float %call, float* @y, align 4
200   ret void
201 }
202
203 ; Function Attrs: nounwind readnone
204 declare float @floorf(float) #1
205
206 ; Function Attrs: nounwind
207 define void @foo14() #0 {
208 entry:
209   %0 = load double* @xd, align 8
210   %call = call double @floor(double %0) #2
211 ;pic:   lw      ${{[0-9]+}}, %call16(floor)(${{[0-9]+}})
212 ;pic:   lw      ${{[0-9]+}}, %got(__mips16_call_stub_df_2)(${{[0-9]+}})
213   store double %call, double* @yd, align 8
214   ret void
215 }
216
217 ; Function Attrs: nounwind readnone
218 declare double @floor(double) #1
219
220 ; Function Attrs: nounwind
221 define void @foo15() #0 {
222 entry:
223   %0 = load float* @x, align 4
224   %call = call float @nearbyintf(float %0) #2
225 ;pic:   lw      ${{[0-9]+}}, %call16(nearbyintf)(${{[0-9]+}})
226 ;pic:   lw      ${{[0-9]+}}, %got(__mips16_call_stub_sf_1)(${{[0-9]+}})
227   store float %call, float* @y, align 4
228   ret void
229 }
230
231 ; Function Attrs: nounwind readnone
232 declare float @nearbyintf(float) #1
233
234 ; Function Attrs: nounwind
235 define void @foo16() #0 {
236 entry:
237   %0 = load double* @xd, align 8
238   %call = call double @nearbyint(double %0) #2
239 ;pic:   lw      ${{[0-9]+}}, %call16(nearbyint)(${{[0-9]+}})
240 ;pic:   lw      ${{[0-9]+}}, %got(__mips16_call_stub_df_2)(${{[0-9]+}})
241   store double %call, double* @yd, align 8
242   ret void
243 }
244
245 ; Function Attrs: nounwind readnone
246 declare double @nearbyint(double) #1
247
248 ; Function Attrs: nounwind
249 define void @foo17() #0 {
250 entry:
251   %0 = load float* @x, align 4
252   %call = call float @ceilf(float %0) #2
253 ;pic:   lw      ${{[0-9]+}}, %call16(ceilf)(${{[0-9]+}})
254 ;pic:   lw      ${{[0-9]+}}, %got(__mips16_call_stub_sf_1)(${{[0-9]+}})
255   store float %call, float* @y, align 4
256   ret void
257 }
258
259 ; Function Attrs: nounwind readnone
260 declare float @ceilf(float) #1
261
262 ; Function Attrs: nounwind
263 define void @foo18() #0 {
264 entry:
265   %0 = load double* @xd, align 8
266   %call = call double @ceil(double %0) #2
267 ;pic:   lw      ${{[0-9]+}}, %call16(ceil)(${{[0-9]+}})
268 ;pic:   lw      ${{[0-9]+}}, %got(__mips16_call_stub_df_2)(${{[0-9]+}})
269   store double %call, double* @yd, align 8
270   ret void
271 }
272
273 ; Function Attrs: nounwind readnone
274 declare double @ceil(double) #1
275
276 ; Function Attrs: nounwind
277 define void @foo19() #0 {
278 entry:
279   %0 = load float* @x, align 4
280   %call = call float @rintf(float %0) #2
281 ;pic:   lw      ${{[0-9]+}}, %call16(rintf)(${{[0-9]+}})
282 ;pic:   lw      ${{[0-9]+}}, %got(__mips16_call_stub_sf_1)(${{[0-9]+}})
283   store float %call, float* @y, align 4
284   ret void
285 }
286
287 ; Function Attrs: nounwind readnone
288 declare float @rintf(float) #1
289
290 ; Function Attrs: nounwind
291 define void @foo20() #0 {
292 entry:
293   %0 = load double* @xd, align 8
294   %call = call double @rint(double %0) #2
295 ;pic:   lw      ${{[0-9]+}}, %call16(rint)(${{[0-9]+}})
296 ;pic:   lw      ${{[0-9]+}}, %got(__mips16_call_stub_df_2)(${{[0-9]+}})
297   store double %call, double* @yd, align 8
298   ret void
299 }
300
301 ; Function Attrs: nounwind readnone
302 declare double @rint(double) #1
303
304 ; Function Attrs: nounwind
305 define void @foo21() #0 {
306 entry:
307   %0 = load float* @x, align 4
308   %call = call float @truncf(float %0) #2
309 ;pic:   lw      ${{[0-9]+}}, %call16(truncf)(${{[0-9]+}})
310 ;pic:   lw      ${{[0-9]+}}, %got(__mips16_call_stub_sf_1)(${{[0-9]+}})
311   store float %call, float* @y, align 4
312   ret void
313 }
314
315 ; Function Attrs: nounwind readnone
316 declare float @truncf(float) #1
317
318 ; Function Attrs: nounwind
319 define void @foo22() #0 {
320 entry:
321   %0 = load double* @xd, align 8
322   %call = call double @trunc(double %0) #2
323 ;pic:   lw      ${{[0-9]+}}, %call16(trunc)(${{[0-9]+}})
324 ;pic:   lw      ${{[0-9]+}}, %got(__mips16_call_stub_df_2)(${{[0-9]+}})
325   store double %call, double* @yd, align 8
326   ret void
327 }
328
329 ; Function Attrs: nounwind readnone
330 declare double @trunc(double) #1
331
332 ; Function Attrs: nounwind
333 define void @foo23() #0 {
334 entry:
335   %0 = load float* @x, align 4
336   %call = call float @log2f(float %0) #3
337 ;pic:   lw      ${{[0-9]+}}, %call16(log2f)(${{[0-9]+}})
338 ;pic:   lw      ${{[0-9]+}}, %got(__mips16_call_stub_sf_1)(${{[0-9]+}})
339   store float %call, float* @y, align 4
340   ret void
341 }
342
343 ; Function Attrs: nounwind
344 declare float @log2f(float) #0
345
346 ; Function Attrs: nounwind
347 define void @foo24() #0 {
348 entry:
349   %0 = load double* @xd, align 8
350   %call = call double @log2(double %0) #3
351 ;pic:   lw      ${{[0-9]+}}, %call16(log2)(${{[0-9]+}})
352 ;pic:   lw      ${{[0-9]+}}, %got(__mips16_call_stub_df_2)(${{[0-9]+}})
353   store double %call, double* @yd, align 8
354   ret void
355 }
356
357 ; Function Attrs: nounwind
358 declare double @log2(double) #0
359
360 ; Function Attrs: nounwind
361 define void @foo25() #0 {
362 entry:
363   %0 = load float* @x, align 4
364   %call = call float @exp2f(float %0) #3
365 ;pic:   lw      ${{[0-9]+}}, %call16(exp2f)(${{[0-9]+}})
366 ;pic:   lw      ${{[0-9]+}}, %got(__mips16_call_stub_sf_1)(${{[0-9]+}})
367   store float %call, float* @y, align 4
368   ret void
369 }
370
371 ; Function Attrs: nounwind
372 declare float @exp2f(float) #0
373
374 ; Function Attrs: nounwind
375 define void @foo26() #0 {
376 entry:
377   %0 = load double* @xd, align 8
378   %call = call double @exp2(double %0) #3
379 ;pic:   lw      ${{[0-9]+}}, %call16(exp2)(${{[0-9]+}})
380 ;pic:   lw      ${{[0-9]+}}, %got(__mips16_call_stub_df_2)(${{[0-9]+}})
381   store double %call, double* @yd, align 8
382   ret void
383 }
384
385 ; Function Attrs: nounwind
386 declare double @exp2(double) #0
387
388 attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
389 attributes #1 = { nounwind readnone "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" }
390 attributes #2 = { nounwind readnone }
391 attributes #3 = { nounwind }