[AMDGPU] Add True16 register classes.
[llvm-project.git] / llvm / test / Transforms / LoopVectorize / RISCV / interleaved-cost.ll
bloba724ef87abb31851eedb4b48f4c9c11f19ed9cc4
1 ; 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
7 %i8.2 = type {i8, i8}
8 define void @i8_factor_2(ptr %data, i64 %n) {
9 entry:
10   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
31 for.body:
32   %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
33   %p0 = getelementptr inbounds %i8.2, ptr %data, i64 %i, i32 0
34   %p1 = getelementptr inbounds %i8.2, ptr %data, i64 %i, i32 1
35   %l0 = load i8, ptr %p0, align 1
36   %l1 = load i8, ptr %p1, align 1
37   %a0 = add i8 %l0, 1
38   %a1 = add i8 %l1, 2
39   store i8 %a0, ptr %p0, align 1
40   store i8 %a1, ptr %p1, align 1
41   %i.next = add nuw nsw i64 %i, 1
42   %cond = icmp slt i64 %i.next, %n
43   br i1 %cond, label %for.body, label %for.end
45 for.end:
46   ret void
49 %i8.3 = type {i8, i8, i8}
50 define void @i8_factor_3(ptr %data, i64 %n) {
51 entry:
52   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 48 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 48 for VF 16 For instruction:   store i8 %a2, ptr %p2, align 1
81 for.body:
82   %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
83   %p0 = getelementptr inbounds %i8.3, ptr %data, i64 %i, i32 0
84   %p1 = getelementptr inbounds %i8.3, ptr %data, i64 %i, i32 1
85   %p2 = getelementptr inbounds %i8.3, ptr %data, i64 %i, i32 2
86   %l0 = load i8, ptr %p0, align 1
87   %l1 = load i8, ptr %p1, align 1
88   %l2 = load i8, ptr %p2, align 1
89   %a0 = add i8 %l0, 1
90   %a1 = add i8 %l1, 2
91   %a2 = add i8 %l2, 3
92   store i8 %a0, ptr %p0, align 1
93   store i8 %a1, ptr %p1, align 1
94   store i8 %a2, ptr %p2, align 1
95   %i.next = add nuw nsw i64 %i, 1
96   %cond = icmp slt i64 %i.next, %n
97   br i1 %cond, label %for.body, label %for.end
99 for.end:
100   ret void