brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.9 KiB · 76cf7d4 Raw
103 lines · plain
1; RUN: opt -mtriple aarch64-linux-gnu -mattr=+sve -passes=loop-vectorize,dce,instcombine -S \2; RUN:   -prefer-predicate-over-epilogue=scalar-epilogue <%s | FileCheck %s3 4define void @stride7_i32(ptr noalias nocapture %dst, i64 %n) #0 {5; CHECK-LABEL: @stride7_i32(6; CHECK:      vector.body7; CHECK:        %[[VEC_IND:.*]] = phi <vscale x 4 x i64> [ %{{.*}}, %vector.ph ], [ %{{.*}}, %vector.body ]8; CHECK-NEXT:   %[[PTR_INDICES:.*]] = mul nuw nsw <vscale x 4 x i64> %[[VEC_IND]], splat (i64 7)9; CHECK-NEXT:   %[[PTRS:.*]] = getelementptr inbounds i32, ptr %dst, <vscale x 4 x i64> %[[PTR_INDICES]]10; CHECK-NEXT:   %[[GLOAD:.*]] = call <vscale x 4 x i32> @llvm.masked.gather.nxv4i32.nxv4p0(<vscale x 4 x ptr> align 4 %[[PTRS]]11; CHECK-NEXT:   %[[VALS:.*]] = add nsw <vscale x 4 x i32> %[[GLOAD]],12; CHECK-NEXT:   call void @llvm.masked.scatter.nxv4i32.nxv4p0(<vscale x 4 x i32> %[[VALS]], <vscale x 4 x ptr> align 4 %[[PTRS]]13entry:14  br label %for.body15 16for.body:                                         ; preds = %entry, %for.body17  %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ]18  %mul = mul nuw nsw i64 %i.05, 719  %arrayidx = getelementptr inbounds i32, ptr %dst, i64 %mul20  %0 = load i32, ptr %arrayidx, align 421  %add = add nsw i32 %0, 322  store i32 %add, ptr %arrayidx, align 423  %inc = add nuw nsw i64 %i.05, 124  %exitcond.not = icmp eq i64 %inc, %n25  br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !026 27for.end:                                          ; preds = %for.end.loopexit, %entry28  ret void29}30 31define void @stride7_f64(ptr noalias nocapture %dst, i64 %n) #0 {32; CHECK-LABEL: @stride7_f64(33; CHECK:      vector.body34; CHECK:        %[[VEC_IND:.*]] = phi <vscale x 2 x i64> [ %{{.*}}, %vector.ph ], [ %{{.*}}, %vector.body ]35; CHECK-NEXT:   %[[PTR_INDICES:.*]] = mul nuw nsw <vscale x 2 x i64> %[[VEC_IND]], splat (i64 7)36; CHECK-NEXT:   %[[PTRS:.*]] = getelementptr inbounds double, ptr %dst, <vscale x 2 x i64> %[[PTR_INDICES]]37; CHECK-NEXT:   %[[GLOAD:.*]] = call <vscale x 2 x double> @llvm.masked.gather.nxv2f64.nxv2p0(<vscale x 2 x ptr> align 8 %[[PTRS]],38; CHECK-NEXT:   %[[VALS:.*]] = fadd <vscale x 2 x double> %[[GLOAD]],39; CHECK-NEXT:  call void @llvm.masked.scatter.nxv2f64.nxv2p0(<vscale x 2 x double> %[[VALS]], <vscale x 2 x ptr> align 8 %[[PTRS]],40entry:41  br label %for.body42 43for.body:                                         ; preds = %entry, %for.body44  %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ]45  %mul = mul nuw nsw i64 %i.05, 746  %arrayidx = getelementptr inbounds double, ptr %dst, i64 %mul47  %0 = load double, ptr %arrayidx, align 848  %add = fadd double %0, 1.000000e+0049  store double %add, ptr %arrayidx, align 850  %inc = add nuw nsw i64 %i.05, 151  %exitcond.not = icmp eq i64 %inc, %n52  br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !653 54for.end:                                          ; preds = %for.end.loopexit, %entry55  ret void56}57 58 59define void @cond_stride7_f64(ptr noalias nocapture %dst, ptr noalias nocapture readonly %cond, i64 %n) #0 {60; CHECK-LABEL: @cond_stride7_f64(61; CHECK:      vector.body62; CHECK:        %[[MASK:.*]] = icmp ne <vscale x 2 x i64>63; CHECK:        %[[PTRS:.*]] = getelementptr inbounds double, ptr %dst, <vscale x 2 x i64> %{{.*}}64; CHECK-NEXT:   %[[GLOAD:.*]] = call <vscale x 2 x double> @llvm.masked.gather.nxv2f64.nxv2p0(<vscale x 2 x ptr> align 8 %[[PTRS]], <vscale x 2 x i1> %[[MASK]]65; CHECK-NEXT:   %[[VALS:.*]] = fadd <vscale x 2 x double> %[[GLOAD]],66; CHECK-NEXT:  call void @llvm.masked.scatter.nxv2f64.nxv2p0(<vscale x 2 x double> %[[VALS]], <vscale x 2 x ptr> align 8 %[[PTRS]], <vscale x 2 x i1> %[[MASK]])67entry:68  br label %for.body69 70for.body:                                         ; preds = %entry, %for.inc71  %i.07 = phi i64 [ %inc, %for.inc ], [ 0, %entry ]72  %arrayidx = getelementptr inbounds i64, ptr %cond, i64 %i.0773  %0 = load i64, ptr %arrayidx, align 874  %tobool.not = icmp eq i64 %0, 075  br i1 %tobool.not, label %for.inc, label %if.then76 77if.then:                                          ; preds = %for.body78  %mul = mul nsw i64 %i.07, 779  %arrayidx1 = getelementptr inbounds double, ptr %dst, i64 %mul80  %1 = load double, ptr %arrayidx1, align 881  %add = fadd double %1, 1.000000e+0082  store double %add, ptr %arrayidx1, align 883  br label %for.inc84 85for.inc:                                          ; preds = %for.body, %if.then86  %inc = add nuw nsw i64 %i.07, 187  %exitcond.not = icmp eq i64 %inc, %n88  br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !689 90for.end:                                          ; preds = %for.end.loopexit, %entry91  ret void92}93 94attributes #0 = { vscale_range(1, 16) }95!0 = distinct !{!0, !1, !2, !3, !4, !5}96!1 = !{!"llvm.loop.mustprogress"}97!2 = !{!"llvm.loop.vectorize.width", i32 4}98!3 = !{!"llvm.loop.vectorize.scalable.enable", i1 true}99!4 = !{!"llvm.loop.interleave.count", i32 1}100!5 = !{!"llvm.loop.vectorize.enable", i1 true}101!6 = distinct !{!6, !1, !7, !3, !4, !5}102!7 = !{!"llvm.loop.vectorize.width", i32 2}103