1 ; RUN: opt -vector-library=MASSV -loop-vectorize -force-vector-interleave=1 -S < %s | FileCheck %s
3 target datalayout = "e-m:e-i64:64-n32:64"
4 target triple = "powerpc64le-unknown-linux-gnu"
6 declare double @ceil(double) #0
7 declare float @fabsf(float) #0
9 declare double @llvm.sqrt.f64(double) #0
10 declare float @llvm.sqrt.f32(float) #0
12 ; Vector counterpart of ceil is unsupported in MASSV library.
13 define void @ceil_f64(double* nocapture %varray) {
14 ; CHECK-LABEL: @ceil_f64(
15 ; CHECK-NOT: __ceild2_massv{{.*}}<2 x double>
22 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
23 %tmp = trunc i64 %iv to i32
24 %conv = sitofp i32 %tmp to double
25 %call = tail call double @ceil(double %conv)
26 %arrayidx = getelementptr inbounds double, double* %varray, i64 %iv
27 store double %call, double* %arrayidx, align 4
28 %iv.next = add nuw nsw i64 %iv, 1
29 %exitcond = icmp eq i64 %iv.next, 1000
30 br i1 %exitcond, label %for.end, label %for.body
36 ; Vector counterpart of fabs is unsupported in MASSV library.
37 define void @fabs_f32(float* nocapture %varray) {
38 ; CHECK-LABEL: @fabs_f32(
39 ; CHECK-NOT: __fabsf4_massv{{.*}}<4 x float>
46 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
47 %tmp = trunc i64 %iv to i32
48 %conv = sitofp i32 %tmp to float
49 %call = tail call float @fabsf(float %conv)
50 %arrayidx = getelementptr inbounds float, float* %varray, i64 %iv
51 store float %call, float* %arrayidx, align 4
52 %iv.next = add nuw nsw i64 %iv, 1
53 %exitcond = icmp eq i64 %iv.next, 1000
54 br i1 %exitcond, label %for.end, label %for.body
60 ; sqrt intrinsics are converted to their vector counterpart intrinsics.
61 ; They are not lowered to MASSV entries.
62 define void @sqrt_f64_intrinsic(double* nocapture %varray) {
63 ; CHECK-LABEL: @sqrt_f64_intrinsic(
64 ; CHECK: llvm.sqrt.v2f64{{.*}}<2 x double>
71 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
72 %tmp = trunc i64 %iv to i32
73 %conv = sitofp i32 %tmp to double
74 %call = tail call double @llvm.sqrt.f64(double %conv)
75 %arrayidx = getelementptr inbounds double, double* %varray, i64 %iv
76 store double %call, double* %arrayidx, align 4
77 %iv.next = add nuw nsw i64 %iv, 1
78 %exitcond = icmp eq i64 %iv.next, 1000
79 br i1 %exitcond, label %for.end, label %for.body
85 define void @sqrt_f32_intrinsic(float* nocapture %varray) {
86 ; CHECK-LABEL: @sqrt_f32_intrinsic(
87 ; CHECK: llvm.sqrt.v4f32{{.*}}<4 x float>
94 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
95 %tmp = trunc i64 %iv to i32
96 %conv = sitofp i32 %tmp to float
97 %call = tail call float @llvm.sqrt.f32(float %conv)
98 %arrayidx = getelementptr inbounds float, float* %varray, i64 %iv
99 store float %call, float* %arrayidx, align 4
100 %iv.next = add nuw nsw i64 %iv, 1
101 %exitcond = icmp eq i64 %iv.next, 1000
102 br i1 %exitcond, label %for.end, label %for.body
108 attributes #0 = { nounwind }