1 ; RUN: opt -vector-library=SVML -loop-vectorize -force-vector-width=4 -force-vector-interleave=1 -mattr=avx -S < %s | FileCheck %s
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-unknown-linux-gnu"
6 declare double @sin(double) #0
7 declare float @sinf(float) #0
8 declare double @llvm.sin.f64(double) #0
9 declare float @llvm.sin.f32(float) #0
11 declare double @cos(double) #0
12 declare float @cosf(float) #0
13 declare double @llvm.cos.f64(double) #0
14 declare float @llvm.cos.f32(float) #0
16 declare double @pow(double, double) #0
17 declare float @powf(float, float) #0
18 declare double @llvm.pow.f64(double, double) #0
19 declare float @llvm.pow.f32(float, float) #0
21 declare double @exp(double) #0
22 declare float @expf(float) #0
23 declare double @llvm.exp.f64(double) #0
24 declare float @llvm.exp.f32(float) #0
26 declare double @log(double) #0
27 declare float @logf(float) #0
28 declare double @llvm.log.f64(double) #0
29 declare float @llvm.log.f32(float) #0
32 define void @sin_f64(double* nocapture %varray) {
33 ; CHECK-LABEL: @sin_f64(
34 ; CHECK: [[TMP5:%.*]] = call <4 x double> @__svml_sin4(<4 x double> [[TMP4:%.*]])
41 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
42 %tmp = trunc i64 %iv to i32
43 %conv = sitofp i32 %tmp to double
44 %call = tail call double @sin(double %conv)
45 %arrayidx = getelementptr inbounds double, double* %varray, i64 %iv
46 store double %call, double* %arrayidx, align 4
47 %iv.next = add nuw nsw i64 %iv, 1
48 %exitcond = icmp eq i64 %iv.next, 1000
49 br i1 %exitcond, label %for.end, label %for.body
55 define void @sin_f32(float* nocapture %varray) {
56 ; CHECK-LABEL: @sin_f32(
57 ; CHECK: [[TMP5:%.*]] = call <4 x float> @__svml_sinf4(<4 x float> [[TMP4:%.*]])
64 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
65 %tmp = trunc i64 %iv to i32
66 %conv = sitofp i32 %tmp to float
67 %call = tail call float @sinf(float %conv)
68 %arrayidx = getelementptr inbounds float, float* %varray, i64 %iv
69 store float %call, float* %arrayidx, align 4
70 %iv.next = add nuw nsw i64 %iv, 1
71 %exitcond = icmp eq i64 %iv.next, 1000
72 br i1 %exitcond, label %for.end, label %for.body
78 define void @sin_f64_intrinsic(double* nocapture %varray) {
79 ; CHECK-LABEL: @sin_f64_intrinsic(
80 ; CHECK: [[TMP5:%.*]] = call <4 x double> @__svml_sin4(<4 x double> [[TMP4:%.*]])
87 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
88 %tmp = trunc i64 %iv to i32
89 %conv = sitofp i32 %tmp to double
90 %call = tail call double @llvm.sin.f64(double %conv)
91 %arrayidx = getelementptr inbounds double, double* %varray, i64 %iv
92 store double %call, double* %arrayidx, align 4
93 %iv.next = add nuw nsw i64 %iv, 1
94 %exitcond = icmp eq i64 %iv.next, 1000
95 br i1 %exitcond, label %for.end, label %for.body
101 define void @sin_f32_intrinsic(float* nocapture %varray) {
102 ; CHECK-LABEL: @sin_f32_intrinsic(
103 ; CHECK: [[TMP5:%.*]] = call <4 x float> @__svml_sinf4(<4 x float> [[TMP4:%.*]])
110 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
111 %tmp = trunc i64 %iv to i32
112 %conv = sitofp i32 %tmp to float
113 %call = tail call float @llvm.sin.f32(float %conv)
114 %arrayidx = getelementptr inbounds float, float* %varray, i64 %iv
115 store float %call, float* %arrayidx, align 4
116 %iv.next = add nuw nsw i64 %iv, 1
117 %exitcond = icmp eq i64 %iv.next, 1000
118 br i1 %exitcond, label %for.end, label %for.body
124 define void @cos_f64(double* nocapture %varray) {
125 ; CHECK-LABEL: @cos_f64(
126 ; CHECK: [[TMP5:%.*]] = call <4 x double> @__svml_cos4(<4 x double> [[TMP4:%.*]])
133 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
134 %tmp = trunc i64 %iv to i32
135 %conv = sitofp i32 %tmp to double
136 %call = tail call double @cos(double %conv)
137 %arrayidx = getelementptr inbounds double, double* %varray, i64 %iv
138 store double %call, double* %arrayidx, align 4
139 %iv.next = add nuw nsw i64 %iv, 1
140 %exitcond = icmp eq i64 %iv.next, 1000
141 br i1 %exitcond, label %for.end, label %for.body
147 define void @cos_f32(float* nocapture %varray) {
148 ; CHECK-LABEL: @cos_f32(
149 ; CHECK: [[TMP5:%.*]] = call <4 x float> @__svml_cosf4(<4 x float> [[TMP4:%.*]])
156 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
157 %tmp = trunc i64 %iv to i32
158 %conv = sitofp i32 %tmp to float
159 %call = tail call float @cosf(float %conv)
160 %arrayidx = getelementptr inbounds float, float* %varray, i64 %iv
161 store float %call, float* %arrayidx, align 4
162 %iv.next = add nuw nsw i64 %iv, 1
163 %exitcond = icmp eq i64 %iv.next, 1000
164 br i1 %exitcond, label %for.end, label %for.body
170 define void @cos_f64_intrinsic(double* nocapture %varray) {
171 ; CHECK-LABEL: @cos_f64_intrinsic(
172 ; CHECK: [[TMP5:%.*]] = call <4 x double> @__svml_cos4(<4 x double> [[TMP4:%.*]])
179 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
180 %tmp = trunc i64 %iv to i32
181 %conv = sitofp i32 %tmp to double
182 %call = tail call double @llvm.cos.f64(double %conv)
183 %arrayidx = getelementptr inbounds double, double* %varray, i64 %iv
184 store double %call, double* %arrayidx, align 4
185 %iv.next = add nuw nsw i64 %iv, 1
186 %exitcond = icmp eq i64 %iv.next, 1000
187 br i1 %exitcond, label %for.end, label %for.body
193 define void @cos_f32_intrinsic(float* nocapture %varray) {
194 ; CHECK-LABEL: @cos_f32_intrinsic(
195 ; CHECK: [[TMP5:%.*]] = call <4 x float> @__svml_cosf4(<4 x float> [[TMP4:%.*]])
202 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
203 %tmp = trunc i64 %iv to i32
204 %conv = sitofp i32 %tmp to float
205 %call = tail call float @llvm.cos.f32(float %conv)
206 %arrayidx = getelementptr inbounds float, float* %varray, i64 %iv
207 store float %call, float* %arrayidx, align 4
208 %iv.next = add nuw nsw i64 %iv, 1
209 %exitcond = icmp eq i64 %iv.next, 1000
210 br i1 %exitcond, label %for.end, label %for.body
216 define void @pow_f64(double* nocapture %varray, double* nocapture readonly %exp) {
217 ; CHECK-LABEL: @pow_f64(
218 ; CHECK: [[TMP8:%.*]] = call <4 x double> @__svml_pow4(<4 x double> [[TMP4:%.*]], <4 x double> [[WIDE_LOAD:%.*]])
225 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
226 %tmp = trunc i64 %iv to i32
227 %conv = sitofp i32 %tmp to double
228 %arrayidx = getelementptr inbounds double, double* %exp, i64 %iv
229 %tmp1 = load double, double* %arrayidx, align 4
230 %tmp2 = tail call double @pow(double %conv, double %tmp1)
231 %arrayidx2 = getelementptr inbounds double, double* %varray, i64 %iv
232 store double %tmp2, double* %arrayidx2, align 4
233 %iv.next = add nuw nsw i64 %iv, 1
234 %exitcond = icmp eq i64 %iv.next, 1000
235 br i1 %exitcond, label %for.end, label %for.body
241 define void @pow_f64_intrinsic(double* nocapture %varray, double* nocapture readonly %exp) {
242 ; CHECK-LABEL: @pow_f64_intrinsic(
243 ; CHECK: [[TMP8:%.*]] = call <4 x double> @__svml_pow4(<4 x double> [[TMP4:%.*]], <4 x double> [[WIDE_LOAD:%.*]])
250 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
251 %tmp = trunc i64 %iv to i32
252 %conv = sitofp i32 %tmp to double
253 %arrayidx = getelementptr inbounds double, double* %exp, i64 %iv
254 %tmp1 = load double, double* %arrayidx, align 4
255 %tmp2 = tail call double @llvm.pow.f64(double %conv, double %tmp1)
256 %arrayidx2 = getelementptr inbounds double, double* %varray, i64 %iv
257 store double %tmp2, double* %arrayidx2, align 4
258 %iv.next = add nuw nsw i64 %iv, 1
259 %exitcond = icmp eq i64 %iv.next, 1000
260 br i1 %exitcond, label %for.end, label %for.body
266 define void @pow_f32(float* nocapture %varray, float* nocapture readonly %exp) {
267 ; CHECK-LABEL: @pow_f32(
268 ; CHECK: [[TMP8:%.*]] = call <4 x float> @__svml_powf4(<4 x float> [[TMP4:%.*]], <4 x float> [[WIDE_LOAD:%.*]])
275 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
276 %tmp = trunc i64 %iv to i32
277 %conv = sitofp i32 %tmp to float
278 %arrayidx = getelementptr inbounds float, float* %exp, i64 %iv
279 %tmp1 = load float, float* %arrayidx, align 4
280 %tmp2 = tail call float @powf(float %conv, float %tmp1)
281 %arrayidx2 = getelementptr inbounds float, float* %varray, i64 %iv
282 store float %tmp2, float* %arrayidx2, align 4
283 %iv.next = add nuw nsw i64 %iv, 1
284 %exitcond = icmp eq i64 %iv.next, 1000
285 br i1 %exitcond, label %for.end, label %for.body
291 define void @pow_f32_intrinsic(float* nocapture %varray, float* nocapture readonly %exp) {
292 ; CHECK-LABEL: @pow_f32_intrinsic(
293 ; CHECK: [[TMP8:%.*]] = call <4 x float> @__svml_powf4(<4 x float> [[TMP4:%.*]], <4 x float> [[WIDE_LOAD:%.*]])
300 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
301 %tmp = trunc i64 %iv to i32
302 %conv = sitofp i32 %tmp to float
303 %arrayidx = getelementptr inbounds float, float* %exp, i64 %iv
304 %tmp1 = load float, float* %arrayidx, align 4
305 %tmp2 = tail call float @llvm.pow.f32(float %conv, float %tmp1)
306 %arrayidx2 = getelementptr inbounds float, float* %varray, i64 %iv
307 store float %tmp2, float* %arrayidx2, align 4
308 %iv.next = add nuw nsw i64 %iv, 1
309 %exitcond = icmp eq i64 %iv.next, 1000
310 br i1 %exitcond, label %for.end, label %for.body
316 define void @exp_f64(double* nocapture %varray) {
317 ; CHECK-LABEL: @exp_f64(
318 ; CHECK: [[TMP5:%.*]] = call <4 x double> @__svml_exp4(<4 x double> [[TMP4:%.*]])
325 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
326 %tmp = trunc i64 %iv to i32
327 %conv = sitofp i32 %tmp to double
328 %call = tail call double @exp(double %conv)
329 %arrayidx = getelementptr inbounds double, double* %varray, i64 %iv
330 store double %call, double* %arrayidx, align 4
331 %iv.next = add nuw nsw i64 %iv, 1
332 %exitcond = icmp eq i64 %iv.next, 1000
333 br i1 %exitcond, label %for.end, label %for.body
339 define void @exp_f32(float* nocapture %varray) {
340 ; CHECK-LABEL: @exp_f32(
341 ; CHECK: [[TMP5:%.*]] = call <4 x float> @__svml_expf4(<4 x float> [[TMP4:%.*]])
348 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
349 %tmp = trunc i64 %iv to i32
350 %conv = sitofp i32 %tmp to float
351 %call = tail call float @expf(float %conv)
352 %arrayidx = getelementptr inbounds float, float* %varray, i64 %iv
353 store float %call, float* %arrayidx, align 4
354 %iv.next = add nuw nsw i64 %iv, 1
355 %exitcond = icmp eq i64 %iv.next, 1000
356 br i1 %exitcond, label %for.end, label %for.body
362 define void @exp_f64_intrinsic(double* nocapture %varray) {
363 ; CHECK-LABEL: @exp_f64_intrinsic(
364 ; CHECK: [[TMP5:%.*]] = call <4 x double> @__svml_exp4(<4 x double> [[TMP4:%.*]])
371 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
372 %tmp = trunc i64 %iv to i32
373 %conv = sitofp i32 %tmp to double
374 %call = tail call double @llvm.exp.f64(double %conv)
375 %arrayidx = getelementptr inbounds double, double* %varray, i64 %iv
376 store double %call, double* %arrayidx, align 4
377 %iv.next = add nuw nsw i64 %iv, 1
378 %exitcond = icmp eq i64 %iv.next, 1000
379 br i1 %exitcond, label %for.end, label %for.body
385 define void @exp_f32_intrinsic(float* nocapture %varray) {
386 ; CHECK-LABEL: @exp_f32_intrinsic(
387 ; CHECK: [[TMP5:%.*]] = call <4 x float> @__svml_expf4(<4 x float> [[TMP4:%.*]])
394 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
395 %tmp = trunc i64 %iv to i32
396 %conv = sitofp i32 %tmp to float
397 %call = tail call float @llvm.exp.f32(float %conv)
398 %arrayidx = getelementptr inbounds float, float* %varray, i64 %iv
399 store float %call, float* %arrayidx, align 4
400 %iv.next = add nuw nsw i64 %iv, 1
401 %exitcond = icmp eq i64 %iv.next, 1000
402 br i1 %exitcond, label %for.end, label %for.body
408 define void @log_f64(double* nocapture %varray) {
409 ; CHECK-LABEL: @log_f64(
410 ; CHECK: [[TMP5:%.*]] = call <4 x double> @__svml_log4(<4 x double> [[TMP4:%.*]])
417 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
418 %tmp = trunc i64 %iv to i32
419 %conv = sitofp i32 %tmp to double
420 %call = tail call double @log(double %conv)
421 %arrayidx = getelementptr inbounds double, double* %varray, i64 %iv
422 store double %call, double* %arrayidx, align 4
423 %iv.next = add nuw nsw i64 %iv, 1
424 %exitcond = icmp eq i64 %iv.next, 1000
425 br i1 %exitcond, label %for.end, label %for.body
431 define void @log_f32(float* nocapture %varray) {
432 ; CHECK-LABEL: @log_f32(
433 ; CHECK: [[TMP5:%.*]] = call <4 x float> @__svml_logf4(<4 x float> [[TMP4:%.*]])
440 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
441 %tmp = trunc i64 %iv to i32
442 %conv = sitofp i32 %tmp to float
443 %call = tail call float @logf(float %conv)
444 %arrayidx = getelementptr inbounds float, float* %varray, i64 %iv
445 store float %call, float* %arrayidx, align 4
446 %iv.next = add nuw nsw i64 %iv, 1
447 %exitcond = icmp eq i64 %iv.next, 1000
448 br i1 %exitcond, label %for.end, label %for.body
454 define void @log_f64_intrinsic(double* nocapture %varray) {
455 ; CHECK-LABEL: @log_f64_intrinsic(
456 ; CHECK: [[TMP5:%.*]] = call <4 x double> @__svml_log4(<4 x double> [[TMP4:%.*]])
463 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
464 %tmp = trunc i64 %iv to i32
465 %conv = sitofp i32 %tmp to double
466 %call = tail call double @llvm.log.f64(double %conv)
467 %arrayidx = getelementptr inbounds double, double* %varray, i64 %iv
468 store double %call, double* %arrayidx, align 4
469 %iv.next = add nuw nsw i64 %iv, 1
470 %exitcond = icmp eq i64 %iv.next, 1000
471 br i1 %exitcond, label %for.end, label %for.body
477 define void @log_f32_intrinsic(float* nocapture %varray) {
478 ; CHECK-LABEL: @log_f32_intrinsic(
479 ; CHECK: [[TMP5:%.*]] = call <4 x float> @__svml_logf4(<4 x float> [[TMP4:%.*]])
486 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
487 %tmp = trunc i64 %iv to i32
488 %conv = sitofp i32 %tmp to float
489 %call = tail call float @llvm.log.f32(float %conv)
490 %arrayidx = getelementptr inbounds float, float* %varray, i64 %iv
491 store float %call, float* %arrayidx, align 4
492 %iv.next = add nuw nsw i64 %iv, 1
493 %exitcond = icmp eq i64 %iv.next, 1000
494 br i1 %exitcond, label %for.end, label %for.body
500 attributes #0 = { nounwind readnone }