102 lines · plain
1; RUN: opt -passes=loop-vectorize -debug-only=loop-vectorize -enable-arm-maskedgatscat -tail-predication=force-enabled -disable-output < %s 2>&1 | FileCheck %s --check-prefixes=CHECK-COST,CHECK-COST-22; REQUIRES: asserts3 4target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"5target triple = "thumbv8.1m.main-none-none-eabi"6 7define void @pred_loop(ptr %off, ptr %data, ptr %dst, i32 %n) #0 {8 9; CHECK-COST: LV: Found an estimated cost of 0 for VF 1 For instruction: %i.09 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]10; CHECK-COST-NEXT: LV: Found an estimated cost of 1 for VF 1 For instruction: %add = add nuw nsw i32 %i.09, 111; CHECK-COST-NEXT: LV: Found an estimated cost of 0 for VF 1 For instruction: %arrayidx = getelementptr inbounds i32, ptr %data, i32 %add12; CHECK-COST-NEXT: LV: Found an estimated cost of 1 for VF 1 For instruction: %0 = load i32, ptr %arrayidx, align 413; CHECK-COST-NEXT: LV: Found an estimated cost of 1 for VF 1 For instruction: %add1 = add nsw i32 %0, 514; CHECK-COST-NEXT: LV: Found an estimated cost of 0 for VF 1 For instruction: %arrayidx2 = getelementptr inbounds i32, ptr %dst, i32 %i.0915; CHECK-COST-NEXT: LV: Found an estimated cost of 1 for VF 1 For instruction: store i32 %add1, ptr %arrayidx2, align 416; CHECK-COST-NEXT: LV: Found an estimated cost of 1 for VF 1 For instruction: %exitcond.not = icmp eq i32 %add, %n17; CHECK-COST-NEXT: LV: Found an estimated cost of 0 for VF 1 For instruction: br i1 %exitcond.not, label %exit.loopexit, label %for.body18; CHECK-COST-NEXT: LV: Scalar loop costs: 5.19 20entry:21 %cmp8 = icmp sgt i32 %n, 022 br i1 %cmp8, label %for.body, label %exit23 24exit: ; preds = %for.body, %entry25 ret void26 27for.body: ; preds = %entry, %for.body28 %i.09 = phi i32 [ %add, %for.body ], [ 0, %entry ]29 %add = add nuw nsw i32 %i.09, 130 %arrayidx = getelementptr inbounds i32, ptr %data, i32 %add31 %0 = load i32, ptr %arrayidx, align 432 %add1 = add nsw i32 %0, 533 %arrayidx2 = getelementptr inbounds i32, ptr %dst, i32 %i.0934 store i32 %add1, ptr %arrayidx2, align 435 %exitcond.not = icmp eq i32 %add, %n36 br i1 %exitcond.not, label %exit, label %for.body37}38 39define void @if_convert(ptr %a, ptr %b, i32 %start, i32 %end) #0 {40 41; CHECK-COST-2: LV: Found an estimated cost of 0 for VF 1 For instruction: %i.032 = phi i32 [ %inc, %if.end ], [ %start, %for.body.preheader ]42; CHECK-COST-2-NEXT: LV: Found an estimated cost of 0 for VF 1 For instruction: %arrayidx = getelementptr inbounds i32, ptr %a, i32 %i.03243; CHECK-COST-2-NEXT: LV: Found an estimated cost of 1 for VF 1 For instruction: %0 = load i32, ptr %arrayidx, align 444; CHECK-COST-2-NEXT: LV: Found an estimated cost of 0 for VF 1 For instruction: %arrayidx2 = getelementptr inbounds i32, ptr %b, i32 %i.03245; CHECK-COST-2-NEXT: LV: Found an estimated cost of 1 for VF 1 For instruction: %1 = load i32, ptr %arrayidx2, align 446; CHECK-COST-2-NEXT: LV: Found an estimated cost of 1 for VF 1 For instruction: %cmp3 = icmp sgt i32 %0, %147; CHECK-COST-2-NEXT: LV: Found an estimated cost of 0 for VF 1 For instruction: br i1 %cmp3, label %if.then, label %if.end48; CHECK-COST-2-NEXT: LV: Found an estimated cost of 1 for VF 1 For instruction: %mul = mul nsw i32 %0, 549; CHECK-COST-2-NEXT: LV: Found an estimated cost of 1 for VF 1 For instruction: %add = add nsw i32 %mul, 350; CHECK-COST-2-NEXT: LV: Found an estimated cost of 0 for VF 1 For instruction: %factor = shl i32 %add, 151; CHECK-COST-2-NEXT: LV: Found an estimated cost of 1 for VF 1 For instruction: %sub = sub i32 %0, %152; CHECK-COST-2-NEXT: LV: Found an estimated cost of 1 for VF 1 For instruction: %add7 = add i32 %sub, %factor53; CHECK-COST-2-NEXT: LV: Found an estimated cost of 1 for VF 1 For instruction: store i32 %add7, ptr %arrayidx2, align 454; CHECK-COST-2-NEXT: LV: Found an estimated cost of 0 for VF 1 For instruction: br label %if.end55; CHECK-COST-2-NEXT: LV: Found an estimated cost of 0 for VF 1 For instruction: %k.0 = phi i32 [ %add, %if.then ], [ %0, %for.body ]56; CHECK-COST-2-NEXT: LV: Found an estimated cost of 1 for VF 1 For instruction: store i32 %k.0, ptr %arrayidx, align 457; CHECK-COST-2-NEXT: LV: Found an estimated cost of 1 for VF 1 For instruction: %inc = add nsw i32 %i.032, 158; CHECK-COST-2-NEXT: LV: Found an estimated cost of 1 for VF 1 For instruction: %exitcond.not = icmp eq i32 %inc, %end59; CHECK-COST-2-NEXT: LV: Found an estimated cost of 0 for VF 1 For instruction: br i1 %exitcond.not, label %for.cond.cleanup.loopexit, label %for.body60; CHECK-COST-2-NEXT: LV: Scalar loop costs: 8.61 62entry:63 %cmp31 = icmp slt i32 %start, %end64 br i1 %cmp31, label %for.body.preheader, label %for.cond.cleanup65 66for.body.preheader: ; preds = %entry67 br label %for.body68 69for.cond.cleanup.loopexit: ; preds = %if.end70 br label %for.cond.cleanup71 72for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry73 ret void74 75for.body: ; preds = %for.body.preheader, %if.end76 %i.032 = phi i32 [ %inc, %if.end ], [ %start, %for.body.preheader ]77 %arrayidx = getelementptr inbounds i32, ptr %a, i32 %i.03278 %0 = load i32, ptr %arrayidx, align 479 %arrayidx2 = getelementptr inbounds i32, ptr %b, i32 %i.03280 %1 = load i32, ptr %arrayidx2, align 481 %cmp3 = icmp sgt i32 %0, %182 br i1 %cmp3, label %if.then, label %if.end83 84if.then: ; preds = %for.body85 %mul = mul nsw i32 %0, 586 %add = add nsw i32 %mul, 387 %factor = shl i32 %add, 188 %sub = sub i32 %0, %189 %add7 = add i32 %sub, %factor90 store i32 %add7, ptr %arrayidx2, align 491 br label %if.end92 93if.end: ; preds = %if.then, %for.body94 %k.0 = phi i32 [ %add, %if.then ], [ %0, %for.body ]95 store i32 %k.0, ptr %arrayidx, align 496 %inc = add nsw i32 %i.032, 197 %exitcond.not = icmp eq i32 %inc, %end98 br i1 %exitcond.not, label %for.cond.cleanup.loopexit, label %for.body99}100 101attributes #0 = { "target-features"="+armv8.1-m.main,+dsp,+fp-armv8d16sp,+fp16,+fullfp16,+hwdiv,+lob,+mve,+mve.fp,+ras,+strict-align,+thumb-mode,+vfp2sp,+vfp3d16sp,+vfp4d16sp"}102