1 ; RUN: opt -loop-vectorize -vectorizer-maximize-bandwidth -mcpu=corei7-avx -debug-only=loop-vectorize -S < %s 2>&1 | FileCheck %s
4 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-unknown-linux-gnu"
7 @a = global [1000 x i8] zeroinitializer, align 16
8 @b = global [1000 x i8] zeroinitializer, align 16
9 @c = global [1000 x i8] zeroinitializer, align 16
10 @u = global [1000 x i32] zeroinitializer, align 16
11 @v = global [1000 x i32] zeroinitializer, align 16
12 @w = global [1000 x i32] zeroinitializer, align 16
14 ; Tests that the vectorization factor is determined by the smallest instead of
15 ; widest type in the loop for maximum bandwidth when
16 ; -vectorizer-maximize-bandwidth is indicated.
19 ; CHECK: LV: Selecting VF: 16.
28 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
29 %arrayidx = getelementptr inbounds [1000 x i8], [1000 x i8]* @b, i64 0, i64 %indvars.iv
30 %0 = load i8, i8* %arrayidx, align 1
31 %arrayidx2 = getelementptr inbounds [1000 x i8], [1000 x i8]* @c, i64 0, i64 %indvars.iv
32 %1 = load i8, i8* %arrayidx2, align 1
34 %arrayidx6 = getelementptr inbounds [1000 x i8], [1000 x i8]* @a, i64 0, i64 %indvars.iv
35 store i8 %add, i8* %arrayidx6, align 1
36 %arrayidx8 = getelementptr inbounds [1000 x i32], [1000 x i32]* @v, i64 0, i64 %indvars.iv
37 %2 = load i32, i32* %arrayidx8, align 4
38 %arrayidx10 = getelementptr inbounds [1000 x i32], [1000 x i32]* @w, i64 0, i64 %indvars.iv
39 %3 = load i32, i32* %arrayidx10, align 4
40 %add11 = add nsw i32 %3, %2
41 %arrayidx13 = getelementptr inbounds [1000 x i32], [1000 x i32]* @u, i64 0, i64 %indvars.iv
42 store i32 %add11, i32* %arrayidx13, align 4
43 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
44 %exitcond = icmp eq i64 %indvars.iv.next, 1000
45 br i1 %exitcond, label %for.cond.cleanup, label %for.body