1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --filter "LV: Found an estimated cost of [0-9]+ for VF [0-9]+ For instruction:\s*store double %v., ptr %out."
2 ; RUN: opt -passes=loop-vectorize -vectorizer-maximize-bandwidth -S -mattr=+sse2 --debug-only=loop-vectorize < %s 2>&1 | FileCheck %s --check-prefix=SSE2
3 ; RUN: opt -passes=loop-vectorize -vectorizer-maximize-bandwidth -S -mattr=+avx --debug-only=loop-vectorize < %s 2>&1 | FileCheck %s --check-prefix=AVX1
4 ; RUN: opt -passes=loop-vectorize -vectorizer-maximize-bandwidth -S -mattr=+avx2 --debug-only=loop-vectorize < %s 2>&1 | FileCheck %s --check-prefix=AVX2
5 ; RUN: opt -passes=loop-vectorize -vectorizer-maximize-bandwidth -S -mattr=+avx512vl --debug-only=loop-vectorize < %s 2>&1 | FileCheck %s --check-prefix=AVX512
8 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
9 target triple = "x86_64-unknown-linux-gnu"
11 @A = global [1024 x i8] zeroinitializer, align 128
12 @B = global [1024 x double] zeroinitializer, align 128
16 ; SSE2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v0, ptr %out0, align 8
17 ; SSE2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v1, ptr %out1, align 8
18 ; SSE2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v2, ptr %out2, align 8
19 ; SSE2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v3, ptr %out3, align 8
20 ; SSE2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v4, ptr %out4, align 8
21 ; SSE2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v5, ptr %out5, align 8
22 ; SSE2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v6, ptr %out6, align 8
23 ; SSE2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v7, ptr %out7, align 8
24 ; SSE2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v0, ptr %out0, align 8
25 ; SSE2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v1, ptr %out1, align 8
26 ; SSE2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v2, ptr %out2, align 8
27 ; SSE2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v3, ptr %out3, align 8
28 ; SSE2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v4, ptr %out4, align 8
29 ; SSE2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v5, ptr %out5, align 8
30 ; SSE2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v6, ptr %out6, align 8
31 ; SSE2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v7, ptr %out7, align 8
32 ; SSE2: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v0, ptr %out0, align 8
33 ; SSE2: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v1, ptr %out1, align 8
34 ; SSE2: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v2, ptr %out2, align 8
35 ; SSE2: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v3, ptr %out3, align 8
36 ; SSE2: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v4, ptr %out4, align 8
37 ; SSE2: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v5, ptr %out5, align 8
38 ; SSE2: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v6, ptr %out6, align 8
39 ; SSE2: LV: Found an estimated cost of 24 for VF 2 For instruction: store double %v7, ptr %out7, align 8
40 ; SSE2: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v0, ptr %out0, align 8
41 ; SSE2: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v1, ptr %out1, align 8
42 ; SSE2: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v2, ptr %out2, align 8
43 ; SSE2: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v3, ptr %out3, align 8
44 ; SSE2: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v4, ptr %out4, align 8
45 ; SSE2: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v5, ptr %out5, align 8
46 ; SSE2: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v6, ptr %out6, align 8
47 ; SSE2: LV: Found an estimated cost of 48 for VF 4 For instruction: store double %v7, ptr %out7, align 8
50 ; AVX1: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v0, ptr %out0, align 8
51 ; AVX1: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v1, ptr %out1, align 8
52 ; AVX1: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v2, ptr %out2, align 8
53 ; AVX1: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v3, ptr %out3, align 8
54 ; AVX1: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v4, ptr %out4, align 8
55 ; AVX1: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v5, ptr %out5, align 8
56 ; AVX1: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v6, ptr %out6, align 8
57 ; AVX1: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v7, ptr %out7, align 8
58 ; AVX1: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v0, ptr %out0, align 8
59 ; AVX1: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v1, ptr %out1, align 8
60 ; AVX1: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v2, ptr %out2, align 8
61 ; AVX1: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v3, ptr %out3, align 8
62 ; AVX1: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v4, ptr %out4, align 8
63 ; AVX1: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v5, ptr %out5, align 8
64 ; AVX1: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v6, ptr %out6, align 8
65 ; AVX1: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v7, ptr %out7, align 8
66 ; AVX1: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v0, ptr %out0, align 8
67 ; AVX1: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v1, ptr %out1, align 8
68 ; AVX1: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v2, ptr %out2, align 8
69 ; AVX1: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v3, ptr %out3, align 8
70 ; AVX1: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v4, ptr %out4, align 8
71 ; AVX1: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v5, ptr %out5, align 8
72 ; AVX1: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v6, ptr %out6, align 8
73 ; AVX1: LV: Found an estimated cost of 24 for VF 2 For instruction: store double %v7, ptr %out7, align 8
74 ; AVX1: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v0, ptr %out0, align 8
75 ; AVX1: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v1, ptr %out1, align 8
76 ; AVX1: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v2, ptr %out2, align 8
77 ; AVX1: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v3, ptr %out3, align 8
78 ; AVX1: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v4, ptr %out4, align 8
79 ; AVX1: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v5, ptr %out5, align 8
80 ; AVX1: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v6, ptr %out6, align 8
81 ; AVX1: LV: Found an estimated cost of 56 for VF 4 For instruction: store double %v7, ptr %out7, align 8
82 ; AVX1: LV: Found an estimated cost of 0 for VF 8 For instruction: store double %v0, ptr %out0, align 8
83 ; AVX1: LV: Found an estimated cost of 0 for VF 8 For instruction: store double %v1, ptr %out1, align 8
84 ; AVX1: LV: Found an estimated cost of 0 for VF 8 For instruction: store double %v2, ptr %out2, align 8
85 ; AVX1: LV: Found an estimated cost of 0 for VF 8 For instruction: store double %v3, ptr %out3, align 8
86 ; AVX1: LV: Found an estimated cost of 0 for VF 8 For instruction: store double %v4, ptr %out4, align 8
87 ; AVX1: LV: Found an estimated cost of 0 for VF 8 For instruction: store double %v5, ptr %out5, align 8
88 ; AVX1: LV: Found an estimated cost of 0 for VF 8 For instruction: store double %v6, ptr %out6, align 8
89 ; AVX1: LV: Found an estimated cost of 112 for VF 8 For instruction: store double %v7, ptr %out7, align 8
92 ; AVX2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v0, ptr %out0, align 8
93 ; AVX2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v1, ptr %out1, align 8
94 ; AVX2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v2, ptr %out2, align 8
95 ; AVX2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v3, ptr %out3, align 8
96 ; AVX2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v4, ptr %out4, align 8
97 ; AVX2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v5, ptr %out5, align 8
98 ; AVX2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v6, ptr %out6, align 8
99 ; AVX2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v7, ptr %out7, align 8
100 ; AVX2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v0, ptr %out0, align 8
101 ; AVX2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v1, ptr %out1, align 8
102 ; AVX2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v2, ptr %out2, align 8
103 ; AVX2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v3, ptr %out3, align 8
104 ; AVX2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v4, ptr %out4, align 8
105 ; AVX2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v5, ptr %out5, align 8
106 ; AVX2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v6, ptr %out6, align 8
107 ; AVX2: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v7, ptr %out7, align 8
108 ; AVX2: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v0, ptr %out0, align 8
109 ; AVX2: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v1, ptr %out1, align 8
110 ; AVX2: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v2, ptr %out2, align 8
111 ; AVX2: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v3, ptr %out3, align 8
112 ; AVX2: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v4, ptr %out4, align 8
113 ; AVX2: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v5, ptr %out5, align 8
114 ; AVX2: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v6, ptr %out6, align 8
115 ; AVX2: LV: Found an estimated cost of 24 for VF 2 For instruction: store double %v7, ptr %out7, align 8
116 ; AVX2: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v0, ptr %out0, align 8
117 ; AVX2: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v1, ptr %out1, align 8
118 ; AVX2: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v2, ptr %out2, align 8
119 ; AVX2: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v3, ptr %out3, align 8
120 ; AVX2: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v4, ptr %out4, align 8
121 ; AVX2: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v5, ptr %out5, align 8
122 ; AVX2: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v6, ptr %out6, align 8
123 ; AVX2: LV: Found an estimated cost of 56 for VF 4 For instruction: store double %v7, ptr %out7, align 8
124 ; AVX2: LV: Found an estimated cost of 0 for VF 8 For instruction: store double %v0, ptr %out0, align 8
125 ; AVX2: LV: Found an estimated cost of 0 for VF 8 For instruction: store double %v1, ptr %out1, align 8
126 ; AVX2: LV: Found an estimated cost of 0 for VF 8 For instruction: store double %v2, ptr %out2, align 8
127 ; AVX2: LV: Found an estimated cost of 0 for VF 8 For instruction: store double %v3, ptr %out3, align 8
128 ; AVX2: LV: Found an estimated cost of 0 for VF 8 For instruction: store double %v4, ptr %out4, align 8
129 ; AVX2: LV: Found an estimated cost of 0 for VF 8 For instruction: store double %v5, ptr %out5, align 8
130 ; AVX2: LV: Found an estimated cost of 0 for VF 8 For instruction: store double %v6, ptr %out6, align 8
131 ; AVX2: LV: Found an estimated cost of 112 for VF 8 For instruction: store double %v7, ptr %out7, align 8
133 ; AVX512-LABEL: 'test'
134 ; AVX512: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v0, ptr %out0, align 8
135 ; AVX512: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v1, ptr %out1, align 8
136 ; AVX512: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v2, ptr %out2, align 8
137 ; AVX512: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v3, ptr %out3, align 8
138 ; AVX512: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v4, ptr %out4, align 8
139 ; AVX512: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v5, ptr %out5, align 8
140 ; AVX512: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v6, ptr %out6, align 8
141 ; AVX512: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v7, ptr %out7, align 8
142 ; AVX512: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v0, ptr %out0, align 8
143 ; AVX512: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v1, ptr %out1, align 8
144 ; AVX512: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v2, ptr %out2, align 8
145 ; AVX512: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v3, ptr %out3, align 8
146 ; AVX512: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v4, ptr %out4, align 8
147 ; AVX512: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v5, ptr %out5, align 8
148 ; AVX512: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v6, ptr %out6, align 8
149 ; AVX512: LV: Found an estimated cost of 1 for VF 1 For instruction: store double %v7, ptr %out7, align 8
150 ; AVX512: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v0, ptr %out0, align 8
151 ; AVX512: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v1, ptr %out1, align 8
152 ; AVX512: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v2, ptr %out2, align 8
153 ; AVX512: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v3, ptr %out3, align 8
154 ; AVX512: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v4, ptr %out4, align 8
155 ; AVX512: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v5, ptr %out5, align 8
156 ; AVX512: LV: Found an estimated cost of 0 for VF 2 For instruction: store double %v6, ptr %out6, align 8
157 ; AVX512: LV: Found an estimated cost of 23 for VF 2 For instruction: store double %v7, ptr %out7, align 8
158 ; AVX512: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v0, ptr %out0, align 8
159 ; AVX512: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v1, ptr %out1, align 8
160 ; AVX512: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v2, ptr %out2, align 8
161 ; AVX512: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v3, ptr %out3, align 8
162 ; AVX512: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v4, ptr %out4, align 8
163 ; AVX512: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v5, ptr %out5, align 8
164 ; AVX512: LV: Found an estimated cost of 0 for VF 4 For instruction: store double %v6, ptr %out6, align 8
165 ; AVX512: LV: Found an estimated cost of 46 for VF 4 For instruction: store double %v7, ptr %out7, align 8
166 ; AVX512: LV: Found an estimated cost of 10 for VF 8 For instruction: store double %v0, ptr %out0, align 8
167 ; AVX512: LV: Found an estimated cost of 10 for VF 8 For instruction: store double %v1, ptr %out1, align 8
168 ; AVX512: LV: Found an estimated cost of 10 for VF 8 For instruction: store double %v2, ptr %out2, align 8
169 ; AVX512: LV: Found an estimated cost of 10 for VF 8 For instruction: store double %v3, ptr %out3, align 8
170 ; AVX512: LV: Found an estimated cost of 10 for VF 8 For instruction: store double %v4, ptr %out4, align 8
171 ; AVX512: LV: Found an estimated cost of 10 for VF 8 For instruction: store double %v5, ptr %out5, align 8
172 ; AVX512: LV: Found an estimated cost of 10 for VF 8 For instruction: store double %v6, ptr %out6, align 8
173 ; AVX512: LV: Found an estimated cost of 10 for VF 8 For instruction: store double %v7, ptr %out7, align 8
174 ; AVX512: LV: Found an estimated cost of 20 for VF 16 For instruction: store double %v0, ptr %out0, align 8
175 ; AVX512: LV: Found an estimated cost of 20 for VF 16 For instruction: store double %v1, ptr %out1, align 8
176 ; AVX512: LV: Found an estimated cost of 20 for VF 16 For instruction: store double %v2, ptr %out2, align 8
177 ; AVX512: LV: Found an estimated cost of 20 for VF 16 For instruction: store double %v3, ptr %out3, align 8
178 ; AVX512: LV: Found an estimated cost of 20 for VF 16 For instruction: store double %v4, ptr %out4, align 8
179 ; AVX512: LV: Found an estimated cost of 20 for VF 16 For instruction: store double %v5, ptr %out5, align 8
180 ; AVX512: LV: Found an estimated cost of 20 for VF 16 For instruction: store double %v6, ptr %out6, align 8
181 ; AVX512: LV: Found an estimated cost of 20 for VF 16 For instruction: store double %v7, ptr %out7, align 8
187 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
189 %iv.0 = add nuw nsw i64 %iv, 0
190 %iv.1 = add nuw nsw i64 %iv, 1
191 %iv.2 = add nuw nsw i64 %iv, 2
192 %iv.3 = add nuw nsw i64 %iv, 3
193 %iv.4 = add nuw nsw i64 %iv, 4
194 %iv.5 = add nuw nsw i64 %iv, 5
195 %iv.6 = add nuw nsw i64 %iv, 6
196 %iv.7 = add nuw nsw i64 %iv, 7
198 %in = getelementptr inbounds [1024 x i8], ptr @A, i64 0, i64 %iv.0
199 %v.narrow = load i8, ptr %in
201 %v = uitofp i8 %v.narrow to double
203 %v0 = fadd double %v, 0.0
204 %v1 = fadd double %v, 1.0
205 %v2 = fadd double %v, 2.0
206 %v3 = fadd double %v, 3.0
207 %v4 = fadd double %v, 4.0
208 %v5 = fadd double %v, 5.0
209 %v6 = fadd double %v, 6.0
210 %v7 = fadd double %v, 7.0
212 %out0 = getelementptr inbounds [1024 x double], ptr @B, i64 0, i64 %iv.0
213 %out1 = getelementptr inbounds [1024 x double], ptr @B, i64 0, i64 %iv.1
214 %out2 = getelementptr inbounds [1024 x double], ptr @B, i64 0, i64 %iv.2
215 %out3 = getelementptr inbounds [1024 x double], ptr @B, i64 0, i64 %iv.3
216 %out4 = getelementptr inbounds [1024 x double], ptr @B, i64 0, i64 %iv.4
217 %out5 = getelementptr inbounds [1024 x double], ptr @B, i64 0, i64 %iv.5
218 %out6 = getelementptr inbounds [1024 x double], ptr @B, i64 0, i64 %iv.6
219 %out7 = getelementptr inbounds [1024 x double], ptr @B, i64 0, i64 %iv.7
221 store double %v0, ptr %out0
222 store double %v1, ptr %out1
223 store double %v2, ptr %out2
224 store double %v3, ptr %out3
225 store double %v4, ptr %out4
226 store double %v5, ptr %out5
227 store double %v6, ptr %out6
228 store double %v7, ptr %out7
230 %iv.next = add nuw nsw i64 %iv.0, 8
231 %cmp = icmp ult i64 %iv.next, 1024
232 br i1 %cmp, label %for.body, label %for.cond.cleanup