113 lines · plain
1; RUN: opt -vector-library=MASSV -passes=inject-tli-mappings,loop-vectorize -force-vector-interleave=1 -S < %s | FileCheck %s2 3target datalayout = "e-m:e-i64:64-n32:64"4target triple = "powerpc64le-unknown-linux-gnu"5 6declare double @ceil(double) #07declare float @fabsf(float) #08 9declare double @llvm.sqrt.f64(double) #010declare float @llvm.sqrt.f32(float) #011 12; Vector counterpart of ceil is unsupported in MASSV library.13define void @ceil_f64(ptr 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>18; CHECK: ret void19;20entry:21 br label %for.body22 23for.body:24 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]25 %tmp = trunc i64 %iv to i3226 %conv = sitofp i32 %tmp to double27 %call = tail call double @ceil(double %conv)28 %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv29 store double %call, ptr %arrayidx, align 430 %iv.next = add nuw nsw i64 %iv, 131 %exitcond = icmp eq i64 %iv.next, 100032 br i1 %exitcond, label %for.end, label %for.body33 34for.end:35 ret void36}37 38; Vector counterpart of fabs is unsupported in MASSV library.39define void @fabs_f32(ptr 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>44; CHECK: ret void45;46entry:47 br label %for.body48 49for.body:50 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]51 %tmp = trunc i64 %iv to i3252 %conv = sitofp i32 %tmp to float53 %call = tail call float @fabsf(float %conv)54 %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv55 store float %call, ptr %arrayidx, align 456 %iv.next = add nuw nsw i64 %iv, 157 %exitcond = icmp eq i64 %iv.next, 100058 br i1 %exitcond, label %for.end, label %for.body59 60for.end:61 ret void62}63 64; sqrt intrinsics are converted to their vector counterpart intrinsics.65; They are not lowered to MASSV entries.66define void @sqrt_f64_intrinsic(ptr nocapture %varray) {67; CHECK-LABEL: @sqrt_f64_intrinsic(68; CHECK: llvm.sqrt.v2f64{{.*}}<2 x double>69; CHECK: ret void70;71entry:72 br label %for.body73 74for.body:75 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]76 %tmp = trunc i64 %iv to i3277 %conv = sitofp i32 %tmp to double78 %call = tail call double @llvm.sqrt.f64(double %conv)79 %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv80 store double %call, ptr %arrayidx, align 481 %iv.next = add nuw nsw i64 %iv, 182 %exitcond = icmp eq i64 %iv.next, 100083 br i1 %exitcond, label %for.end, label %for.body84 85for.end:86 ret void87}88 89define void @sqrt_f32_intrinsic(ptr nocapture %varray) {90; CHECK-LABEL: @sqrt_f32_intrinsic(91; CHECK: llvm.sqrt.v4f32{{.*}}<4 x float>92; CHECK: ret void93;94entry:95 br label %for.body96 97for.body:98 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]99 %tmp = trunc i64 %iv to i32100 %conv = sitofp i32 %tmp to float101 %call = tail call float @llvm.sqrt.f32(float %conv)102 %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv103 store float %call, ptr %arrayidx, align 4104 %iv.next = add nuw nsw i64 %iv, 1105 %exitcond = icmp eq i64 %iv.next, 1000106 br i1 %exitcond, label %for.end, label %for.body107 108for.end:109 ret void110}111 112attributes #0 = { nounwind }113