1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt < %s -mtriple=aarch64--linux-gnu -cost-model -analyze | FileCheck %s --check-prefix=COST
4 define i8 @add.i8.v8i8(<8 x i8> %v) {
5 ; COST-LABEL: 'add.i8.v8i8'
6 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i8 @llvm.vector.reduce.add.v8i8(<8 x i8> %v)
7 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %r
9 %r = call i8 @llvm.vector.reduce.add.v8i8(<8 x i8> %v)
13 define i8 @add.i8.v16i8(<16 x i8> %v) {
14 ; COST-LABEL: 'add.i8.v16i8'
15 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> %v)
16 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %r
18 %r = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> %v)
22 define i16 @add.i16.v4i16(<4 x i16> %v) {
23 ; COST-LABEL: 'add.i16.v4i16'
24 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i16 @llvm.vector.reduce.add.v4i16(<4 x i16> %v)
25 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %r
27 %r = call i16 @llvm.vector.reduce.add.v4i16(<4 x i16> %v)
31 define i16 @add.i16.v8i16(<8 x i16> %v) {
32 ; COST-LABEL: 'add.i16.v8i16'
33 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> %v)
34 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %r
36 %r = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> %v)
40 define i32 @add.i32.v4i32(<4 x i32> %v) {
41 ; COST-LABEL: 'add.i32.v4i32'
42 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %v)
43 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r
45 %r = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %v)
49 define i8 @umin.i8.v8i8(<8 x i8> %v) {
50 ; COST-LABEL: 'umin.i8.v8i8'
51 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i8 @llvm.vector.reduce.umin.v8i8(<8 x i8> %v)
52 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %r
54 %r = call i8 @llvm.vector.reduce.umin.v8i8(<8 x i8> %v)
58 define i8 @umin.i8.v16i8(<16 x i8> %v) {
59 ; COST-LABEL: 'umin.i8.v16i8'
60 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i8 @llvm.vector.reduce.umin.v16i8(<16 x i8> %v)
61 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %r
63 %r = call i8 @llvm.vector.reduce.umin.v16i8(<16 x i8> %v)
67 define i16 @umin.i16.v4i16(<4 x i16> %v) {
68 ; COST-LABEL: 'umin.i16.v4i16'
69 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i16 @llvm.vector.reduce.umin.v4i16(<4 x i16> %v)
70 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %r
72 %r = call i16 @llvm.vector.reduce.umin.v4i16(<4 x i16> %v)
76 define i16 @umin.i16.v8i16(<8 x i16> %v) {
77 ; COST-LABEL: 'umin.i16.v8i16'
78 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i16 @llvm.vector.reduce.umin.v8i16(<8 x i16> %v)
79 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %r
81 %r = call i16 @llvm.vector.reduce.umin.v8i16(<8 x i16> %v)
85 define i32 @umin.i32.v4i32(<4 x i32> %v) {
86 ; COST-LABEL: 'umin.i32.v4i32'
87 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i32 @llvm.vector.reduce.umin.v4i32(<4 x i32> %v)
88 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r
90 %r = call i32 @llvm.vector.reduce.umin.v4i32(<4 x i32> %v)
94 define i8 @umax.i8.v8i8(<8 x i8> %v) {
95 ; COST-LABEL: 'umax.i8.v8i8'
96 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i8 @llvm.vector.reduce.umax.v8i8(<8 x i8> %v)
97 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %r
99 %r = call i8 @llvm.vector.reduce.umax.v8i8(<8 x i8> %v)
103 define i8 @umax.i8.v16i8(<16 x i8> %v) {
104 ; COST-LABEL: 'umax.i8.v16i8'
105 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i8 @llvm.vector.reduce.umax.v16i8(<16 x i8> %v)
106 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %r
108 %r = call i8 @llvm.vector.reduce.umax.v16i8(<16 x i8> %v)
112 define i16 @umax.i16.v4i16(<4 x i16> %v) {
113 ; COST-LABEL: 'umax.i16.v4i16'
114 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i16 @llvm.vector.reduce.umax.v4i16(<4 x i16> %v)
115 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %r
117 %r = call i16 @llvm.vector.reduce.umax.v4i16(<4 x i16> %v)
121 define i16 @umax.i16.v8i16(<8 x i16> %v) {
122 ; COST-LABEL: 'umax.i16.v8i16'
123 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i16 @llvm.vector.reduce.umax.v8i16(<8 x i16> %v)
124 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %r
126 %r = call i16 @llvm.vector.reduce.umax.v8i16(<8 x i16> %v)
130 define i32 @umax.i32.v4i32(<4 x i32> %v) {
131 ; COST-LABEL: 'umax.i32.v4i32'
132 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i32 @llvm.vector.reduce.umax.v4i32(<4 x i32> %v)
133 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r
135 %r = call i32 @llvm.vector.reduce.umax.v4i32(<4 x i32> %v)
139 define i8 @smin.i8.v8i8(<8 x i8> %v) {
140 ; COST-LABEL: 'smin.i8.v8i8'
141 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i8 @llvm.vector.reduce.smin.v8i8(<8 x i8> %v)
142 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %r
144 %r = call i8 @llvm.vector.reduce.smin.v8i8(<8 x i8> %v)
148 define i8 @smin.i8.v16i8(<16 x i8> %v) {
149 ; COST-LABEL: 'smin.i8.v16i8'
150 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i8 @llvm.vector.reduce.smin.v16i8(<16 x i8> %v)
151 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %r
153 %r = call i8 @llvm.vector.reduce.smin.v16i8(<16 x i8> %v)
157 define i16 @smin.i16.v4i16(<4 x i16> %v) {
158 ; COST-LABEL: 'smin.i16.v4i16'
159 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i16 @llvm.vector.reduce.smin.v4i16(<4 x i16> %v)
160 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %r
162 %r = call i16 @llvm.vector.reduce.smin.v4i16(<4 x i16> %v)
166 define i16 @smin.i16.v8i16(<8 x i16> %v) {
167 ; COST-LABEL: 'smin.i16.v8i16'
168 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i16 @llvm.vector.reduce.smin.v8i16(<8 x i16> %v)
169 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %r
171 %r = call i16 @llvm.vector.reduce.smin.v8i16(<8 x i16> %v)
175 define i32 @smin.i32.v4i32(<4 x i32> %v) {
176 ; COST-LABEL: 'smin.i32.v4i32'
177 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %v)
178 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r
180 %r = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %v)
184 define i8 @smax.i8.v8i8(<8 x i8> %v) {
185 ; COST-LABEL: 'smax.i8.v8i8'
186 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i8 @llvm.vector.reduce.smax.v8i8(<8 x i8> %v)
187 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %r
189 %r = call i8 @llvm.vector.reduce.smax.v8i8(<8 x i8> %v)
193 define i8 @smax.i8.v16i8(<16 x i8> %v) {
194 ; COST-LABEL: 'smax.i8.v16i8'
195 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i8 @llvm.vector.reduce.smax.v16i8(<16 x i8> %v)
196 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i8 %r
198 %r = call i8 @llvm.vector.reduce.smax.v16i8(<16 x i8> %v)
202 define i16 @smax.i16.v4i16(<4 x i16> %v) {
203 ; COST-LABEL: 'smax.i16.v4i16'
204 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i16 @llvm.vector.reduce.smax.v4i16(<4 x i16> %v)
205 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %r
207 %r = call i16 @llvm.vector.reduce.smax.v4i16(<4 x i16> %v)
211 define i16 @smax.i16.v8i16(<8 x i16> %v) {
212 ; COST-LABEL: 'smax.i16.v8i16'
213 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i16 @llvm.vector.reduce.smax.v8i16(<8 x i16> %v)
214 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i16 %r
216 %r = call i16 @llvm.vector.reduce.smax.v8i16(<8 x i16> %v)
220 define i32 @smax.i32.v4i32(<4 x i32> %v) {
221 ; COST-LABEL: 'smax.i32.v4i32'
222 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %v)
223 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 %r
225 %r = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %v)
229 define float @fmin.f32.v4f32(<4 x float> %v) {
230 ; COST-LABEL: 'fmin.f32.v4f32'
231 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call nnan float @llvm.vector.reduce.fmin.v4f32(<4 x float> %v)
232 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret float %r
234 %r = call nnan float @llvm.vector.reduce.fmin.v4f32(<4 x float> %v)
238 define float @fmax.f32.v4f32(<4 x float> %v) {
239 ; COST-LABEL: 'fmax.f32.v4f32'
240 ; COST-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = call nnan float @llvm.vector.reduce.fmax.v4f32(<4 x float> %v)
241 ; COST-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret float %r
243 %r = call nnan float @llvm.vector.reduce.fmax.v4f32(<4 x float> %v)
247 declare i8 @llvm.vector.reduce.add.v8i8(<8 x i8>)
248 declare i8 @llvm.vector.reduce.add.v16i8(<16 x i8>)
249 declare i16 @llvm.vector.reduce.add.v4i16(<4 x i16>)
250 declare i16 @llvm.vector.reduce.add.v8i16(<8 x i16>)
251 declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>)
253 declare i8 @llvm.vector.reduce.umin.v8i8(<8 x i8>)
254 declare i8 @llvm.vector.reduce.umin.v16i8(<16 x i8>)
255 declare i16 @llvm.vector.reduce.umin.v4i16(<4 x i16>)
256 declare i16 @llvm.vector.reduce.umin.v8i16(<8 x i16>)
257 declare i32 @llvm.vector.reduce.umin.v4i32(<4 x i32>)
259 declare i8 @llvm.vector.reduce.umax.v8i8(<8 x i8>)
260 declare i8 @llvm.vector.reduce.umax.v16i8(<16 x i8>)
261 declare i16 @llvm.vector.reduce.umax.v4i16(<4 x i16>)
262 declare i16 @llvm.vector.reduce.umax.v8i16(<8 x i16>)
263 declare i32 @llvm.vector.reduce.umax.v4i32(<4 x i32>)
265 declare i8 @llvm.vector.reduce.smin.v8i8(<8 x i8>)
266 declare i8 @llvm.vector.reduce.smin.v16i8(<16 x i8>)
267 declare i16 @llvm.vector.reduce.smin.v4i16(<4 x i16>)
268 declare i16 @llvm.vector.reduce.smin.v8i16(<8 x i16>)
269 declare i32 @llvm.vector.reduce.smin.v4i32(<4 x i32>)
271 declare i8 @llvm.vector.reduce.smax.v8i8(<8 x i8>)
272 declare i8 @llvm.vector.reduce.smax.v16i8(<16 x i8>)
273 declare i16 @llvm.vector.reduce.smax.v4i16(<4 x i16>)
274 declare i16 @llvm.vector.reduce.smax.v8i16(<8 x i16>)
275 declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>)
277 declare float @llvm.vector.reduce.fmin.v4f32(<4 x float>)
279 declare float @llvm.vector.reduce.fmax.v4f32(<4 x float>)