Skip to content

Commit e98875a

Browse files
committed
[RISCV] Add scalable interleave cost tests. NFC
This gets the cost from the recipe output rather than the individual instruction cost. The factor 3 test was left alone since we don't support anything else other than factor 2 for scalable vectors currently.
1 parent 1b53aae commit e98875a

File tree

1 file changed

+33
-52
lines changed

1 file changed

+33
-52
lines changed

llvm/test/Transforms/LoopVectorize/RISCV/interleaved-cost.ll

Lines changed: 33 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,31 @@
11
; REQUIRES: asserts
2-
; RUN: opt -passes=loop-vectorize -mtriple=riscv64 -mattr=+v -force-vector-width=2 -debug-only=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s --check-prefix=VF_2
3-
; RUN: opt -passes=loop-vectorize -mtriple=riscv64 -mattr=+v -force-vector-width=4 -debug-only=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s --check-prefix=VF_4
4-
; RUN: opt -passes=loop-vectorize -mtriple=riscv64 -mattr=+v -force-vector-width=8 -debug-only=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s --check-prefix=VF_8
5-
; RUN: opt -passes=loop-vectorize -mtriple=riscv64 -mattr=+v -force-vector-width=16 -debug-only=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s --check-prefix=VF_16
2+
; RUN: opt -passes=loop-vectorize -mtriple=riscv64 -mattr=+v -debug-only=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s
63

74
%i8.2 = type {i8, i8}
85
define void @i8_factor_2(ptr %data, i64 %n) {
96
entry:
107
br label %for.body
11-
; VF_2-LABEL: Checking a loop in 'i8_factor_2'
12-
; VF_2: Found an estimated cost of 2 for VF 2 For instruction: %l0 = load i8, ptr %p0, align 1
13-
; VF_2-NEXT: Found an estimated cost of 0 for VF 2 For instruction: %l1 = load i8, ptr %p1, align 1
14-
; VF_2: Found an estimated cost of 0 for VF 2 For instruction: store i8 %a0, ptr %p0, align 1
15-
; VF_2-NEXT: Found an estimated cost of 2 for VF 2 For instruction: store i8 %a1, ptr %p1, align 1
16-
; VF_4-LABEL: Checking a loop in 'i8_factor_2'
17-
; VF_4: Found an estimated cost of 2 for VF 4 For instruction: %l0 = load i8, ptr %p0, align 1
18-
; VF_4-NEXT: Found an estimated cost of 0 for VF 4 For instruction: %l1 = load i8, ptr %p1, align 1
19-
; VF_4: Found an estimated cost of 0 for VF 4 For instruction: store i8 %a0, ptr %p0, align 1
20-
; VF_4-NEXT: Found an estimated cost of 2 for VF 4 For instruction: store i8 %a1, ptr %p1, align 1
21-
; VF_8-LABEL: Checking a loop in 'i8_factor_2'
22-
; VF_8: Found an estimated cost of 2 for VF 8 For instruction: %l0 = load i8, ptr %p0, align 1
23-
; VF_8-NEXT: Found an estimated cost of 0 for VF 8 For instruction: %l1 = load i8, ptr %p1, align 1
24-
; VF_8: Found an estimated cost of 0 for VF 8 For instruction: store i8 %a0, ptr %p0, align 1
25-
; VF_8-NEXT: Found an estimated cost of 2 for VF 8 For instruction: store i8 %a1, ptr %p1, align 1
26-
; VF_16-LABEL: Checking a loop in 'i8_factor_2'
27-
; VF_16: Found an estimated cost of 3 for VF 16 For instruction: %l0 = load i8, ptr %p0, align 1
28-
; VF_16-NEXT: Found an estimated cost of 0 for VF 16 For instruction: %l1 = load i8, ptr %p1, align 1
29-
; VF_16: Found an estimated cost of 0 for VF 16 For instruction: store i8 %a0, ptr %p0, align 1
30-
; VF_16-NEXT: Found an estimated cost of 3 for VF 16 For instruction: store i8 %a1, ptr %p1, align 1
8+
; CHECK-LABEL: Checking a loop in 'i8_factor_2'
9+
; CHECK: Cost of 2 for VF 2: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
10+
; CHECK: Cost of 2 for VF 2: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
11+
; CHECK: Cost of 2 for VF 4: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
12+
; CHECK: Cost of 2 for VF 4: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
13+
; CHECK: Cost of 2 for VF 8: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
14+
; CHECK: Cost of 2 for VF 8: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
15+
; CHECK: Cost of 3 for VF 16: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
16+
; CHECK: Cost of 3 for VF 16: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
17+
; CHECK: Cost of 5 for VF 32: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
18+
; CHECK: Cost of 5 for VF 32: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
19+
; CHECK: Cost of 2 for VF vscale x 1: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
20+
; CHECK: Cost of 2 for VF vscale x 1: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
21+
; CHECK: Cost of 2 for VF vscale x 2: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
22+
; CHECK: Cost of 2 for VF vscale x 2: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
23+
; CHECK: Cost of 2 for VF vscale x 4: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
24+
; CHECK: Cost of 2 for VF vscale x 4: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
25+
; CHECK: Cost of 3 for VF vscale x 8: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
26+
; CHECK: Cost of 3 for VF vscale x 8: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
27+
; CHECK: Cost of 5 for VF vscale x 16: INTERLEAVE-GROUP with factor 2 at %l0, ir<%p0>
28+
; CHECK: Cost of 5 for VF vscale x 16: INTERLEAVE-GROUP with factor 2 at <badref>, ir<%p0>
3129
for.body:
3230
%i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
3331
%p0 = getelementptr inbounds %i8.2, ptr %data, i64 %i, i32 0
@@ -50,34 +48,17 @@ for.end:
5048
define void @i8_factor_3(ptr %data, i64 %n) {
5149
entry:
5250
br label %for.body
53-
; VF_2-LABEL: Checking a loop in 'i8_factor_3'
54-
; VF_2: Found an estimated cost of 2 for VF 2 For instruction: %l0 = load i8, ptr %p0, align 1
55-
; VF_2-NEXT: Found an estimated cost of 0 for VF 2 For instruction: %l1 = load i8, ptr %p1, align 1
56-
; VF_2-NEXT: Found an estimated cost of 0 for VF 2 For instruction: %l2 = load i8, ptr %p2, align 1
57-
; VF_2: Found an estimated cost of 0 for VF 2 For instruction: store i8 %a0, ptr %p0, align 1
58-
; VF_2: Found an estimated cost of 0 for VF 2 For instruction: store i8 %a1, ptr %p1, align 1
59-
; VF_2-NEXT: Found an estimated cost of 2 for VF 2 For instruction: store i8 %a2, ptr %p2, align 1
60-
; VF_4-LABEL: Checking a loop in 'i8_factor_3'
61-
; VF_4: Found an estimated cost of 2 for VF 4 For instruction: %l0 = load i8, ptr %p0, align 1
62-
; VF_4-NEXT: Found an estimated cost of 0 for VF 4 For instruction: %l1 = load i8, ptr %p1, align 1
63-
; VF_4-NEXT: Found an estimated cost of 0 for VF 4 For instruction: %l2 = load i8, ptr %p2, align 1
64-
; VF_4: Found an estimated cost of 0 for VF 4 For instruction: store i8 %a0, ptr %p0, align 1
65-
; VF_4: Found an estimated cost of 0 for VF 4 For instruction: store i8 %a1, ptr %p1, align 1
66-
; VF_4-NEXT: Found an estimated cost of 2 for VF 4 For instruction: store i8 %a2, ptr %p2, align 1
67-
; VF_8-LABEL: Checking a loop in 'i8_factor_3'
68-
; VF_8: Found an estimated cost of 3 for VF 8 For instruction: %l0 = load i8, ptr %p0, align 1
69-
; VF_8-NEXT: Found an estimated cost of 0 for VF 8 For instruction: %l1 = load i8, ptr %p1, align 1
70-
; VF_8-NEXT: Found an estimated cost of 0 for VF 8 For instruction: %l2 = load i8, ptr %p2, align 1
71-
; VF_8: Found an estimated cost of 0 for VF 8 For instruction: store i8 %a0, ptr %p0, align 1
72-
; VF_8: Found an estimated cost of 0 for VF 8 For instruction: store i8 %a1, ptr %p1, align 1
73-
; VF_8-NEXT: Found an estimated cost of 3 for VF 8 For instruction: store i8 %a2, ptr %p2, align 1
74-
; VF_16-LABEL: Checking a loop in 'i8_factor_3'
75-
; VF_16: Found an estimated cost of 5 for VF 16 For instruction: %l0 = load i8, ptr %p0, align 1
76-
; VF_16-NEXT: Found an estimated cost of 0 for VF 16 For instruction: %l1 = load i8, ptr %p1, align 1
77-
; VF_16-NEXT: Found an estimated cost of 0 for VF 16 For instruction: %l2 = load i8, ptr %p2, align 1
78-
; VF_16: Found an estimated cost of 0 for VF 16 For instruction: store i8 %a0, ptr %p0, align 1
79-
; VF_16: Found an estimated cost of 0 for VF 16 For instruction: store i8 %a1, ptr %p1, align 1
80-
; VF_16-NEXT: Found an estimated cost of 5 for VF 16 For instruction: store i8 %a2, ptr %p2, align 1
51+
; CHECK-LABEL: Checking a loop in 'i8_factor_3'
52+
; CHECK: Cost of 2 for VF 2: INTERLEAVE-GROUP with factor 3 at %l0, ir<%p0>
53+
; CHECK: Cost of 2 for VF 2: INTERLEAVE-GROUP with factor 3 at <badref>, ir<%p0>
54+
; CHECK: Cost of 2 for VF 4: INTERLEAVE-GROUP with factor 3 at %l0, ir<%p0>
55+
; CHECK: Cost of 2 for VF 4: INTERLEAVE-GROUP with factor 3 at <badref>, ir<%p0>
56+
; CHECK: Cost of 3 for VF 8: INTERLEAVE-GROUP with factor 3 at %l0, ir<%p0>
57+
; CHECK: Cost of 3 for VF 8: INTERLEAVE-GROUP with factor 3 at <badref>, ir<%p0>
58+
; CHECK: Cost of 5 for VF 16: INTERLEAVE-GROUP with factor 3 at %l0, ir<%p0>
59+
; CHECK: Cost of 5 for VF 16: INTERLEAVE-GROUP with factor 3 at <badref>, ir<%p0>
60+
; CHECK: Cost of 9 for VF 32: INTERLEAVE-GROUP with factor 3 at %l0, ir<%p0>
61+
; CHECK: Cost of 9 for VF 32: INTERLEAVE-GROUP with factor 3 at <badref>, ir<%p0>
8162
for.body:
8263
%i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
8364
%p0 = getelementptr inbounds %i8.3, ptr %data, i64 %i, i32 0

0 commit comments

Comments
 (0)