1 ; RUN: opt -loop-vectorize -vectorizer-maximize-bandwidth -S -mattr=+sse2 --debug-only=loop-vectorize < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,SSE2
2 ; RUN: opt -loop-vectorize -vectorizer-maximize-bandwidth -S -mattr=+avx --debug-only=loop-vectorize < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,AVX1
3 ; RUN: opt -loop-vectorize -vectorizer-maximize-bandwidth -S -mattr=+avx2 --debug-only=loop-vectorize < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,AVX2
4 ; RUN: opt -loop-vectorize -vectorizer-maximize-bandwidth -S -mattr=+avx512bw,+avx512vl --debug-only=loop-vectorize < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,AVX512
7 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64-unknown-linux-gnu"
10 @A = global [1024 x i8] zeroinitializer, align 128
11 @B = global [1024 x i64] zeroinitializer, align 128
13 ; CHECK: LV: Checking a loop in "test"
15 ; SSE2: LV: Found an estimated cost of 1 for VF 1 For instruction: store i64 %v5, i64* %out5, align 8
16 ; SSE2: LV: Found an estimated cost of 44 for VF 2 For instruction: store i64 %v5, i64* %out5, align 8
17 ; SSE2: LV: Found an estimated cost of 88 for VF 4 For instruction: store i64 %v5, i64* %out5, align 8
19 ; AVX1: LV: Found an estimated cost of 1 for VF 1 For instruction: store i64 %v5, i64* %out5, align 8
20 ; AVX1: LV: Found an estimated cost of 33 for VF 2 For instruction: store i64 %v5, i64* %out5, align 8
21 ; AVX1: LV: Found an estimated cost of 78 for VF 4 For instruction: store i64 %v5, i64* %out5, align 8
22 ; AVX1: LV: Found an estimated cost of 156 for VF 8 For instruction: store i64 %v5, i64* %out5, align 8
24 ; AVX2: LV: Found an estimated cost of 1 for VF 1 For instruction: store i64 %v5, i64* %out5, align 8
25 ; AVX2: LV: Found an estimated cost of 11 for VF 2 For instruction: store i64 %v5, i64* %out5, align 8
26 ; AVX2: LV: Found an estimated cost of 21 for VF 4 For instruction: store i64 %v5, i64* %out5, align 8
27 ; AVX2: LV: Found an estimated cost of 42 for VF 8 For instruction: store i64 %v5, i64* %out5, align 8
29 ; AVX512: LV: Found an estimated cost of 1 for VF 1 For instruction: store i64 %v5, i64* %out5, align 8
30 ; AVX512: LV: Found an estimated cost of 17 for VF 2 For instruction: store i64 %v5, i64* %out5, align 8
31 ; AVX512: LV: Found an estimated cost of 25 for VF 4 For instruction: store i64 %v5, i64* %out5, align 8
32 ; AVX512: LV: Found an estimated cost of 51 for VF 8 For instruction: store i64 %v5, i64* %out5, align 8
33 ; AVX512: LV: Found an estimated cost of 102 for VF 16 For instruction: store i64 %v5, i64* %out5, align 8
34 ; AVX512: LV: Found an estimated cost of 204 for VF 32 For instruction: store i64 %v5, i64* %out5, align 8
36 ; CHECK-NOT: LV: Found an estimated cost of {{[0-9]+}} for VF {{[0-9]+}} For instruction: store i64 %v5, i64* %out5, align 8
43 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
45 %iv.0 = add nuw nsw i64 %iv, 0
46 %iv.1 = add nuw nsw i64 %iv, 1
47 %iv.2 = add nuw nsw i64 %iv, 2
48 %iv.3 = add nuw nsw i64 %iv, 3
49 %iv.4 = add nuw nsw i64 %iv, 4
50 %iv.5 = add nuw nsw i64 %iv, 5
52 %in = getelementptr inbounds [1024 x i8], [1024 x i8]* @A, i64 0, i64 %iv.0
53 %v.narrow = load i8, i8* %in
55 %v = zext i8 %v.narrow to i64
64 %out0 = getelementptr inbounds [1024 x i64], [1024 x i64]* @B, i64 0, i64 %iv.0
65 %out1 = getelementptr inbounds [1024 x i64], [1024 x i64]* @B, i64 0, i64 %iv.1
66 %out2 = getelementptr inbounds [1024 x i64], [1024 x i64]* @B, i64 0, i64 %iv.2
67 %out3 = getelementptr inbounds [1024 x i64], [1024 x i64]* @B, i64 0, i64 %iv.3
68 %out4 = getelementptr inbounds [1024 x i64], [1024 x i64]* @B, i64 0, i64 %iv.4
69 %out5 = getelementptr inbounds [1024 x i64], [1024 x i64]* @B, i64 0, i64 %iv.5
71 store i64 %v0, i64* %out0
72 store i64 %v1, i64* %out1
73 store i64 %v2, i64* %out2
74 store i64 %v3, i64* %out3
75 store i64 %v4, i64* %out4
76 store i64 %v5, i64* %out5
78 %iv.next = add nuw nsw i64 %iv.0, 6
79 %cmp = icmp ult i64 %iv.next, 1024
80 br i1 %cmp, label %for.body, label %for.cond.cleanup