1; RUN: llc -mtriple=arm-eabi -float-abi=soft -mcpu=cortex-a9 %s -o - | FileCheck %s
2
3@A = global <4 x float> <float 0., float 1., float 2., float 3.>
4
5define void @test_sqrt(<4 x float>* %X) nounwind {
6
7; CHECK-LABEL: test_sqrt:
8
9; CHECK:      movw    r1, :lower16:{{.*}}
10; CHECK:      movt    r1, :upper16:{{.*}}
11; CHECK:      vld1.64 {{.*}}, [r1:128]
12; CHECK:      vsqrt.f32       {{s[0-9]+}}, {{s[0-9]+}}
13; CHECK:      vsqrt.f32       {{s[0-9]+}}, {{s[0-9]+}}
14; CHECK:      vsqrt.f32       {{s[0-9]+}}, {{s[0-9]+}}
15; CHECK:      vsqrt.f32       {{s[0-9]+}}, {{s[0-9]+}}
16; CHECK:      vst1.64  {{.*}}
17
18L.entry:
19  %0 = load <4 x float>, <4 x float>* @A, align 16
20  %1 = call <4 x float> @llvm.sqrt.v4f32(<4 x float> %0)
21  store <4 x float> %1, <4 x float>* %X, align 16
22  ret void
23}
24
25declare <4 x float> @llvm.sqrt.v4f32(<4 x float>) nounwind readonly
26
27
28define void @test_cos(<4 x float>* %X) nounwind {
29
30; CHECK-LABEL: test_cos:
31
32; CHECK:      movw  [[reg0:r[0-9]+]], :lower16:{{.*}}
33; CHECK:      movt  [[reg0]], :upper16:{{.*}}
34; CHECK:      vld1.64
35
36; CHECK:      {{v?mov(.32)?}}  r0,
37; CHECK:      bl  {{.*}}cosf
38
39; CHECK:      {{v?mov(.32)?}}  r0,
40; CHECK:      bl  {{.*}}cosf
41
42; CHECK:      {{v?mov(.32)?}}  r0,
43; CHECK:      bl  {{.*}}cosf
44
45; CHECK:      {{v?mov(.32)?}}  r0,
46; CHECK:      bl  {{.*}}cosf
47
48; CHECK:      vst1.64
49
50L.entry:
51  %0 = load <4 x float>, <4 x float>* @A, align 16
52  %1 = call <4 x float> @llvm.cos.v4f32(<4 x float> %0)
53  store <4 x float> %1, <4 x float>* %X, align 16
54  ret void
55}
56
57declare <4 x float> @llvm.cos.v4f32(<4 x float>) nounwind readonly
58
59define void @test_exp(<4 x float>* %X) nounwind {
60
61; CHECK-LABEL: test_exp:
62
63; CHECK:      movw  [[reg0:r[0-9]+]], :lower16:{{.*}}
64; CHECK:      movt  [[reg0]], :upper16:{{.*}}
65; CHECK:      vld1.64
66
67; CHECK:      {{v?mov(.32)?}}  r0,
68; CHECK:      bl  {{.*}}expf
69
70; CHECK:      {{v?mov(.32)?}}  r0,
71; CHECK:      bl  {{.*}}expf
72
73; CHECK:      {{v?mov(.32)?}}  r0,
74; CHECK:      bl  {{.*}}expf
75
76; CHECK:      {{v?mov(.32)?}}  r0,
77; CHECK:      bl  {{.*}}expf
78
79; CHECK:      vst1.64
80
81L.entry:
82  %0 = load <4 x float>, <4 x float>* @A, align 16
83  %1 = call <4 x float> @llvm.exp.v4f32(<4 x float> %0)
84  store <4 x float> %1, <4 x float>* %X, align 16
85  ret void
86}
87
88declare <4 x float> @llvm.exp.v4f32(<4 x float>) nounwind readonly
89
90define void @test_exp2(<4 x float>* %X) nounwind {
91
92; CHECK-LABEL: test_exp2:
93
94; CHECK:      movw  [[reg0:r[0-9]+]], :lower16:{{.*}}
95; CHECK:      movt  [[reg0]], :upper16:{{.*}}
96; CHECK:      vld1.64
97
98; CHECK:      {{v?mov(.32)?}}  r0,
99; CHECK:      bl  {{.*}}exp2f
100
101; CHECK:      {{v?mov(.32)?}}  r0,
102; CHECK:      bl  {{.*}}exp2f
103
104; CHECK:      {{v?mov(.32)?}}  r0,
105; CHECK:      bl  {{.*}}exp2f
106
107; CHECK:      {{v?mov(.32)?}}  r0,
108; CHECK:      bl  {{.*}}exp2f
109
110; CHECK:      vst1.64
111
112L.entry:
113  %0 = load <4 x float>, <4 x float>* @A, align 16
114  %1 = call <4 x float> @llvm.exp2.v4f32(<4 x float> %0)
115  store <4 x float> %1, <4 x float>* %X, align 16
116  ret void
117}
118
119declare <4 x float> @llvm.exp2.v4f32(<4 x float>) nounwind readonly
120
121define void @test_log10(<4 x float>* %X) nounwind {
122
123; CHECK-LABEL: test_log10:
124
125; CHECK:      movw  [[reg0:r[0-9]+]], :lower16:{{.*}}
126; CHECK:      movt  [[reg0]], :upper16:{{.*}}
127; CHECK:      vld1.64
128
129; CHECK:      {{v?mov(.32)?}}  r0,
130; CHECK:      bl  {{.*}}log10f
131
132; CHECK:      {{v?mov(.32)?}}  r0,
133; CHECK:      bl  {{.*}}log10f
134
135; CHECK:      {{v?mov(.32)?}}  r0,
136; CHECK:      bl  {{.*}}log10f
137
138; CHECK:      {{v?mov(.32)?}}  r0,
139; CHECK:      bl  {{.*}}log10f
140
141; CHECK:      vst1.64
142
143L.entry:
144  %0 = load <4 x float>, <4 x float>* @A, align 16
145  %1 = call <4 x float> @llvm.log10.v4f32(<4 x float> %0)
146  store <4 x float> %1, <4 x float>* %X, align 16
147  ret void
148}
149
150declare <4 x float> @llvm.log10.v4f32(<4 x float>) nounwind readonly
151
152define void @test_log(<4 x float>* %X) nounwind {
153
154; CHECK-LABEL: test_log:
155
156; CHECK:      movw  [[reg0:r[0-9]+]], :lower16:{{.*}}
157; CHECK:      movt  [[reg0]], :upper16:{{.*}}
158; CHECK:      vld1.64
159
160; CHECK:      {{v?mov(.32)?}}  r0,
161; CHECK:      bl  {{.*}}logf
162
163; CHECK:      {{v?mov(.32)?}}  r0,
164; CHECK:      bl  {{.*}}logf
165
166; CHECK:      {{v?mov(.32)?}}  r0,
167; CHECK:      bl  {{.*}}logf
168
169; CHECK:      {{v?mov(.32)?}}  r0,
170; CHECK:      bl  {{.*}}logf
171
172; CHECK:      vst1.64
173
174L.entry:
175  %0 = load <4 x float>, <4 x float>* @A, align 16
176  %1 = call <4 x float> @llvm.log.v4f32(<4 x float> %0)
177  store <4 x float> %1, <4 x float>* %X, align 16
178  ret void
179}
180
181declare <4 x float> @llvm.log.v4f32(<4 x float>) nounwind readonly
182
183define void @test_log2(<4 x float>* %X) nounwind {
184
185; CHECK-LABEL: test_log2:
186
187; CHECK:      movw  [[reg0:r[0-9]+]], :lower16:{{.*}}
188; CHECK:      movt  [[reg0]], :upper16:{{.*}}
189; CHECK:      vld1.64
190
191; CHECK:      {{v?mov(.32)?}}  r0,
192; CHECK:      bl  {{.*}}log2f
193
194; CHECK:      {{v?mov(.32)?}}  r0,
195; CHECK:      bl  {{.*}}log2f
196
197; CHECK:      {{v?mov(.32)?}}  r0,
198; CHECK:      bl  {{.*}}log2f
199
200; CHECK:      {{v?mov(.32)?}}  r0,
201; CHECK:      bl  {{.*}}log2f
202
203; CHECK:      vst1.64
204
205L.entry:
206  %0 = load <4 x float>, <4 x float>* @A, align 16
207  %1 = call <4 x float> @llvm.log2.v4f32(<4 x float> %0)
208  store <4 x float> %1, <4 x float>* %X, align 16
209  ret void
210}
211
212declare <4 x float> @llvm.log2.v4f32(<4 x float>) nounwind readonly
213
214
215define void @test_pow(<4 x float>* %X) nounwind {
216
217; CHECK-LABEL: test_pow:
218
219; CHECK:      movw  [[reg0:r[0-9]+]], :lower16:{{.*}}
220; CHECK:      movt  [[reg0]], :upper16:{{.*}}
221; CHECK:      vld1.64
222
223; CHECK:      {{v?mov(.32)?}}  r0,
224; CHECK:      bl  {{.*}}powf
225
226; CHECK:      {{v?mov(.32)?}}  r0,
227; CHECK:      bl  {{.*}}powf
228
229; CHECK:      {{v?mov(.32)?}}  r0,
230; CHECK:      bl  {{.*}}powf
231
232; CHECK:      {{v?mov(.32)?}}  r0,
233; CHECK:      bl  {{.*}}powf
234
235; CHECK:      vst1.64
236
237L.entry:
238
239  %0 = load <4 x float>, <4 x float>* @A, align 16
240  %1 = call <4 x float> @llvm.pow.v4f32(<4 x float> %0, <4 x float> <float 2., float 2., float 2., float 2.>)
241
242  store <4 x float> %1, <4 x float>* %X, align 16
243
244  ret void
245}
246
247declare <4 x float> @llvm.pow.v4f32(<4 x float>, <4 x float>) nounwind readonly
248
249define void @test_powi(<4 x float>* %X) nounwind {
250
251; CHECK-LABEL: test_powi:
252
253; CHECK:       movw  [[reg0:r[0-9]+]], :lower16:{{.*}}
254; CHECK:       movt  [[reg0]], :upper16:{{.*}}
255; CHECK:       vld1.64 {{.*}}:128
256; CHECK:       vmul.f32 {{.*}}
257
258; CHECK:      vst1.64
259
260L.entry:
261
262  %0 = load <4 x float>, <4 x float>* @A, align 16
263  %1 = call <4 x float> @llvm.powi.v4f32(<4 x float> %0, i32 2)
264
265  store <4 x float> %1, <4 x float>* %X, align 16
266
267  ret void
268}
269
270declare <4 x float> @llvm.powi.v4f32(<4 x float>, i32) nounwind readonly
271
272define void @test_sin(<4 x float>* %X) nounwind {
273
274; CHECK-LABEL: test_sin:
275
276; CHECK:      movw  [[reg0:r[0-9]+]], :lower16:{{.*}}
277; CHECK:      movt  [[reg0]], :upper16:{{.*}}
278; CHECK:      vld1.64
279
280; CHECK:      {{v?mov(.32)?}}  r0,
281; CHECK:      bl  {{.*}}sinf
282
283; CHECK:      {{v?mov(.32)?}}  r0,
284; CHECK:      bl  {{.*}}sinf
285
286; CHECK:      {{v?mov(.32)?}}  r0,
287; CHECK:      bl  {{.*}}sinf
288
289; CHECK:      {{v?mov(.32)?}}  r0,
290; CHECK:      bl  {{.*}}sinf
291
292; CHECK:      vst1.64
293
294L.entry:
295  %0 = load <4 x float>, <4 x float>* @A, align 16
296  %1 = call <4 x float> @llvm.sin.v4f32(<4 x float> %0)
297  store <4 x float> %1, <4 x float>* %X, align 16
298  ret void
299}
300
301declare <4 x float> @llvm.sin.v4f32(<4 x float>) nounwind readonly
302
303define void @test_floor(<4 x float>* %X) nounwind {
304
305; CHECK-LABEL: test_floor:
306
307; CHECK:      movw  [[reg0:r[0-9]+]], :lower16:{{.*}}
308; CHECK:      movt  [[reg0]], :upper16:{{.*}}
309; CHECK:      vld1.64
310
311; CHECK:      {{v?mov(.32)?}}  r0,
312; CHECK:      bl  {{.*}}floorf
313
314; CHECK:      {{v?mov(.32)?}}  r0,
315; CHECK:      bl  {{.*}}floorf
316
317; CHECK:      {{v?mov(.32)?}}  r0,
318; CHECK:      bl  {{.*}}floorf
319
320; CHECK:      {{v?mov(.32)?}}  r0,
321; CHECK:      bl  {{.*}}floorf
322
323; CHECK:      vst1.64
324
325L.entry:
326  %0 = load <4 x float>, <4 x float>* @A, align 16
327  %1 = call <4 x float> @llvm.floor.v4f32(<4 x float> %0)
328  store <4 x float> %1, <4 x float>* %X, align 16
329  ret void
330}
331
332declare <4 x float> @llvm.floor.v4f32(<4 x float>) nounwind readonly
333
334