1 ; RUN: llc -mtriple=mipsel-linux-gnu -march=mipsel -mattr=mips16 -relocation-model=pic < %s | FileCheck %s -check-prefix=pic
2 ; RUN: llc -mtriple=mipsel-linux-gnu -march=mipsel -mattr=mips16 -relocation-model=static -mips32-function-mask=1010111 -mips-os16 < %s | FileCheck %s -check-prefix=fmask
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
15 ; Function Attrs: nounwind
16 define void @foo1() #0 {
18 ; fmask: .set noreorder
26 %0 = load float, ptr @x, align 4
27 %1 = load float, ptr @one, align 4
28 %call = call float @copysignf(float %0, float %1) #2
29 store float %call, ptr @y, align 4
33 ; Function Attrs: nounwind readnone
34 declare float @copysignf(float, float) #1
36 ; Function Attrs: nounwind
37 define void @foo2() #0 {
42 %0 = load float, ptr @x, align 4
43 %1 = load float, ptr @negone, align 4
44 %call = call float @copysignf(float %0, float %1) #2
45 store float %call, ptr @y, align 4
49 ; Function Attrs: nounwind
50 define void @foo3() #0 {
53 ; fmask: .set noreorder
60 %0 = load double, ptr @xd, align 8
61 %1 = load float, ptr @oned, align 4
62 %conv = fpext float %1 to double
63 %call = call double @copysign(double %0, double %conv) #2
64 store double %call, ptr @yd, align 8
68 ; Function Attrs: nounwind readnone
69 declare double @copysign(double, double) #1
71 ; Function Attrs: nounwind
72 define void @foo4() #0 {
77 %0 = load double, ptr @xd, align 8
78 %1 = load double, ptr @negoned, align 8
79 %call = call double @copysign(double %0, double %1) #2
80 store double %call, ptr @yd, align 8
84 ; Function Attrs: nounwind
85 define void @foo5() #0 {
87 %0 = load float, ptr @xn, align 4
88 %call = call float @fabsf(float %0) #2
89 store float %call, ptr @y, align 4
93 ; Function Attrs: nounwind readnone
94 declare float @fabsf(float) #1
96 ; Function Attrs: nounwind
97 define void @foo6() #0 {
99 %0 = load double, ptr @xdn, align 8
100 %call = call double @fabs(double %0) #2
101 store double %call, ptr @yd, align 8
105 ; Function Attrs: nounwind readnone
106 declare double @fabs(double) #1
108 ; Function Attrs: nounwind
109 define void @foo7() #0 {
111 %0 = load float, ptr @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, ptr @y, align 4
119 ; Function Attrs: nounwind
120 declare float @sinf(float) #0
122 ; Function Attrs: nounwind
123 define void @foo8() #0 {
125 %0 = load double, ptr @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, ptr @yd, align 8
133 ; Function Attrs: nounwind
134 declare double @sin(double) #0
136 ; Function Attrs: nounwind
137 define void @foo9() #0 {
139 %0 = load float, ptr @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, ptr @y, align 4
147 ; Function Attrs: nounwind
148 declare float @cosf(float) #0
150 ; Function Attrs: nounwind
151 define void @foo10() #0 {
153 %0 = load double, ptr @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, ptr @yd, align 8
161 ; Function Attrs: nounwind
162 declare double @cos(double) #0
164 ; Function Attrs: nounwind
165 define void @foo11() #0 {
167 %0 = load float, ptr @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, ptr @y, align 4
175 ; Function Attrs: nounwind
176 declare float @sqrtf(float) #0
178 ; Function Attrs: nounwind
179 define void @foo12() #0 {
181 %0 = load double, ptr @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, ptr @yd, align 8
189 ; Function Attrs: nounwind
190 declare double @sqrt(double) #0
192 ; Function Attrs: nounwind
193 define void @foo13() #0 {
195 %0 = load float, ptr @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, ptr @y, align 4
203 ; Function Attrs: nounwind readnone
204 declare float @floorf(float) #1
206 ; Function Attrs: nounwind
207 define void @foo14() #0 {
209 %0 = load double, ptr @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, ptr @yd, align 8
217 ; Function Attrs: nounwind readnone
218 declare double @floor(double) #1
220 ; Function Attrs: nounwind
221 define void @foo15() #0 {
223 %0 = load float, ptr @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, ptr @y, align 4
231 ; Function Attrs: nounwind readnone
232 declare float @nearbyintf(float) #1
234 ; Function Attrs: nounwind
235 define void @foo16() #0 {
237 %0 = load double, ptr @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, ptr @yd, align 8
245 ; Function Attrs: nounwind readnone
246 declare double @nearbyint(double) #1
248 ; Function Attrs: nounwind
249 define void @foo17() #0 {
251 %0 = load float, ptr @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, ptr @y, align 4
259 ; Function Attrs: nounwind readnone
260 declare float @ceilf(float) #1
262 ; Function Attrs: nounwind
263 define void @foo18() #0 {
265 %0 = load double, ptr @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, ptr @yd, align 8
273 ; Function Attrs: nounwind readnone
274 declare double @ceil(double) #1
276 ; Function Attrs: nounwind
277 define void @foo19() #0 {
279 %0 = load float, ptr @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, ptr @y, align 4
287 ; Function Attrs: nounwind readnone
288 declare float @rintf(float) #1
290 ; Function Attrs: nounwind
291 define void @foo20() #0 {
293 %0 = load double, ptr @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, ptr @yd, align 8
301 ; Function Attrs: nounwind readnone
302 declare double @rint(double) #1
304 ; Function Attrs: nounwind
305 define void @foo21() #0 {
307 %0 = load float, ptr @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, ptr @y, align 4
315 ; Function Attrs: nounwind readnone
316 declare float @truncf(float) #1
318 ; Function Attrs: nounwind
319 define void @foo22() #0 {
321 %0 = load double, ptr @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, ptr @yd, align 8
329 ; Function Attrs: nounwind readnone
330 declare double @trunc(double) #1
332 ; Function Attrs: nounwind
333 define void @foo23() #0 {
335 %0 = load float, ptr @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, ptr @y, align 4
343 ; Function Attrs: nounwind
344 declare float @log2f(float) #0
346 ; Function Attrs: nounwind
347 define void @foo24() #0 {
349 %0 = load double, ptr @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, ptr @yd, align 8
357 ; Function Attrs: nounwind
358 declare double @log2(double) #0
360 ; Function Attrs: nounwind
361 define void @foo25() #0 {
363 %0 = load float, ptr @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, ptr @y, align 4
371 ; Function Attrs: nounwind
372 declare float @exp2f(float) #0
374 ; Function Attrs: nounwind
375 define void @foo26() #0 {
377 %0 = load double, ptr @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, ptr @yd, align 8
385 ; Function Attrs: nounwind
386 declare double @exp2(double) #0
388 attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "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" "frame-pointer"="all" "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 }