1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt -mtriple=riscv32 -mattr=+v -passes="print<cost-model>" 2>&1 \
3 ; RUN: -disable-output < %s | FileCheck %s -check-prefix=RVI
4 ; RUN: opt -mtriple=riscv64 -mattr=+v -passes="print<cost-model>" 2>&1 \
5 ; RUN: -disable-output < %s | FileCheck %s -check-prefix=RVI
7 define void @testi8(ptr %a, i32 %i) {
9 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a1 = getelementptr inbounds i8, ptr %a, i32 1
10 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i8 undef, ptr %a1, align 1
11 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a2 = getelementptr inbounds i8, ptr %a, i32 -1
12 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i8 undef, ptr %a2, align 1
13 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a3 = getelementptr inbounds i8, ptr %a, i32 2047
14 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i8 undef, ptr %a3, align 1
15 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a4 = getelementptr inbounds i8, ptr %a, i32 2048
16 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i8 undef, ptr %a4, align 1
17 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a5 = getelementptr inbounds i8, ptr %a, i32 -2048
18 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i8 undef, ptr %a5, align 1
19 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a6 = getelementptr inbounds i8, ptr %a, i32 -2049
20 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i8 undef, ptr %a6, align 1
21 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ai = getelementptr inbounds i8, ptr %a, i32 %i
22 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i8 undef, ptr %ai, align 1
23 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
25 %a1 = getelementptr inbounds i8, ptr %a, i32 1
26 store volatile i8 undef, ptr %a1
27 %a2 = getelementptr inbounds i8, ptr %a, i32 -1
28 store volatile i8 undef, ptr %a2
29 %a3 = getelementptr inbounds i8, ptr %a, i32 2047
30 store volatile i8 undef, ptr %a3
31 %a4 = getelementptr inbounds i8, ptr %a, i32 2048
32 store volatile i8 undef, ptr %a4
33 %a5 = getelementptr inbounds i8, ptr %a, i32 -2048
34 store volatile i8 undef, ptr %a5
35 %a6 = getelementptr inbounds i8, ptr %a, i32 -2049
36 store volatile i8 undef, ptr %a6
37 %ai = getelementptr inbounds i8, ptr %a, i32 %i
38 store volatile i8 undef, ptr %ai
42 define void @testi16(ptr %a, i32 %i) {
43 ; RVI-LABEL: 'testi16'
44 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a1 = getelementptr inbounds i16, ptr %a, i32 1
45 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i16 undef, ptr %a1, align 2
46 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a2 = getelementptr inbounds i16, ptr %a, i32 -1
47 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i16 undef, ptr %a2, align 2
48 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a3 = getelementptr inbounds i16, ptr %a, i32 1023
49 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i16 undef, ptr %a3, align 2
50 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a4 = getelementptr inbounds i16, ptr %a, i32 1024
51 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i16 undef, ptr %a4, align 2
52 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a5 = getelementptr inbounds i16, ptr %a, i32 -1024
53 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i16 undef, ptr %a5, align 2
54 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a6 = getelementptr inbounds i16, ptr %a, i32 -1025
55 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i16 undef, ptr %a6, align 2
56 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ai = getelementptr inbounds i16, ptr %a, i32 %i
57 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i16 undef, ptr %ai, align 2
58 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
60 %a1 = getelementptr inbounds i16, ptr %a, i32 1
61 store volatile i16 undef, ptr %a1
62 %a2 = getelementptr inbounds i16, ptr %a, i32 -1
63 store volatile i16 undef, ptr %a2
64 %a3 = getelementptr inbounds i16, ptr %a, i32 1023
65 store volatile i16 undef, ptr %a3
66 %a4 = getelementptr inbounds i16, ptr %a, i32 1024
67 store volatile i16 undef, ptr %a4
68 %a5 = getelementptr inbounds i16, ptr %a, i32 -1024
69 store volatile i16 undef, ptr %a5
70 %a6 = getelementptr inbounds i16, ptr %a, i32 -1025
71 store volatile i16 undef, ptr %a6
72 %ai = getelementptr inbounds i16, ptr %a, i32 %i
73 store volatile i16 undef, ptr %ai
77 define void @testi32(ptr %a, i32 %i) {
78 ; RVI-LABEL: 'testi32'
79 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a1 = getelementptr inbounds i32, ptr %a, i32 1
80 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i32 undef, ptr %a1, align 4
81 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a2 = getelementptr inbounds i32, ptr %a, i32 -1
82 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i32 undef, ptr %a2, align 4
83 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a3 = getelementptr inbounds i32, ptr %a, i32 511
84 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i32 undef, ptr %a3, align 4
85 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a4 = getelementptr inbounds i32, ptr %a, i32 512
86 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i32 undef, ptr %a4, align 4
87 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a5 = getelementptr inbounds i32, ptr %a, i32 -512
88 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i32 undef, ptr %a5, align 4
89 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a6 = getelementptr inbounds i32, ptr %a, i32 -513
90 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i32 undef, ptr %a6, align 4
91 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ai = getelementptr inbounds i32, ptr %a, i32 %i
92 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile i32 undef, ptr %ai, align 4
93 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
95 %a1 = getelementptr inbounds i32, ptr %a, i32 1
96 store volatile i32 undef, ptr %a1
97 %a2 = getelementptr inbounds i32, ptr %a, i32 -1
98 store volatile i32 undef, ptr %a2
99 %a3 = getelementptr inbounds i32, ptr %a, i32 511
100 store volatile i32 undef, ptr %a3
101 %a4 = getelementptr inbounds i32, ptr %a, i32 512
102 store volatile i32 undef, ptr %a4
103 %a5 = getelementptr inbounds i32, ptr %a, i32 -512
104 store volatile i32 undef, ptr %a5
105 %a6 = getelementptr inbounds i32, ptr %a, i32 -513
106 store volatile i32 undef, ptr %a6
107 %ai = getelementptr inbounds i32, ptr %a, i32 %i
108 store volatile i32 undef, ptr %ai
112 define void @testi64(ptr %a, i32 %i) {
113 %a1 = getelementptr inbounds i64, ptr %a, i32 1
114 store volatile i64 undef, ptr %a1
115 %a2 = getelementptr inbounds i64, ptr %a, i32 -1
116 store volatile i64 undef, ptr %a2
117 %a3 = getelementptr inbounds i64, ptr %a, i32 255
118 store volatile i64 undef, ptr %a3
119 %a4 = getelementptr inbounds i64, ptr %a, i32 256
120 store volatile i64 undef, ptr %a4
121 %a5 = getelementptr inbounds i64, ptr %a, i32 -256
122 store volatile i64 undef, ptr %a5
123 %a6 = getelementptr inbounds i64, ptr %a, i32 -257
124 store volatile i64 undef, ptr %a6
125 %ai = getelementptr inbounds i64, ptr %a, i32 %i
126 store volatile i64 undef, ptr %ai
130 define void @testfloat(ptr %a, i32 %i) {
131 ; RVI-LABEL: 'testfloat'
132 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a1 = getelementptr inbounds float, ptr %a, i32 1
133 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile float undef, ptr %a1, align 4
134 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a2 = getelementptr inbounds float, ptr %a, i32 -1
135 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile float undef, ptr %a2, align 4
136 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a3 = getelementptr inbounds float, ptr %a, i32 511
137 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile float undef, ptr %a3, align 4
138 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a4 = getelementptr inbounds float, ptr %a, i32 512
139 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile float undef, ptr %a4, align 4
140 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a5 = getelementptr inbounds float, ptr %a, i32 -512
141 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile float undef, ptr %a5, align 4
142 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a6 = getelementptr inbounds float, ptr %a, i32 -513
143 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile float undef, ptr %a6, align 4
144 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ai = getelementptr inbounds float, ptr %a, i32 %i
145 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile float undef, ptr %ai, align 4
146 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
148 %a1 = getelementptr inbounds float, ptr %a, i32 1
149 store volatile float undef, ptr %a1
150 %a2 = getelementptr inbounds float, ptr %a, i32 -1
151 store volatile float undef, ptr %a2
152 %a3 = getelementptr inbounds float, ptr %a, i32 511
153 store volatile float undef, ptr %a3
154 %a4 = getelementptr inbounds float, ptr %a, i32 512
155 store volatile float undef, ptr %a4
156 %a5 = getelementptr inbounds float, ptr %a, i32 -512
157 store volatile float undef, ptr %a5
158 %a6 = getelementptr inbounds float, ptr %a, i32 -513
159 store volatile float undef, ptr %a6
160 %ai = getelementptr inbounds float, ptr %a, i32 %i
161 store volatile float undef, ptr %ai
165 define void @testdouble(ptr %a, i32 %i) {
166 ; RVI-LABEL: 'testdouble'
167 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a1 = getelementptr inbounds double, ptr %a, i32 1
168 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile double undef, ptr %a1, align 8
169 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a2 = getelementptr inbounds double, ptr %a, i32 -1
170 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile double undef, ptr %a2, align 8
171 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a3 = getelementptr inbounds double, ptr %a, i32 255
172 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile double undef, ptr %a3, align 8
173 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a4 = getelementptr inbounds double, ptr %a, i32 256
174 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile double undef, ptr %a4, align 8
175 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a5 = getelementptr inbounds double, ptr %a, i32 -256
176 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile double undef, ptr %a5, align 8
177 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a6 = getelementptr inbounds double, ptr %a, i32 -257
178 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile double undef, ptr %a6, align 8
179 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ai = getelementptr inbounds double, ptr %a, i32 %i
180 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile double undef, ptr %ai, align 8
181 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
183 %a1 = getelementptr inbounds double, ptr %a, i32 1
184 store volatile double undef, ptr %a1
185 %a2 = getelementptr inbounds double, ptr %a, i32 -1
186 store volatile double undef, ptr %a2
187 %a3 = getelementptr inbounds double, ptr %a, i32 255
188 store volatile double undef, ptr %a3
189 %a4 = getelementptr inbounds double, ptr %a, i32 256
190 store volatile double undef, ptr %a4
191 %a5 = getelementptr inbounds double, ptr %a, i32 -256
192 store volatile double undef, ptr %a5
193 %a6 = getelementptr inbounds double, ptr %a, i32 -257
194 store volatile double undef, ptr %a6
195 %ai = getelementptr inbounds double, ptr %a, i32 %i
196 store volatile double undef, ptr %ai
200 define void @testvecs(i32 %i) {
201 ; RVI-LABEL: 'testvecs'
202 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b0 = getelementptr inbounds <4 x i8>, ptr undef, i32 1
203 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile <4 x i8> undef, ptr %b0, align 4
204 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b1 = getelementptr inbounds <4 x i16>, ptr undef, i32 1
205 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile <4 x i16> undef, ptr %b1, align 8
206 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b2 = getelementptr inbounds <4 x i32>, ptr undef, i32 1
207 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile <4 x i32> undef, ptr %b2, align 16
208 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b3 = getelementptr inbounds <4 x i64>, ptr undef, i32 1
209 ; RVI-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store volatile <4 x i64> undef, ptr %b3, align 32
210 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b4 = getelementptr inbounds <4 x float>, ptr undef, i32 1
211 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile <4 x float> undef, ptr %b4, align 16
212 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b5 = getelementptr inbounds <4 x double>, ptr undef, i32 1
213 ; RVI-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store volatile <4 x double> undef, ptr %b5, align 32
214 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c1 = getelementptr inbounds <4 x i8>, ptr undef, i32 128
215 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile <4 x i8> undef, ptr %c1, align 4
216 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c2 = getelementptr inbounds <4 x i16>, ptr undef, i32 128
217 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile <4 x i16> undef, ptr %c2, align 8
218 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c3 = getelementptr inbounds <4 x i32>, ptr undef, i32 128
219 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile <4 x i32> undef, ptr %c3, align 16
220 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c4 = getelementptr inbounds <4 x i64>, ptr undef, i32 128
221 ; RVI-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store volatile <4 x i64> undef, ptr %c4, align 32
222 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c5 = getelementptr inbounds <4 x float>, ptr undef, i32 128
223 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile <4 x float> undef, ptr %c5, align 16
224 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %c6 = getelementptr inbounds <4 x double>, ptr undef, i32 128
225 ; RVI-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store volatile <4 x double> undef, ptr %c6, align 32
226 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
229 %b0 = getelementptr inbounds <4 x i8>, ptr undef, i32 1
230 store volatile <4 x i8> undef, ptr %b0
231 %b1 = getelementptr inbounds <4 x i16>, ptr undef, i32 1
232 store volatile <4 x i16> undef, ptr %b1
233 %b2 = getelementptr inbounds <4 x i32>, ptr undef, i32 1
234 store volatile <4 x i32> undef, ptr %b2
235 %b3 = getelementptr inbounds <4 x i64>, ptr undef, i32 1
236 store volatile <4 x i64> undef, ptr %b3
237 %b4 = getelementptr inbounds <4 x float>, ptr undef, i32 1
238 store volatile <4 x float> undef, ptr %b4
239 %b5 = getelementptr inbounds <4 x double>, ptr undef, i32 1
240 store volatile <4 x double> undef, ptr %b5
242 %c1 = getelementptr inbounds <4 x i8>, ptr undef, i32 128
243 store volatile <4 x i8> undef, ptr %c1
244 %c2 = getelementptr inbounds <4 x i16>, ptr undef, i32 128
245 store volatile <4 x i16> undef, ptr %c2
246 %c3 = getelementptr inbounds <4 x i32>, ptr undef, i32 128
247 store volatile <4 x i32> undef, ptr %c3
248 %c4 = getelementptr inbounds <4 x i64>, ptr undef, i32 128
249 store volatile <4 x i64> undef, ptr %c4
250 %c5 = getelementptr inbounds <4 x float>, ptr undef, i32 128
251 store volatile <4 x float> undef, ptr %c5
252 %c6 = getelementptr inbounds <4 x double>, ptr undef, i32 128
253 store volatile <4 x double> undef, ptr %c6
258 ; Ensure that memory operations of a different type than the pointer source type
259 ; use the correct type to determine if folding is possible. These operations
260 ; are on vector types so there should be a cost for the GEP as the offset cannot
261 ; be folded into the instruction.
262 define void @non_foldable_vector_uses(ptr %base, <2 x ptr> %base.vec) {
263 ; RVI-LABEL: 'non_foldable_vector_uses'
264 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = getelementptr i8, ptr %base, i32 42
265 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %x1 = load volatile <2 x i8>, ptr %1, align 2
266 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %2 = getelementptr i8, ptr %base, i32 42
267 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %x2 = call <2 x i8> @llvm.masked.load.v2i8.p0(ptr %2, i32 1, <2 x i1> undef, <2 x i8> undef)
268 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %3 = getelementptr i8, <2 x ptr> %base.vec, <2 x i32> <i32 42, i32 43>
269 ; RVI-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %x3 = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> %3, i32 1, <2 x i1> undef, <2 x i8> undef)
270 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %4 = getelementptr i8, ptr %base, i32 42
271 ; RVI-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %x4 = call <2 x i8> @llvm.masked.expandload.v2i8(ptr %4, <2 x i1> undef, <2 x i8> undef)
272 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %5 = getelementptr i8, ptr %base, i32 42
273 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %x5 = call <2 x i8> @llvm.vp.load.v2i8.p0(ptr %5, <2 x i1> undef, i32 undef)
274 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %6 = getelementptr i8, ptr %base, i32 42
275 ; RVI-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %x6 = call <2 x i8> @llvm.experimental.vp.strided.load.v2i8.p0.i64(ptr %6, i64 undef, <2 x i1> undef, i32 undef)
276 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %7 = getelementptr i8, ptr %base, i32 42
277 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile <2 x i8> undef, ptr %7, align 2
278 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %8 = getelementptr i8, ptr %base, i32 42
279 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: call void @llvm.masked.store.v2i8.p0(<2 x i8> undef, ptr %8, i32 1, <2 x i1> undef)
280 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %9 = getelementptr i8, <2 x ptr> %base.vec, <2 x i32> <i32 42, i32 43>
281 ; RVI-NEXT: Cost Model: Found an estimated cost of 2 for instruction: call void @llvm.masked.scatter.v2i8.v2p0(<2 x i8> undef, <2 x ptr> %9, i32 1, <2 x i1> undef)
282 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %10 = getelementptr i8, ptr %base, i32 42
283 ; RVI-NEXT: Cost Model: Found an estimated cost of 12 for instruction: call void @llvm.masked.compressstore.v2i8(<2 x i8> undef, ptr %10, <2 x i1> undef)
284 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %11 = getelementptr i8, ptr %base, i32 42
285 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: call void @llvm.vp.store.v2i8.p0(<2 x i8> undef, ptr %11, <2 x i1> undef, i32 undef)
286 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %12 = getelementptr i8, ptr %base, i32 42
287 ; RVI-NEXT: Cost Model: Found an estimated cost of 12 for instruction: call void @llvm.experimental.vp.strided.store.v2i8.p0.i64(<2 x i8> undef, ptr %12, i64 undef, <2 x i1> undef, i32 undef)
288 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
290 %1 = getelementptr i8, ptr %base, i32 42
291 %x1 = load volatile <2 x i8>, ptr %1
293 %2 = getelementptr i8, ptr %base, i32 42
294 %x2 = call <2 x i8> @llvm.masked.load.v2i8.p0(ptr %2, i32 1, <2 x i1> undef, <2 x i8> undef)
296 %3 = getelementptr i8, <2 x ptr> %base.vec, <2 x i32> <i32 42, i32 43>
297 %x3 = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> %3, i32 1, <2 x i1> undef, <2 x i8> undef)
299 %4 = getelementptr i8, ptr %base, i32 42
300 %x4 = call <2 x i8> @llvm.masked.expandload.v2i8(ptr %4, <2 x i1> undef, <2 x i8> undef)
302 %5 = getelementptr i8, ptr %base, i32 42
303 %x5 = call <2 x i8> @llvm.vp.load.v2i8.p0(ptr %5, <2 x i1> undef, i32 undef)
305 %6 = getelementptr i8, ptr %base, i32 42
306 %x6 = call <2 x i8> @llvm.experimental.vp.strided.load.v2i8.i64(ptr %6, i64 undef, <2 x i1> undef, i32 undef)
308 %7 = getelementptr i8, ptr %base, i32 42
309 store volatile <2 x i8> undef, ptr %7
311 %8 = getelementptr i8, ptr %base, i32 42
312 call void @llvm.masked.store.v2i8.p0(<2 x i8> undef, ptr %8, i32 1, <2 x i1> undef)
314 %9 = getelementptr i8, <2 x ptr> %base.vec, <2 x i32> <i32 42, i32 43>
315 call void @llvm.masked.scatter.v2i8.v2p0(<2 x i8> undef, <2 x ptr> %9, i32 1, <2 x i1> undef)
317 %10 = getelementptr i8, ptr %base, i32 42
318 call void @llvm.masked.compressstore.v2i8(<2 x i8> undef, ptr %10, <2 x i1> undef)
320 %11 = getelementptr i8, ptr %base, i32 42
321 call void @llvm.vp.store.v2i8.p0(<2 x i8> undef, ptr %11, <2 x i1> undef, i32 undef)
323 %12 = getelementptr i8, ptr %base, i32 42
324 call void @llvm.experimental.vp.strided.store.v2i8.i64(<2 x i8> undef, ptr %12, i64 undef, <2 x i1> undef, i32 undef)
329 ; Despite the fact that these are vector loads and stores which doesn't allow an
330 ; offset in the addressing mode, because the offsets are zero we don't actually
331 ; need to do any calculation for the GEP and thus it should be free.
332 define void @foldable_vector_uses(ptr %base, <2 x ptr> %base.vec) {
333 ; RVI-LABEL: 'foldable_vector_uses'
334 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %1 = getelementptr i8, ptr %base, i32 0
335 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %x1 = load volatile <2 x i8>, ptr %1, align 2
336 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %2 = getelementptr i8, ptr %base, i32 0
337 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %x2 = call <2 x i8> @llvm.masked.load.v2i8.p0(ptr %2, i32 1, <2 x i1> undef, <2 x i8> undef)
338 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %3 = getelementptr i8, <2 x ptr> %base.vec, <2 x i32> zeroinitializer
339 ; RVI-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %x3 = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> %3, i32 1, <2 x i1> undef, <2 x i8> undef)
340 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %4 = getelementptr i8, ptr %base, i32 0
341 ; RVI-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %x4 = call <2 x i8> @llvm.masked.expandload.v2i8(ptr %4, <2 x i1> undef, <2 x i8> undef)
342 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %5 = getelementptr i8, ptr %base, i32 0
343 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %x5 = call <2 x i8> @llvm.vp.load.v2i8.p0(ptr %5, <2 x i1> undef, i32 undef)
344 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %6 = getelementptr i8, ptr %base, i32 0
345 ; RVI-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %x6 = call <2 x i8> @llvm.experimental.vp.strided.load.v2i8.p0.i64(ptr %6, i64 undef, <2 x i1> undef, i32 undef)
346 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %7 = getelementptr i8, ptr %base, i32 0
347 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store volatile <2 x i8> undef, ptr %7, align 2
348 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %8 = getelementptr i8, ptr %base, i32 0
349 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: call void @llvm.masked.store.v2i8.p0(<2 x i8> undef, ptr %8, i32 1, <2 x i1> undef)
350 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %9 = getelementptr i8, <2 x ptr> %base.vec, <2 x i32> zeroinitializer
351 ; RVI-NEXT: Cost Model: Found an estimated cost of 2 for instruction: call void @llvm.masked.scatter.v2i8.v2p0(<2 x i8> undef, <2 x ptr> %9, i32 1, <2 x i1> undef)
352 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %10 = getelementptr i8, ptr %base, i32 0
353 ; RVI-NEXT: Cost Model: Found an estimated cost of 12 for instruction: call void @llvm.masked.compressstore.v2i8(<2 x i8> undef, ptr %10, <2 x i1> undef)
354 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %11 = getelementptr i8, ptr %base, i32 0
355 ; RVI-NEXT: Cost Model: Found an estimated cost of 1 for instruction: call void @llvm.vp.store.v2i8.p0(<2 x i8> undef, ptr %11, <2 x i1> undef, i32 undef)
356 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %12 = getelementptr i8, ptr %base, i32 0
357 ; RVI-NEXT: Cost Model: Found an estimated cost of 12 for instruction: call void @llvm.experimental.vp.strided.store.v2i8.p0.i64(<2 x i8> undef, ptr %12, i64 undef, <2 x i1> undef, i32 undef)
358 ; RVI-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
360 %1 = getelementptr i8, ptr %base, i32 0
361 %x1 = load volatile <2 x i8>, ptr %1
363 %2 = getelementptr i8, ptr %base, i32 0
364 %x2 = call <2 x i8> @llvm.masked.load.v2i8.p0(ptr %2, i32 1, <2 x i1> undef, <2 x i8> undef)
366 %3 = getelementptr i8, <2 x ptr> %base.vec, <2 x i32> <i32 0, i32 0>
367 %x3 = call <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr> %3, i32 1, <2 x i1> undef, <2 x i8> undef)
369 %4 = getelementptr i8, ptr %base, i32 0
370 %x4 = call <2 x i8> @llvm.masked.expandload.v2i8(ptr %4, <2 x i1> undef, <2 x i8> undef)
372 %5 = getelementptr i8, ptr %base, i32 0
373 %x5 = call <2 x i8> @llvm.vp.load.v2i8.p0(ptr %5, <2 x i1> undef, i32 undef)
375 %6 = getelementptr i8, ptr %base, i32 0
376 %x6 = call <2 x i8> @llvm.experimental.vp.strided.load.v2i8.i64(ptr %6, i64 undef, <2 x i1> undef, i32 undef)
378 %7 = getelementptr i8, ptr %base, i32 0
379 store volatile <2 x i8> undef, ptr %7
381 %8 = getelementptr i8, ptr %base, i32 0
382 call void @llvm.masked.store.v2i8.p0(<2 x i8> undef, ptr %8, i32 1, <2 x i1> undef)
384 %9 = getelementptr i8, <2 x ptr> %base.vec, <2 x i32> <i32 0, i32 0>
385 call void @llvm.masked.scatter.v2i8.v2p0(<2 x i8> undef, <2 x ptr> %9, i32 1, <2 x i1> undef)
387 %10 = getelementptr i8, ptr %base, i32 0
388 call void @llvm.masked.compressstore.v2i8(<2 x i8> undef, ptr %10, <2 x i1> undef)
390 %11 = getelementptr i8, ptr %base, i32 0
391 call void @llvm.vp.store.v2i8.p0(<2 x i8> undef, ptr %11, <2 x i1> undef, i32 undef)
393 %12 = getelementptr i8, ptr %base, i32 0
394 call void @llvm.experimental.vp.strided.store.v2i8.i64(<2 x i8> undef, ptr %12, i64 undef, <2 x i1> undef, i32 undef)
399 declare <2 x i8> @llvm.masked.load.v2i8.p0(ptr, i32, <2 x i1>, <2 x i8>)
400 declare <2 x i8> @llvm.masked.gather.v2i8.v2p0(<2 x ptr>, i32, <2 x i1>, <2 x i8>)
401 declare <2 x i8> @llvm.masked.expandload.v2i8(ptr, <2 x i1>, <2 x i8>)
402 declare <2 x i8> @llvm.vp.load.v2i8.p0(ptr, <2 x i1>, i32)
403 declare <2 x i8> @llvm.experimental.vp.strided.load.v2i8.i64(ptr, i64, <2 x i1>, i32)
405 declare void @llvm.masked.store.v2i8.p0(<2 x i8>, ptr, i32, <2 x i1>)
406 declare void @llvm.masked.scatter.v2i8.v2p0(<2 x i8>, <2 x ptr>, i32, <2 x i1>)
407 declare void @llvm.masked.compressstore.v2i8(<2 x i8>, ptr, <2 x i1>)
408 declare void @llvm.vp.store.v2i8.p0(<2 x i8>, ptr, <2 x i1>, i32)
409 declare void @llvm.experimental.vp.strided.store.v2i8.i64(<2 x i8>, ptr, i64, <2 x i1>, i32)