xref: /llvm-project/llvm/test/Transforms/LoopVectorize/RISCV/interleaved-cost.ll (revision beb12f92c71981670e07e47275efc6b5647011c1)
1; REQUIRES: asserts
2; RUN: opt -passes=loop-vectorize -mtriple=riscv64 -mattr=+v,-optimized-nf2-segment-load-store -debug-only=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s --check-prefix=NO-OPT
3; RUN: opt -passes=loop-vectorize -mtriple=riscv64 -mattr=+v -debug-only=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s --check-prefix=OPT-NF2
4; RUN: opt -passes=loop-vectorize -mtriple=riscv64 -mattr=+v,+optimized-nf3-segment-load-store -debug-only=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s --check-prefix=OPT-NF3
5; RUN: opt -passes=loop-vectorize -mtriple=riscv64 -mattr=+v,+optimized-nf4-segment-load-store -debug-only=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s --check-prefix=OPT-NF4
6; RUN: opt -passes=loop-vectorize -mtriple=riscv64 -mattr=+v,+optimized-nf5-segment-load-store -debug-only=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s --check-prefix=OPT-NF5
7; RUN: opt -passes=loop-vectorize -mtriple=riscv64 -mattr=+v,+optimized-nf6-segment-load-store -debug-only=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s --check-prefix=OPT-NF6
8; RUN: opt -passes=loop-vectorize -mtriple=riscv64 -mattr=+v,+optimized-nf7-segment-load-store -debug-only=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s --check-prefix=OPT-NF7
9; RUN: opt -passes=loop-vectorize -mtriple=riscv64 -mattr=+v,+optimized-nf8-segment-load-store -debug-only=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s --check-prefix=OPT-NF8
10
11%i8.2 = type {i8, i8}
12define void @i8_factor_2(ptr %data, i64 %n) {
13entry:
14  br label %for.body
15; OPT-NF2-LABEL: Checking a loop in 'i8_factor_2'
16; OPT-NF2: Cost of 3 for VF 2: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
17; OPT-NF2: Cost of 3 for VF 2: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
18; OPT-NF2: Cost of 3 for VF 4: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
19; OPT-NF2: Cost of 3 for VF 4: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
20; OPT-NF2: Cost of 3 for VF 8: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
21; OPT-NF2: Cost of 3 for VF 8: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
22; OPT-NF2: Cost of 4 for VF 16: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
23; OPT-NF2: Cost of 4 for VF 16: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
24; OPT-NF2: Cost of 8 for VF 32: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
25; OPT-NF2: Cost of 8 for VF 32: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
26; OPT-NF2: Cost of 3 for VF vscale x 1: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
27; OPT-NF2: Cost of 3 for VF vscale x 1: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
28; OPT-NF2: Cost of 3 for VF vscale x 2: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
29; OPT-NF2: Cost of 3 for VF vscale x 2: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
30; OPT-NF2: Cost of 3 for VF vscale x 4: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
31; OPT-NF2: Cost of 3 for VF vscale x 4: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
32; OPT-NF2: Cost of 4 for VF vscale x 8: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
33; OPT-NF2: Cost of 4 for VF vscale x 8: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
34; OPT-NF2: Cost of 8 for VF vscale x 16: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
35; OPT-NF2: Cost of 8 for VF vscale x 16: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
36; NO-OPT-LABEL: Checking a loop in 'i8_factor_2'
37; NO-OPT: Cost of 4 for VF 2: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
38; NO-OPT: Cost of 4 for VF 2: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
39; NO-OPT: Cost of 8 for VF 4: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
40; NO-OPT: Cost of 8 for VF 4: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
41; NO-OPT: Cost of 16 for VF 8: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
42; NO-OPT: Cost of 16 for VF 8: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
43; NO-OPT: Cost of 32 for VF 16: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
44; NO-OPT: Cost of 32 for VF 16: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
45; NO-OPT: Cost of 64 for VF 32: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
46; NO-OPT: Cost of 64 for VF 32: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
47; NO-OPT: Cost of 4 for VF vscale x 1: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
48; NO-OPT: Cost of 4 for VF vscale x 1: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
49; NO-OPT: Cost of 8 for VF vscale x 2: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
50; NO-OPT: Cost of 8 for VF vscale x 2: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
51; NO-OPT: Cost of 16 for VF vscale x 4: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
52; NO-OPT: Cost of 16 for VF vscale x 4: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
53; NO-OPT: Cost of 32 for VF vscale x 8: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
54; NO-OPT: Cost of 32 for VF vscale x 8: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
55; NO-OPT: Cost of 64 for VF vscale x 16: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
56; NO-OPT: Cost of 64 for VF vscale x 16: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
57for.body:
58  %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
59  %p0 = getelementptr inbounds %i8.2, ptr %data, i64 %i, i32 0
60  %p1 = getelementptr inbounds %i8.2, ptr %data, i64 %i, i32 1
61  %l0 = load i8, ptr %p0, align 1
62  %l1 = load i8, ptr %p1, align 1
63  %a0 = add i8 %l0, 1
64  %a1 = add i8 %l1, 2
65  store i8 %a0, ptr %p0, align 1
66  store i8 %a1, ptr %p1, align 1
67  %i.next = add nuw nsw i64 %i, 1
68  %cond = icmp slt i64 %i.next, %n
69  br i1 %cond, label %for.body, label %for.end
70
71for.end:
72  ret void
73}
74
75%i8.3 = type {i8, i8, i8}
76define void @i8_factor_3(ptr %data, i64 %n) {
77entry:
78  br label %for.body
79; OPT-NF3-LABEL: Checking a loop in 'i8_factor_3'
80; OPT-NF3: Cost of 4 for VF 2: INTERLEAVE-GROUP with factor 3 at %l0, ir<%p0>
81; OPT-NF3: Cost of 4 for VF 2: INTERLEAVE-GROUP with factor 3 at <badref>, ir<%p0>
82; OPT-NF3: Cost of 4 for VF 4: INTERLEAVE-GROUP with factor 3 at %l0, ir<%p0>
83; OPT-NF3: Cost of 4 for VF 4: INTERLEAVE-GROUP with factor 3 at <badref>, ir<%p0>
84; OPT-NF3: Cost of 5 for VF 8: INTERLEAVE-GROUP with factor 3 at %l0, ir<%p0>
85; OPT-NF3: Cost of 5 for VF 8: INTERLEAVE-GROUP with factor 3 at <badref>, ir<%p0>
86; OPT-NF3: Cost of 7 for VF 16: INTERLEAVE-GROUP with factor 3 at %l0, ir<%p0>
87; OPT-NF3: Cost of 7 for VF 16: INTERLEAVE-GROUP with factor 3 at <badref>, ir<%p0>
88; OPT-NF3: Cost of 14 for VF 32: INTERLEAVE-GROUP with factor 3 at %l0, ir<%p0>
89; OPT-NF3: Cost of 14 for VF 32: INTERLEAVE-GROUP with factor 3 at <badref>, ir<%p0>
90; NO-OPT-LABEL: Checking a loop in 'i8_factor_3'
91; NO-OPT: Cost of 6 for VF 2: INTERLEAVE-GROUP with factor 3 at %l0, ir<%p0>
92; NO-OPT: Cost of 6 for VF 2: INTERLEAVE-GROUP with factor 3 at <badref>, ir<%p0>
93; NO-OPT: Cost of 12 for VF 4: INTERLEAVE-GROUP with factor 3 at %l0, ir<%p0>
94; NO-OPT: Cost of 12 for VF 4: INTERLEAVE-GROUP with factor 3 at <badref>, ir<%p0>
95; NO-OPT: Cost of 24 for VF 8: INTERLEAVE-GROUP with factor 3 at %l0, ir<%p0>
96; NO-OPT: Cost of 24 for VF 8: INTERLEAVE-GROUP with factor 3 at <badref>, ir<%p0>
97; NO-OPT: Cost of 48 for VF 16: INTERLEAVE-GROUP with factor 3 at %l0, ir<%p0>
98; NO-OPT: Cost of 48 for VF 16: INTERLEAVE-GROUP with factor 3 at <badref>, ir<%p0>
99; NO-OPT: Cost of 96 for VF 32: INTERLEAVE-GROUP with factor 3 at %l0, ir<%p0>
100; NO-OPT: Cost of 96 for VF 32: INTERLEAVE-GROUP with factor 3 at <badref>, ir<%p0>
101for.body:
102  %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
103  %p0 = getelementptr inbounds %i8.3, ptr %data, i64 %i, i32 0
104  %p1 = getelementptr inbounds %i8.3, ptr %data, i64 %i, i32 1
105  %p2 = getelementptr inbounds %i8.3, ptr %data, i64 %i, i32 2
106  %l0 = load i8, ptr %p0, align 1
107  %l1 = load i8, ptr %p1, align 1
108  %l2 = load i8, ptr %p2, align 1
109  %a0 = add i8 %l0, 1
110  %a1 = add i8 %l1, 2
111  %a2 = add i8 %l2, 3
112  store i8 %a0, ptr %p0, align 1
113  store i8 %a1, ptr %p1, align 1
114  store i8 %a2, ptr %p2, align 1
115  %i.next = add nuw nsw i64 %i, 1
116  %cond = icmp slt i64 %i.next, %n
117  br i1 %cond, label %for.body, label %for.end
118
119for.end:
120  ret void
121}
122
123%i8.4 = type {i8, i8, i8, i8}
124define void @i8_factor_4(ptr %data, i64 %n) {
125entry:
126  br label %for.body
127; OPT-NF4-LABEL: Checking a loop in 'i8_factor_4'
128; OPT-NF4: Cost of 5 for VF 2: INTERLEAVE-GROUP with factor 4 at %l0, ir<%p0>
129; OPT-NF4: Cost of 5 for VF 2: INTERLEAVE-GROUP with factor 4 at <badref>, ir<%p0>
130; OPT-NF4: Cost of 5 for VF 4: INTERLEAVE-GROUP with factor 4 at %l0, ir<%p0>
131; OPT-NF4: Cost of 5 for VF 4: INTERLEAVE-GROUP with factor 4 at <badref>, ir<%p0>
132; OPT-NF4: Cost of 6 for VF 8: INTERLEAVE-GROUP with factor 4 at %l0, ir<%p0>
133; OPT-NF4: Cost of 6 for VF 8: INTERLEAVE-GROUP with factor 4 at <badref>, ir<%p0>
134; OPT-NF4: Cost of 8 for VF 16: INTERLEAVE-GROUP with factor 4 at %l0, ir<%p0>
135; OPT-NF4: Cost of 8 for VF 16: INTERLEAVE-GROUP with factor 4 at <badref>, ir<%p0>
136; OPT-NF4: Cost of 16 for VF 32: INTERLEAVE-GROUP with factor 4 at %l0, ir<%p0>
137; OPT-NF4: Cost of 16 for VF 32: INTERLEAVE-GROUP with factor 4 at <badref>, ir<%p0>
138; NO-OPT-LABEL: Checking a loop in 'i8_factor_4'
139; NO-OPT: Cost of 8 for VF 2: INTERLEAVE-GROUP with factor 4 at %l0, ir<%p0>
140; NO-OPT: Cost of 8 for VF 2: INTERLEAVE-GROUP with factor 4 at <badref>, ir<%p0>
141; NO-OPT: Cost of 16 for VF 4: INTERLEAVE-GROUP with factor 4 at %l0, ir<%p0>
142; NO-OPT: Cost of 16 for VF 4: INTERLEAVE-GROUP with factor 4 at <badref>, ir<%p0>
143; NO-OPT: Cost of 32 for VF 8: INTERLEAVE-GROUP with factor 4 at %l0, ir<%p0>
144; NO-OPT: Cost of 32 for VF 8: INTERLEAVE-GROUP with factor 4 at <badref>, ir<%p0>
145; NO-OPT: Cost of 64 for VF 16: INTERLEAVE-GROUP with factor 4 at %l0, ir<%p0>
146; NO-OPT: Cost of 64 for VF 16: INTERLEAVE-GROUP with factor 4 at <badref>, ir<%p0>
147; NO-OPT: Cost of 128 for VF 32: INTERLEAVE-GROUP with factor 4 at %l0, ir<%p0>
148; NO-OPT: Cost of 128 for VF 32: INTERLEAVE-GROUP with factor 4 at <badref>, ir<%p0>
149for.body:
150  %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
151  %p0 = getelementptr inbounds %i8.4, ptr %data, i64 %i, i32 0
152  %p1 = getelementptr inbounds %i8.4, ptr %data, i64 %i, i32 1
153  %p2 = getelementptr inbounds %i8.4, ptr %data, i64 %i, i32 2
154  %p3 = getelementptr inbounds %i8.4, ptr %data, i64 %i, i32 3
155  %l0 = load i8, ptr %p0, align 1
156  %l1 = load i8, ptr %p1, align 1
157  %l2 = load i8, ptr %p2, align 1
158  %l3 = load i8, ptr %p3, align 1
159  %a0 = add i8 %l0, 1
160  %a1 = add i8 %l1, 2
161  %a2 = add i8 %l2, 3
162  %a3 = add i8 %l3, 4
163  store i8 %a0, ptr %p0, align 1
164  store i8 %a1, ptr %p1, align 1
165  store i8 %a2, ptr %p2, align 1
166  store i8 %a3, ptr %p3, align 1
167  %i.next = add nuw nsw i64 %i, 1
168  %cond = icmp slt i64 %i.next, %n
169  br i1 %cond, label %for.body, label %for.end
170
171for.end:
172  ret void
173}
174
175%i8.5 = type {i8, i8, i8, i8, i8}
176define void @i8_factor_5(ptr %data, i64 %n) {
177entry:
178  br label %for.body
179; OPT-NF5-LABEL: Checking a loop in 'i8_factor_5'
180; OPT-NF5: Cost of 6 for VF 2: INTERLEAVE-GROUP with factor 5 at %l0, ir<%p0>
181; OPT-NF5: Cost of 6 for VF 2: INTERLEAVE-GROUP with factor 5 at <badref>, ir<%p0>
182; OPT-NF5: Cost of 7 for VF 4: INTERLEAVE-GROUP with factor 5 at %l0, ir<%p0>
183; OPT-NF5: Cost of 7 for VF 4: INTERLEAVE-GROUP with factor 5 at <badref>, ir<%p0>
184; OPT-NF5: Cost of 9 for VF 8: INTERLEAVE-GROUP with factor 5 at %l0, ir<%p0>
185; OPT-NF5: Cost of 9 for VF 8: INTERLEAVE-GROUP with factor 5 at <badref>, ir<%p0>
186; OPT-NF5: Cost of 13 for VF 16: INTERLEAVE-GROUP with factor 5 at %l0, ir<%p0>
187; OPT-NF5: Cost of 13 for VF 16: INTERLEAVE-GROUP with factor 5 at <badref>, ir<%p0>
188; NO-OPT-LABEL: Checking a loop in 'i8_factor_5'
189; NO-OPT: Cost of 10 for VF 2: INTERLEAVE-GROUP with factor 5 at %l0, ir<%p0>
190; NO-OPT: Cost of 10 for VF 2: INTERLEAVE-GROUP with factor 5 at <badref>, ir<%p0>
191; NO-OPT: Cost of 20 for VF 4: INTERLEAVE-GROUP with factor 5 at %l0, ir<%p0>
192; NO-OPT: Cost of 20 for VF 4: INTERLEAVE-GROUP with factor 5 at <badref>, ir<%p0>
193; NO-OPT: Cost of 40 for VF 8: INTERLEAVE-GROUP with factor 5 at %l0, ir<%p0>
194; NO-OPT: Cost of 40 for VF 8: INTERLEAVE-GROUP with factor 5 at <badref>, ir<%p0>
195; NO-OPT: Cost of 80 for VF 16: INTERLEAVE-GROUP with factor 5 at %l0, ir<%p0>
196; NO-OPT: Cost of 80 for VF 16: INTERLEAVE-GROUP with factor 5 at <badref>, ir<%p0>
197for.body:
198  %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
199  %p0 = getelementptr inbounds %i8.5, ptr %data, i64 %i, i32 0
200  %p1 = getelementptr inbounds %i8.5, ptr %data, i64 %i, i32 1
201  %p2 = getelementptr inbounds %i8.5, ptr %data, i64 %i, i32 2
202  %p3 = getelementptr inbounds %i8.5, ptr %data, i64 %i, i32 3
203  %p4 = getelementptr inbounds %i8.5, ptr %data, i64 %i, i32 4
204  %l0 = load i8, ptr %p0, align 1
205  %l1 = load i8, ptr %p1, align 1
206  %l2 = load i8, ptr %p2, align 1
207  %l3 = load i8, ptr %p3, align 1
208  %l4 = load i8, ptr %p4, align 1
209  %a0 = add i8 %l0, 1
210  %a1 = add i8 %l1, 2
211  %a2 = add i8 %l2, 3
212  %a3 = add i8 %l3, 4
213  %a4 = add i8 %l4, 5
214  store i8 %a0, ptr %p0, align 1
215  store i8 %a1, ptr %p1, align 1
216  store i8 %a2, ptr %p2, align 1
217  store i8 %a3, ptr %p3, align 1
218  store i8 %a4, ptr %p4, align 1
219  %i.next = add nuw nsw i64 %i, 1
220  %cond = icmp slt i64 %i.next, %n
221  br i1 %cond, label %for.body, label %for.end
222
223for.end:
224  ret void
225}
226
227%i8.6 = type {i8, i8, i8, i8, i8, i8}
228define void @i8_factor_6(ptr %data, i64 %n) {
229entry:
230  br label %for.body
231; OPT-NF6-LABEL: Checking a loop in 'i8_factor_6'
232; OPT-NF6: Cost of 7 for VF 2: INTERLEAVE-GROUP with factor 6 at %l0, ir<%p0>
233; OPT-NF6: Cost of 7 for VF 2: INTERLEAVE-GROUP with factor 6 at <badref>, ir<%p0>
234; OPT-NF6: Cost of 8 for VF 4: INTERLEAVE-GROUP with factor 6 at %l0, ir<%p0>
235; OPT-NF6: Cost of 8 for VF 4: INTERLEAVE-GROUP with factor 6 at <badref>, ir<%p0>
236; OPT-NF6: Cost of 10 for VF 8: INTERLEAVE-GROUP with factor 6 at %l0, ir<%p0>
237; OPT-NF6: Cost of 10 for VF 8: INTERLEAVE-GROUP with factor 6 at <badref>, ir<%p0>
238; OPT-NF6: Cost of 14 for VF 16: INTERLEAVE-GROUP with factor 6 at %l0, ir<%p0>
239; OPT-NF6: Cost of 14 for VF 16: INTERLEAVE-GROUP with factor 6 at <badref>, ir<%p0>
240; NO-OPT-LABEL: Checking a loop in 'i8_factor_6'
241; NO-OPT: Cost of 12 for VF 2: INTERLEAVE-GROUP with factor 6 at %l0, ir<%p0>
242; NO-OPT: Cost of 12 for VF 2: INTERLEAVE-GROUP with factor 6 at <badref>, ir<%p0>
243; NO-OPT: Cost of 24 for VF 4: INTERLEAVE-GROUP with factor 6 at %l0, ir<%p0>
244; NO-OPT: Cost of 24 for VF 4: INTERLEAVE-GROUP with factor 6 at <badref>, ir<%p0>
245; NO-OPT: Cost of 48 for VF 8: INTERLEAVE-GROUP with factor 6 at %l0, ir<%p0>
246; NO-OPT: Cost of 48 for VF 8: INTERLEAVE-GROUP with factor 6 at <badref>, ir<%p0>
247; NO-OPT: Cost of 96 for VF 16: INTERLEAVE-GROUP with factor 6 at %l0, ir<%p0>
248; NO-OPT: Cost of 96 for VF 16: INTERLEAVE-GROUP with factor 6 at <badref>, ir<%p0>
249for.body:
250  %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
251  %p0 = getelementptr inbounds %i8.6, ptr %data, i64 %i, i32 0
252  %p1 = getelementptr inbounds %i8.6, ptr %data, i64 %i, i32 1
253  %p2 = getelementptr inbounds %i8.6, ptr %data, i64 %i, i32 2
254  %p3 = getelementptr inbounds %i8.6, ptr %data, i64 %i, i32 3
255  %p4 = getelementptr inbounds %i8.6, ptr %data, i64 %i, i32 4
256  %p5 = getelementptr inbounds %i8.6, ptr %data, i64 %i, i32 5
257  %l0 = load i8, ptr %p0, align 1
258  %l1 = load i8, ptr %p1, align 1
259  %l2 = load i8, ptr %p2, align 1
260  %l3 = load i8, ptr %p3, align 1
261  %l4 = load i8, ptr %p4, align 1
262  %l5 = load i8, ptr %p5, align 1
263  %a0 = add i8 %l0, 1
264  %a1 = add i8 %l1, 2
265  %a2 = add i8 %l2, 3
266  %a3 = add i8 %l3, 4
267  %a4 = add i8 %l4, 5
268  %a5 = add i8 %l5, 6
269  store i8 %a0, ptr %p0, align 1
270  store i8 %a1, ptr %p1, align 1
271  store i8 %a2, ptr %p2, align 1
272  store i8 %a3, ptr %p3, align 1
273  store i8 %a4, ptr %p4, align 1
274  store i8 %a5, ptr %p5, align 1
275  %i.next = add nuw nsw i64 %i, 1
276  %cond = icmp slt i64 %i.next, %n
277  br i1 %cond, label %for.body, label %for.end
278
279for.end:
280  ret void
281}
282
283%i8.7 = type {i8, i8, i8, i8, i8, i8, i8}
284define void @i8_factor_7(ptr %data, i64 %n) {
285entry:
286  br label %for.body
287; OPT-NF7-LABEL: Checking a loop in 'i8_factor_7'
288; OPT-NF7: Cost of 8 for VF 2: INTERLEAVE-GROUP with factor 7 at %l0, ir<%p0>
289; OPT-NF7: Cost of 8 for VF 2: INTERLEAVE-GROUP with factor 7 at <badref>, ir<%p0>
290; OPT-NF7: Cost of 9 for VF 4: INTERLEAVE-GROUP with factor 7 at %l0, ir<%p0>
291; OPT-NF7: Cost of 9 for VF 4: INTERLEAVE-GROUP with factor 7 at <badref>, ir<%p0>
292; OPT-NF7: Cost of 11 for VF 8: INTERLEAVE-GROUP with factor 7 at %l0, ir<%p0>
293; OPT-NF7: Cost of 11 for VF 8: INTERLEAVE-GROUP with factor 7 at <badref>, ir<%p0>
294; OPT-NF7: Cost of 15 for VF 16: INTERLEAVE-GROUP with factor 7 at %l0, ir<%p0>
295; OPT-NF7: Cost of 15 for VF 16: INTERLEAVE-GROUP with factor 7 at <badref>, ir<%p0>
296; NO-OPT-LABEL: Checking a loop in 'i8_factor_7'
297; NO-OPT: Cost of 14 for VF 2: INTERLEAVE-GROUP with factor 7 at %l0, ir<%p0>
298; NO-OPT: Cost of 14 for VF 2: INTERLEAVE-GROUP with factor 7 at <badref>, ir<%p0>
299; NO-OPT: Cost of 28 for VF 4: INTERLEAVE-GROUP with factor 7 at %l0, ir<%p0>
300; NO-OPT: Cost of 28 for VF 4: INTERLEAVE-GROUP with factor 7 at <badref>, ir<%p0>
301; NO-OPT: Cost of 56 for VF 8: INTERLEAVE-GROUP with factor 7 at %l0, ir<%p0>
302; NO-OPT: Cost of 56 for VF 8: INTERLEAVE-GROUP with factor 7 at <badref>, ir<%p0>
303; NO-OPT: Cost of 112 for VF 16: INTERLEAVE-GROUP with factor 7 at %l0, ir<%p0>
304; NO-OPT: Cost of 112 for VF 16: INTERLEAVE-GROUP with factor 7 at <badref>, ir<%p0>
305for.body:
306  %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
307  %p0 = getelementptr inbounds %i8.7, ptr %data, i64 %i, i32 0
308  %p1 = getelementptr inbounds %i8.7, ptr %data, i64 %i, i32 1
309  %p2 = getelementptr inbounds %i8.7, ptr %data, i64 %i, i32 2
310  %p3 = getelementptr inbounds %i8.7, ptr %data, i64 %i, i32 3
311  %p4 = getelementptr inbounds %i8.7, ptr %data, i64 %i, i32 4
312  %p5 = getelementptr inbounds %i8.7, ptr %data, i64 %i, i32 5
313  %p6 = getelementptr inbounds %i8.7, ptr %data, i64 %i, i32 6
314  %l0 = load i8, ptr %p0, align 1
315  %l1 = load i8, ptr %p1, align 1
316  %l2 = load i8, ptr %p2, align 1
317  %l3 = load i8, ptr %p3, align 1
318  %l4 = load i8, ptr %p4, align 1
319  %l5 = load i8, ptr %p5, align 1
320  %l6 = load i8, ptr %p6, align 1
321  %a0 = add i8 %l0, 1
322  %a1 = add i8 %l1, 2
323  %a2 = add i8 %l2, 3
324  %a3 = add i8 %l3, 4
325  %a4 = add i8 %l4, 5
326  %a5 = add i8 %l5, 6
327  %a6 = add i8 %l6, 7
328  store i8 %a0, ptr %p0, align 1
329  store i8 %a1, ptr %p1, align 1
330  store i8 %a2, ptr %p2, align 1
331  store i8 %a3, ptr %p3, align 1
332  store i8 %a4, ptr %p4, align 1
333  store i8 %a5, ptr %p5, align 1
334  store i8 %a6, ptr %p6, align 1
335  %i.next = add nuw nsw i64 %i, 1
336  %cond = icmp slt i64 %i.next, %n
337  br i1 %cond, label %for.body, label %for.end
338
339for.end:
340  ret void
341}
342
343%i8.8 = type {i8, i8, i8, i8, i8, i8, i8, i8}
344define void @i8_factor_8(ptr %data, i64 %n) {
345entry:
346  br label %for.body
347; OPT-NF8-LABEL: Checking a loop in 'i8_factor_8'
348; OPT-NF8: Cost of 9 for VF 2: INTERLEAVE-GROUP with factor 8 at %l0, ir<%p0>
349; OPT-NF8: Cost of 9 for VF 2: INTERLEAVE-GROUP with factor 8 at <badref>, ir<%p0>
350; OPT-NF8: Cost of 10 for VF 4: INTERLEAVE-GROUP with factor 8 at %l0, ir<%p0>
351; OPT-NF8: Cost of 10 for VF 4: INTERLEAVE-GROUP with factor 8 at <badref>, ir<%p0>
352; OPT-NF8: Cost of 12 for VF 8: INTERLEAVE-GROUP with factor 8 at %l0, ir<%p0>
353; OPT-NF8: Cost of 12 for VF 8: INTERLEAVE-GROUP with factor 8 at <badref>, ir<%p0>
354; OPT-NF8: Cost of 16 for VF 16: INTERLEAVE-GROUP with factor 8 at %l0, ir<%p0>
355; OPT-NF8: Cost of 16 for VF 16: INTERLEAVE-GROUP with factor 8 at <badref>, ir<%p0>
356; NO-OPT-LABEL: Checking a loop in 'i8_factor_8'
357; NO-OPT: Cost of 16 for VF 2: INTERLEAVE-GROUP with factor 8 at %l0, ir<%p0>
358; NO-OPT: Cost of 16 for VF 2: INTERLEAVE-GROUP with factor 8 at <badref>, ir<%p0>
359; NO-OPT: Cost of 32 for VF 4: INTERLEAVE-GROUP with factor 8 at %l0, ir<%p0>
360; NO-OPT: Cost of 32 for VF 4: INTERLEAVE-GROUP with factor 8 at <badref>, ir<%p0>
361; NO-OPT: Cost of 64 for VF 8: INTERLEAVE-GROUP with factor 8 at %l0, ir<%p0>
362; NO-OPT: Cost of 64 for VF 8: INTERLEAVE-GROUP with factor 8 at <badref>, ir<%p0>
363; NO-OPT: Cost of 128 for VF 16: INTERLEAVE-GROUP with factor 8 at %l0, ir<%p0>
364; NO-OPT: Cost of 128 for VF 16: INTERLEAVE-GROUP with factor 8 at <badref>, ir<%p0>
365for.body:
366  %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
367  %p0 = getelementptr inbounds %i8.8, ptr %data, i64 %i, i32 0
368  %p1 = getelementptr inbounds %i8.8, ptr %data, i64 %i, i32 1
369  %p2 = getelementptr inbounds %i8.8, ptr %data, i64 %i, i32 2
370  %p3 = getelementptr inbounds %i8.8, ptr %data, i64 %i, i32 3
371  %p4 = getelementptr inbounds %i8.8, ptr %data, i64 %i, i32 4
372  %p5 = getelementptr inbounds %i8.8, ptr %data, i64 %i, i32 5
373  %p6 = getelementptr inbounds %i8.8, ptr %data, i64 %i, i32 6
374  %p7 = getelementptr inbounds %i8.8, ptr %data, i64 %i, i32 7
375  %l0 = load i8, ptr %p0, align 1
376  %l1 = load i8, ptr %p1, align 1
377  %l2 = load i8, ptr %p2, align 1
378  %l3 = load i8, ptr %p3, align 1
379  %l4 = load i8, ptr %p4, align 1
380  %l5 = load i8, ptr %p5, align 1
381  %l6 = load i8, ptr %p6, align 1
382  %l7 = load i8, ptr %p7, align 1
383  %a0 = add i8 %l0, 1
384  %a1 = add i8 %l1, 2
385  %a2 = add i8 %l2, 3
386  %a3 = add i8 %l3, 4
387  %a4 = add i8 %l4, 5
388  %a5 = add i8 %l5, 6
389  %a6 = add i8 %l6, 7
390  %a7 = add i8 %l7, 8
391  store i8 %a0, ptr %p0, align 1
392  store i8 %a1, ptr %p1, align 1
393  store i8 %a2, ptr %p2, align 1
394  store i8 %a3, ptr %p3, align 1
395  store i8 %a4, ptr %p4, align 1
396  store i8 %a5, ptr %p5, align 1
397  store i8 %a6, ptr %p6, align 1
398  store i8 %a7, ptr %p7, align 1
399  %i.next = add nuw nsw i64 %i, 1
400  %cond = icmp slt i64 %i.next, %n
401  br i1 %cond, label %for.body, label %for.end
402
403for.end:
404  ret void
405}
406