xref: /llvm-project/llvm/test/Transforms/LoopVectorize/X86/svml-calls.ll (revision 1d8743359360d3d960d599e03e62537dc108aae2)
1; RUN: opt -vector-library=SVML -passes=inject-tli-mappings,loop-vectorize -force-vector-width=4 -force-vector-interleave=1 -mattr=avx -S < %s | FileCheck %s
2
3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4target triple = "x86_64-unknown-linux-gnu"
5
6declare double @sin(double) #0
7declare float @sinf(float) #0
8declare double @llvm.sin.f64(double) #0
9declare float @llvm.sin.f32(float) #0
10
11declare double @cos(double) #0
12declare float @cosf(float) #0
13declare double @llvm.cos.f64(double) #0
14declare float @llvm.cos.f32(float) #0
15
16declare double @pow(double, double) #0
17declare float @powf(float, float) #0
18declare double @llvm.pow.f64(double, double) #0
19declare float @llvm.pow.f32(float, float) #0
20
21declare double @exp(double) #0
22declare float @expf(float) #0
23declare double @llvm.exp.f64(double) #0
24declare float @llvm.exp.f32(float) #0
25
26declare double @log(double) #0
27declare float @logf(float) #0
28declare double @llvm.log.f64(double) #0
29declare float @llvm.log.f32(float) #0
30
31declare double @log2(double) #0
32declare float @log2f(float) #0
33declare double @llvm.log2.f64(double) #0
34declare float @llvm.log2.f32(float) #0
35
36declare double @log10(double) #0
37declare float @log10f(float) #0
38declare double @llvm.log10.f64(double) #0
39declare float @llvm.log10.f32(float) #0
40
41declare double @sqrt(double) #0
42declare float @sqrtf(float) #0
43
44declare double @exp2(double) #0
45declare float @exp2f(float) #0
46declare double @llvm.exp2.f64(double) #0
47declare float @llvm.exp2.f32(float) #0
48
49define void @sin_f64(ptr nocapture %varray) {
50; CHECK-LABEL: @sin_f64(
51; CHECK:    [[TMP5:%.*]] = call <4 x double> @__svml_sin4(<4 x double> [[TMP4:%.*]])
52; CHECK:    ret void
53;
54entry:
55  br label %for.body
56
57for.body:
58  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
59  %tmp = trunc i64 %iv to i32
60  %conv = sitofp i32 %tmp to double
61  %call = tail call double @sin(double %conv)
62  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv
63  store double %call, ptr %arrayidx, align 4
64  %iv.next = add nuw nsw i64 %iv, 1
65  %exitcond = icmp eq i64 %iv.next, 1000
66  br i1 %exitcond, label %for.end, label %for.body
67
68for.end:
69  ret void
70}
71
72define void @sin_f32(ptr nocapture %varray) {
73; CHECK-LABEL: @sin_f32(
74; CHECK:    [[TMP5:%.*]] = call <4 x float> @__svml_sinf4(<4 x float> [[TMP4:%.*]])
75; CHECK:    ret void
76;
77entry:
78  br label %for.body
79
80for.body:
81  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
82  %tmp = trunc i64 %iv to i32
83  %conv = sitofp i32 %tmp to float
84  %call = tail call float @sinf(float %conv)
85  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv
86  store float %call, ptr %arrayidx, align 4
87  %iv.next = add nuw nsw i64 %iv, 1
88  %exitcond = icmp eq i64 %iv.next, 1000
89  br i1 %exitcond, label %for.end, label %for.body
90
91for.end:
92  ret void
93}
94
95define void @sin_f64_intrinsic(ptr nocapture %varray) {
96; CHECK-LABEL: @sin_f64_intrinsic(
97; CHECK:    [[TMP5:%.*]] = call <4 x double> @__svml_sin4(<4 x double> [[TMP4:%.*]])
98; CHECK:    ret void
99;
100entry:
101  br label %for.body
102
103for.body:
104  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
105  %tmp = trunc i64 %iv to i32
106  %conv = sitofp i32 %tmp to double
107  %call = tail call double @llvm.sin.f64(double %conv)
108  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv
109  store double %call, ptr %arrayidx, align 4
110  %iv.next = add nuw nsw i64 %iv, 1
111  %exitcond = icmp eq i64 %iv.next, 1000
112  br i1 %exitcond, label %for.end, label %for.body
113
114for.end:
115  ret void
116}
117
118define void @sin_f32_intrinsic(ptr nocapture %varray) {
119; CHECK-LABEL: @sin_f32_intrinsic(
120; CHECK:    [[TMP5:%.*]] = call <4 x float> @__svml_sinf4(<4 x float> [[TMP4:%.*]])
121; CHECK:    ret void
122;
123entry:
124  br label %for.body
125
126for.body:
127  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
128  %tmp = trunc i64 %iv to i32
129  %conv = sitofp i32 %tmp to float
130  %call = tail call float @llvm.sin.f32(float %conv)
131  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv
132  store float %call, ptr %arrayidx, align 4
133  %iv.next = add nuw nsw i64 %iv, 1
134  %exitcond = icmp eq i64 %iv.next, 1000
135  br i1 %exitcond, label %for.end, label %for.body
136
137for.end:
138  ret void
139}
140
141define void @cos_f64(ptr nocapture %varray) {
142; CHECK-LABEL: @cos_f64(
143; CHECK:    [[TMP5:%.*]] = call <4 x double> @__svml_cos4(<4 x double> [[TMP4:%.*]])
144; CHECK:    ret void
145;
146entry:
147  br label %for.body
148
149for.body:
150  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
151  %tmp = trunc i64 %iv to i32
152  %conv = sitofp i32 %tmp to double
153  %call = tail call double @cos(double %conv)
154  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv
155  store double %call, ptr %arrayidx, align 4
156  %iv.next = add nuw nsw i64 %iv, 1
157  %exitcond = icmp eq i64 %iv.next, 1000
158  br i1 %exitcond, label %for.end, label %for.body
159
160for.end:
161  ret void
162}
163
164define void @cos_f32(ptr nocapture %varray) {
165; CHECK-LABEL: @cos_f32(
166; CHECK:    [[TMP5:%.*]] = call <4 x float> @__svml_cosf4(<4 x float> [[TMP4:%.*]])
167; CHECK:    ret void
168;
169entry:
170  br label %for.body
171
172for.body:
173  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
174  %tmp = trunc i64 %iv to i32
175  %conv = sitofp i32 %tmp to float
176  %call = tail call float @cosf(float %conv)
177  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv
178  store float %call, ptr %arrayidx, align 4
179  %iv.next = add nuw nsw i64 %iv, 1
180  %exitcond = icmp eq i64 %iv.next, 1000
181  br i1 %exitcond, label %for.end, label %for.body
182
183for.end:
184  ret void
185}
186
187define void @cos_f64_intrinsic(ptr nocapture %varray) {
188; CHECK-LABEL: @cos_f64_intrinsic(
189; CHECK:    [[TMP5:%.*]] = call <4 x double> @__svml_cos4(<4 x double> [[TMP4:%.*]])
190; CHECK:    ret void
191;
192entry:
193  br label %for.body
194
195for.body:
196  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
197  %tmp = trunc i64 %iv to i32
198  %conv = sitofp i32 %tmp to double
199  %call = tail call double @llvm.cos.f64(double %conv)
200  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv
201  store double %call, ptr %arrayidx, align 4
202  %iv.next = add nuw nsw i64 %iv, 1
203  %exitcond = icmp eq i64 %iv.next, 1000
204  br i1 %exitcond, label %for.end, label %for.body
205
206for.end:
207  ret void
208}
209
210define void @cos_f32_intrinsic(ptr nocapture %varray) {
211; CHECK-LABEL: @cos_f32_intrinsic(
212; CHECK:    [[TMP5:%.*]] = call <4 x float> @__svml_cosf4(<4 x float> [[TMP4:%.*]])
213; CHECK:    ret void
214;
215entry:
216  br label %for.body
217
218for.body:
219  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
220  %tmp = trunc i64 %iv to i32
221  %conv = sitofp i32 %tmp to float
222  %call = tail call float @llvm.cos.f32(float %conv)
223  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv
224  store float %call, ptr %arrayidx, align 4
225  %iv.next = add nuw nsw i64 %iv, 1
226  %exitcond = icmp eq i64 %iv.next, 1000
227  br i1 %exitcond, label %for.end, label %for.body
228
229for.end:
230  ret void
231}
232
233define void @tan_f64_intrinsic(ptr nocapture %varray) {
234; CHECK-LABEL: @tan_f64_intrinsic(
235; CHECK:    [[TMP5:%.*]] = call <4 x double> @__svml_tan4(<4 x double> [[TMP4:%.*]])
236; CHECK:    ret void
237;
238entry:
239  br label %for.body
240
241for.body:
242  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
243  %tmp = trunc i64 %iv to i32
244  %conv = sitofp i32 %tmp to double
245  %call = tail call double @llvm.tan.f64(double %conv)
246  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv
247  store double %call, ptr %arrayidx, align 4
248  %iv.next = add nuw nsw i64 %iv, 1
249  %exitcond = icmp eq i64 %iv.next, 1000
250  br i1 %exitcond, label %for.end, label %for.body
251
252for.end:
253  ret void
254}
255
256define void @tan_f32_intrinsic(ptr nocapture %varray) {
257; CHECK-LABEL: @tan_f32_intrinsic(
258; CHECK:    [[TMP5:%.*]] = call <4 x float> @__svml_tanf4(<4 x float> [[TMP4:%.*]])
259; CHECK:    ret void
260;
261entry:
262  br label %for.body
263
264for.body:
265  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
266  %tmp = trunc i64 %iv to i32
267  %conv = sitofp i32 %tmp to float
268  %call = tail call float @llvm.tan.f32(float %conv)
269  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv
270  store float %call, ptr %arrayidx, align 4
271  %iv.next = add nuw nsw i64 %iv, 1
272  %exitcond = icmp eq i64 %iv.next, 1000
273  br i1 %exitcond, label %for.end, label %for.body
274
275for.end:
276  ret void
277}
278
279define void @pow_f64(ptr nocapture %varray, ptr nocapture readonly %exp) {
280; CHECK-LABEL: @pow_f64(
281; CHECK:    [[TMP8:%.*]] = call <4 x double> @__svml_pow4(<4 x double> [[TMP4:%.*]], <4 x double> [[WIDE_LOAD:%.*]])
282; CHECK:    ret void
283;
284entry:
285  br label %for.body
286
287for.body:
288  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
289  %tmp = trunc i64 %iv to i32
290  %conv = sitofp i32 %tmp to double
291  %arrayidx = getelementptr inbounds double, ptr %exp, i64 %iv
292  %tmp1 = load double, ptr %arrayidx, align 4
293  %tmp2 = tail call double @pow(double %conv, double %tmp1)
294  %arrayidx2 = getelementptr inbounds double, ptr %varray, i64 %iv
295  store double %tmp2, ptr %arrayidx2, align 4
296  %iv.next = add nuw nsw i64 %iv, 1
297  %exitcond = icmp eq i64 %iv.next, 1000
298  br i1 %exitcond, label %for.end, label %for.body
299
300for.end:
301  ret void
302}
303
304define void @pow_f64_intrinsic(ptr nocapture %varray, ptr nocapture readonly %exp) {
305; CHECK-LABEL: @pow_f64_intrinsic(
306; CHECK:    [[TMP8:%.*]] = call <4 x double> @__svml_pow4(<4 x double> [[TMP4:%.*]], <4 x double> [[WIDE_LOAD:%.*]])
307; CHECK:    ret void
308;
309entry:
310  br label %for.body
311
312for.body:
313  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
314  %tmp = trunc i64 %iv to i32
315  %conv = sitofp i32 %tmp to double
316  %arrayidx = getelementptr inbounds double, ptr %exp, i64 %iv
317  %tmp1 = load double, ptr %arrayidx, align 4
318  %tmp2 = tail call double @llvm.pow.f64(double %conv, double %tmp1)
319  %arrayidx2 = getelementptr inbounds double, ptr %varray, i64 %iv
320  store double %tmp2, ptr %arrayidx2, align 4
321  %iv.next = add nuw nsw i64 %iv, 1
322  %exitcond = icmp eq i64 %iv.next, 1000
323  br i1 %exitcond, label %for.end, label %for.body
324
325for.end:
326  ret void
327}
328
329define void @pow_f32(ptr nocapture %varray, ptr nocapture readonly %exp) {
330; CHECK-LABEL: @pow_f32(
331; CHECK:    [[TMP8:%.*]] = call <4 x float> @__svml_powf4(<4 x float> [[TMP4:%.*]], <4 x float> [[WIDE_LOAD:%.*]])
332; CHECK:    ret void
333;
334entry:
335  br label %for.body
336
337for.body:
338  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
339  %tmp = trunc i64 %iv to i32
340  %conv = sitofp i32 %tmp to float
341  %arrayidx = getelementptr inbounds float, ptr %exp, i64 %iv
342  %tmp1 = load float, ptr %arrayidx, align 4
343  %tmp2 = tail call float @powf(float %conv, float %tmp1)
344  %arrayidx2 = getelementptr inbounds float, ptr %varray, i64 %iv
345  store float %tmp2, ptr %arrayidx2, align 4
346  %iv.next = add nuw nsw i64 %iv, 1
347  %exitcond = icmp eq i64 %iv.next, 1000
348  br i1 %exitcond, label %for.end, label %for.body
349
350for.end:
351  ret void
352}
353
354define void @pow_f32_intrinsic(ptr nocapture %varray, ptr nocapture readonly %exp) {
355; CHECK-LABEL: @pow_f32_intrinsic(
356; CHECK:    [[TMP8:%.*]] = call <4 x float> @__svml_powf4(<4 x float> [[TMP4:%.*]], <4 x float> [[WIDE_LOAD:%.*]])
357; CHECK:    ret void
358;
359entry:
360  br label %for.body
361
362for.body:
363  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
364  %tmp = trunc i64 %iv to i32
365  %conv = sitofp i32 %tmp to float
366  %arrayidx = getelementptr inbounds float, ptr %exp, i64 %iv
367  %tmp1 = load float, ptr %arrayidx, align 4
368  %tmp2 = tail call float @llvm.pow.f32(float %conv, float %tmp1)
369  %arrayidx2 = getelementptr inbounds float, ptr %varray, i64 %iv
370  store float %tmp2, ptr %arrayidx2, align 4
371  %iv.next = add nuw nsw i64 %iv, 1
372  %exitcond = icmp eq i64 %iv.next, 1000
373  br i1 %exitcond, label %for.end, label %for.body
374
375for.end:
376  ret void
377}
378
379define void @exp_f64(ptr nocapture %varray) {
380; CHECK-LABEL: @exp_f64(
381; CHECK:    [[TMP5:%.*]] = call <4 x double> @__svml_exp4(<4 x double> [[TMP4:%.*]])
382; CHECK:    ret void
383;
384entry:
385  br label %for.body
386
387for.body:
388  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
389  %tmp = trunc i64 %iv to i32
390  %conv = sitofp i32 %tmp to double
391  %call = tail call double @exp(double %conv)
392  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv
393  store double %call, ptr %arrayidx, align 4
394  %iv.next = add nuw nsw i64 %iv, 1
395  %exitcond = icmp eq i64 %iv.next, 1000
396  br i1 %exitcond, label %for.end, label %for.body
397
398for.end:
399  ret void
400}
401
402define void @exp_f32(ptr nocapture %varray) {
403; CHECK-LABEL: @exp_f32(
404; CHECK:    [[TMP5:%.*]] = call <4 x float> @__svml_expf4(<4 x float> [[TMP4:%.*]])
405; CHECK:    ret void
406;
407entry:
408  br label %for.body
409
410for.body:
411  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
412  %tmp = trunc i64 %iv to i32
413  %conv = sitofp i32 %tmp to float
414  %call = tail call float @expf(float %conv)
415  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv
416  store float %call, ptr %arrayidx, align 4
417  %iv.next = add nuw nsw i64 %iv, 1
418  %exitcond = icmp eq i64 %iv.next, 1000
419  br i1 %exitcond, label %for.end, label %for.body
420
421for.end:
422  ret void
423}
424
425define void @exp_f64_intrinsic(ptr nocapture %varray) {
426; CHECK-LABEL: @exp_f64_intrinsic(
427; CHECK:    [[TMP5:%.*]] = call <4 x double> @__svml_exp4(<4 x double> [[TMP4:%.*]])
428; CHECK:    ret void
429;
430entry:
431  br label %for.body
432
433for.body:
434  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
435  %tmp = trunc i64 %iv to i32
436  %conv = sitofp i32 %tmp to double
437  %call = tail call double @llvm.exp.f64(double %conv)
438  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv
439  store double %call, ptr %arrayidx, align 4
440  %iv.next = add nuw nsw i64 %iv, 1
441  %exitcond = icmp eq i64 %iv.next, 1000
442  br i1 %exitcond, label %for.end, label %for.body
443
444for.end:
445  ret void
446}
447
448define void @exp_f32_intrinsic(ptr nocapture %varray) {
449; CHECK-LABEL: @exp_f32_intrinsic(
450; CHECK:    [[TMP5:%.*]] = call <4 x float> @__svml_expf4(<4 x float> [[TMP4:%.*]])
451; CHECK:    ret void
452;
453entry:
454  br label %for.body
455
456for.body:
457  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
458  %tmp = trunc i64 %iv to i32
459  %conv = sitofp i32 %tmp to float
460  %call = tail call float @llvm.exp.f32(float %conv)
461  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv
462  store float %call, ptr %arrayidx, align 4
463  %iv.next = add nuw nsw i64 %iv, 1
464  %exitcond = icmp eq i64 %iv.next, 1000
465  br i1 %exitcond, label %for.end, label %for.body
466
467for.end:
468  ret void
469}
470
471define void @log_f64(ptr nocapture %varray) {
472; CHECK-LABEL: @log_f64(
473; CHECK:    [[TMP5:%.*]] = call <4 x double> @__svml_log4(<4 x double> [[TMP4:%.*]])
474; CHECK:    ret void
475;
476entry:
477  br label %for.body
478
479for.body:
480  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
481  %tmp = trunc i64 %iv to i32
482  %conv = sitofp i32 %tmp to double
483  %call = tail call double @log(double %conv)
484  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv
485  store double %call, ptr %arrayidx, align 4
486  %iv.next = add nuw nsw i64 %iv, 1
487  %exitcond = icmp eq i64 %iv.next, 1000
488  br i1 %exitcond, label %for.end, label %for.body
489
490for.end:
491  ret void
492}
493
494define void @log_f32(ptr nocapture %varray) {
495; CHECK-LABEL: @log_f32(
496; CHECK:    [[TMP5:%.*]] = call <4 x float> @__svml_logf4(<4 x float> [[TMP4:%.*]])
497; CHECK:    ret void
498;
499entry:
500  br label %for.body
501
502for.body:
503  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
504  %tmp = trunc i64 %iv to i32
505  %conv = sitofp i32 %tmp to float
506  %call = tail call float @logf(float %conv)
507  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv
508  store float %call, ptr %arrayidx, align 4
509  %iv.next = add nuw nsw i64 %iv, 1
510  %exitcond = icmp eq i64 %iv.next, 1000
511  br i1 %exitcond, label %for.end, label %for.body
512
513for.end:
514  ret void
515}
516
517define void @log_f64_intrinsic(ptr nocapture %varray) {
518; CHECK-LABEL: @log_f64_intrinsic(
519; CHECK:    [[TMP5:%.*]] = call <4 x double> @__svml_log4(<4 x double> [[TMP4:%.*]])
520; CHECK:    ret void
521;
522entry:
523  br label %for.body
524
525for.body:
526  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
527  %tmp = trunc i64 %iv to i32
528  %conv = sitofp i32 %tmp to double
529  %call = tail call double @llvm.log.f64(double %conv)
530  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv
531  store double %call, ptr %arrayidx, align 4
532  %iv.next = add nuw nsw i64 %iv, 1
533  %exitcond = icmp eq i64 %iv.next, 1000
534  br i1 %exitcond, label %for.end, label %for.body
535
536for.end:
537  ret void
538}
539
540define void @log_f32_intrinsic(ptr nocapture %varray) {
541; CHECK-LABEL: @log_f32_intrinsic(
542; CHECK:    [[TMP5:%.*]] = call <4 x float> @__svml_logf4(<4 x float> [[TMP4:%.*]])
543; CHECK:    ret void
544;
545entry:
546  br label %for.body
547
548for.body:
549  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
550  %tmp = trunc i64 %iv to i32
551  %conv = sitofp i32 %tmp to float
552  %call = tail call float @llvm.log.f32(float %conv)
553  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv
554  store float %call, ptr %arrayidx, align 4
555  %iv.next = add nuw nsw i64 %iv, 1
556  %exitcond = icmp eq i64 %iv.next, 1000
557  br i1 %exitcond, label %for.end, label %for.body
558
559for.end:
560  ret void
561}
562
563define void @log2_f64(ptr nocapture %varray) {
564; CHECK-LABEL: @log2_f64(
565; CHECK:    [[TMP5:%.*]] = call <4 x double> @__svml_log24(<4 x double> [[TMP4:%.*]])
566; CHECK:    ret void
567;
568entry:
569  br label %for.body
570
571for.body:
572  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
573  %tmp = trunc i64 %iv to i32
574  %conv = sitofp i32 %tmp to double
575  %call = tail call double @log2(double %conv)
576  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv
577  store double %call, ptr %arrayidx, align 4
578  %iv.next = add nuw nsw i64 %iv, 1
579  %exitcond = icmp eq i64 %iv.next, 1000
580  br i1 %exitcond, label %for.end, label %for.body
581
582for.end:
583  ret void
584}
585
586define void @log2_f32(ptr nocapture %varray) {
587; CHECK-LABEL: @log2_f32(
588; CHECK:    [[TMP5:%.*]] = call <4 x float> @__svml_log2f4(<4 x float> [[TMP4:%.*]])
589; CHECK:    ret void
590;
591entry:
592  br label %for.body
593
594for.body:
595  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
596  %tmp = trunc i64 %iv to i32
597  %conv = sitofp i32 %tmp to float
598  %call = tail call float @log2f(float %conv)
599  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv
600  store float %call, ptr %arrayidx, align 4
601  %iv.next = add nuw nsw i64 %iv, 1
602  %exitcond = icmp eq i64 %iv.next, 1000
603  br i1 %exitcond, label %for.end, label %for.body
604
605for.end:
606  ret void
607}
608
609define void @log2_f64_intrinsic(ptr nocapture %varray) {
610; CHECK-LABEL: @log2_f64_intrinsic(
611; CHECK:    [[TMP5:%.*]] = call <4 x double> @__svml_log24(<4 x double> [[TMP4:%.*]])
612; CHECK:    ret void
613;
614entry:
615  br label %for.body
616
617for.body:
618  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
619  %tmp = trunc i64 %iv to i32
620  %conv = sitofp i32 %tmp to double
621  %call = tail call double @llvm.log2.f64(double %conv)
622  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv
623  store double %call, ptr %arrayidx, align 4
624  %iv.next = add nuw nsw i64 %iv, 1
625  %exitcond = icmp eq i64 %iv.next, 1000
626  br i1 %exitcond, label %for.end, label %for.body
627
628for.end:
629  ret void
630}
631
632define void @log2_f32_intrinsic(ptr nocapture %varray) {
633; CHECK-LABEL: @log2_f32_intrinsic(
634; CHECK:    [[TMP5:%.*]] = call <4 x float> @__svml_log2f4(<4 x float> [[TMP4:%.*]])
635; CHECK:    ret void
636;
637entry:
638  br label %for.body
639
640for.body:
641  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
642  %tmp = trunc i64 %iv to i32
643  %conv = sitofp i32 %tmp to float
644  %call = tail call float @llvm.log2.f32(float %conv)
645  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv
646  store float %call, ptr %arrayidx, align 4
647  %iv.next = add nuw nsw i64 %iv, 1
648  %exitcond = icmp eq i64 %iv.next, 1000
649  br i1 %exitcond, label %for.end, label %for.body
650
651for.end:
652  ret void
653}
654
655define void @log10_f64(ptr nocapture %varray) {
656; CHECK-LABEL: @log10_f64(
657; CHECK:    [[TMP5:%.*]] = call <4 x double> @__svml_log104(<4 x double> [[TMP4:%.*]])
658; CHECK:    ret void
659;
660entry:
661  br label %for.body
662
663for.body:
664  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
665  %tmp = trunc i64 %iv to i32
666  %conv = sitofp i32 %tmp to double
667  %call = tail call double @log10(double %conv)
668  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv
669  store double %call, ptr %arrayidx, align 4
670  %iv.next = add nuw nsw i64 %iv, 1
671  %exitcond = icmp eq i64 %iv.next, 1000
672  br i1 %exitcond, label %for.end, label %for.body
673
674for.end:
675  ret void
676}
677
678define void @log10_f32(ptr nocapture %varray) {
679; CHECK-LABEL: @log10_f32(
680; CHECK:    [[TMP5:%.*]] = call <4 x float> @__svml_log10f4(<4 x float> [[TMP4:%.*]])
681; CHECK:    ret void
682;
683entry:
684  br label %for.body
685
686for.body:
687  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
688  %tmp = trunc i64 %iv to i32
689  %conv = sitofp i32 %tmp to float
690  %call = tail call float @log10f(float %conv)
691  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv
692  store float %call, ptr %arrayidx, align 4
693  %iv.next = add nuw nsw i64 %iv, 1
694  %exitcond = icmp eq i64 %iv.next, 1000
695  br i1 %exitcond, label %for.end, label %for.body
696
697for.end:
698  ret void
699}
700
701define void @log10_f64_intrinsic(ptr nocapture %varray) {
702; CHECK-LABEL: @log10_f64_intrinsic(
703; CHECK:    [[TMP5:%.*]] = call <4 x double> @__svml_log104(<4 x double> [[TMP4:%.*]])
704; CHECK:    ret void
705;
706entry:
707  br label %for.body
708
709for.body:
710  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
711  %tmp = trunc i64 %iv to i32
712  %conv = sitofp i32 %tmp to double
713  %call = tail call double @llvm.log10.f64(double %conv)
714  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv
715  store double %call, ptr %arrayidx, align 4
716  %iv.next = add nuw nsw i64 %iv, 1
717  %exitcond = icmp eq i64 %iv.next, 1000
718  br i1 %exitcond, label %for.end, label %for.body
719
720for.end:
721  ret void
722}
723
724define void @log10_f32_intrinsic(ptr nocapture %varray) {
725; CHECK-LABEL: @log10_f32_intrinsic(
726; CHECK:    [[TMP5:%.*]] = call <4 x float> @__svml_log10f4(<4 x float> [[TMP4:%.*]])
727; CHECK:    ret void
728;
729entry:
730  br label %for.body
731
732for.body:
733  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
734  %tmp = trunc i64 %iv to i32
735  %conv = sitofp i32 %tmp to float
736  %call = tail call float @llvm.log10.f32(float %conv)
737  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv
738  store float %call, ptr %arrayidx, align 4
739  %iv.next = add nuw nsw i64 %iv, 1
740  %exitcond = icmp eq i64 %iv.next, 1000
741  br i1 %exitcond, label %for.end, label %for.body
742
743for.end:
744  ret void
745}
746
747define void @sqrt_f64(ptr nocapture %varray) {
748; CHECK-LABEL: @sqrt_f64(
749; CHECK:    [[TMP5:%.*]] = call <4 x double> @__svml_sqrt4(<4 x double> [[TMP4:%.*]])
750; CHECK:    ret void
751;
752entry:
753  br label %for.body
754
755for.body:
756  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
757  %tmp = trunc i64 %iv to i32
758  %conv = sitofp i32 %tmp to double
759  %call = tail call double @sqrt(double %conv)
760  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv
761  store double %call, ptr %arrayidx, align 4
762  %iv.next = add nuw nsw i64 %iv, 1
763  %exitcond = icmp eq i64 %iv.next, 1000
764  br i1 %exitcond, label %for.end, label %for.body
765
766for.end:
767  ret void
768}
769
770define void @sqrt_f32(ptr nocapture %varray) {
771; CHECK-LABEL: @sqrt_f32(
772; CHECK:    [[TMP5:%.*]] = call <4 x float> @__svml_sqrtf4(<4 x float> [[TMP4:%.*]])
773; CHECK:    ret void
774;
775entry:
776  br label %for.body
777
778for.body:
779  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
780  %tmp = trunc i64 %iv to i32
781  %conv = sitofp i32 %tmp to float
782  %call = tail call float @sqrtf(float %conv)
783  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv
784  store float %call, ptr %arrayidx, align 4
785  %iv.next = add nuw nsw i64 %iv, 1
786  %exitcond = icmp eq i64 %iv.next, 1000
787  br i1 %exitcond, label %for.end, label %for.body
788
789for.end:
790  ret void
791}
792
793define void @exp2_f64(ptr nocapture %varray) {
794; CHECK-LABEL: @exp2_f64(
795; CHECK:    [[TMP5:%.*]] = call <4 x double> @__svml_exp24(<4 x double> [[TMP4:%.*]])
796; CHECK:    ret void
797;
798entry:
799  br label %for.body
800
801for.body:
802  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
803  %tmp = trunc i64 %iv to i32
804  %conv = sitofp i32 %tmp to double
805  %call = tail call double @exp2(double %conv)
806  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv
807  store double %call, ptr %arrayidx, align 4
808  %iv.next = add nuw nsw i64 %iv, 1
809  %exitcond = icmp eq i64 %iv.next, 1000
810  br i1 %exitcond, label %for.end, label %for.body
811
812for.end:
813  ret void
814}
815
816define void @exp2_f32(ptr nocapture %varray) {
817; CHECK-LABEL: @exp2_f32(
818; CHECK:    [[TMP5:%.*]] = call <4 x float> @__svml_exp2f4(<4 x float> [[TMP4:%.*]])
819; CHECK:    ret void
820;
821entry:
822  br label %for.body
823
824for.body:
825  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
826  %tmp = trunc i64 %iv to i32
827  %conv = sitofp i32 %tmp to float
828  %call = tail call float @exp2f(float %conv)
829  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv
830  store float %call, ptr %arrayidx, align 4
831  %iv.next = add nuw nsw i64 %iv, 1
832  %exitcond = icmp eq i64 %iv.next, 1000
833  br i1 %exitcond, label %for.end, label %for.body
834
835for.end:
836  ret void
837}
838
839define void @exp2_f64_intrinsic(ptr nocapture %varray) {
840; CHECK-LABEL: @exp2_f64_intrinsic(
841; CHECK:    [[TMP5:%.*]] = call <4 x double> @__svml_exp24(<4 x double> [[TMP4:%.*]])
842; CHECK:    ret void
843;
844entry:
845  br label %for.body
846
847for.body:
848  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
849  %tmp = trunc i64 %iv to i32
850  %conv = sitofp i32 %tmp to double
851  %call = tail call double @llvm.exp2.f64(double %conv)
852  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv
853  store double %call, ptr %arrayidx, align 4
854  %iv.next = add nuw nsw i64 %iv, 1
855  %exitcond = icmp eq i64 %iv.next, 1000
856  br i1 %exitcond, label %for.end, label %for.body
857
858for.end:
859  ret void
860}
861
862define void @exp2_f32_intrinsic(ptr nocapture %varray) {
863; CHECK-LABEL: @exp2_f32_intrinsic(
864; CHECK:    [[TMP5:%.*]] = call <4 x float> @__svml_exp2f4(<4 x float> [[TMP4:%.*]])
865; CHECK:    ret void
866;
867entry:
868  br label %for.body
869
870for.body:
871  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
872  %tmp = trunc i64 %iv to i32
873  %conv = sitofp i32 %tmp to float
874  %call = tail call float @llvm.exp2.f32(float %conv)
875  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv
876  store float %call, ptr %arrayidx, align 4
877  %iv.next = add nuw nsw i64 %iv, 1
878  %exitcond = icmp eq i64 %iv.next, 1000
879  br i1 %exitcond, label %for.end, label %for.body
880
881for.end:
882  ret void
883}
884
885attributes #0 = { nounwind readnone }
886