1; RUN: opt -vector-library=MASSV -passes=inject-tli-mappings,loop-vectorize -force-vector-interleave=1 -S < %s | FileCheck %s 2 3target datalayout = "e-m:e-i64:64-n32:64" 4target triple = "powerpc64le-unknown-linux-gnu" 5 6declare double @ceil(double) #0 7declare float @fabsf(float) #0 8 9declare double @llvm.sqrt.f64(double) #0 10declare float @llvm.sqrt.f32(float) #0 11 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 void 19; 20entry: 21 br label %for.body 22 23for.body: 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, ptr %varray, i64 %iv 29 store double %call, ptr %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 33 34for.end: 35 ret void 36} 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 void 45; 46entry: 47 br label %for.body 48 49for.body: 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, ptr %varray, i64 %iv 55 store float %call, ptr %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 59 60for.end: 61 ret void 62} 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 void 70; 71entry: 72 br label %for.body 73 74for.body: 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, ptr %varray, i64 %iv 80 store double %call, ptr %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 84 85for.end: 86 ret void 87} 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 void 93; 94entry: 95 br label %for.body 96 97for.body: 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, ptr %varray, i64 %iv 103 store float %call, ptr %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 107 108for.end: 109 ret void 110} 111 112attributes #0 = { nounwind } 113