1 ; Check that we won't interleave by more than "best known" estimated trip count.
3 ; The loop is expected to be vectorized by 4 and interleaving suppresed due to
4 ; short trip count which is controled by "tiny-trip-count-interleave-threshold".
5 ; RUN: opt -passes=loop-vectorize -force-vector-width=4 -vectorizer-min-trip-count=4 -S < %s | FileCheck %s
7 ; The loop is expected to be vectorized by 4 and computed interleaving factor is 1.
8 ; Thus the resulting step is 4.
9 ; RUN: opt -passes=loop-vectorize -force-vector-width=4 -vectorizer-min-trip-count=4 -tiny-trip-count-interleave-threshold=4 -S < %s | FileCheck %s
11 ; The loop is expected to be vectorized by 2 and computed interleaving factor is 2.
12 ; Thus the resulting step is 4.
13 ; RUN: opt -passes=loop-vectorize -force-vector-width=2 -vectorizer-min-trip-count=4 -tiny-trip-count-interleave-threshold=4 -S < %s | FileCheck %s
15 ; Check that we won't interleave by more than "best known" estimated trip count.
17 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
18 target triple = "x86_64-unknown-linux-gnu"
20 @a = dso_local global [5 x i32] zeroinitializer, align 16
21 @b = dso_local global [5 x i32] zeroinitializer, align 16
23 ; Function Attrs: nofree norecurse nounwind uwtable
24 define dso_local void @_Z3fooi(i32 %M) local_unnamed_addr {
25 ; CHECK-LABEL: @_Z3fooi(
26 ; CHECK: [[VECTOR_BODY:vector\.body]]:
27 ; CHECK: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH:%.*]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
28 ; CHECK: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4
31 %cmp8 = icmp sgt i32 %M, 0
32 br i1 %cmp8, label %for.body.preheader, label %for.cond.cleanup
34 for.body.preheader: ; preds = %entry
35 %wide.trip.count = zext i32 %M to i64
38 for.cond.cleanup.loopexit: ; preds = %for.body
39 br label %for.cond.cleanup
41 for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
44 for.body: ; preds = %for.body, %for.body.preheader
45 %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
46 %arrayidx = getelementptr inbounds [5 x i32], [5 x i32]* @b, i64 0, i64 %indvars.iv
47 %0 = load i32, i32* %arrayidx, align 4
48 %1 = trunc i64 %indvars.iv to i32
49 %mul = mul nsw i32 %0, %1
50 %arrayidx2 = getelementptr inbounds [5 x i32], [5 x i32]* @a, i64 0, i64 %indvars.iv
51 %2 = load i32, i32* %arrayidx2, align 4
52 %add = add nsw i32 %2, %mul
53 store i32 %add, i32* %arrayidx2, align 4
54 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
55 %exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count
56 br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body, !prof !1
59 !1 = !{!"branch_weights", i32 1, i32 5}