blob: 258b1bf97d7b63c4675dd4d2705b6885c9f5bf28 [file] [log] [blame]
Daniel Sanders8008de52015-10-15 14:34:23 +00001; 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
Reed Kotler83f879d2013-08-01 21:17:53 +00003
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
16define void @foo1() #0 {
Reed Kotlerd8f33622013-08-20 20:53:09 +000017; 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
Reed Kotler83f879d2013-08-01 21:17:53 +000025entry:
David Blaikiea79ac142015-02-27 21:17:42 +000026 %0 = load float, float* @x, align 4
27 %1 = load float, float* @one, align 4
Reed Kotler83f879d2013-08-01 21:17:53 +000028 %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
34declare float @copysignf(float, float) #1
35
36; Function Attrs: nounwind
37define void @foo2() #0 {
Reed Kotlerd8f33622013-08-20 20:53:09 +000038; fmask: .ent foo2
39; fmask: save {{.*}}
40; fmask: .end foo2
Reed Kotler83f879d2013-08-01 21:17:53 +000041entry:
David Blaikiea79ac142015-02-27 21:17:42 +000042 %0 = load float, float* @x, align 4
43 %1 = load float, float* @negone, align 4
Reed Kotler83f879d2013-08-01 21:17:53 +000044 %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
50define void @foo3() #0 {
51entry:
Reed Kotlerd8f33622013-08-20 20:53:09 +000052; 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
David Blaikiea79ac142015-02-27 21:17:42 +000060 %0 = load double, double* @xd, align 8
61 %1 = load float, float* @oned, align 4
Reed Kotler83f879d2013-08-01 21:17:53 +000062 %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
69declare double @copysign(double, double) #1
70
71; Function Attrs: nounwind
72define void @foo4() #0 {
73entry:
Reed Kotlerd8f33622013-08-20 20:53:09 +000074; fmask: .ent foo4
75; fmask: save {{.*}}
76; fmask: .end foo4
David Blaikiea79ac142015-02-27 21:17:42 +000077 %0 = load double, double* @xd, align 8
78 %1 = load double, double* @negoned, align 8
Reed Kotler83f879d2013-08-01 21:17:53 +000079 %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
85define void @foo5() #0 {
86entry:
David Blaikiea79ac142015-02-27 21:17:42 +000087 %0 = load float, float* @xn, align 4
Reed Kotler83f879d2013-08-01 21:17:53 +000088 %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
94declare float @fabsf(float) #1
95
96; Function Attrs: nounwind
97define void @foo6() #0 {
98entry:
David Blaikiea79ac142015-02-27 21:17:42 +000099 %0 = load double, double* @xdn, align 8
Reed Kotler83f879d2013-08-01 21:17:53 +0000100 %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
106declare double @fabs(double) #1
107
108; Function Attrs: nounwind
109define void @foo7() #0 {
110entry:
David Blaikiea79ac142015-02-27 21:17:42 +0000111 %0 = load float, float* @x, align 4
Reed Kotler83f879d2013-08-01 21:17:53 +0000112 %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
120declare float @sinf(float) #0
121
122; Function Attrs: nounwind
123define void @foo8() #0 {
124entry:
David Blaikiea79ac142015-02-27 21:17:42 +0000125 %0 = load double, double* @xd, align 8
Reed Kotler83f879d2013-08-01 21:17:53 +0000126 %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
134declare double @sin(double) #0
135
136; Function Attrs: nounwind
137define void @foo9() #0 {
138entry:
David Blaikiea79ac142015-02-27 21:17:42 +0000139 %0 = load float, float* @x, align 4
Reed Kotler83f879d2013-08-01 21:17:53 +0000140 %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
148declare float @cosf(float) #0
149
150; Function Attrs: nounwind
151define void @foo10() #0 {
152entry:
David Blaikiea79ac142015-02-27 21:17:42 +0000153 %0 = load double, double* @xd, align 8
Reed Kotler83f879d2013-08-01 21:17:53 +0000154 %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
162declare double @cos(double) #0
163
164; Function Attrs: nounwind
165define void @foo11() #0 {
166entry:
David Blaikiea79ac142015-02-27 21:17:42 +0000167 %0 = load float, float* @x, align 4
Reed Kotler83f879d2013-08-01 21:17:53 +0000168 %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
176declare float @sqrtf(float) #0
177
178; Function Attrs: nounwind
179define void @foo12() #0 {
180entry:
David Blaikiea79ac142015-02-27 21:17:42 +0000181 %0 = load double, double* @xd, align 8
Reed Kotler83f879d2013-08-01 21:17:53 +0000182 %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
190declare double @sqrt(double) #0
191
192; Function Attrs: nounwind
193define void @foo13() #0 {
194entry:
David Blaikiea79ac142015-02-27 21:17:42 +0000195 %0 = load float, float* @x, align 4
Reed Kotler83f879d2013-08-01 21:17:53 +0000196 %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
204declare float @floorf(float) #1
205
206; Function Attrs: nounwind
207define void @foo14() #0 {
208entry:
David Blaikiea79ac142015-02-27 21:17:42 +0000209 %0 = load double, double* @xd, align 8
Reed Kotler83f879d2013-08-01 21:17:53 +0000210 %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
218declare double @floor(double) #1
219
220; Function Attrs: nounwind
221define void @foo15() #0 {
222entry:
David Blaikiea79ac142015-02-27 21:17:42 +0000223 %0 = load float, float* @x, align 4
Reed Kotler83f879d2013-08-01 21:17:53 +0000224 %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
232declare float @nearbyintf(float) #1
233
234; Function Attrs: nounwind
235define void @foo16() #0 {
236entry:
David Blaikiea79ac142015-02-27 21:17:42 +0000237 %0 = load double, double* @xd, align 8
Reed Kotler83f879d2013-08-01 21:17:53 +0000238 %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
246declare double @nearbyint(double) #1
247
248; Function Attrs: nounwind
249define void @foo17() #0 {
250entry:
David Blaikiea79ac142015-02-27 21:17:42 +0000251 %0 = load float, float* @x, align 4
Reed Kotler83f879d2013-08-01 21:17:53 +0000252 %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
260declare float @ceilf(float) #1
261
262; Function Attrs: nounwind
263define void @foo18() #0 {
264entry:
David Blaikiea79ac142015-02-27 21:17:42 +0000265 %0 = load double, double* @xd, align 8
Reed Kotler83f879d2013-08-01 21:17:53 +0000266 %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
274declare double @ceil(double) #1
275
276; Function Attrs: nounwind
277define void @foo19() #0 {
278entry:
David Blaikiea79ac142015-02-27 21:17:42 +0000279 %0 = load float, float* @x, align 4
Reed Kotler83f879d2013-08-01 21:17:53 +0000280 %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
288declare float @rintf(float) #1
289
290; Function Attrs: nounwind
291define void @foo20() #0 {
292entry:
David Blaikiea79ac142015-02-27 21:17:42 +0000293 %0 = load double, double* @xd, align 8
Reed Kotler83f879d2013-08-01 21:17:53 +0000294 %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
302declare double @rint(double) #1
303
304; Function Attrs: nounwind
305define void @foo21() #0 {
306entry:
David Blaikiea79ac142015-02-27 21:17:42 +0000307 %0 = load float, float* @x, align 4
Reed Kotler83f879d2013-08-01 21:17:53 +0000308 %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
316declare float @truncf(float) #1
317
318; Function Attrs: nounwind
319define void @foo22() #0 {
320entry:
David Blaikiea79ac142015-02-27 21:17:42 +0000321 %0 = load double, double* @xd, align 8
Reed Kotler83f879d2013-08-01 21:17:53 +0000322 %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
330declare double @trunc(double) #1
331
332; Function Attrs: nounwind
333define void @foo23() #0 {
334entry:
David Blaikiea79ac142015-02-27 21:17:42 +0000335 %0 = load float, float* @x, align 4
Reed Kotler83f879d2013-08-01 21:17:53 +0000336 %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
344declare float @log2f(float) #0
345
346; Function Attrs: nounwind
347define void @foo24() #0 {
348entry:
David Blaikiea79ac142015-02-27 21:17:42 +0000349 %0 = load double, double* @xd, align 8
Reed Kotler83f879d2013-08-01 21:17:53 +0000350 %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
358declare double @log2(double) #0
359
360; Function Attrs: nounwind
361define void @foo25() #0 {
362entry:
David Blaikiea79ac142015-02-27 21:17:42 +0000363 %0 = load float, float* @x, align 4
Reed Kotler83f879d2013-08-01 21:17:53 +0000364 %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
372declare float @exp2f(float) #0
373
374; Function Attrs: nounwind
375define void @foo26() #0 {
376entry:
David Blaikiea79ac142015-02-27 21:17:42 +0000377 %0 = load double, double* @xd, align 8
Reed Kotler83f879d2013-08-01 21:17:53 +0000378 %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
386declare double @exp2(double) #0
387
Eric Christophera9353d12014-09-26 01:44:08 +0000388attributes #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" }
Bill Wendling187d3dd2013-08-22 21:28:54 +0000389attributes #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" }
Reed Kotler83f879d2013-08-01 21:17:53 +0000390attributes #2 = { nounwind readnone }
391attributes #3 = { nounwind }