1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt < %s -mtriple=riscv32 -mattr=+v -riscv-v-vector-bits-min=256 -passes="print<cost-model>" -cost-kind=throughput 2>&1 -disable-output | FileCheck %s
3 ; RUN: opt < %s -mtriple=riscv64 -mattr=+v -riscv-v-vector-bits-min=256 -passes="print<cost-model>" -cost-kind=throughput 2>&1 -disable-output | FileCheck %s
5 define i32 @reduce_i1(i32 %arg) {
6 ; CHECK-LABEL: 'reduce_i1'
7 ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V1 = call i1 @llvm.vector.reduce.and.v1i1(<1 x i1> undef)
8 ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V2 = call i1 @llvm.vector.reduce.and.v2i1(<2 x i1> undef)
9 ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V4 = call i1 @llvm.vector.reduce.and.v4i1(<4 x i1> undef)
10 ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V8 = call i1 @llvm.vector.reduce.and.v8i1(<8 x i1> undef)
11 ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V16 = call i1 @llvm.vector.reduce.and.v16i1(<16 x i1> undef)
12 ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V32 = call i1 @llvm.vector.reduce.and.v32i1(<32 x i1> undef)
13 ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V64 = call i1 @llvm.vector.reduce.and.v64i1(<64 x i1> undef)
14 ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V128 = call i1 @llvm.vector.reduce.and.v128i1(<128 x i1> undef)
15 ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V256 = call i1 @llvm.vector.reduce.and.v256i1(<256 x i1> undef)
16 ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V512 = call i1 @llvm.vector.reduce.and.v512i1(<512 x i1> undef)
17 ; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %V1024 = call i1 @llvm.vector.reduce.and.v1024i1(<1024 x i1> undef)
18 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
20 %V1 = call i1 @llvm.vector.reduce.and.v1i1(<1 x i1> undef)
21 %V2 = call i1 @llvm.vector.reduce.and.v2i1(<2 x i1> undef)
22 %V4 = call i1 @llvm.vector.reduce.and.v4i1(<4 x i1> undef)
23 %V8 = call i1 @llvm.vector.reduce.and.v8i1(<8 x i1> undef)
24 %V16 = call i1 @llvm.vector.reduce.and.v16i1(<16 x i1> undef)
25 %V32 = call i1 @llvm.vector.reduce.and.v32i1(<32 x i1> undef)
26 %V64 = call i1 @llvm.vector.reduce.and.v64i1(<64 x i1> undef)
27 %V128 = call i1 @llvm.vector.reduce.and.v128i1(<128 x i1> undef)
28 %V256 = call i1 @llvm.vector.reduce.and.v256i1(<256 x i1> undef)
29 %V512 = call i1 @llvm.vector.reduce.and.v512i1(<512 x i1> undef)
30 %V1024 = call i1 @llvm.vector.reduce.and.v1024i1(<1024 x i1> undef)
34 define i32 @reduce_i8(i32 %arg) {
35 ; CHECK-LABEL: 'reduce_i8'
36 ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V1 = call i8 @llvm.vector.reduce.and.v1i8(<1 x i8> undef)
37 ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V2 = call i8 @llvm.vector.reduce.and.v2i8(<2 x i8> undef)
38 ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V4 = call i8 @llvm.vector.reduce.and.v4i8(<4 x i8> undef)
39 ; CHECK-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V8 = call i8 @llvm.vector.reduce.and.v8i8(<8 x i8> undef)
40 ; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %V16 = call i8 @llvm.vector.reduce.and.v16i8(<16 x i8> undef)
41 ; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %V32 = call i8 @llvm.vector.reduce.and.v32i8(<32 x i8> undef)
42 ; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %V64 = call i8 @llvm.vector.reduce.and.v64i8(<64 x i8> undef)
43 ; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V128 = call i8 @llvm.vector.reduce.and.v128i8(<128 x i8> undef)
44 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
46 %V1 = call i8 @llvm.vector.reduce.and.v1i8(<1 x i8> undef)
47 %V2 = call i8 @llvm.vector.reduce.and.v2i8(<2 x i8> undef)
48 %V4 = call i8 @llvm.vector.reduce.and.v4i8(<4 x i8> undef)
49 %V8 = call i8 @llvm.vector.reduce.and.v8i8(<8 x i8> undef)
50 %V16 = call i8 @llvm.vector.reduce.and.v16i8(<16 x i8> undef)
51 %V32 = call i8 @llvm.vector.reduce.and.v32i8(<32 x i8> undef)
52 %V64 = call i8 @llvm.vector.reduce.and.v64i8(<64 x i8> undef)
53 %V128 = call i8 @llvm.vector.reduce.and.v128i8(<128 x i8> undef)
57 define i32 @reduce_i16(i32 %arg) {
58 ; CHECK-LABEL: 'reduce_i16'
59 ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V1 = call i16 @llvm.vector.reduce.and.v1i16(<1 x i16> undef)
60 ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V2 = call i16 @llvm.vector.reduce.and.v2i16(<2 x i16> undef)
61 ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V4 = call i16 @llvm.vector.reduce.and.v4i16(<4 x i16> undef)
62 ; CHECK-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V8 = call i16 @llvm.vector.reduce.and.v8i16(<8 x i16> undef)
63 ; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %V16 = call i16 @llvm.vector.reduce.and.v16i16(<16 x i16> undef)
64 ; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %V32 = call i16 @llvm.vector.reduce.and.v32i16(<32 x i16> undef)
65 ; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %V64 = call i16 @llvm.vector.reduce.and.v64i16(<64 x i16> undef)
66 ; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V128 = call i16 @llvm.vector.reduce.and.v128i16(<128 x i16> undef)
67 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
69 %V1 = call i16 @llvm.vector.reduce.and.v1i16(<1 x i16> undef)
70 %V2 = call i16 @llvm.vector.reduce.and.v2i16(<2 x i16> undef)
71 %V4 = call i16 @llvm.vector.reduce.and.v4i16(<4 x i16> undef)
72 %V8 = call i16 @llvm.vector.reduce.and.v8i16(<8 x i16> undef)
73 %V16 = call i16 @llvm.vector.reduce.and.v16i16(<16 x i16> undef)
74 %V32 = call i16 @llvm.vector.reduce.and.v32i16(<32 x i16> undef)
75 %V64 = call i16 @llvm.vector.reduce.and.v64i16(<64 x i16> undef)
76 %V128 = call i16 @llvm.vector.reduce.and.v128i16(<128 x i16> undef)
80 define i32 @reduce_i32(i32 %arg) {
81 ; CHECK-LABEL: 'reduce_i32'
82 ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V1 = call i32 @llvm.vector.reduce.and.v1i32(<1 x i32> undef)
83 ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V2 = call i32 @llvm.vector.reduce.and.v2i32(<2 x i32> undef)
84 ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V4 = call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> undef)
85 ; CHECK-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V8 = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> undef)
86 ; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %V16 = call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> undef)
87 ; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %V32 = call i32 @llvm.vector.reduce.and.v32i32(<32 x i32> undef)
88 ; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %V64 = call i32 @llvm.vector.reduce.and.v64i32(<64 x i32> undef)
89 ; CHECK-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %V128 = call i32 @llvm.vector.reduce.and.v128i32(<128 x i32> undef)
90 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
92 %V1 = call i32 @llvm.vector.reduce.and.v1i32(<1 x i32> undef)
93 %V2 = call i32 @llvm.vector.reduce.and.v2i32(<2 x i32> undef)
94 %V4 = call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> undef)
95 %V8 = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> undef)
96 %V16 = call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> undef)
97 %V32 = call i32 @llvm.vector.reduce.and.v32i32(<32 x i32> undef)
98 %V64 = call i32 @llvm.vector.reduce.and.v64i32(<64 x i32> undef)
99 %V128 = call i32 @llvm.vector.reduce.and.v128i32(<128 x i32> undef)
103 define i32 @reduce_i64(i32 %arg) {
104 ; CHECK-LABEL: 'reduce_i64'
105 ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V1 = call i64 @llvm.vector.reduce.and.v1i64(<1 x i64> undef)
106 ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V2 = call i64 @llvm.vector.reduce.and.v2i64(<2 x i64> undef)
107 ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V4 = call i64 @llvm.vector.reduce.and.v4i64(<4 x i64> undef)
108 ; CHECK-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V8 = call i64 @llvm.vector.reduce.and.v8i64(<8 x i64> undef)
109 ; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %V16 = call i64 @llvm.vector.reduce.and.v16i64(<16 x i64> undef)
110 ; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %V32 = call i64 @llvm.vector.reduce.and.v32i64(<32 x i64> undef)
111 ; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V64 = call i64 @llvm.vector.reduce.and.v64i64(<64 x i64> undef)
112 ; CHECK-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %V128 = call i64 @llvm.vector.reduce.and.v128i64(<128 x i64> undef)
113 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
115 %V1 = call i64 @llvm.vector.reduce.and.v1i64(<1 x i64> undef)
116 %V2 = call i64 @llvm.vector.reduce.and.v2i64(<2 x i64> undef)
117 %V4 = call i64 @llvm.vector.reduce.and.v4i64(<4 x i64> undef)
118 %V8 = call i64 @llvm.vector.reduce.and.v8i64(<8 x i64> undef)
119 %V16 = call i64 @llvm.vector.reduce.and.v16i64(<16 x i64> undef)
120 %V32 = call i64 @llvm.vector.reduce.and.v32i64(<32 x i64> undef)
121 %V64 = call i64 @llvm.vector.reduce.and.v64i64(<64 x i64> undef)
122 %V128 = call i64 @llvm.vector.reduce.and.v128i64(<128 x i64> undef)
126 declare i1 @llvm.vector.reduce.and.v1i1(<1 x i1>)
127 declare i1 @llvm.vector.reduce.and.v2i1(<2 x i1>)
128 declare i1 @llvm.vector.reduce.and.v4i1(<4 x i1>)
129 declare i1 @llvm.vector.reduce.and.v8i1(<8 x i1>)
130 declare i1 @llvm.vector.reduce.and.v16i1(<16 x i1>)
131 declare i1 @llvm.vector.reduce.and.v32i1(<32 x i1>)
132 declare i1 @llvm.vector.reduce.and.v64i1(<64 x i1>)
133 declare i1 @llvm.vector.reduce.and.v128i1(<128 x i1>)
134 declare i1 @llvm.vector.reduce.and.v256i1(<256 x i1>)
135 declare i1 @llvm.vector.reduce.and.v512i1(<512 x i1>)
136 declare i1 @llvm.vector.reduce.and.v1024i1(<1024 x i1>)
137 declare i8 @llvm.vector.reduce.and.v1i8(<1 x i8>)
138 declare i8 @llvm.vector.reduce.and.v2i8(<2 x i8>)
139 declare i8 @llvm.vector.reduce.and.v4i8(<4 x i8>)
140 declare i8 @llvm.vector.reduce.and.v8i8(<8 x i8>)
141 declare i8 @llvm.vector.reduce.and.v16i8(<16 x i8>)
142 declare i8 @llvm.vector.reduce.and.v32i8(<32 x i8>)
143 declare i8 @llvm.vector.reduce.and.v64i8(<64 x i8>)
144 declare i8 @llvm.vector.reduce.and.v128i8(<128 x i8>)
145 declare i16 @llvm.vector.reduce.and.v1i16(<1 x i16>)
146 declare i16 @llvm.vector.reduce.and.v2i16(<2 x i16>)
147 declare i16 @llvm.vector.reduce.and.v4i16(<4 x i16>)
148 declare i16 @llvm.vector.reduce.and.v8i16(<8 x i16>)
149 declare i16 @llvm.vector.reduce.and.v16i16(<16 x i16>)
150 declare i16 @llvm.vector.reduce.and.v32i16(<32 x i16>)
151 declare i16 @llvm.vector.reduce.and.v64i16(<64 x i16>)
152 declare i16 @llvm.vector.reduce.and.v128i16(<128 x i16>)
153 declare i32 @llvm.vector.reduce.and.v1i32(<1 x i32>)
154 declare i32 @llvm.vector.reduce.and.v2i32(<2 x i32>)
155 declare i32 @llvm.vector.reduce.and.v4i32(<4 x i32>)
156 declare i32 @llvm.vector.reduce.and.v8i32(<8 x i32>)
157 declare i32 @llvm.vector.reduce.and.v16i32(<16 x i32>)
158 declare i32 @llvm.vector.reduce.and.v32i32(<32 x i32>)
159 declare i32 @llvm.vector.reduce.and.v64i32(<64 x i32>)
160 declare i32 @llvm.vector.reduce.and.v128i32(<128 x i32>)
161 declare i64 @llvm.vector.reduce.and.v1i64(<1 x i64>)
162 declare i64 @llvm.vector.reduce.and.v2i64(<2 x i64>)
163 declare i64 @llvm.vector.reduce.and.v4i64(<4 x i64>)
164 declare i64 @llvm.vector.reduce.and.v8i64(<8 x i64>)
165 declare i64 @llvm.vector.reduce.and.v16i64(<16 x i64>)
166 declare i64 @llvm.vector.reduce.and.v32i64(<32 x i64>)
167 declare i64 @llvm.vector.reduce.and.v64i64(<64 x i64>)
168 declare i64 @llvm.vector.reduce.and.v128i64(<128 x i64>)