1 ; RUN: opt -vector-library=MASSV -inject-tli-mappings -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>
16 ; CHECK-NOT: __ceild2_P8{{.*}}<2 x double>
17 ; CHECK-NOT: __ceild2{{.*}}<2 x double>
24 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
25 %tmp = trunc i64 %iv to i32
26 %conv = sitofp i32 %tmp to double
27 %call = tail call double @ceil(double %conv)
28 %arrayidx = getelementptr inbounds double, double* %varray, i64 %iv
29 store double %call, double* %arrayidx, align 4
30 %iv.next = add nuw nsw i64 %iv, 1
31 %exitcond = icmp eq i64 %iv.next, 1000
32 br i1 %exitcond, label %for.end, label %for.body
38 ; Vector counterpart of fabs is unsupported in MASSV library.
39 define void @fabs_f32(float* nocapture %varray) {
40 ; CHECK-LABEL: @fabs_f32(
41 ; CHECK-NOT: __fabsf4_massv{{.*}}<4 x float>
42 ; CHECK-NOT: __fabsf4_P8{{.*}}<4 x float>
43 ; CHECK-NOT: __fabsf4{{.*}}<4 x float>
50 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
51 %tmp = trunc i64 %iv to i32
52 %conv = sitofp i32 %tmp to float
53 %call = tail call float @fabsf(float %conv)
54 %arrayidx = getelementptr inbounds float, float* %varray, i64 %iv
55 store float %call, float* %arrayidx, align 4
56 %iv.next = add nuw nsw i64 %iv, 1
57 %exitcond = icmp eq i64 %iv.next, 1000
58 br i1 %exitcond, label %for.end, label %for.body
64 ; sqrt intrinsics are converted to their vector counterpart intrinsics.
65 ; They are not lowered to MASSV entries.
66 define void @sqrt_f64_intrinsic(double* nocapture %varray) {
67 ; CHECK-LABEL: @sqrt_f64_intrinsic(
68 ; CHECK: llvm.sqrt.v2f64{{.*}}<2 x double>
75 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
76 %tmp = trunc i64 %iv to i32
77 %conv = sitofp i32 %tmp to double
78 %call = tail call double @llvm.sqrt.f64(double %conv)
79 %arrayidx = getelementptr inbounds double, double* %varray, i64 %iv
80 store double %call, double* %arrayidx, align 4
81 %iv.next = add nuw nsw i64 %iv, 1
82 %exitcond = icmp eq i64 %iv.next, 1000
83 br i1 %exitcond, label %for.end, label %for.body
89 define void @sqrt_f32_intrinsic(float* nocapture %varray) {
90 ; CHECK-LABEL: @sqrt_f32_intrinsic(
91 ; CHECK: llvm.sqrt.v4f32{{.*}}<4 x float>
98 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
99 %tmp = trunc i64 %iv to i32
100 %conv = sitofp i32 %tmp to float
101 %call = tail call float @llvm.sqrt.f32(float %conv)
102 %arrayidx = getelementptr inbounds float, float* %varray, i64 %iv
103 store float %call, float* %arrayidx, align 4
104 %iv.next = add nuw nsw i64 %iv, 1
105 %exitcond = icmp eq i64 %iv.next, 1000
106 br i1 %exitcond, label %for.end, label %for.body
112 attributes #0 = { nounwind }