1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-none-linux-gnu %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-BASE
3 ; RUN: llc -mtriple=aarch64-none-linux-gnu -mattr=+dotprod %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-DOT
4 ; RUN: llc -mtriple=aarch64-none-linux-gnu -global-isel -global-isel-abort=2 -mattr=+dotprod %s -o - 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-GI
6 ; CHECK-GI: warning: Instruction selection used fallback path for full
8 define i32 @addv_v2i32(<2 x i32> %a) {
9 ; CHECK-LABEL: addv_v2i32:
10 ; CHECK: // %bb.0: // %entry
11 ; CHECK-NEXT: addp v0.2s, v0.2s, v0.2s
12 ; CHECK-NEXT: fmov w0, s0
15 %arg1 = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> %a)
19 define i16 @addv_v4i16(<4 x i16> %a) {
20 ; CHECK-LABEL: addv_v4i16:
21 ; CHECK: // %bb.0: // %entry
22 ; CHECK-NEXT: addv h0, v0.4h
23 ; CHECK-NEXT: fmov w0, s0
26 %arg1 = call i16 @llvm.vector.reduce.add.v4i16(<4 x i16> %a)
30 define i32 @add_v4i32_v4i32(<4 x i32> %x) {
31 ; CHECK-LABEL: add_v4i32_v4i32:
32 ; CHECK: // %bb.0: // %entry
33 ; CHECK-NEXT: addv s0, v0.4s
34 ; CHECK-NEXT: fmov w0, s0
37 %z = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %x)
41 define i8 @addv_v8i8(<8 x i8> %a) {
42 ; CHECK-LABEL: addv_v8i8:
43 ; CHECK: // %bb.0: // %entry
44 ; CHECK-NEXT: addv b0, v0.8b
45 ; CHECK-NEXT: fmov w0, s0
48 %arg1 = call i8 @llvm.vector.reduce.add.v8i8(<8 x i8> %a)
52 define i64 @add_v4i32_v4i64_zext(<4 x i32> %x) {
53 ; CHECK-BASE-LABEL: add_v4i32_v4i64_zext:
54 ; CHECK-BASE: // %bb.0: // %entry
55 ; CHECK-BASE-NEXT: uaddlv d0, v0.4s
56 ; CHECK-BASE-NEXT: fmov x0, d0
57 ; CHECK-BASE-NEXT: ret
59 ; CHECK-DOT-LABEL: add_v4i32_v4i64_zext:
60 ; CHECK-DOT: // %bb.0: // %entry
61 ; CHECK-DOT-NEXT: uaddlv d0, v0.4s
62 ; CHECK-DOT-NEXT: fmov x0, d0
65 ; CHECK-GI-LABEL: add_v4i32_v4i64_zext:
66 ; CHECK-GI: // %bb.0: // %entry
67 ; CHECK-GI-NEXT: ushll v1.2d, v0.2s, #0
68 ; CHECK-GI-NEXT: uaddw2 v0.2d, v1.2d, v0.4s
69 ; CHECK-GI-NEXT: addp d0, v0.2d
70 ; CHECK-GI-NEXT: fmov x0, d0
73 %xx = zext <4 x i32> %x to <4 x i64>
74 %z = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %xx)
78 define i64 @add_v4i32_v4i64_sext(<4 x i32> %x) {
79 ; CHECK-BASE-LABEL: add_v4i32_v4i64_sext:
80 ; CHECK-BASE: // %bb.0: // %entry
81 ; CHECK-BASE-NEXT: saddlv d0, v0.4s
82 ; CHECK-BASE-NEXT: fmov x0, d0
83 ; CHECK-BASE-NEXT: ret
85 ; CHECK-DOT-LABEL: add_v4i32_v4i64_sext:
86 ; CHECK-DOT: // %bb.0: // %entry
87 ; CHECK-DOT-NEXT: saddlv d0, v0.4s
88 ; CHECK-DOT-NEXT: fmov x0, d0
91 ; CHECK-GI-LABEL: add_v4i32_v4i64_sext:
92 ; CHECK-GI: // %bb.0: // %entry
93 ; CHECK-GI-NEXT: sshll v1.2d, v0.2s, #0
94 ; CHECK-GI-NEXT: saddw2 v0.2d, v1.2d, v0.4s
95 ; CHECK-GI-NEXT: addp d0, v0.2d
96 ; CHECK-GI-NEXT: fmov x0, d0
99 %xx = sext <4 x i32> %x to <4 x i64>
100 %z = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %xx)
104 define i64 @add_v2i32_v2i64_zext(<2 x i32> %x) {
105 ; CHECK-LABEL: add_v2i32_v2i64_zext:
106 ; CHECK: // %bb.0: // %entry
107 ; CHECK-NEXT: ushll v0.2d, v0.2s, #0
108 ; CHECK-NEXT: addp d0, v0.2d
109 ; CHECK-NEXT: fmov x0, d0
112 %xx = zext <2 x i32> %x to <2 x i64>
113 %z = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %xx)
117 define i64 @add_v2i32_v2i64_sext(<2 x i32> %x) {
118 ; CHECK-LABEL: add_v2i32_v2i64_sext:
119 ; CHECK: // %bb.0: // %entry
120 ; CHECK-NEXT: sshll v0.2d, v0.2s, #0
121 ; CHECK-NEXT: addp d0, v0.2d
122 ; CHECK-NEXT: fmov x0, d0
125 %xx = sext <2 x i32> %x to <2 x i64>
126 %z = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %xx)
130 define i32 @add_v8i16_v8i32_zext(<8 x i16> %x) {
131 ; CHECK-BASE-LABEL: add_v8i16_v8i32_zext:
132 ; CHECK-BASE: // %bb.0: // %entry
133 ; CHECK-BASE-NEXT: uaddlv s0, v0.8h
134 ; CHECK-BASE-NEXT: fmov w0, s0
135 ; CHECK-BASE-NEXT: ret
137 ; CHECK-DOT-LABEL: add_v8i16_v8i32_zext:
138 ; CHECK-DOT: // %bb.0: // %entry
139 ; CHECK-DOT-NEXT: uaddlv s0, v0.8h
140 ; CHECK-DOT-NEXT: fmov w0, s0
141 ; CHECK-DOT-NEXT: ret
143 ; CHECK-GI-LABEL: add_v8i16_v8i32_zext:
144 ; CHECK-GI: // %bb.0: // %entry
145 ; CHECK-GI-NEXT: ushll v1.4s, v0.4h, #0
146 ; CHECK-GI-NEXT: uaddw2 v0.4s, v1.4s, v0.8h
147 ; CHECK-GI-NEXT: addv s0, v0.4s
148 ; CHECK-GI-NEXT: fmov w0, s0
151 %xx = zext <8 x i16> %x to <8 x i32>
152 %z = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %xx)
156 define i32 @add_v8i16_v8i32_sext(<8 x i16> %x) {
157 ; CHECK-BASE-LABEL: add_v8i16_v8i32_sext:
158 ; CHECK-BASE: // %bb.0: // %entry
159 ; CHECK-BASE-NEXT: saddlv s0, v0.8h
160 ; CHECK-BASE-NEXT: fmov w0, s0
161 ; CHECK-BASE-NEXT: ret
163 ; CHECK-DOT-LABEL: add_v8i16_v8i32_sext:
164 ; CHECK-DOT: // %bb.0: // %entry
165 ; CHECK-DOT-NEXT: saddlv s0, v0.8h
166 ; CHECK-DOT-NEXT: fmov w0, s0
167 ; CHECK-DOT-NEXT: ret
169 ; CHECK-GI-LABEL: add_v8i16_v8i32_sext:
170 ; CHECK-GI: // %bb.0: // %entry
171 ; CHECK-GI-NEXT: sshll v1.4s, v0.4h, #0
172 ; CHECK-GI-NEXT: saddw2 v0.4s, v1.4s, v0.8h
173 ; CHECK-GI-NEXT: addv s0, v0.4s
174 ; CHECK-GI-NEXT: fmov w0, s0
177 %xx = sext <8 x i16> %x to <8 x i32>
178 %z = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %xx)
182 define i32 @add_v4i16_v4i32_zext(<4 x i16> %x) {
183 ; CHECK-LABEL: add_v4i16_v4i32_zext:
184 ; CHECK: // %bb.0: // %entry
185 ; CHECK-NEXT: ushll v0.4s, v0.4h, #0
186 ; CHECK-NEXT: addv s0, v0.4s
187 ; CHECK-NEXT: fmov w0, s0
190 %xx = zext <4 x i16> %x to <4 x i32>
191 %z = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %xx)
195 define i32 @add_v4i16_v4i32_sext(<4 x i16> %x) {
196 ; CHECK-LABEL: add_v4i16_v4i32_sext:
197 ; CHECK: // %bb.0: // %entry
198 ; CHECK-NEXT: sshll v0.4s, v0.4h, #0
199 ; CHECK-NEXT: addv s0, v0.4s
200 ; CHECK-NEXT: fmov w0, s0
203 %xx = sext <4 x i16> %x to <4 x i32>
204 %z = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %xx)
208 define zeroext i16 @add_v8i16_v8i16(<8 x i16> %x) {
209 ; CHECK-BASE-LABEL: add_v8i16_v8i16:
210 ; CHECK-BASE: // %bb.0: // %entry
211 ; CHECK-BASE-NEXT: addv h0, v0.8h
212 ; CHECK-BASE-NEXT: fmov w0, s0
213 ; CHECK-BASE-NEXT: ret
215 ; CHECK-DOT-LABEL: add_v8i16_v8i16:
216 ; CHECK-DOT: // %bb.0: // %entry
217 ; CHECK-DOT-NEXT: addv h0, v0.8h
218 ; CHECK-DOT-NEXT: fmov w0, s0
219 ; CHECK-DOT-NEXT: ret
221 ; CHECK-GI-LABEL: add_v8i16_v8i16:
222 ; CHECK-GI: // %bb.0: // %entry
223 ; CHECK-GI-NEXT: addv h0, v0.8h
224 ; CHECK-GI-NEXT: fmov w8, s0
225 ; CHECK-GI-NEXT: uxth w0, w8
228 %z = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> %x)
232 define i64 @add_v8i16_v8i64_zext(<8 x i16> %x) {
233 ; CHECK-BASE-LABEL: add_v8i16_v8i64_zext:
234 ; CHECK-BASE: // %bb.0: // %entry
235 ; CHECK-BASE-NEXT: ushll2 v1.4s, v0.8h, #0
236 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
237 ; CHECK-BASE-NEXT: uaddl2 v2.2d, v0.4s, v1.4s
238 ; CHECK-BASE-NEXT: uaddl v0.2d, v0.2s, v1.2s
239 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v2.2d
240 ; CHECK-BASE-NEXT: addp d0, v0.2d
241 ; CHECK-BASE-NEXT: fmov x0, d0
242 ; CHECK-BASE-NEXT: ret
244 ; CHECK-DOT-LABEL: add_v8i16_v8i64_zext:
245 ; CHECK-DOT: // %bb.0: // %entry
246 ; CHECK-DOT-NEXT: ushll2 v1.4s, v0.8h, #0
247 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
248 ; CHECK-DOT-NEXT: uaddl2 v2.2d, v0.4s, v1.4s
249 ; CHECK-DOT-NEXT: uaddl v0.2d, v0.2s, v1.2s
250 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v2.2d
251 ; CHECK-DOT-NEXT: addp d0, v0.2d
252 ; CHECK-DOT-NEXT: fmov x0, d0
253 ; CHECK-DOT-NEXT: ret
255 ; CHECK-GI-LABEL: add_v8i16_v8i64_zext:
256 ; CHECK-GI: // %bb.0: // %entry
257 ; CHECK-GI-NEXT: ushll v1.4s, v0.4h, #0
258 ; CHECK-GI-NEXT: ushll2 v0.4s, v0.8h, #0
259 ; CHECK-GI-NEXT: ushll v2.2d, v1.2s, #0
260 ; CHECK-GI-NEXT: ushll v3.2d, v0.2s, #0
261 ; CHECK-GI-NEXT: uaddw2 v1.2d, v2.2d, v1.4s
262 ; CHECK-GI-NEXT: uaddw2 v0.2d, v3.2d, v0.4s
263 ; CHECK-GI-NEXT: add v0.2d, v1.2d, v0.2d
264 ; CHECK-GI-NEXT: addp d0, v0.2d
265 ; CHECK-GI-NEXT: fmov x0, d0
268 %xx = zext <8 x i16> %x to <8 x i64>
269 %z = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> %xx)
273 define i64 @add_v8i16_v8i64_sext(<8 x i16> %x) {
274 ; CHECK-BASE-LABEL: add_v8i16_v8i64_sext:
275 ; CHECK-BASE: // %bb.0: // %entry
276 ; CHECK-BASE-NEXT: sshll2 v1.4s, v0.8h, #0
277 ; CHECK-BASE-NEXT: sshll v0.4s, v0.4h, #0
278 ; CHECK-BASE-NEXT: saddl2 v2.2d, v0.4s, v1.4s
279 ; CHECK-BASE-NEXT: saddl v0.2d, v0.2s, v1.2s
280 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v2.2d
281 ; CHECK-BASE-NEXT: addp d0, v0.2d
282 ; CHECK-BASE-NEXT: fmov x0, d0
283 ; CHECK-BASE-NEXT: ret
285 ; CHECK-DOT-LABEL: add_v8i16_v8i64_sext:
286 ; CHECK-DOT: // %bb.0: // %entry
287 ; CHECK-DOT-NEXT: sshll2 v1.4s, v0.8h, #0
288 ; CHECK-DOT-NEXT: sshll v0.4s, v0.4h, #0
289 ; CHECK-DOT-NEXT: saddl2 v2.2d, v0.4s, v1.4s
290 ; CHECK-DOT-NEXT: saddl v0.2d, v0.2s, v1.2s
291 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v2.2d
292 ; CHECK-DOT-NEXT: addp d0, v0.2d
293 ; CHECK-DOT-NEXT: fmov x0, d0
294 ; CHECK-DOT-NEXT: ret
296 ; CHECK-GI-LABEL: add_v8i16_v8i64_sext:
297 ; CHECK-GI: // %bb.0: // %entry
298 ; CHECK-GI-NEXT: sshll v1.4s, v0.4h, #0
299 ; CHECK-GI-NEXT: sshll2 v0.4s, v0.8h, #0
300 ; CHECK-GI-NEXT: sshll v2.2d, v1.2s, #0
301 ; CHECK-GI-NEXT: sshll v3.2d, v0.2s, #0
302 ; CHECK-GI-NEXT: saddw2 v1.2d, v2.2d, v1.4s
303 ; CHECK-GI-NEXT: saddw2 v0.2d, v3.2d, v0.4s
304 ; CHECK-GI-NEXT: add v0.2d, v1.2d, v0.2d
305 ; CHECK-GI-NEXT: addp d0, v0.2d
306 ; CHECK-GI-NEXT: fmov x0, d0
309 %xx = sext <8 x i16> %x to <8 x i64>
310 %z = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> %xx)
314 define i64 @add_v4i16_v4i64_zext(<4 x i16> %x) {
315 ; CHECK-BASE-LABEL: add_v4i16_v4i64_zext:
316 ; CHECK-BASE: // %bb.0: // %entry
317 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
318 ; CHECK-BASE-NEXT: uaddlv d0, v0.4s
319 ; CHECK-BASE-NEXT: fmov x0, d0
320 ; CHECK-BASE-NEXT: ret
322 ; CHECK-DOT-LABEL: add_v4i16_v4i64_zext:
323 ; CHECK-DOT: // %bb.0: // %entry
324 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
325 ; CHECK-DOT-NEXT: uaddlv d0, v0.4s
326 ; CHECK-DOT-NEXT: fmov x0, d0
327 ; CHECK-DOT-NEXT: ret
329 ; CHECK-GI-LABEL: add_v4i16_v4i64_zext:
330 ; CHECK-GI: // %bb.0: // %entry
331 ; CHECK-GI-NEXT: ushll v0.4s, v0.4h, #0
332 ; CHECK-GI-NEXT: ushll v1.2d, v0.2s, #0
333 ; CHECK-GI-NEXT: uaddw2 v0.2d, v1.2d, v0.4s
334 ; CHECK-GI-NEXT: addp d0, v0.2d
335 ; CHECK-GI-NEXT: fmov x0, d0
338 %xx = zext <4 x i16> %x to <4 x i64>
339 %z = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %xx)
343 define i64 @add_v4i16_v4i64_sext(<4 x i16> %x) {
344 ; CHECK-BASE-LABEL: add_v4i16_v4i64_sext:
345 ; CHECK-BASE: // %bb.0: // %entry
346 ; CHECK-BASE-NEXT: sshll v0.4s, v0.4h, #0
347 ; CHECK-BASE-NEXT: saddlv d0, v0.4s
348 ; CHECK-BASE-NEXT: fmov x0, d0
349 ; CHECK-BASE-NEXT: ret
351 ; CHECK-DOT-LABEL: add_v4i16_v4i64_sext:
352 ; CHECK-DOT: // %bb.0: // %entry
353 ; CHECK-DOT-NEXT: sshll v0.4s, v0.4h, #0
354 ; CHECK-DOT-NEXT: saddlv d0, v0.4s
355 ; CHECK-DOT-NEXT: fmov x0, d0
356 ; CHECK-DOT-NEXT: ret
358 ; CHECK-GI-LABEL: add_v4i16_v4i64_sext:
359 ; CHECK-GI: // %bb.0: // %entry
360 ; CHECK-GI-NEXT: sshll v0.4s, v0.4h, #0
361 ; CHECK-GI-NEXT: sshll v1.2d, v0.2s, #0
362 ; CHECK-GI-NEXT: saddw2 v0.2d, v1.2d, v0.4s
363 ; CHECK-GI-NEXT: addp d0, v0.2d
364 ; CHECK-GI-NEXT: fmov x0, d0
367 %xx = sext <4 x i16> %x to <4 x i64>
368 %z = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %xx)
372 define i64 @add_v2i16_v2i64_zext(<2 x i16> %x) {
373 ; CHECK-BASE-LABEL: add_v2i16_v2i64_zext:
374 ; CHECK-BASE: // %bb.0: // %entry
375 ; CHECK-BASE-NEXT: movi d1, #0x00ffff0000ffff
376 ; CHECK-BASE-NEXT: and v0.8b, v0.8b, v1.8b
377 ; CHECK-BASE-NEXT: ushll v0.2d, v0.2s, #0
378 ; CHECK-BASE-NEXT: addp d0, v0.2d
379 ; CHECK-BASE-NEXT: fmov x0, d0
380 ; CHECK-BASE-NEXT: ret
382 ; CHECK-DOT-LABEL: add_v2i16_v2i64_zext:
383 ; CHECK-DOT: // %bb.0: // %entry
384 ; CHECK-DOT-NEXT: movi d1, #0x00ffff0000ffff
385 ; CHECK-DOT-NEXT: and v0.8b, v0.8b, v1.8b
386 ; CHECK-DOT-NEXT: ushll v0.2d, v0.2s, #0
387 ; CHECK-DOT-NEXT: addp d0, v0.2d
388 ; CHECK-DOT-NEXT: fmov x0, d0
389 ; CHECK-DOT-NEXT: ret
391 ; CHECK-GI-LABEL: add_v2i16_v2i64_zext:
392 ; CHECK-GI: // %bb.0: // %entry
393 ; CHECK-GI-NEXT: movi v1.2d, #0x0000000000ffff
394 ; CHECK-GI-NEXT: ushll v0.2d, v0.2s, #0
395 ; CHECK-GI-NEXT: and v0.16b, v0.16b, v1.16b
396 ; CHECK-GI-NEXT: addp d0, v0.2d
397 ; CHECK-GI-NEXT: fmov x0, d0
400 %xx = zext <2 x i16> %x to <2 x i64>
401 %z = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %xx)
405 define i64 @add_v2i16_v2i64_sext(<2 x i16> %x) {
406 ; CHECK-LABEL: add_v2i16_v2i64_sext:
407 ; CHECK: // %bb.0: // %entry
408 ; CHECK-NEXT: ushll v0.2d, v0.2s, #0
409 ; CHECK-NEXT: shl v0.2d, v0.2d, #48
410 ; CHECK-NEXT: sshr v0.2d, v0.2d, #48
411 ; CHECK-NEXT: addp d0, v0.2d
412 ; CHECK-NEXT: fmov x0, d0
415 %xx = sext <2 x i16> %x to <2 x i64>
416 %z = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %xx)
420 define i32 @add_v16i8_v16i32_zext(<16 x i8> %x) {
421 ; CHECK-BASE-LABEL: add_v16i8_v16i32_zext:
422 ; CHECK-BASE: // %bb.0: // %entry
423 ; CHECK-BASE-NEXT: ushll2 v1.8h, v0.16b, #0
424 ; CHECK-BASE-NEXT: ushll v0.8h, v0.8b, #0
425 ; CHECK-BASE-NEXT: uaddl2 v2.4s, v0.8h, v1.8h
426 ; CHECK-BASE-NEXT: uaddl v0.4s, v0.4h, v1.4h
427 ; CHECK-BASE-NEXT: add v0.4s, v0.4s, v2.4s
428 ; CHECK-BASE-NEXT: addv s0, v0.4s
429 ; CHECK-BASE-NEXT: fmov w0, s0
430 ; CHECK-BASE-NEXT: ret
432 ; CHECK-DOT-LABEL: add_v16i8_v16i32_zext:
433 ; CHECK-DOT: // %bb.0: // %entry
434 ; CHECK-DOT-NEXT: movi v1.16b, #1
435 ; CHECK-DOT-NEXT: movi v2.2d, #0000000000000000
436 ; CHECK-DOT-NEXT: udot v2.4s, v0.16b, v1.16b
437 ; CHECK-DOT-NEXT: addv s0, v2.4s
438 ; CHECK-DOT-NEXT: fmov w0, s0
439 ; CHECK-DOT-NEXT: ret
441 ; CHECK-GI-LABEL: add_v16i8_v16i32_zext:
442 ; CHECK-GI: // %bb.0: // %entry
443 ; CHECK-GI-NEXT: ushll v1.8h, v0.8b, #0
444 ; CHECK-GI-NEXT: ushll2 v0.8h, v0.16b, #0
445 ; CHECK-GI-NEXT: ushll v2.4s, v1.4h, #0
446 ; CHECK-GI-NEXT: ushll v3.4s, v0.4h, #0
447 ; CHECK-GI-NEXT: uaddw2 v1.4s, v2.4s, v1.8h
448 ; CHECK-GI-NEXT: uaddw2 v0.4s, v3.4s, v0.8h
449 ; CHECK-GI-NEXT: add v0.4s, v1.4s, v0.4s
450 ; CHECK-GI-NEXT: addv s0, v0.4s
451 ; CHECK-GI-NEXT: fmov w0, s0
454 %xx = zext <16 x i8> %x to <16 x i32>
455 %z = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> %xx)
459 define i32 @add_v16i8_v16i32_sext(<16 x i8> %x) {
460 ; CHECK-BASE-LABEL: add_v16i8_v16i32_sext:
461 ; CHECK-BASE: // %bb.0: // %entry
462 ; CHECK-BASE-NEXT: sshll2 v1.8h, v0.16b, #0
463 ; CHECK-BASE-NEXT: sshll v0.8h, v0.8b, #0
464 ; CHECK-BASE-NEXT: saddl2 v2.4s, v0.8h, v1.8h
465 ; CHECK-BASE-NEXT: saddl v0.4s, v0.4h, v1.4h
466 ; CHECK-BASE-NEXT: add v0.4s, v0.4s, v2.4s
467 ; CHECK-BASE-NEXT: addv s0, v0.4s
468 ; CHECK-BASE-NEXT: fmov w0, s0
469 ; CHECK-BASE-NEXT: ret
471 ; CHECK-DOT-LABEL: add_v16i8_v16i32_sext:
472 ; CHECK-DOT: // %bb.0: // %entry
473 ; CHECK-DOT-NEXT: movi v1.16b, #1
474 ; CHECK-DOT-NEXT: movi v2.2d, #0000000000000000
475 ; CHECK-DOT-NEXT: sdot v2.4s, v0.16b, v1.16b
476 ; CHECK-DOT-NEXT: addv s0, v2.4s
477 ; CHECK-DOT-NEXT: fmov w0, s0
478 ; CHECK-DOT-NEXT: ret
480 ; CHECK-GI-LABEL: add_v16i8_v16i32_sext:
481 ; CHECK-GI: // %bb.0: // %entry
482 ; CHECK-GI-NEXT: sshll v1.8h, v0.8b, #0
483 ; CHECK-GI-NEXT: sshll2 v0.8h, v0.16b, #0
484 ; CHECK-GI-NEXT: sshll v2.4s, v1.4h, #0
485 ; CHECK-GI-NEXT: sshll v3.4s, v0.4h, #0
486 ; CHECK-GI-NEXT: saddw2 v1.4s, v2.4s, v1.8h
487 ; CHECK-GI-NEXT: saddw2 v0.4s, v3.4s, v0.8h
488 ; CHECK-GI-NEXT: add v0.4s, v1.4s, v0.4s
489 ; CHECK-GI-NEXT: addv s0, v0.4s
490 ; CHECK-GI-NEXT: fmov w0, s0
493 %xx = sext <16 x i8> %x to <16 x i32>
494 %z = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> %xx)
498 define i32 @add_v8i8_v8i32_zext(<8 x i8> %x) {
499 ; CHECK-BASE-LABEL: add_v8i8_v8i32_zext:
500 ; CHECK-BASE: // %bb.0: // %entry
501 ; CHECK-BASE-NEXT: ushll v0.8h, v0.8b, #0
502 ; CHECK-BASE-NEXT: uaddlv s0, v0.8h
503 ; CHECK-BASE-NEXT: fmov w0, s0
504 ; CHECK-BASE-NEXT: ret
506 ; CHECK-DOT-LABEL: add_v8i8_v8i32_zext:
507 ; CHECK-DOT: // %bb.0: // %entry
508 ; CHECK-DOT-NEXT: movi v1.2d, #0000000000000000
509 ; CHECK-DOT-NEXT: movi v2.8b, #1
510 ; CHECK-DOT-NEXT: udot v1.2s, v0.8b, v2.8b
511 ; CHECK-DOT-NEXT: addp v0.2s, v1.2s, v1.2s
512 ; CHECK-DOT-NEXT: fmov w0, s0
513 ; CHECK-DOT-NEXT: ret
515 ; CHECK-GI-LABEL: add_v8i8_v8i32_zext:
516 ; CHECK-GI: // %bb.0: // %entry
517 ; CHECK-GI-NEXT: ushll v0.8h, v0.8b, #0
518 ; CHECK-GI-NEXT: ushll v1.4s, v0.4h, #0
519 ; CHECK-GI-NEXT: uaddw2 v0.4s, v1.4s, v0.8h
520 ; CHECK-GI-NEXT: addv s0, v0.4s
521 ; CHECK-GI-NEXT: fmov w0, s0
524 %xx = zext <8 x i8> %x to <8 x i32>
525 %z = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %xx)
529 define i32 @add_v8i8_v8i32_sext(<8 x i8> %x) {
530 ; CHECK-BASE-LABEL: add_v8i8_v8i32_sext:
531 ; CHECK-BASE: // %bb.0: // %entry
532 ; CHECK-BASE-NEXT: sshll v0.8h, v0.8b, #0
533 ; CHECK-BASE-NEXT: saddlv s0, v0.8h
534 ; CHECK-BASE-NEXT: fmov w0, s0
535 ; CHECK-BASE-NEXT: ret
537 ; CHECK-DOT-LABEL: add_v8i8_v8i32_sext:
538 ; CHECK-DOT: // %bb.0: // %entry
539 ; CHECK-DOT-NEXT: movi v1.2d, #0000000000000000
540 ; CHECK-DOT-NEXT: movi v2.8b, #1
541 ; CHECK-DOT-NEXT: sdot v1.2s, v0.8b, v2.8b
542 ; CHECK-DOT-NEXT: addp v0.2s, v1.2s, v1.2s
543 ; CHECK-DOT-NEXT: fmov w0, s0
544 ; CHECK-DOT-NEXT: ret
546 ; CHECK-GI-LABEL: add_v8i8_v8i32_sext:
547 ; CHECK-GI: // %bb.0: // %entry
548 ; CHECK-GI-NEXT: sshll v0.8h, v0.8b, #0
549 ; CHECK-GI-NEXT: sshll v1.4s, v0.4h, #0
550 ; CHECK-GI-NEXT: saddw2 v0.4s, v1.4s, v0.8h
551 ; CHECK-GI-NEXT: addv s0, v0.4s
552 ; CHECK-GI-NEXT: fmov w0, s0
555 %xx = sext <8 x i8> %x to <8 x i32>
556 %z = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %xx)
560 define i32 @add_v4i8_v4i32_zext(<4 x i8> %x) {
561 ; CHECK-BASE-LABEL: add_v4i8_v4i32_zext:
562 ; CHECK-BASE: // %bb.0: // %entry
563 ; CHECK-BASE-NEXT: bic v0.4h, #255, lsl #8
564 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
565 ; CHECK-BASE-NEXT: addv s0, v0.4s
566 ; CHECK-BASE-NEXT: fmov w0, s0
567 ; CHECK-BASE-NEXT: ret
569 ; CHECK-DOT-LABEL: add_v4i8_v4i32_zext:
570 ; CHECK-DOT: // %bb.0: // %entry
571 ; CHECK-DOT-NEXT: bic v0.4h, #255, lsl #8
572 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
573 ; CHECK-DOT-NEXT: addv s0, v0.4s
574 ; CHECK-DOT-NEXT: fmov w0, s0
575 ; CHECK-DOT-NEXT: ret
577 ; CHECK-GI-LABEL: add_v4i8_v4i32_zext:
578 ; CHECK-GI: // %bb.0: // %entry
579 ; CHECK-GI-NEXT: movi v1.2d, #0x0000ff000000ff
580 ; CHECK-GI-NEXT: ushll v0.4s, v0.4h, #0
581 ; CHECK-GI-NEXT: and v0.16b, v0.16b, v1.16b
582 ; CHECK-GI-NEXT: addv s0, v0.4s
583 ; CHECK-GI-NEXT: fmov w0, s0
586 %xx = zext <4 x i8> %x to <4 x i32>
587 %z = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %xx)
591 define i32 @add_v4i8_v4i32_sext(<4 x i8> %x) {
592 ; CHECK-LABEL: add_v4i8_v4i32_sext:
593 ; CHECK: // %bb.0: // %entry
594 ; CHECK-NEXT: ushll v0.4s, v0.4h, #0
595 ; CHECK-NEXT: shl v0.4s, v0.4s, #24
596 ; CHECK-NEXT: sshr v0.4s, v0.4s, #24
597 ; CHECK-NEXT: addv s0, v0.4s
598 ; CHECK-NEXT: fmov w0, s0
601 %xx = sext <4 x i8> %x to <4 x i32>
602 %z = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %xx)
606 define zeroext i16 @add_v16i8_v16i16_zext(<16 x i8> %x) {
607 ; CHECK-BASE-LABEL: add_v16i8_v16i16_zext:
608 ; CHECK-BASE: // %bb.0: // %entry
609 ; CHECK-BASE-NEXT: uaddlp v0.8h, v0.16b
610 ; CHECK-BASE-NEXT: addv h0, v0.8h
611 ; CHECK-BASE-NEXT: fmov w0, s0
612 ; CHECK-BASE-NEXT: ret
614 ; CHECK-DOT-LABEL: add_v16i8_v16i16_zext:
615 ; CHECK-DOT: // %bb.0: // %entry
616 ; CHECK-DOT-NEXT: uaddlp v0.8h, v0.16b
617 ; CHECK-DOT-NEXT: addv h0, v0.8h
618 ; CHECK-DOT-NEXT: fmov w0, s0
619 ; CHECK-DOT-NEXT: ret
621 ; CHECK-GI-LABEL: add_v16i8_v16i16_zext:
622 ; CHECK-GI: // %bb.0: // %entry
623 ; CHECK-GI-NEXT: ushll v1.8h, v0.8b, #0
624 ; CHECK-GI-NEXT: uaddw2 v0.8h, v1.8h, v0.16b
625 ; CHECK-GI-NEXT: addv h0, v0.8h
626 ; CHECK-GI-NEXT: fmov w8, s0
627 ; CHECK-GI-NEXT: uxth w0, w8
630 %xx = zext <16 x i8> %x to <16 x i16>
631 %z = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> %xx)
635 define signext i16 @add_v16i8_v16i16_sext(<16 x i8> %x) {
636 ; CHECK-BASE-LABEL: add_v16i8_v16i16_sext:
637 ; CHECK-BASE: // %bb.0: // %entry
638 ; CHECK-BASE-NEXT: saddlp v0.8h, v0.16b
639 ; CHECK-BASE-NEXT: addv h0, v0.8h
640 ; CHECK-BASE-NEXT: smov w0, v0.h[0]
641 ; CHECK-BASE-NEXT: ret
643 ; CHECK-DOT-LABEL: add_v16i8_v16i16_sext:
644 ; CHECK-DOT: // %bb.0: // %entry
645 ; CHECK-DOT-NEXT: saddlp v0.8h, v0.16b
646 ; CHECK-DOT-NEXT: addv h0, v0.8h
647 ; CHECK-DOT-NEXT: smov w0, v0.h[0]
648 ; CHECK-DOT-NEXT: ret
650 ; CHECK-GI-LABEL: add_v16i8_v16i16_sext:
651 ; CHECK-GI: // %bb.0: // %entry
652 ; CHECK-GI-NEXT: sshll v1.8h, v0.8b, #0
653 ; CHECK-GI-NEXT: saddw2 v0.8h, v1.8h, v0.16b
654 ; CHECK-GI-NEXT: addv h0, v0.8h
655 ; CHECK-GI-NEXT: fmov w8, s0
656 ; CHECK-GI-NEXT: sxth w0, w8
659 %xx = sext <16 x i8> %x to <16 x i16>
660 %z = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> %xx)
664 define zeroext i16 @add_v8i8_v8i16_zext(<8 x i8> %x) {
665 ; CHECK-BASE-LABEL: add_v8i8_v8i16_zext:
666 ; CHECK-BASE: // %bb.0: // %entry
667 ; CHECK-BASE-NEXT: ushll v0.8h, v0.8b, #0
668 ; CHECK-BASE-NEXT: addv h0, v0.8h
669 ; CHECK-BASE-NEXT: fmov w0, s0
670 ; CHECK-BASE-NEXT: ret
672 ; CHECK-DOT-LABEL: add_v8i8_v8i16_zext:
673 ; CHECK-DOT: // %bb.0: // %entry
674 ; CHECK-DOT-NEXT: ushll v0.8h, v0.8b, #0
675 ; CHECK-DOT-NEXT: addv h0, v0.8h
676 ; CHECK-DOT-NEXT: fmov w0, s0
677 ; CHECK-DOT-NEXT: ret
679 ; CHECK-GI-LABEL: add_v8i8_v8i16_zext:
680 ; CHECK-GI: // %bb.0: // %entry
681 ; CHECK-GI-NEXT: ushll v0.8h, v0.8b, #0
682 ; CHECK-GI-NEXT: addv h0, v0.8h
683 ; CHECK-GI-NEXT: fmov w8, s0
684 ; CHECK-GI-NEXT: uxth w0, w8
687 %xx = zext <8 x i8> %x to <8 x i16>
688 %z = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> %xx)
692 define signext i16 @add_v8i8_v8i16_sext(<8 x i8> %x) {
693 ; CHECK-BASE-LABEL: add_v8i8_v8i16_sext:
694 ; CHECK-BASE: // %bb.0: // %entry
695 ; CHECK-BASE-NEXT: sshll v0.8h, v0.8b, #0
696 ; CHECK-BASE-NEXT: addv h0, v0.8h
697 ; CHECK-BASE-NEXT: smov w0, v0.h[0]
698 ; CHECK-BASE-NEXT: ret
700 ; CHECK-DOT-LABEL: add_v8i8_v8i16_sext:
701 ; CHECK-DOT: // %bb.0: // %entry
702 ; CHECK-DOT-NEXT: sshll v0.8h, v0.8b, #0
703 ; CHECK-DOT-NEXT: addv h0, v0.8h
704 ; CHECK-DOT-NEXT: smov w0, v0.h[0]
705 ; CHECK-DOT-NEXT: ret
707 ; CHECK-GI-LABEL: add_v8i8_v8i16_sext:
708 ; CHECK-GI: // %bb.0: // %entry
709 ; CHECK-GI-NEXT: sshll v0.8h, v0.8b, #0
710 ; CHECK-GI-NEXT: addv h0, v0.8h
711 ; CHECK-GI-NEXT: fmov w8, s0
712 ; CHECK-GI-NEXT: sxth w0, w8
715 %xx = sext <8 x i8> %x to <8 x i16>
716 %z = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> %xx)
720 define zeroext i8 @add_v16i8_v16i8(<16 x i8> %x) {
721 ; CHECK-BASE-LABEL: add_v16i8_v16i8:
722 ; CHECK-BASE: // %bb.0: // %entry
723 ; CHECK-BASE-NEXT: addv b0, v0.16b
724 ; CHECK-BASE-NEXT: fmov w0, s0
725 ; CHECK-BASE-NEXT: ret
727 ; CHECK-DOT-LABEL: add_v16i8_v16i8:
728 ; CHECK-DOT: // %bb.0: // %entry
729 ; CHECK-DOT-NEXT: addv b0, v0.16b
730 ; CHECK-DOT-NEXT: fmov w0, s0
731 ; CHECK-DOT-NEXT: ret
733 ; CHECK-GI-LABEL: add_v16i8_v16i8:
734 ; CHECK-GI: // %bb.0: // %entry
735 ; CHECK-GI-NEXT: addv b0, v0.16b
736 ; CHECK-GI-NEXT: fmov w8, s0
737 ; CHECK-GI-NEXT: uxtb w0, w8
740 %z = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> %x)
744 define i64 @add_v16i8_v16i64_zext(<16 x i8> %x) {
745 ; CHECK-BASE-LABEL: add_v16i8_v16i64_zext:
746 ; CHECK-BASE: // %bb.0: // %entry
747 ; CHECK-BASE-NEXT: ushll2 v1.8h, v0.16b, #0
748 ; CHECK-BASE-NEXT: ushll v0.8h, v0.8b, #0
749 ; CHECK-BASE-NEXT: ushll2 v2.4s, v1.8h, #0
750 ; CHECK-BASE-NEXT: ushll2 v3.4s, v0.8h, #0
751 ; CHECK-BASE-NEXT: ushll v1.4s, v1.4h, #0
752 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
753 ; CHECK-BASE-NEXT: uaddl2 v4.2d, v3.4s, v2.4s
754 ; CHECK-BASE-NEXT: uaddl v2.2d, v3.2s, v2.2s
755 ; CHECK-BASE-NEXT: uaddl2 v5.2d, v0.4s, v1.4s
756 ; CHECK-BASE-NEXT: uaddl v0.2d, v0.2s, v1.2s
757 ; CHECK-BASE-NEXT: add v1.2d, v5.2d, v4.2d
758 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v2.2d
759 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v1.2d
760 ; CHECK-BASE-NEXT: addp d0, v0.2d
761 ; CHECK-BASE-NEXT: fmov x0, d0
762 ; CHECK-BASE-NEXT: ret
764 ; CHECK-DOT-LABEL: add_v16i8_v16i64_zext:
765 ; CHECK-DOT: // %bb.0: // %entry
766 ; CHECK-DOT-NEXT: ushll2 v1.8h, v0.16b, #0
767 ; CHECK-DOT-NEXT: ushll v0.8h, v0.8b, #0
768 ; CHECK-DOT-NEXT: ushll2 v2.4s, v1.8h, #0
769 ; CHECK-DOT-NEXT: ushll2 v3.4s, v0.8h, #0
770 ; CHECK-DOT-NEXT: ushll v1.4s, v1.4h, #0
771 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
772 ; CHECK-DOT-NEXT: uaddl2 v4.2d, v3.4s, v2.4s
773 ; CHECK-DOT-NEXT: uaddl v2.2d, v3.2s, v2.2s
774 ; CHECK-DOT-NEXT: uaddl2 v5.2d, v0.4s, v1.4s
775 ; CHECK-DOT-NEXT: uaddl v0.2d, v0.2s, v1.2s
776 ; CHECK-DOT-NEXT: add v1.2d, v5.2d, v4.2d
777 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v2.2d
778 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v1.2d
779 ; CHECK-DOT-NEXT: addp d0, v0.2d
780 ; CHECK-DOT-NEXT: fmov x0, d0
781 ; CHECK-DOT-NEXT: ret
783 ; CHECK-GI-LABEL: add_v16i8_v16i64_zext:
784 ; CHECK-GI: // %bb.0: // %entry
785 ; CHECK-GI-NEXT: ushll v1.8h, v0.8b, #0
786 ; CHECK-GI-NEXT: ushll2 v0.8h, v0.16b, #0
787 ; CHECK-GI-NEXT: ushll v2.4s, v1.4h, #0
788 ; CHECK-GI-NEXT: ushll2 v1.4s, v1.8h, #0
789 ; CHECK-GI-NEXT: ushll v3.4s, v0.4h, #0
790 ; CHECK-GI-NEXT: ushll2 v0.4s, v0.8h, #0
791 ; CHECK-GI-NEXT: ushll v4.2d, v2.2s, #0
792 ; CHECK-GI-NEXT: ushll v5.2d, v1.2s, #0
793 ; CHECK-GI-NEXT: ushll v6.2d, v3.2s, #0
794 ; CHECK-GI-NEXT: ushll v7.2d, v0.2s, #0
795 ; CHECK-GI-NEXT: uaddw2 v2.2d, v4.2d, v2.4s
796 ; CHECK-GI-NEXT: uaddw2 v1.2d, v5.2d, v1.4s
797 ; CHECK-GI-NEXT: uaddw2 v3.2d, v6.2d, v3.4s
798 ; CHECK-GI-NEXT: uaddw2 v0.2d, v7.2d, v0.4s
799 ; CHECK-GI-NEXT: add v1.2d, v2.2d, v1.2d
800 ; CHECK-GI-NEXT: add v0.2d, v3.2d, v0.2d
801 ; CHECK-GI-NEXT: add v0.2d, v1.2d, v0.2d
802 ; CHECK-GI-NEXT: addp d0, v0.2d
803 ; CHECK-GI-NEXT: fmov x0, d0
806 %xx = zext <16 x i8> %x to <16 x i64>
807 %z = call i64 @llvm.vector.reduce.add.v16i64(<16 x i64> %xx)
811 define i64 @add_v16i8_v16i64_sext(<16 x i8> %x) {
812 ; CHECK-BASE-LABEL: add_v16i8_v16i64_sext:
813 ; CHECK-BASE: // %bb.0: // %entry
814 ; CHECK-BASE-NEXT: sshll2 v1.8h, v0.16b, #0
815 ; CHECK-BASE-NEXT: sshll v0.8h, v0.8b, #0
816 ; CHECK-BASE-NEXT: sshll2 v2.4s, v1.8h, #0
817 ; CHECK-BASE-NEXT: sshll2 v3.4s, v0.8h, #0
818 ; CHECK-BASE-NEXT: sshll v1.4s, v1.4h, #0
819 ; CHECK-BASE-NEXT: sshll v0.4s, v0.4h, #0
820 ; CHECK-BASE-NEXT: saddl2 v4.2d, v3.4s, v2.4s
821 ; CHECK-BASE-NEXT: saddl v2.2d, v3.2s, v2.2s
822 ; CHECK-BASE-NEXT: saddl2 v5.2d, v0.4s, v1.4s
823 ; CHECK-BASE-NEXT: saddl v0.2d, v0.2s, v1.2s
824 ; CHECK-BASE-NEXT: add v1.2d, v5.2d, v4.2d
825 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v2.2d
826 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v1.2d
827 ; CHECK-BASE-NEXT: addp d0, v0.2d
828 ; CHECK-BASE-NEXT: fmov x0, d0
829 ; CHECK-BASE-NEXT: ret
831 ; CHECK-DOT-LABEL: add_v16i8_v16i64_sext:
832 ; CHECK-DOT: // %bb.0: // %entry
833 ; CHECK-DOT-NEXT: sshll2 v1.8h, v0.16b, #0
834 ; CHECK-DOT-NEXT: sshll v0.8h, v0.8b, #0
835 ; CHECK-DOT-NEXT: sshll2 v2.4s, v1.8h, #0
836 ; CHECK-DOT-NEXT: sshll2 v3.4s, v0.8h, #0
837 ; CHECK-DOT-NEXT: sshll v1.4s, v1.4h, #0
838 ; CHECK-DOT-NEXT: sshll v0.4s, v0.4h, #0
839 ; CHECK-DOT-NEXT: saddl2 v4.2d, v3.4s, v2.4s
840 ; CHECK-DOT-NEXT: saddl v2.2d, v3.2s, v2.2s
841 ; CHECK-DOT-NEXT: saddl2 v5.2d, v0.4s, v1.4s
842 ; CHECK-DOT-NEXT: saddl v0.2d, v0.2s, v1.2s
843 ; CHECK-DOT-NEXT: add v1.2d, v5.2d, v4.2d
844 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v2.2d
845 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v1.2d
846 ; CHECK-DOT-NEXT: addp d0, v0.2d
847 ; CHECK-DOT-NEXT: fmov x0, d0
848 ; CHECK-DOT-NEXT: ret
850 ; CHECK-GI-LABEL: add_v16i8_v16i64_sext:
851 ; CHECK-GI: // %bb.0: // %entry
852 ; CHECK-GI-NEXT: sshll v1.8h, v0.8b, #0
853 ; CHECK-GI-NEXT: sshll2 v0.8h, v0.16b, #0
854 ; CHECK-GI-NEXT: sshll v2.4s, v1.4h, #0
855 ; CHECK-GI-NEXT: sshll2 v1.4s, v1.8h, #0
856 ; CHECK-GI-NEXT: sshll v3.4s, v0.4h, #0
857 ; CHECK-GI-NEXT: sshll2 v0.4s, v0.8h, #0
858 ; CHECK-GI-NEXT: sshll v4.2d, v2.2s, #0
859 ; CHECK-GI-NEXT: sshll v5.2d, v1.2s, #0
860 ; CHECK-GI-NEXT: sshll v6.2d, v3.2s, #0
861 ; CHECK-GI-NEXT: sshll v7.2d, v0.2s, #0
862 ; CHECK-GI-NEXT: saddw2 v2.2d, v4.2d, v2.4s
863 ; CHECK-GI-NEXT: saddw2 v1.2d, v5.2d, v1.4s
864 ; CHECK-GI-NEXT: saddw2 v3.2d, v6.2d, v3.4s
865 ; CHECK-GI-NEXT: saddw2 v0.2d, v7.2d, v0.4s
866 ; CHECK-GI-NEXT: add v1.2d, v2.2d, v1.2d
867 ; CHECK-GI-NEXT: add v0.2d, v3.2d, v0.2d
868 ; CHECK-GI-NEXT: add v0.2d, v1.2d, v0.2d
869 ; CHECK-GI-NEXT: addp d0, v0.2d
870 ; CHECK-GI-NEXT: fmov x0, d0
873 %xx = sext <16 x i8> %x to <16 x i64>
874 %z = call i64 @llvm.vector.reduce.add.v16i64(<16 x i64> %xx)
878 define i64 @add_v8i8_v8i64_zext(<8 x i8> %x) {
879 ; CHECK-BASE-LABEL: add_v8i8_v8i64_zext:
880 ; CHECK-BASE: // %bb.0: // %entry
881 ; CHECK-BASE-NEXT: ushll v0.8h, v0.8b, #0
882 ; CHECK-BASE-NEXT: ushll2 v1.4s, v0.8h, #0
883 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
884 ; CHECK-BASE-NEXT: uaddl2 v2.2d, v0.4s, v1.4s
885 ; CHECK-BASE-NEXT: uaddl v0.2d, v0.2s, v1.2s
886 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v2.2d
887 ; CHECK-BASE-NEXT: addp d0, v0.2d
888 ; CHECK-BASE-NEXT: fmov x0, d0
889 ; CHECK-BASE-NEXT: ret
891 ; CHECK-DOT-LABEL: add_v8i8_v8i64_zext:
892 ; CHECK-DOT: // %bb.0: // %entry
893 ; CHECK-DOT-NEXT: ushll v0.8h, v0.8b, #0
894 ; CHECK-DOT-NEXT: ushll2 v1.4s, v0.8h, #0
895 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
896 ; CHECK-DOT-NEXT: uaddl2 v2.2d, v0.4s, v1.4s
897 ; CHECK-DOT-NEXT: uaddl v0.2d, v0.2s, v1.2s
898 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v2.2d
899 ; CHECK-DOT-NEXT: addp d0, v0.2d
900 ; CHECK-DOT-NEXT: fmov x0, d0
901 ; CHECK-DOT-NEXT: ret
903 ; CHECK-GI-LABEL: add_v8i8_v8i64_zext:
904 ; CHECK-GI: // %bb.0: // %entry
905 ; CHECK-GI-NEXT: ushll v0.8h, v0.8b, #0
906 ; CHECK-GI-NEXT: ushll v1.4s, v0.4h, #0
907 ; CHECK-GI-NEXT: ushll2 v0.4s, v0.8h, #0
908 ; CHECK-GI-NEXT: ushll v2.2d, v1.2s, #0
909 ; CHECK-GI-NEXT: ushll v3.2d, v0.2s, #0
910 ; CHECK-GI-NEXT: uaddw2 v1.2d, v2.2d, v1.4s
911 ; CHECK-GI-NEXT: uaddw2 v0.2d, v3.2d, v0.4s
912 ; CHECK-GI-NEXT: add v0.2d, v1.2d, v0.2d
913 ; CHECK-GI-NEXT: addp d0, v0.2d
914 ; CHECK-GI-NEXT: fmov x0, d0
917 %xx = zext <8 x i8> %x to <8 x i64>
918 %z = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> %xx)
922 define i64 @add_v8i8_v8i64_sext(<8 x i8> %x) {
923 ; CHECK-BASE-LABEL: add_v8i8_v8i64_sext:
924 ; CHECK-BASE: // %bb.0: // %entry
925 ; CHECK-BASE-NEXT: sshll v0.8h, v0.8b, #0
926 ; CHECK-BASE-NEXT: sshll2 v1.4s, v0.8h, #0
927 ; CHECK-BASE-NEXT: sshll v0.4s, v0.4h, #0
928 ; CHECK-BASE-NEXT: saddl2 v2.2d, v0.4s, v1.4s
929 ; CHECK-BASE-NEXT: saddl v0.2d, v0.2s, v1.2s
930 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v2.2d
931 ; CHECK-BASE-NEXT: addp d0, v0.2d
932 ; CHECK-BASE-NEXT: fmov x0, d0
933 ; CHECK-BASE-NEXT: ret
935 ; CHECK-DOT-LABEL: add_v8i8_v8i64_sext:
936 ; CHECK-DOT: // %bb.0: // %entry
937 ; CHECK-DOT-NEXT: sshll v0.8h, v0.8b, #0
938 ; CHECK-DOT-NEXT: sshll2 v1.4s, v0.8h, #0
939 ; CHECK-DOT-NEXT: sshll v0.4s, v0.4h, #0
940 ; CHECK-DOT-NEXT: saddl2 v2.2d, v0.4s, v1.4s
941 ; CHECK-DOT-NEXT: saddl v0.2d, v0.2s, v1.2s
942 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v2.2d
943 ; CHECK-DOT-NEXT: addp d0, v0.2d
944 ; CHECK-DOT-NEXT: fmov x0, d0
945 ; CHECK-DOT-NEXT: ret
947 ; CHECK-GI-LABEL: add_v8i8_v8i64_sext:
948 ; CHECK-GI: // %bb.0: // %entry
949 ; CHECK-GI-NEXT: sshll v0.8h, v0.8b, #0
950 ; CHECK-GI-NEXT: sshll v1.4s, v0.4h, #0
951 ; CHECK-GI-NEXT: sshll2 v0.4s, v0.8h, #0
952 ; CHECK-GI-NEXT: sshll v2.2d, v1.2s, #0
953 ; CHECK-GI-NEXT: sshll v3.2d, v0.2s, #0
954 ; CHECK-GI-NEXT: saddw2 v1.2d, v2.2d, v1.4s
955 ; CHECK-GI-NEXT: saddw2 v0.2d, v3.2d, v0.4s
956 ; CHECK-GI-NEXT: add v0.2d, v1.2d, v0.2d
957 ; CHECK-GI-NEXT: addp d0, v0.2d
958 ; CHECK-GI-NEXT: fmov x0, d0
961 %xx = sext <8 x i8> %x to <8 x i64>
962 %z = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> %xx)
966 define i64 @add_v4i8_v4i64_zext(<4 x i8> %x) {
967 ; CHECK-BASE-LABEL: add_v4i8_v4i64_zext:
968 ; CHECK-BASE: // %bb.0: // %entry
969 ; CHECK-BASE-NEXT: bic v0.4h, #255, lsl #8
970 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
971 ; CHECK-BASE-NEXT: uaddlv d0, v0.4s
972 ; CHECK-BASE-NEXT: fmov x0, d0
973 ; CHECK-BASE-NEXT: ret
975 ; CHECK-DOT-LABEL: add_v4i8_v4i64_zext:
976 ; CHECK-DOT: // %bb.0: // %entry
977 ; CHECK-DOT-NEXT: bic v0.4h, #255, lsl #8
978 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
979 ; CHECK-DOT-NEXT: uaddlv d0, v0.4s
980 ; CHECK-DOT-NEXT: fmov x0, d0
981 ; CHECK-DOT-NEXT: ret
983 ; CHECK-GI-LABEL: add_v4i8_v4i64_zext:
984 ; CHECK-GI: // %bb.0: // %entry
985 ; CHECK-GI-NEXT: ushll v0.4s, v0.4h, #0
986 ; CHECK-GI-NEXT: movi v1.2d, #0x000000000000ff
987 ; CHECK-GI-NEXT: ushll v2.2d, v0.2s, #0
988 ; CHECK-GI-NEXT: ushll2 v0.2d, v0.4s, #0
989 ; CHECK-GI-NEXT: and v2.16b, v2.16b, v1.16b
990 ; CHECK-GI-NEXT: and v0.16b, v0.16b, v1.16b
991 ; CHECK-GI-NEXT: add v0.2d, v2.2d, v0.2d
992 ; CHECK-GI-NEXT: addp d0, v0.2d
993 ; CHECK-GI-NEXT: fmov x0, d0
996 %xx = zext <4 x i8> %x to <4 x i64>
997 %z = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %xx)
1001 define i64 @add_v4i8_v4i64_sext(<4 x i8> %x) {
1002 ; CHECK-BASE-LABEL: add_v4i8_v4i64_sext:
1003 ; CHECK-BASE: // %bb.0: // %entry
1004 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
1005 ; CHECK-BASE-NEXT: ushll v1.2d, v0.2s, #0
1006 ; CHECK-BASE-NEXT: ushll2 v0.2d, v0.4s, #0
1007 ; CHECK-BASE-NEXT: shl v1.2d, v1.2d, #56
1008 ; CHECK-BASE-NEXT: shl v0.2d, v0.2d, #56
1009 ; CHECK-BASE-NEXT: sshr v1.2d, v1.2d, #56
1010 ; CHECK-BASE-NEXT: ssra v1.2d, v0.2d, #56
1011 ; CHECK-BASE-NEXT: addp d0, v1.2d
1012 ; CHECK-BASE-NEXT: fmov x0, d0
1013 ; CHECK-BASE-NEXT: ret
1015 ; CHECK-DOT-LABEL: add_v4i8_v4i64_sext:
1016 ; CHECK-DOT: // %bb.0: // %entry
1017 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
1018 ; CHECK-DOT-NEXT: ushll v1.2d, v0.2s, #0
1019 ; CHECK-DOT-NEXT: ushll2 v0.2d, v0.4s, #0
1020 ; CHECK-DOT-NEXT: shl v1.2d, v1.2d, #56
1021 ; CHECK-DOT-NEXT: shl v0.2d, v0.2d, #56
1022 ; CHECK-DOT-NEXT: sshr v1.2d, v1.2d, #56
1023 ; CHECK-DOT-NEXT: ssra v1.2d, v0.2d, #56
1024 ; CHECK-DOT-NEXT: addp d0, v1.2d
1025 ; CHECK-DOT-NEXT: fmov x0, d0
1026 ; CHECK-DOT-NEXT: ret
1028 ; CHECK-GI-LABEL: add_v4i8_v4i64_sext:
1029 ; CHECK-GI: // %bb.0: // %entry
1030 ; CHECK-GI-NEXT: ushll v0.4s, v0.4h, #0
1031 ; CHECK-GI-NEXT: ushll2 v1.2d, v0.4s, #0
1032 ; CHECK-GI-NEXT: ushll v0.2d, v0.2s, #0
1033 ; CHECK-GI-NEXT: shl v1.2d, v1.2d, #56
1034 ; CHECK-GI-NEXT: shl v0.2d, v0.2d, #56
1035 ; CHECK-GI-NEXT: sshr v1.2d, v1.2d, #56
1036 ; CHECK-GI-NEXT: ssra v1.2d, v0.2d, #56
1037 ; CHECK-GI-NEXT: addp d0, v1.2d
1038 ; CHECK-GI-NEXT: fmov x0, d0
1039 ; CHECK-GI-NEXT: ret
1041 %xx = sext <4 x i8> %x to <4 x i64>
1042 %z = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %xx)
1046 define i64 @add_v2i8_v2i64_zext(<2 x i8> %x) {
1047 ; CHECK-BASE-LABEL: add_v2i8_v2i64_zext:
1048 ; CHECK-BASE: // %bb.0: // %entry
1049 ; CHECK-BASE-NEXT: movi d1, #0x0000ff000000ff
1050 ; CHECK-BASE-NEXT: and v0.8b, v0.8b, v1.8b
1051 ; CHECK-BASE-NEXT: ushll v0.2d, v0.2s, #0
1052 ; CHECK-BASE-NEXT: addp d0, v0.2d
1053 ; CHECK-BASE-NEXT: fmov x0, d0
1054 ; CHECK-BASE-NEXT: ret
1056 ; CHECK-DOT-LABEL: add_v2i8_v2i64_zext:
1057 ; CHECK-DOT: // %bb.0: // %entry
1058 ; CHECK-DOT-NEXT: movi d1, #0x0000ff000000ff
1059 ; CHECK-DOT-NEXT: and v0.8b, v0.8b, v1.8b
1060 ; CHECK-DOT-NEXT: ushll v0.2d, v0.2s, #0
1061 ; CHECK-DOT-NEXT: addp d0, v0.2d
1062 ; CHECK-DOT-NEXT: fmov x0, d0
1063 ; CHECK-DOT-NEXT: ret
1065 ; CHECK-GI-LABEL: add_v2i8_v2i64_zext:
1066 ; CHECK-GI: // %bb.0: // %entry
1067 ; CHECK-GI-NEXT: movi v1.2d, #0x000000000000ff
1068 ; CHECK-GI-NEXT: ushll v0.2d, v0.2s, #0
1069 ; CHECK-GI-NEXT: and v0.16b, v0.16b, v1.16b
1070 ; CHECK-GI-NEXT: addp d0, v0.2d
1071 ; CHECK-GI-NEXT: fmov x0, d0
1072 ; CHECK-GI-NEXT: ret
1074 %xx = zext <2 x i8> %x to <2 x i64>
1075 %z = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %xx)
1079 define i64 @add_v2i8_v2i64_sext(<2 x i8> %x) {
1080 ; CHECK-LABEL: add_v2i8_v2i64_sext:
1081 ; CHECK: // %bb.0: // %entry
1082 ; CHECK-NEXT: ushll v0.2d, v0.2s, #0
1083 ; CHECK-NEXT: shl v0.2d, v0.2d, #56
1084 ; CHECK-NEXT: sshr v0.2d, v0.2d, #56
1085 ; CHECK-NEXT: addp d0, v0.2d
1086 ; CHECK-NEXT: fmov x0, d0
1089 %xx = sext <2 x i8> %x to <2 x i64>
1090 %z = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %xx)
1094 define i64 @add_v2i64_v2i64(<2 x i64> %x) {
1095 ; CHECK-LABEL: add_v2i64_v2i64:
1096 ; CHECK: // %bb.0: // %entry
1097 ; CHECK-NEXT: addp d0, v0.2d
1098 ; CHECK-NEXT: fmov x0, d0
1101 %z = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %x)
1105 define i32 @add_v4i32_v4i32_acc(<4 x i32> %x, i32 %a) {
1106 ; CHECK-LABEL: add_v4i32_v4i32_acc:
1107 ; CHECK: // %bb.0: // %entry
1108 ; CHECK-NEXT: addv s0, v0.4s
1109 ; CHECK-NEXT: fmov w8, s0
1110 ; CHECK-NEXT: add w0, w8, w0
1113 %z = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %x)
1118 define i64 @add_v4i32_v4i64_acc_zext(<4 x i32> %x, i64 %a) {
1119 ; CHECK-BASE-LABEL: add_v4i32_v4i64_acc_zext:
1120 ; CHECK-BASE: // %bb.0: // %entry
1121 ; CHECK-BASE-NEXT: uaddlv d0, v0.4s
1122 ; CHECK-BASE-NEXT: fmov x8, d0
1123 ; CHECK-BASE-NEXT: add x0, x8, x0
1124 ; CHECK-BASE-NEXT: ret
1126 ; CHECK-DOT-LABEL: add_v4i32_v4i64_acc_zext:
1127 ; CHECK-DOT: // %bb.0: // %entry
1128 ; CHECK-DOT-NEXT: uaddlv d0, v0.4s
1129 ; CHECK-DOT-NEXT: fmov x8, d0
1130 ; CHECK-DOT-NEXT: add x0, x8, x0
1131 ; CHECK-DOT-NEXT: ret
1133 ; CHECK-GI-LABEL: add_v4i32_v4i64_acc_zext:
1134 ; CHECK-GI: // %bb.0: // %entry
1135 ; CHECK-GI-NEXT: ushll v1.2d, v0.2s, #0
1136 ; CHECK-GI-NEXT: uaddw2 v0.2d, v1.2d, v0.4s
1137 ; CHECK-GI-NEXT: addp d0, v0.2d
1138 ; CHECK-GI-NEXT: fmov x8, d0
1139 ; CHECK-GI-NEXT: add x0, x8, x0
1140 ; CHECK-GI-NEXT: ret
1142 %xx = zext <4 x i32> %x to <4 x i64>
1143 %z = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %xx)
1148 define i64 @add_v4i32_v4i64_acc_sext(<4 x i32> %x, i64 %a) {
1149 ; CHECK-BASE-LABEL: add_v4i32_v4i64_acc_sext:
1150 ; CHECK-BASE: // %bb.0: // %entry
1151 ; CHECK-BASE-NEXT: saddlv d0, v0.4s
1152 ; CHECK-BASE-NEXT: fmov x8, d0
1153 ; CHECK-BASE-NEXT: add x0, x8, x0
1154 ; CHECK-BASE-NEXT: ret
1156 ; CHECK-DOT-LABEL: add_v4i32_v4i64_acc_sext:
1157 ; CHECK-DOT: // %bb.0: // %entry
1158 ; CHECK-DOT-NEXT: saddlv d0, v0.4s
1159 ; CHECK-DOT-NEXT: fmov x8, d0
1160 ; CHECK-DOT-NEXT: add x0, x8, x0
1161 ; CHECK-DOT-NEXT: ret
1163 ; CHECK-GI-LABEL: add_v4i32_v4i64_acc_sext:
1164 ; CHECK-GI: // %bb.0: // %entry
1165 ; CHECK-GI-NEXT: sshll v1.2d, v0.2s, #0
1166 ; CHECK-GI-NEXT: saddw2 v0.2d, v1.2d, v0.4s
1167 ; CHECK-GI-NEXT: addp d0, v0.2d
1168 ; CHECK-GI-NEXT: fmov x8, d0
1169 ; CHECK-GI-NEXT: add x0, x8, x0
1170 ; CHECK-GI-NEXT: ret
1172 %xx = sext <4 x i32> %x to <4 x i64>
1173 %z = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %xx)
1178 define i64 @add_v2i32_v2i64_acc_zext(<2 x i32> %x, i64 %a) {
1179 ; CHECK-LABEL: add_v2i32_v2i64_acc_zext:
1180 ; CHECK: // %bb.0: // %entry
1181 ; CHECK-NEXT: ushll v0.2d, v0.2s, #0
1182 ; CHECK-NEXT: addp d0, v0.2d
1183 ; CHECK-NEXT: fmov x8, d0
1184 ; CHECK-NEXT: add x0, x8, x0
1187 %xx = zext <2 x i32> %x to <2 x i64>
1188 %z = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %xx)
1193 define i64 @add_v2i32_v2i64_acc_sext(<2 x i32> %x, i64 %a) {
1194 ; CHECK-LABEL: add_v2i32_v2i64_acc_sext:
1195 ; CHECK: // %bb.0: // %entry
1196 ; CHECK-NEXT: sshll v0.2d, v0.2s, #0
1197 ; CHECK-NEXT: addp d0, v0.2d
1198 ; CHECK-NEXT: fmov x8, d0
1199 ; CHECK-NEXT: add x0, x8, x0
1202 %xx = sext <2 x i32> %x to <2 x i64>
1203 %z = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %xx)
1208 define i32 @add_v8i16_v8i32_acc_zext(<8 x i16> %x, i32 %a) {
1209 ; CHECK-BASE-LABEL: add_v8i16_v8i32_acc_zext:
1210 ; CHECK-BASE: // %bb.0: // %entry
1211 ; CHECK-BASE-NEXT: uaddlv s0, v0.8h
1212 ; CHECK-BASE-NEXT: fmov w8, s0
1213 ; CHECK-BASE-NEXT: add w0, w8, w0
1214 ; CHECK-BASE-NEXT: ret
1216 ; CHECK-DOT-LABEL: add_v8i16_v8i32_acc_zext:
1217 ; CHECK-DOT: // %bb.0: // %entry
1218 ; CHECK-DOT-NEXT: uaddlv s0, v0.8h
1219 ; CHECK-DOT-NEXT: fmov w8, s0
1220 ; CHECK-DOT-NEXT: add w0, w8, w0
1221 ; CHECK-DOT-NEXT: ret
1223 ; CHECK-GI-LABEL: add_v8i16_v8i32_acc_zext:
1224 ; CHECK-GI: // %bb.0: // %entry
1225 ; CHECK-GI-NEXT: ushll v1.4s, v0.4h, #0
1226 ; CHECK-GI-NEXT: uaddw2 v0.4s, v1.4s, v0.8h
1227 ; CHECK-GI-NEXT: addv s0, v0.4s
1228 ; CHECK-GI-NEXT: fmov w8, s0
1229 ; CHECK-GI-NEXT: add w0, w8, w0
1230 ; CHECK-GI-NEXT: ret
1232 %xx = zext <8 x i16> %x to <8 x i32>
1233 %z = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %xx)
1238 define i32 @add_v8i16_v8i32_acc_sext(<8 x i16> %x, i32 %a) {
1239 ; CHECK-BASE-LABEL: add_v8i16_v8i32_acc_sext:
1240 ; CHECK-BASE: // %bb.0: // %entry
1241 ; CHECK-BASE-NEXT: saddlv s0, v0.8h
1242 ; CHECK-BASE-NEXT: fmov w8, s0
1243 ; CHECK-BASE-NEXT: add w0, w8, w0
1244 ; CHECK-BASE-NEXT: ret
1246 ; CHECK-DOT-LABEL: add_v8i16_v8i32_acc_sext:
1247 ; CHECK-DOT: // %bb.0: // %entry
1248 ; CHECK-DOT-NEXT: saddlv s0, v0.8h
1249 ; CHECK-DOT-NEXT: fmov w8, s0
1250 ; CHECK-DOT-NEXT: add w0, w8, w0
1251 ; CHECK-DOT-NEXT: ret
1253 ; CHECK-GI-LABEL: add_v8i16_v8i32_acc_sext:
1254 ; CHECK-GI: // %bb.0: // %entry
1255 ; CHECK-GI-NEXT: sshll v1.4s, v0.4h, #0
1256 ; CHECK-GI-NEXT: saddw2 v0.4s, v1.4s, v0.8h
1257 ; CHECK-GI-NEXT: addv s0, v0.4s
1258 ; CHECK-GI-NEXT: fmov w8, s0
1259 ; CHECK-GI-NEXT: add w0, w8, w0
1260 ; CHECK-GI-NEXT: ret
1262 %xx = sext <8 x i16> %x to <8 x i32>
1263 %z = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %xx)
1268 define i32 @add_v4i16_v4i32_acc_zext(<4 x i16> %x, i32 %a) {
1269 ; CHECK-LABEL: add_v4i16_v4i32_acc_zext:
1270 ; CHECK: // %bb.0: // %entry
1271 ; CHECK-NEXT: ushll v0.4s, v0.4h, #0
1272 ; CHECK-NEXT: addv s0, v0.4s
1273 ; CHECK-NEXT: fmov w8, s0
1274 ; CHECK-NEXT: add w0, w8, w0
1277 %xx = zext <4 x i16> %x to <4 x i32>
1278 %z = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %xx)
1283 define i32 @add_v4i16_v4i32_acc_sext(<4 x i16> %x, i32 %a) {
1284 ; CHECK-LABEL: add_v4i16_v4i32_acc_sext:
1285 ; CHECK: // %bb.0: // %entry
1286 ; CHECK-NEXT: sshll v0.4s, v0.4h, #0
1287 ; CHECK-NEXT: addv s0, v0.4s
1288 ; CHECK-NEXT: fmov w8, s0
1289 ; CHECK-NEXT: add w0, w8, w0
1292 %xx = sext <4 x i16> %x to <4 x i32>
1293 %z = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %xx)
1298 define zeroext i16 @add_v8i16_v8i16_acc(<8 x i16> %x, i16 %a) {
1299 ; CHECK-BASE-LABEL: add_v8i16_v8i16_acc:
1300 ; CHECK-BASE: // %bb.0: // %entry
1301 ; CHECK-BASE-NEXT: addv h0, v0.8h
1302 ; CHECK-BASE-NEXT: fmov w8, s0
1303 ; CHECK-BASE-NEXT: add w8, w8, w0
1304 ; CHECK-BASE-NEXT: and w0, w8, #0xffff
1305 ; CHECK-BASE-NEXT: ret
1307 ; CHECK-DOT-LABEL: add_v8i16_v8i16_acc:
1308 ; CHECK-DOT: // %bb.0: // %entry
1309 ; CHECK-DOT-NEXT: addv h0, v0.8h
1310 ; CHECK-DOT-NEXT: fmov w8, s0
1311 ; CHECK-DOT-NEXT: add w8, w8, w0
1312 ; CHECK-DOT-NEXT: and w0, w8, #0xffff
1313 ; CHECK-DOT-NEXT: ret
1315 ; CHECK-GI-LABEL: add_v8i16_v8i16_acc:
1316 ; CHECK-GI: // %bb.0: // %entry
1317 ; CHECK-GI-NEXT: addv h0, v0.8h
1318 ; CHECK-GI-NEXT: fmov w8, s0
1319 ; CHECK-GI-NEXT: add w8, w0, w8, uxth
1320 ; CHECK-GI-NEXT: and w0, w8, #0xffff
1321 ; CHECK-GI-NEXT: ret
1323 %z = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> %x)
1328 define i64 @add_v8i16_v8i64_acc_zext(<8 x i16> %x, i64 %a) {
1329 ; CHECK-BASE-LABEL: add_v8i16_v8i64_acc_zext:
1330 ; CHECK-BASE: // %bb.0: // %entry
1331 ; CHECK-BASE-NEXT: ushll2 v1.4s, v0.8h, #0
1332 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
1333 ; CHECK-BASE-NEXT: uaddl2 v2.2d, v0.4s, v1.4s
1334 ; CHECK-BASE-NEXT: uaddl v0.2d, v0.2s, v1.2s
1335 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v2.2d
1336 ; CHECK-BASE-NEXT: addp d0, v0.2d
1337 ; CHECK-BASE-NEXT: fmov x8, d0
1338 ; CHECK-BASE-NEXT: add x0, x8, x0
1339 ; CHECK-BASE-NEXT: ret
1341 ; CHECK-DOT-LABEL: add_v8i16_v8i64_acc_zext:
1342 ; CHECK-DOT: // %bb.0: // %entry
1343 ; CHECK-DOT-NEXT: ushll2 v1.4s, v0.8h, #0
1344 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
1345 ; CHECK-DOT-NEXT: uaddl2 v2.2d, v0.4s, v1.4s
1346 ; CHECK-DOT-NEXT: uaddl v0.2d, v0.2s, v1.2s
1347 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v2.2d
1348 ; CHECK-DOT-NEXT: addp d0, v0.2d
1349 ; CHECK-DOT-NEXT: fmov x8, d0
1350 ; CHECK-DOT-NEXT: add x0, x8, x0
1351 ; CHECK-DOT-NEXT: ret
1353 ; CHECK-GI-LABEL: add_v8i16_v8i64_acc_zext:
1354 ; CHECK-GI: // %bb.0: // %entry
1355 ; CHECK-GI-NEXT: ushll v1.4s, v0.4h, #0
1356 ; CHECK-GI-NEXT: ushll2 v0.4s, v0.8h, #0
1357 ; CHECK-GI-NEXT: ushll v2.2d, v1.2s, #0
1358 ; CHECK-GI-NEXT: ushll v3.2d, v0.2s, #0
1359 ; CHECK-GI-NEXT: uaddw2 v1.2d, v2.2d, v1.4s
1360 ; CHECK-GI-NEXT: uaddw2 v0.2d, v3.2d, v0.4s
1361 ; CHECK-GI-NEXT: add v0.2d, v1.2d, v0.2d
1362 ; CHECK-GI-NEXT: addp d0, v0.2d
1363 ; CHECK-GI-NEXT: fmov x8, d0
1364 ; CHECK-GI-NEXT: add x0, x8, x0
1365 ; CHECK-GI-NEXT: ret
1367 %xx = zext <8 x i16> %x to <8 x i64>
1368 %z = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> %xx)
1373 define i64 @add_v8i16_v8i64_acc_sext(<8 x i16> %x, i64 %a) {
1374 ; CHECK-BASE-LABEL: add_v8i16_v8i64_acc_sext:
1375 ; CHECK-BASE: // %bb.0: // %entry
1376 ; CHECK-BASE-NEXT: sshll2 v1.4s, v0.8h, #0
1377 ; CHECK-BASE-NEXT: sshll v0.4s, v0.4h, #0
1378 ; CHECK-BASE-NEXT: saddl2 v2.2d, v0.4s, v1.4s
1379 ; CHECK-BASE-NEXT: saddl v0.2d, v0.2s, v1.2s
1380 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v2.2d
1381 ; CHECK-BASE-NEXT: addp d0, v0.2d
1382 ; CHECK-BASE-NEXT: fmov x8, d0
1383 ; CHECK-BASE-NEXT: add x0, x8, x0
1384 ; CHECK-BASE-NEXT: ret
1386 ; CHECK-DOT-LABEL: add_v8i16_v8i64_acc_sext:
1387 ; CHECK-DOT: // %bb.0: // %entry
1388 ; CHECK-DOT-NEXT: sshll2 v1.4s, v0.8h, #0
1389 ; CHECK-DOT-NEXT: sshll v0.4s, v0.4h, #0
1390 ; CHECK-DOT-NEXT: saddl2 v2.2d, v0.4s, v1.4s
1391 ; CHECK-DOT-NEXT: saddl v0.2d, v0.2s, v1.2s
1392 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v2.2d
1393 ; CHECK-DOT-NEXT: addp d0, v0.2d
1394 ; CHECK-DOT-NEXT: fmov x8, d0
1395 ; CHECK-DOT-NEXT: add x0, x8, x0
1396 ; CHECK-DOT-NEXT: ret
1398 ; CHECK-GI-LABEL: add_v8i16_v8i64_acc_sext:
1399 ; CHECK-GI: // %bb.0: // %entry
1400 ; CHECK-GI-NEXT: sshll v1.4s, v0.4h, #0
1401 ; CHECK-GI-NEXT: sshll2 v0.4s, v0.8h, #0
1402 ; CHECK-GI-NEXT: sshll v2.2d, v1.2s, #0
1403 ; CHECK-GI-NEXT: sshll v3.2d, v0.2s, #0
1404 ; CHECK-GI-NEXT: saddw2 v1.2d, v2.2d, v1.4s
1405 ; CHECK-GI-NEXT: saddw2 v0.2d, v3.2d, v0.4s
1406 ; CHECK-GI-NEXT: add v0.2d, v1.2d, v0.2d
1407 ; CHECK-GI-NEXT: addp d0, v0.2d
1408 ; CHECK-GI-NEXT: fmov x8, d0
1409 ; CHECK-GI-NEXT: add x0, x8, x0
1410 ; CHECK-GI-NEXT: ret
1412 %xx = sext <8 x i16> %x to <8 x i64>
1413 %z = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> %xx)
1418 define i64 @add_v4i16_v4i64_acc_zext(<4 x i16> %x, i64 %a) {
1419 ; CHECK-BASE-LABEL: add_v4i16_v4i64_acc_zext:
1420 ; CHECK-BASE: // %bb.0: // %entry
1421 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
1422 ; CHECK-BASE-NEXT: uaddlv d0, v0.4s
1423 ; CHECK-BASE-NEXT: fmov x8, d0
1424 ; CHECK-BASE-NEXT: add x0, x8, x0
1425 ; CHECK-BASE-NEXT: ret
1427 ; CHECK-DOT-LABEL: add_v4i16_v4i64_acc_zext:
1428 ; CHECK-DOT: // %bb.0: // %entry
1429 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
1430 ; CHECK-DOT-NEXT: uaddlv d0, v0.4s
1431 ; CHECK-DOT-NEXT: fmov x8, d0
1432 ; CHECK-DOT-NEXT: add x0, x8, x0
1433 ; CHECK-DOT-NEXT: ret
1435 ; CHECK-GI-LABEL: add_v4i16_v4i64_acc_zext:
1436 ; CHECK-GI: // %bb.0: // %entry
1437 ; CHECK-GI-NEXT: ushll v0.4s, v0.4h, #0
1438 ; CHECK-GI-NEXT: ushll v1.2d, v0.2s, #0
1439 ; CHECK-GI-NEXT: uaddw2 v0.2d, v1.2d, v0.4s
1440 ; CHECK-GI-NEXT: addp d0, v0.2d
1441 ; CHECK-GI-NEXT: fmov x8, d0
1442 ; CHECK-GI-NEXT: add x0, x8, x0
1443 ; CHECK-GI-NEXT: ret
1445 %xx = zext <4 x i16> %x to <4 x i64>
1446 %z = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %xx)
1451 define i64 @add_v4i16_v4i64_acc_sext(<4 x i16> %x, i64 %a) {
1452 ; CHECK-BASE-LABEL: add_v4i16_v4i64_acc_sext:
1453 ; CHECK-BASE: // %bb.0: // %entry
1454 ; CHECK-BASE-NEXT: sshll v0.4s, v0.4h, #0
1455 ; CHECK-BASE-NEXT: saddlv d0, v0.4s
1456 ; CHECK-BASE-NEXT: fmov x8, d0
1457 ; CHECK-BASE-NEXT: add x0, x8, x0
1458 ; CHECK-BASE-NEXT: ret
1460 ; CHECK-DOT-LABEL: add_v4i16_v4i64_acc_sext:
1461 ; CHECK-DOT: // %bb.0: // %entry
1462 ; CHECK-DOT-NEXT: sshll v0.4s, v0.4h, #0
1463 ; CHECK-DOT-NEXT: saddlv d0, v0.4s
1464 ; CHECK-DOT-NEXT: fmov x8, d0
1465 ; CHECK-DOT-NEXT: add x0, x8, x0
1466 ; CHECK-DOT-NEXT: ret
1468 ; CHECK-GI-LABEL: add_v4i16_v4i64_acc_sext:
1469 ; CHECK-GI: // %bb.0: // %entry
1470 ; CHECK-GI-NEXT: sshll v0.4s, v0.4h, #0
1471 ; CHECK-GI-NEXT: sshll v1.2d, v0.2s, #0
1472 ; CHECK-GI-NEXT: saddw2 v0.2d, v1.2d, v0.4s
1473 ; CHECK-GI-NEXT: addp d0, v0.2d
1474 ; CHECK-GI-NEXT: fmov x8, d0
1475 ; CHECK-GI-NEXT: add x0, x8, x0
1476 ; CHECK-GI-NEXT: ret
1478 %xx = sext <4 x i16> %x to <4 x i64>
1479 %z = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %xx)
1484 define i64 @add_v2i16_v2i64_acc_zext(<2 x i16> %x, i64 %a) {
1485 ; CHECK-BASE-LABEL: add_v2i16_v2i64_acc_zext:
1486 ; CHECK-BASE: // %bb.0: // %entry
1487 ; CHECK-BASE-NEXT: movi d1, #0x00ffff0000ffff
1488 ; CHECK-BASE-NEXT: and v0.8b, v0.8b, v1.8b
1489 ; CHECK-BASE-NEXT: ushll v0.2d, v0.2s, #0
1490 ; CHECK-BASE-NEXT: addp d0, v0.2d
1491 ; CHECK-BASE-NEXT: fmov x8, d0
1492 ; CHECK-BASE-NEXT: add x0, x8, x0
1493 ; CHECK-BASE-NEXT: ret
1495 ; CHECK-DOT-LABEL: add_v2i16_v2i64_acc_zext:
1496 ; CHECK-DOT: // %bb.0: // %entry
1497 ; CHECK-DOT-NEXT: movi d1, #0x00ffff0000ffff
1498 ; CHECK-DOT-NEXT: and v0.8b, v0.8b, v1.8b
1499 ; CHECK-DOT-NEXT: ushll v0.2d, v0.2s, #0
1500 ; CHECK-DOT-NEXT: addp d0, v0.2d
1501 ; CHECK-DOT-NEXT: fmov x8, d0
1502 ; CHECK-DOT-NEXT: add x0, x8, x0
1503 ; CHECK-DOT-NEXT: ret
1505 ; CHECK-GI-LABEL: add_v2i16_v2i64_acc_zext:
1506 ; CHECK-GI: // %bb.0: // %entry
1507 ; CHECK-GI-NEXT: movi v1.2d, #0x0000000000ffff
1508 ; CHECK-GI-NEXT: ushll v0.2d, v0.2s, #0
1509 ; CHECK-GI-NEXT: and v0.16b, v0.16b, v1.16b
1510 ; CHECK-GI-NEXT: addp d0, v0.2d
1511 ; CHECK-GI-NEXT: fmov x8, d0
1512 ; CHECK-GI-NEXT: add x0, x8, x0
1513 ; CHECK-GI-NEXT: ret
1515 %xx = zext <2 x i16> %x to <2 x i64>
1516 %z = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %xx)
1521 define i64 @add_v2i16_v2i64_acc_sext(<2 x i16> %x, i64 %a) {
1522 ; CHECK-LABEL: add_v2i16_v2i64_acc_sext:
1523 ; CHECK: // %bb.0: // %entry
1524 ; CHECK-NEXT: ushll v0.2d, v0.2s, #0
1525 ; CHECK-NEXT: shl v0.2d, v0.2d, #48
1526 ; CHECK-NEXT: sshr v0.2d, v0.2d, #48
1527 ; CHECK-NEXT: addp d0, v0.2d
1528 ; CHECK-NEXT: fmov x8, d0
1529 ; CHECK-NEXT: add x0, x8, x0
1532 %xx = sext <2 x i16> %x to <2 x i64>
1533 %z = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %xx)
1538 define i32 @add_v16i8_v16i32_acc_zext(<16 x i8> %x, i32 %a) {
1539 ; CHECK-BASE-LABEL: add_v16i8_v16i32_acc_zext:
1540 ; CHECK-BASE: // %bb.0: // %entry
1541 ; CHECK-BASE-NEXT: ushll2 v1.8h, v0.16b, #0
1542 ; CHECK-BASE-NEXT: ushll v0.8h, v0.8b, #0
1543 ; CHECK-BASE-NEXT: uaddl2 v2.4s, v0.8h, v1.8h
1544 ; CHECK-BASE-NEXT: uaddl v0.4s, v0.4h, v1.4h
1545 ; CHECK-BASE-NEXT: add v0.4s, v0.4s, v2.4s
1546 ; CHECK-BASE-NEXT: addv s0, v0.4s
1547 ; CHECK-BASE-NEXT: fmov w8, s0
1548 ; CHECK-BASE-NEXT: add w0, w8, w0
1549 ; CHECK-BASE-NEXT: ret
1551 ; CHECK-DOT-LABEL: add_v16i8_v16i32_acc_zext:
1552 ; CHECK-DOT: // %bb.0: // %entry
1553 ; CHECK-DOT-NEXT: movi v1.16b, #1
1554 ; CHECK-DOT-NEXT: movi v2.2d, #0000000000000000
1555 ; CHECK-DOT-NEXT: udot v2.4s, v0.16b, v1.16b
1556 ; CHECK-DOT-NEXT: addv s0, v2.4s
1557 ; CHECK-DOT-NEXT: fmov w8, s0
1558 ; CHECK-DOT-NEXT: add w0, w8, w0
1559 ; CHECK-DOT-NEXT: ret
1561 ; CHECK-GI-LABEL: add_v16i8_v16i32_acc_zext:
1562 ; CHECK-GI: // %bb.0: // %entry
1563 ; CHECK-GI-NEXT: ushll v1.8h, v0.8b, #0
1564 ; CHECK-GI-NEXT: ushll2 v0.8h, v0.16b, #0
1565 ; CHECK-GI-NEXT: ushll v2.4s, v1.4h, #0
1566 ; CHECK-GI-NEXT: ushll v3.4s, v0.4h, #0
1567 ; CHECK-GI-NEXT: uaddw2 v1.4s, v2.4s, v1.8h
1568 ; CHECK-GI-NEXT: uaddw2 v0.4s, v3.4s, v0.8h
1569 ; CHECK-GI-NEXT: add v0.4s, v1.4s, v0.4s
1570 ; CHECK-GI-NEXT: addv s0, v0.4s
1571 ; CHECK-GI-NEXT: fmov w8, s0
1572 ; CHECK-GI-NEXT: add w0, w8, w0
1573 ; CHECK-GI-NEXT: ret
1575 %xx = zext <16 x i8> %x to <16 x i32>
1576 %z = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> %xx)
1581 define i32 @add_v16i8_v16i32_acc_sext(<16 x i8> %x, i32 %a) {
1582 ; CHECK-BASE-LABEL: add_v16i8_v16i32_acc_sext:
1583 ; CHECK-BASE: // %bb.0: // %entry
1584 ; CHECK-BASE-NEXT: sshll2 v1.8h, v0.16b, #0
1585 ; CHECK-BASE-NEXT: sshll v0.8h, v0.8b, #0
1586 ; CHECK-BASE-NEXT: saddl2 v2.4s, v0.8h, v1.8h
1587 ; CHECK-BASE-NEXT: saddl v0.4s, v0.4h, v1.4h
1588 ; CHECK-BASE-NEXT: add v0.4s, v0.4s, v2.4s
1589 ; CHECK-BASE-NEXT: addv s0, v0.4s
1590 ; CHECK-BASE-NEXT: fmov w8, s0
1591 ; CHECK-BASE-NEXT: add w0, w8, w0
1592 ; CHECK-BASE-NEXT: ret
1594 ; CHECK-DOT-LABEL: add_v16i8_v16i32_acc_sext:
1595 ; CHECK-DOT: // %bb.0: // %entry
1596 ; CHECK-DOT-NEXT: movi v1.16b, #1
1597 ; CHECK-DOT-NEXT: movi v2.2d, #0000000000000000
1598 ; CHECK-DOT-NEXT: sdot v2.4s, v0.16b, v1.16b
1599 ; CHECK-DOT-NEXT: addv s0, v2.4s
1600 ; CHECK-DOT-NEXT: fmov w8, s0
1601 ; CHECK-DOT-NEXT: add w0, w8, w0
1602 ; CHECK-DOT-NEXT: ret
1604 ; CHECK-GI-LABEL: add_v16i8_v16i32_acc_sext:
1605 ; CHECK-GI: // %bb.0: // %entry
1606 ; CHECK-GI-NEXT: sshll v1.8h, v0.8b, #0
1607 ; CHECK-GI-NEXT: sshll2 v0.8h, v0.16b, #0
1608 ; CHECK-GI-NEXT: sshll v2.4s, v1.4h, #0
1609 ; CHECK-GI-NEXT: sshll v3.4s, v0.4h, #0
1610 ; CHECK-GI-NEXT: saddw2 v1.4s, v2.4s, v1.8h
1611 ; CHECK-GI-NEXT: saddw2 v0.4s, v3.4s, v0.8h
1612 ; CHECK-GI-NEXT: add v0.4s, v1.4s, v0.4s
1613 ; CHECK-GI-NEXT: addv s0, v0.4s
1614 ; CHECK-GI-NEXT: fmov w8, s0
1615 ; CHECK-GI-NEXT: add w0, w8, w0
1616 ; CHECK-GI-NEXT: ret
1618 %xx = sext <16 x i8> %x to <16 x i32>
1619 %z = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> %xx)
1624 define i32 @add_v8i8_v8i32_acc_zext(<8 x i8> %x, i32 %a) {
1625 ; CHECK-BASE-LABEL: add_v8i8_v8i32_acc_zext:
1626 ; CHECK-BASE: // %bb.0: // %entry
1627 ; CHECK-BASE-NEXT: ushll v0.8h, v0.8b, #0
1628 ; CHECK-BASE-NEXT: uaddlv s0, v0.8h
1629 ; CHECK-BASE-NEXT: fmov w8, s0
1630 ; CHECK-BASE-NEXT: add w0, w8, w0
1631 ; CHECK-BASE-NEXT: ret
1633 ; CHECK-DOT-LABEL: add_v8i8_v8i32_acc_zext:
1634 ; CHECK-DOT: // %bb.0: // %entry
1635 ; CHECK-DOT-NEXT: movi v1.2d, #0000000000000000
1636 ; CHECK-DOT-NEXT: movi v2.8b, #1
1637 ; CHECK-DOT-NEXT: udot v1.2s, v0.8b, v2.8b
1638 ; CHECK-DOT-NEXT: addp v0.2s, v1.2s, v1.2s
1639 ; CHECK-DOT-NEXT: fmov w8, s0
1640 ; CHECK-DOT-NEXT: add w0, w8, w0
1641 ; CHECK-DOT-NEXT: ret
1643 ; CHECK-GI-LABEL: add_v8i8_v8i32_acc_zext:
1644 ; CHECK-GI: // %bb.0: // %entry
1645 ; CHECK-GI-NEXT: ushll v0.8h, v0.8b, #0
1646 ; CHECK-GI-NEXT: ushll v1.4s, v0.4h, #0
1647 ; CHECK-GI-NEXT: uaddw2 v0.4s, v1.4s, v0.8h
1648 ; CHECK-GI-NEXT: addv s0, v0.4s
1649 ; CHECK-GI-NEXT: fmov w8, s0
1650 ; CHECK-GI-NEXT: add w0, w8, w0
1651 ; CHECK-GI-NEXT: ret
1653 %xx = zext <8 x i8> %x to <8 x i32>
1654 %z = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %xx)
1659 define i32 @add_v8i8_v8i32_acc_sext(<8 x i8> %x, i32 %a) {
1660 ; CHECK-BASE-LABEL: add_v8i8_v8i32_acc_sext:
1661 ; CHECK-BASE: // %bb.0: // %entry
1662 ; CHECK-BASE-NEXT: sshll v0.8h, v0.8b, #0
1663 ; CHECK-BASE-NEXT: saddlv s0, v0.8h
1664 ; CHECK-BASE-NEXT: fmov w8, s0
1665 ; CHECK-BASE-NEXT: add w0, w8, w0
1666 ; CHECK-BASE-NEXT: ret
1668 ; CHECK-DOT-LABEL: add_v8i8_v8i32_acc_sext:
1669 ; CHECK-DOT: // %bb.0: // %entry
1670 ; CHECK-DOT-NEXT: movi v1.2d, #0000000000000000
1671 ; CHECK-DOT-NEXT: movi v2.8b, #1
1672 ; CHECK-DOT-NEXT: sdot v1.2s, v0.8b, v2.8b
1673 ; CHECK-DOT-NEXT: addp v0.2s, v1.2s, v1.2s
1674 ; CHECK-DOT-NEXT: fmov w8, s0
1675 ; CHECK-DOT-NEXT: add w0, w8, w0
1676 ; CHECK-DOT-NEXT: ret
1678 ; CHECK-GI-LABEL: add_v8i8_v8i32_acc_sext:
1679 ; CHECK-GI: // %bb.0: // %entry
1680 ; CHECK-GI-NEXT: sshll v0.8h, v0.8b, #0
1681 ; CHECK-GI-NEXT: sshll v1.4s, v0.4h, #0
1682 ; CHECK-GI-NEXT: saddw2 v0.4s, v1.4s, v0.8h
1683 ; CHECK-GI-NEXT: addv s0, v0.4s
1684 ; CHECK-GI-NEXT: fmov w8, s0
1685 ; CHECK-GI-NEXT: add w0, w8, w0
1686 ; CHECK-GI-NEXT: ret
1688 %xx = sext <8 x i8> %x to <8 x i32>
1689 %z = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %xx)
1694 define i32 @add_v4i8_v4i32_acc_zext(<4 x i8> %x, i32 %a) {
1695 ; CHECK-BASE-LABEL: add_v4i8_v4i32_acc_zext:
1696 ; CHECK-BASE: // %bb.0: // %entry
1697 ; CHECK-BASE-NEXT: bic v0.4h, #255, lsl #8
1698 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
1699 ; CHECK-BASE-NEXT: addv s0, v0.4s
1700 ; CHECK-BASE-NEXT: fmov w8, s0
1701 ; CHECK-BASE-NEXT: add w0, w8, w0
1702 ; CHECK-BASE-NEXT: ret
1704 ; CHECK-DOT-LABEL: add_v4i8_v4i32_acc_zext:
1705 ; CHECK-DOT: // %bb.0: // %entry
1706 ; CHECK-DOT-NEXT: bic v0.4h, #255, lsl #8
1707 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
1708 ; CHECK-DOT-NEXT: addv s0, v0.4s
1709 ; CHECK-DOT-NEXT: fmov w8, s0
1710 ; CHECK-DOT-NEXT: add w0, w8, w0
1711 ; CHECK-DOT-NEXT: ret
1713 ; CHECK-GI-LABEL: add_v4i8_v4i32_acc_zext:
1714 ; CHECK-GI: // %bb.0: // %entry
1715 ; CHECK-GI-NEXT: movi v1.2d, #0x0000ff000000ff
1716 ; CHECK-GI-NEXT: ushll v0.4s, v0.4h, #0
1717 ; CHECK-GI-NEXT: and v0.16b, v0.16b, v1.16b
1718 ; CHECK-GI-NEXT: addv s0, v0.4s
1719 ; CHECK-GI-NEXT: fmov w8, s0
1720 ; CHECK-GI-NEXT: add w0, w8, w0
1721 ; CHECK-GI-NEXT: ret
1723 %xx = zext <4 x i8> %x to <4 x i32>
1724 %z = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %xx)
1729 define i32 @add_v4i8_v4i32_acc_sext(<4 x i8> %x, i32 %a) {
1730 ; CHECK-LABEL: add_v4i8_v4i32_acc_sext:
1731 ; CHECK: // %bb.0: // %entry
1732 ; CHECK-NEXT: ushll v0.4s, v0.4h, #0
1733 ; CHECK-NEXT: shl v0.4s, v0.4s, #24
1734 ; CHECK-NEXT: sshr v0.4s, v0.4s, #24
1735 ; CHECK-NEXT: addv s0, v0.4s
1736 ; CHECK-NEXT: fmov w8, s0
1737 ; CHECK-NEXT: add w0, w8, w0
1740 %xx = sext <4 x i8> %x to <4 x i32>
1741 %z = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %xx)
1746 define zeroext i16 @add_v16i8_v16i16_acc_zext(<16 x i8> %x, i16 %a) {
1747 ; CHECK-BASE-LABEL: add_v16i8_v16i16_acc_zext:
1748 ; CHECK-BASE: // %bb.0: // %entry
1749 ; CHECK-BASE-NEXT: uaddlv h0, v0.16b
1750 ; CHECK-BASE-NEXT: fmov w8, s0
1751 ; CHECK-BASE-NEXT: add w8, w8, w0
1752 ; CHECK-BASE-NEXT: and w0, w8, #0xffff
1753 ; CHECK-BASE-NEXT: ret
1755 ; CHECK-DOT-LABEL: add_v16i8_v16i16_acc_zext:
1756 ; CHECK-DOT: // %bb.0: // %entry
1757 ; CHECK-DOT-NEXT: uaddlv h0, v0.16b
1758 ; CHECK-DOT-NEXT: fmov w8, s0
1759 ; CHECK-DOT-NEXT: add w8, w8, w0
1760 ; CHECK-DOT-NEXT: and w0, w8, #0xffff
1761 ; CHECK-DOT-NEXT: ret
1763 ; CHECK-GI-LABEL: add_v16i8_v16i16_acc_zext:
1764 ; CHECK-GI: // %bb.0: // %entry
1765 ; CHECK-GI-NEXT: ushll v1.8h, v0.8b, #0
1766 ; CHECK-GI-NEXT: uaddw2 v0.8h, v1.8h, v0.16b
1767 ; CHECK-GI-NEXT: addv h0, v0.8h
1768 ; CHECK-GI-NEXT: fmov w8, s0
1769 ; CHECK-GI-NEXT: add w8, w0, w8, uxth
1770 ; CHECK-GI-NEXT: and w0, w8, #0xffff
1771 ; CHECK-GI-NEXT: ret
1773 %xx = zext <16 x i8> %x to <16 x i16>
1774 %z = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> %xx)
1779 define signext i16 @add_v16i8_v16i16_acc_sext(<16 x i8> %x, i16 %a) {
1780 ; CHECK-BASE-LABEL: add_v16i8_v16i16_acc_sext:
1781 ; CHECK-BASE: // %bb.0: // %entry
1782 ; CHECK-BASE-NEXT: saddlv h0, v0.16b
1783 ; CHECK-BASE-NEXT: fmov w8, s0
1784 ; CHECK-BASE-NEXT: add w8, w8, w0
1785 ; CHECK-BASE-NEXT: sxth w0, w8
1786 ; CHECK-BASE-NEXT: ret
1788 ; CHECK-DOT-LABEL: add_v16i8_v16i16_acc_sext:
1789 ; CHECK-DOT: // %bb.0: // %entry
1790 ; CHECK-DOT-NEXT: saddlv h0, v0.16b
1791 ; CHECK-DOT-NEXT: fmov w8, s0
1792 ; CHECK-DOT-NEXT: add w8, w8, w0
1793 ; CHECK-DOT-NEXT: sxth w0, w8
1794 ; CHECK-DOT-NEXT: ret
1796 ; CHECK-GI-LABEL: add_v16i8_v16i16_acc_sext:
1797 ; CHECK-GI: // %bb.0: // %entry
1798 ; CHECK-GI-NEXT: sshll v1.8h, v0.8b, #0
1799 ; CHECK-GI-NEXT: saddw2 v0.8h, v1.8h, v0.16b
1800 ; CHECK-GI-NEXT: addv h0, v0.8h
1801 ; CHECK-GI-NEXT: fmov w8, s0
1802 ; CHECK-GI-NEXT: add w8, w0, w8, uxth
1803 ; CHECK-GI-NEXT: sxth w0, w8
1804 ; CHECK-GI-NEXT: ret
1806 %xx = sext <16 x i8> %x to <16 x i16>
1807 %z = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> %xx)
1812 define zeroext i16 @add_v8i8_v8i16_acc_zext(<8 x i8> %x, i16 %a) {
1813 ; CHECK-BASE-LABEL: add_v8i8_v8i16_acc_zext:
1814 ; CHECK-BASE: // %bb.0: // %entry
1815 ; CHECK-BASE-NEXT: ushll v0.8h, v0.8b, #0
1816 ; CHECK-BASE-NEXT: addv h0, v0.8h
1817 ; CHECK-BASE-NEXT: fmov w8, s0
1818 ; CHECK-BASE-NEXT: add w8, w8, w0
1819 ; CHECK-BASE-NEXT: and w0, w8, #0xffff
1820 ; CHECK-BASE-NEXT: ret
1822 ; CHECK-DOT-LABEL: add_v8i8_v8i16_acc_zext:
1823 ; CHECK-DOT: // %bb.0: // %entry
1824 ; CHECK-DOT-NEXT: ushll v0.8h, v0.8b, #0
1825 ; CHECK-DOT-NEXT: addv h0, v0.8h
1826 ; CHECK-DOT-NEXT: fmov w8, s0
1827 ; CHECK-DOT-NEXT: add w8, w8, w0
1828 ; CHECK-DOT-NEXT: and w0, w8, #0xffff
1829 ; CHECK-DOT-NEXT: ret
1831 ; CHECK-GI-LABEL: add_v8i8_v8i16_acc_zext:
1832 ; CHECK-GI: // %bb.0: // %entry
1833 ; CHECK-GI-NEXT: ushll v0.8h, v0.8b, #0
1834 ; CHECK-GI-NEXT: addv h0, v0.8h
1835 ; CHECK-GI-NEXT: fmov w8, s0
1836 ; CHECK-GI-NEXT: add w8, w0, w8, uxth
1837 ; CHECK-GI-NEXT: and w0, w8, #0xffff
1838 ; CHECK-GI-NEXT: ret
1840 %xx = zext <8 x i8> %x to <8 x i16>
1841 %z = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> %xx)
1846 define signext i16 @add_v8i8_v8i16_acc_sext(<8 x i8> %x, i16 %a) {
1847 ; CHECK-BASE-LABEL: add_v8i8_v8i16_acc_sext:
1848 ; CHECK-BASE: // %bb.0: // %entry
1849 ; CHECK-BASE-NEXT: sshll v0.8h, v0.8b, #0
1850 ; CHECK-BASE-NEXT: addv h0, v0.8h
1851 ; CHECK-BASE-NEXT: fmov w8, s0
1852 ; CHECK-BASE-NEXT: add w8, w8, w0
1853 ; CHECK-BASE-NEXT: sxth w0, w8
1854 ; CHECK-BASE-NEXT: ret
1856 ; CHECK-DOT-LABEL: add_v8i8_v8i16_acc_sext:
1857 ; CHECK-DOT: // %bb.0: // %entry
1858 ; CHECK-DOT-NEXT: sshll v0.8h, v0.8b, #0
1859 ; CHECK-DOT-NEXT: addv h0, v0.8h
1860 ; CHECK-DOT-NEXT: fmov w8, s0
1861 ; CHECK-DOT-NEXT: add w8, w8, w0
1862 ; CHECK-DOT-NEXT: sxth w0, w8
1863 ; CHECK-DOT-NEXT: ret
1865 ; CHECK-GI-LABEL: add_v8i8_v8i16_acc_sext:
1866 ; CHECK-GI: // %bb.0: // %entry
1867 ; CHECK-GI-NEXT: sshll v0.8h, v0.8b, #0
1868 ; CHECK-GI-NEXT: addv h0, v0.8h
1869 ; CHECK-GI-NEXT: fmov w8, s0
1870 ; CHECK-GI-NEXT: add w8, w0, w8, uxth
1871 ; CHECK-GI-NEXT: sxth w0, w8
1872 ; CHECK-GI-NEXT: ret
1874 %xx = sext <8 x i8> %x to <8 x i16>
1875 %z = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> %xx)
1880 define zeroext i8 @add_v16i8_v16i8_acc(<16 x i8> %x, i8 %a) {
1881 ; CHECK-BASE-LABEL: add_v16i8_v16i8_acc:
1882 ; CHECK-BASE: // %bb.0: // %entry
1883 ; CHECK-BASE-NEXT: addv b0, v0.16b
1884 ; CHECK-BASE-NEXT: fmov w8, s0
1885 ; CHECK-BASE-NEXT: add w8, w8, w0
1886 ; CHECK-BASE-NEXT: and w0, w8, #0xff
1887 ; CHECK-BASE-NEXT: ret
1889 ; CHECK-DOT-LABEL: add_v16i8_v16i8_acc:
1890 ; CHECK-DOT: // %bb.0: // %entry
1891 ; CHECK-DOT-NEXT: addv b0, v0.16b
1892 ; CHECK-DOT-NEXT: fmov w8, s0
1893 ; CHECK-DOT-NEXT: add w8, w8, w0
1894 ; CHECK-DOT-NEXT: and w0, w8, #0xff
1895 ; CHECK-DOT-NEXT: ret
1897 ; CHECK-GI-LABEL: add_v16i8_v16i8_acc:
1898 ; CHECK-GI: // %bb.0: // %entry
1899 ; CHECK-GI-NEXT: addv b0, v0.16b
1900 ; CHECK-GI-NEXT: fmov w8, s0
1901 ; CHECK-GI-NEXT: add w8, w0, w8, uxtb
1902 ; CHECK-GI-NEXT: and w0, w8, #0xff
1903 ; CHECK-GI-NEXT: ret
1905 %z = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> %x)
1910 define i64 @add_v16i8_v16i64_acc_zext(<16 x i8> %x, i64 %a) {
1911 ; CHECK-BASE-LABEL: add_v16i8_v16i64_acc_zext:
1912 ; CHECK-BASE: // %bb.0: // %entry
1913 ; CHECK-BASE-NEXT: ushll2 v1.8h, v0.16b, #0
1914 ; CHECK-BASE-NEXT: ushll v0.8h, v0.8b, #0
1915 ; CHECK-BASE-NEXT: ushll2 v2.4s, v1.8h, #0
1916 ; CHECK-BASE-NEXT: ushll2 v3.4s, v0.8h, #0
1917 ; CHECK-BASE-NEXT: ushll v1.4s, v1.4h, #0
1918 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
1919 ; CHECK-BASE-NEXT: uaddl2 v4.2d, v3.4s, v2.4s
1920 ; CHECK-BASE-NEXT: uaddl v2.2d, v3.2s, v2.2s
1921 ; CHECK-BASE-NEXT: uaddl2 v5.2d, v0.4s, v1.4s
1922 ; CHECK-BASE-NEXT: uaddl v0.2d, v0.2s, v1.2s
1923 ; CHECK-BASE-NEXT: add v1.2d, v5.2d, v4.2d
1924 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v2.2d
1925 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v1.2d
1926 ; CHECK-BASE-NEXT: addp d0, v0.2d
1927 ; CHECK-BASE-NEXT: fmov x8, d0
1928 ; CHECK-BASE-NEXT: add x0, x8, x0
1929 ; CHECK-BASE-NEXT: ret
1931 ; CHECK-DOT-LABEL: add_v16i8_v16i64_acc_zext:
1932 ; CHECK-DOT: // %bb.0: // %entry
1933 ; CHECK-DOT-NEXT: ushll2 v1.8h, v0.16b, #0
1934 ; CHECK-DOT-NEXT: ushll v0.8h, v0.8b, #0
1935 ; CHECK-DOT-NEXT: ushll2 v2.4s, v1.8h, #0
1936 ; CHECK-DOT-NEXT: ushll2 v3.4s, v0.8h, #0
1937 ; CHECK-DOT-NEXT: ushll v1.4s, v1.4h, #0
1938 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
1939 ; CHECK-DOT-NEXT: uaddl2 v4.2d, v3.4s, v2.4s
1940 ; CHECK-DOT-NEXT: uaddl v2.2d, v3.2s, v2.2s
1941 ; CHECK-DOT-NEXT: uaddl2 v5.2d, v0.4s, v1.4s
1942 ; CHECK-DOT-NEXT: uaddl v0.2d, v0.2s, v1.2s
1943 ; CHECK-DOT-NEXT: add v1.2d, v5.2d, v4.2d
1944 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v2.2d
1945 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v1.2d
1946 ; CHECK-DOT-NEXT: addp d0, v0.2d
1947 ; CHECK-DOT-NEXT: fmov x8, d0
1948 ; CHECK-DOT-NEXT: add x0, x8, x0
1949 ; CHECK-DOT-NEXT: ret
1951 ; CHECK-GI-LABEL: add_v16i8_v16i64_acc_zext:
1952 ; CHECK-GI: // %bb.0: // %entry
1953 ; CHECK-GI-NEXT: ushll v1.8h, v0.8b, #0
1954 ; CHECK-GI-NEXT: ushll2 v0.8h, v0.16b, #0
1955 ; CHECK-GI-NEXT: ushll v2.4s, v1.4h, #0
1956 ; CHECK-GI-NEXT: ushll2 v1.4s, v1.8h, #0
1957 ; CHECK-GI-NEXT: ushll v3.4s, v0.4h, #0
1958 ; CHECK-GI-NEXT: ushll2 v0.4s, v0.8h, #0
1959 ; CHECK-GI-NEXT: ushll v4.2d, v2.2s, #0
1960 ; CHECK-GI-NEXT: ushll v5.2d, v1.2s, #0
1961 ; CHECK-GI-NEXT: ushll v6.2d, v3.2s, #0
1962 ; CHECK-GI-NEXT: ushll v7.2d, v0.2s, #0
1963 ; CHECK-GI-NEXT: uaddw2 v2.2d, v4.2d, v2.4s
1964 ; CHECK-GI-NEXT: uaddw2 v1.2d, v5.2d, v1.4s
1965 ; CHECK-GI-NEXT: uaddw2 v3.2d, v6.2d, v3.4s
1966 ; CHECK-GI-NEXT: uaddw2 v0.2d, v7.2d, v0.4s
1967 ; CHECK-GI-NEXT: add v1.2d, v2.2d, v1.2d
1968 ; CHECK-GI-NEXT: add v0.2d, v3.2d, v0.2d
1969 ; CHECK-GI-NEXT: add v0.2d, v1.2d, v0.2d
1970 ; CHECK-GI-NEXT: addp d0, v0.2d
1971 ; CHECK-GI-NEXT: fmov x8, d0
1972 ; CHECK-GI-NEXT: add x0, x8, x0
1973 ; CHECK-GI-NEXT: ret
1975 %xx = zext <16 x i8> %x to <16 x i64>
1976 %z = call i64 @llvm.vector.reduce.add.v16i64(<16 x i64> %xx)
1981 define i64 @add_v16i8_v16i64_acc_sext(<16 x i8> %x, i64 %a) {
1982 ; CHECK-BASE-LABEL: add_v16i8_v16i64_acc_sext:
1983 ; CHECK-BASE: // %bb.0: // %entry
1984 ; CHECK-BASE-NEXT: sshll2 v1.8h, v0.16b, #0
1985 ; CHECK-BASE-NEXT: sshll v0.8h, v0.8b, #0
1986 ; CHECK-BASE-NEXT: sshll2 v2.4s, v1.8h, #0
1987 ; CHECK-BASE-NEXT: sshll2 v3.4s, v0.8h, #0
1988 ; CHECK-BASE-NEXT: sshll v1.4s, v1.4h, #0
1989 ; CHECK-BASE-NEXT: sshll v0.4s, v0.4h, #0
1990 ; CHECK-BASE-NEXT: saddl2 v4.2d, v3.4s, v2.4s
1991 ; CHECK-BASE-NEXT: saddl v2.2d, v3.2s, v2.2s
1992 ; CHECK-BASE-NEXT: saddl2 v5.2d, v0.4s, v1.4s
1993 ; CHECK-BASE-NEXT: saddl v0.2d, v0.2s, v1.2s
1994 ; CHECK-BASE-NEXT: add v1.2d, v5.2d, v4.2d
1995 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v2.2d
1996 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v1.2d
1997 ; CHECK-BASE-NEXT: addp d0, v0.2d
1998 ; CHECK-BASE-NEXT: fmov x8, d0
1999 ; CHECK-BASE-NEXT: add x0, x8, x0
2000 ; CHECK-BASE-NEXT: ret
2002 ; CHECK-DOT-LABEL: add_v16i8_v16i64_acc_sext:
2003 ; CHECK-DOT: // %bb.0: // %entry
2004 ; CHECK-DOT-NEXT: sshll2 v1.8h, v0.16b, #0
2005 ; CHECK-DOT-NEXT: sshll v0.8h, v0.8b, #0
2006 ; CHECK-DOT-NEXT: sshll2 v2.4s, v1.8h, #0
2007 ; CHECK-DOT-NEXT: sshll2 v3.4s, v0.8h, #0
2008 ; CHECK-DOT-NEXT: sshll v1.4s, v1.4h, #0
2009 ; CHECK-DOT-NEXT: sshll v0.4s, v0.4h, #0
2010 ; CHECK-DOT-NEXT: saddl2 v4.2d, v3.4s, v2.4s
2011 ; CHECK-DOT-NEXT: saddl v2.2d, v3.2s, v2.2s
2012 ; CHECK-DOT-NEXT: saddl2 v5.2d, v0.4s, v1.4s
2013 ; CHECK-DOT-NEXT: saddl v0.2d, v0.2s, v1.2s
2014 ; CHECK-DOT-NEXT: add v1.2d, v5.2d, v4.2d
2015 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v2.2d
2016 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v1.2d
2017 ; CHECK-DOT-NEXT: addp d0, v0.2d
2018 ; CHECK-DOT-NEXT: fmov x8, d0
2019 ; CHECK-DOT-NEXT: add x0, x8, x0
2020 ; CHECK-DOT-NEXT: ret
2022 ; CHECK-GI-LABEL: add_v16i8_v16i64_acc_sext:
2023 ; CHECK-GI: // %bb.0: // %entry
2024 ; CHECK-GI-NEXT: sshll v1.8h, v0.8b, #0
2025 ; CHECK-GI-NEXT: sshll2 v0.8h, v0.16b, #0
2026 ; CHECK-GI-NEXT: sshll v2.4s, v1.4h, #0
2027 ; CHECK-GI-NEXT: sshll2 v1.4s, v1.8h, #0
2028 ; CHECK-GI-NEXT: sshll v3.4s, v0.4h, #0
2029 ; CHECK-GI-NEXT: sshll2 v0.4s, v0.8h, #0
2030 ; CHECK-GI-NEXT: sshll v4.2d, v2.2s, #0
2031 ; CHECK-GI-NEXT: sshll v5.2d, v1.2s, #0
2032 ; CHECK-GI-NEXT: sshll v6.2d, v3.2s, #0
2033 ; CHECK-GI-NEXT: sshll v7.2d, v0.2s, #0
2034 ; CHECK-GI-NEXT: saddw2 v2.2d, v4.2d, v2.4s
2035 ; CHECK-GI-NEXT: saddw2 v1.2d, v5.2d, v1.4s
2036 ; CHECK-GI-NEXT: saddw2 v3.2d, v6.2d, v3.4s
2037 ; CHECK-GI-NEXT: saddw2 v0.2d, v7.2d, v0.4s
2038 ; CHECK-GI-NEXT: add v1.2d, v2.2d, v1.2d
2039 ; CHECK-GI-NEXT: add v0.2d, v3.2d, v0.2d
2040 ; CHECK-GI-NEXT: add v0.2d, v1.2d, v0.2d
2041 ; CHECK-GI-NEXT: addp d0, v0.2d
2042 ; CHECK-GI-NEXT: fmov x8, d0
2043 ; CHECK-GI-NEXT: add x0, x8, x0
2044 ; CHECK-GI-NEXT: ret
2046 %xx = sext <16 x i8> %x to <16 x i64>
2047 %z = call i64 @llvm.vector.reduce.add.v16i64(<16 x i64> %xx)
2052 define i64 @add_v8i8_v8i64_acc_zext(<8 x i8> %x, i64 %a) {
2053 ; CHECK-BASE-LABEL: add_v8i8_v8i64_acc_zext:
2054 ; CHECK-BASE: // %bb.0: // %entry
2055 ; CHECK-BASE-NEXT: ushll v0.8h, v0.8b, #0
2056 ; CHECK-BASE-NEXT: ushll2 v1.4s, v0.8h, #0
2057 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
2058 ; CHECK-BASE-NEXT: uaddl2 v2.2d, v0.4s, v1.4s
2059 ; CHECK-BASE-NEXT: uaddl v0.2d, v0.2s, v1.2s
2060 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v2.2d
2061 ; CHECK-BASE-NEXT: addp d0, v0.2d
2062 ; CHECK-BASE-NEXT: fmov x8, d0
2063 ; CHECK-BASE-NEXT: add x0, x8, x0
2064 ; CHECK-BASE-NEXT: ret
2066 ; CHECK-DOT-LABEL: add_v8i8_v8i64_acc_zext:
2067 ; CHECK-DOT: // %bb.0: // %entry
2068 ; CHECK-DOT-NEXT: ushll v0.8h, v0.8b, #0
2069 ; CHECK-DOT-NEXT: ushll2 v1.4s, v0.8h, #0
2070 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
2071 ; CHECK-DOT-NEXT: uaddl2 v2.2d, v0.4s, v1.4s
2072 ; CHECK-DOT-NEXT: uaddl v0.2d, v0.2s, v1.2s
2073 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v2.2d
2074 ; CHECK-DOT-NEXT: addp d0, v0.2d
2075 ; CHECK-DOT-NEXT: fmov x8, d0
2076 ; CHECK-DOT-NEXT: add x0, x8, x0
2077 ; CHECK-DOT-NEXT: ret
2079 ; CHECK-GI-LABEL: add_v8i8_v8i64_acc_zext:
2080 ; CHECK-GI: // %bb.0: // %entry
2081 ; CHECK-GI-NEXT: ushll v0.8h, v0.8b, #0
2082 ; CHECK-GI-NEXT: ushll v1.4s, v0.4h, #0
2083 ; CHECK-GI-NEXT: ushll2 v0.4s, v0.8h, #0
2084 ; CHECK-GI-NEXT: ushll v2.2d, v1.2s, #0
2085 ; CHECK-GI-NEXT: ushll v3.2d, v0.2s, #0
2086 ; CHECK-GI-NEXT: uaddw2 v1.2d, v2.2d, v1.4s
2087 ; CHECK-GI-NEXT: uaddw2 v0.2d, v3.2d, v0.4s
2088 ; CHECK-GI-NEXT: add v0.2d, v1.2d, v0.2d
2089 ; CHECK-GI-NEXT: addp d0, v0.2d
2090 ; CHECK-GI-NEXT: fmov x8, d0
2091 ; CHECK-GI-NEXT: add x0, x8, x0
2092 ; CHECK-GI-NEXT: ret
2094 %xx = zext <8 x i8> %x to <8 x i64>
2095 %z = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> %xx)
2100 define i64 @add_v8i8_v8i64_acc_sext(<8 x i8> %x, i64 %a) {
2101 ; CHECK-BASE-LABEL: add_v8i8_v8i64_acc_sext:
2102 ; CHECK-BASE: // %bb.0: // %entry
2103 ; CHECK-BASE-NEXT: sshll v0.8h, v0.8b, #0
2104 ; CHECK-BASE-NEXT: sshll2 v1.4s, v0.8h, #0
2105 ; CHECK-BASE-NEXT: sshll v0.4s, v0.4h, #0
2106 ; CHECK-BASE-NEXT: saddl2 v2.2d, v0.4s, v1.4s
2107 ; CHECK-BASE-NEXT: saddl v0.2d, v0.2s, v1.2s
2108 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v2.2d
2109 ; CHECK-BASE-NEXT: addp d0, v0.2d
2110 ; CHECK-BASE-NEXT: fmov x8, d0
2111 ; CHECK-BASE-NEXT: add x0, x8, x0
2112 ; CHECK-BASE-NEXT: ret
2114 ; CHECK-DOT-LABEL: add_v8i8_v8i64_acc_sext:
2115 ; CHECK-DOT: // %bb.0: // %entry
2116 ; CHECK-DOT-NEXT: sshll v0.8h, v0.8b, #0
2117 ; CHECK-DOT-NEXT: sshll2 v1.4s, v0.8h, #0
2118 ; CHECK-DOT-NEXT: sshll v0.4s, v0.4h, #0
2119 ; CHECK-DOT-NEXT: saddl2 v2.2d, v0.4s, v1.4s
2120 ; CHECK-DOT-NEXT: saddl v0.2d, v0.2s, v1.2s
2121 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v2.2d
2122 ; CHECK-DOT-NEXT: addp d0, v0.2d
2123 ; CHECK-DOT-NEXT: fmov x8, d0
2124 ; CHECK-DOT-NEXT: add x0, x8, x0
2125 ; CHECK-DOT-NEXT: ret
2127 ; CHECK-GI-LABEL: add_v8i8_v8i64_acc_sext:
2128 ; CHECK-GI: // %bb.0: // %entry
2129 ; CHECK-GI-NEXT: sshll v0.8h, v0.8b, #0
2130 ; CHECK-GI-NEXT: sshll v1.4s, v0.4h, #0
2131 ; CHECK-GI-NEXT: sshll2 v0.4s, v0.8h, #0
2132 ; CHECK-GI-NEXT: sshll v2.2d, v1.2s, #0
2133 ; CHECK-GI-NEXT: sshll v3.2d, v0.2s, #0
2134 ; CHECK-GI-NEXT: saddw2 v1.2d, v2.2d, v1.4s
2135 ; CHECK-GI-NEXT: saddw2 v0.2d, v3.2d, v0.4s
2136 ; CHECK-GI-NEXT: add v0.2d, v1.2d, v0.2d
2137 ; CHECK-GI-NEXT: addp d0, v0.2d
2138 ; CHECK-GI-NEXT: fmov x8, d0
2139 ; CHECK-GI-NEXT: add x0, x8, x0
2140 ; CHECK-GI-NEXT: ret
2142 %xx = sext <8 x i8> %x to <8 x i64>
2143 %z = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> %xx)
2148 define i64 @add_v4i8_v4i64_acc_zext(<4 x i8> %x, i64 %a) {
2149 ; CHECK-BASE-LABEL: add_v4i8_v4i64_acc_zext:
2150 ; CHECK-BASE: // %bb.0: // %entry
2151 ; CHECK-BASE-NEXT: bic v0.4h, #255, lsl #8
2152 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
2153 ; CHECK-BASE-NEXT: uaddlv d0, v0.4s
2154 ; CHECK-BASE-NEXT: fmov x8, d0
2155 ; CHECK-BASE-NEXT: add x0, x8, x0
2156 ; CHECK-BASE-NEXT: ret
2158 ; CHECK-DOT-LABEL: add_v4i8_v4i64_acc_zext:
2159 ; CHECK-DOT: // %bb.0: // %entry
2160 ; CHECK-DOT-NEXT: bic v0.4h, #255, lsl #8
2161 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
2162 ; CHECK-DOT-NEXT: uaddlv d0, v0.4s
2163 ; CHECK-DOT-NEXT: fmov x8, d0
2164 ; CHECK-DOT-NEXT: add x0, x8, x0
2165 ; CHECK-DOT-NEXT: ret
2167 ; CHECK-GI-LABEL: add_v4i8_v4i64_acc_zext:
2168 ; CHECK-GI: // %bb.0: // %entry
2169 ; CHECK-GI-NEXT: ushll v0.4s, v0.4h, #0
2170 ; CHECK-GI-NEXT: movi v1.2d, #0x000000000000ff
2171 ; CHECK-GI-NEXT: ushll v2.2d, v0.2s, #0
2172 ; CHECK-GI-NEXT: ushll2 v0.2d, v0.4s, #0
2173 ; CHECK-GI-NEXT: and v2.16b, v2.16b, v1.16b
2174 ; CHECK-GI-NEXT: and v0.16b, v0.16b, v1.16b
2175 ; CHECK-GI-NEXT: add v0.2d, v2.2d, v0.2d
2176 ; CHECK-GI-NEXT: addp d0, v0.2d
2177 ; CHECK-GI-NEXT: fmov x8, d0
2178 ; CHECK-GI-NEXT: add x0, x8, x0
2179 ; CHECK-GI-NEXT: ret
2181 %xx = zext <4 x i8> %x to <4 x i64>
2182 %z = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %xx)
2187 define i64 @add_v4i8_v4i64_acc_sext(<4 x i8> %x, i64 %a) {
2188 ; CHECK-BASE-LABEL: add_v4i8_v4i64_acc_sext:
2189 ; CHECK-BASE: // %bb.0: // %entry
2190 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
2191 ; CHECK-BASE-NEXT: ushll v1.2d, v0.2s, #0
2192 ; CHECK-BASE-NEXT: ushll2 v0.2d, v0.4s, #0
2193 ; CHECK-BASE-NEXT: shl v1.2d, v1.2d, #56
2194 ; CHECK-BASE-NEXT: shl v0.2d, v0.2d, #56
2195 ; CHECK-BASE-NEXT: sshr v1.2d, v1.2d, #56
2196 ; CHECK-BASE-NEXT: ssra v1.2d, v0.2d, #56
2197 ; CHECK-BASE-NEXT: addp d0, v1.2d
2198 ; CHECK-BASE-NEXT: fmov x8, d0
2199 ; CHECK-BASE-NEXT: add x0, x8, x0
2200 ; CHECK-BASE-NEXT: ret
2202 ; CHECK-DOT-LABEL: add_v4i8_v4i64_acc_sext:
2203 ; CHECK-DOT: // %bb.0: // %entry
2204 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
2205 ; CHECK-DOT-NEXT: ushll v1.2d, v0.2s, #0
2206 ; CHECK-DOT-NEXT: ushll2 v0.2d, v0.4s, #0
2207 ; CHECK-DOT-NEXT: shl v1.2d, v1.2d, #56
2208 ; CHECK-DOT-NEXT: shl v0.2d, v0.2d, #56
2209 ; CHECK-DOT-NEXT: sshr v1.2d, v1.2d, #56
2210 ; CHECK-DOT-NEXT: ssra v1.2d, v0.2d, #56
2211 ; CHECK-DOT-NEXT: addp d0, v1.2d
2212 ; CHECK-DOT-NEXT: fmov x8, d0
2213 ; CHECK-DOT-NEXT: add x0, x8, x0
2214 ; CHECK-DOT-NEXT: ret
2216 ; CHECK-GI-LABEL: add_v4i8_v4i64_acc_sext:
2217 ; CHECK-GI: // %bb.0: // %entry
2218 ; CHECK-GI-NEXT: ushll v0.4s, v0.4h, #0
2219 ; CHECK-GI-NEXT: ushll2 v1.2d, v0.4s, #0
2220 ; CHECK-GI-NEXT: ushll v0.2d, v0.2s, #0
2221 ; CHECK-GI-NEXT: shl v1.2d, v1.2d, #56
2222 ; CHECK-GI-NEXT: shl v0.2d, v0.2d, #56
2223 ; CHECK-GI-NEXT: sshr v1.2d, v1.2d, #56
2224 ; CHECK-GI-NEXT: ssra v1.2d, v0.2d, #56
2225 ; CHECK-GI-NEXT: addp d0, v1.2d
2226 ; CHECK-GI-NEXT: fmov x8, d0
2227 ; CHECK-GI-NEXT: add x0, x8, x0
2228 ; CHECK-GI-NEXT: ret
2230 %xx = sext <4 x i8> %x to <4 x i64>
2231 %z = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %xx)
2236 define i64 @add_v2i8_v2i64_acc_zext(<2 x i8> %x, i64 %a) {
2237 ; CHECK-BASE-LABEL: add_v2i8_v2i64_acc_zext:
2238 ; CHECK-BASE: // %bb.0: // %entry
2239 ; CHECK-BASE-NEXT: movi d1, #0x0000ff000000ff
2240 ; CHECK-BASE-NEXT: and v0.8b, v0.8b, v1.8b
2241 ; CHECK-BASE-NEXT: ushll v0.2d, v0.2s, #0
2242 ; CHECK-BASE-NEXT: addp d0, v0.2d
2243 ; CHECK-BASE-NEXT: fmov x8, d0
2244 ; CHECK-BASE-NEXT: add x0, x8, x0
2245 ; CHECK-BASE-NEXT: ret
2247 ; CHECK-DOT-LABEL: add_v2i8_v2i64_acc_zext:
2248 ; CHECK-DOT: // %bb.0: // %entry
2249 ; CHECK-DOT-NEXT: movi d1, #0x0000ff000000ff
2250 ; CHECK-DOT-NEXT: and v0.8b, v0.8b, v1.8b
2251 ; CHECK-DOT-NEXT: ushll v0.2d, v0.2s, #0
2252 ; CHECK-DOT-NEXT: addp d0, v0.2d
2253 ; CHECK-DOT-NEXT: fmov x8, d0
2254 ; CHECK-DOT-NEXT: add x0, x8, x0
2255 ; CHECK-DOT-NEXT: ret
2257 ; CHECK-GI-LABEL: add_v2i8_v2i64_acc_zext:
2258 ; CHECK-GI: // %bb.0: // %entry
2259 ; CHECK-GI-NEXT: movi v1.2d, #0x000000000000ff
2260 ; CHECK-GI-NEXT: ushll v0.2d, v0.2s, #0
2261 ; CHECK-GI-NEXT: and v0.16b, v0.16b, v1.16b
2262 ; CHECK-GI-NEXT: addp d0, v0.2d
2263 ; CHECK-GI-NEXT: fmov x8, d0
2264 ; CHECK-GI-NEXT: add x0, x8, x0
2265 ; CHECK-GI-NEXT: ret
2267 %xx = zext <2 x i8> %x to <2 x i64>
2268 %z = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %xx)
2273 define i64 @add_v2i8_v2i64_acc_sext(<2 x i8> %x, i64 %a) {
2274 ; CHECK-LABEL: add_v2i8_v2i64_acc_sext:
2275 ; CHECK: // %bb.0: // %entry
2276 ; CHECK-NEXT: ushll v0.2d, v0.2s, #0
2277 ; CHECK-NEXT: shl v0.2d, v0.2d, #56
2278 ; CHECK-NEXT: sshr v0.2d, v0.2d, #56
2279 ; CHECK-NEXT: addp d0, v0.2d
2280 ; CHECK-NEXT: fmov x8, d0
2281 ; CHECK-NEXT: add x0, x8, x0
2284 %xx = sext <2 x i8> %x to <2 x i64>
2285 %z = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %xx)
2290 define i64 @add_v2i64_v2i64_acc(<2 x i64> %x, i64 %a) {
2291 ; CHECK-LABEL: add_v2i64_v2i64_acc:
2292 ; CHECK: // %bb.0: // %entry
2293 ; CHECK-NEXT: addp d0, v0.2d
2294 ; CHECK-NEXT: fmov x8, d0
2295 ; CHECK-NEXT: add x0, x8, x0
2298 %z = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %x)
2303 define i32 @add_pair_v4i32_v4i32(<4 x i32> %x, <4 x i32> %y) {
2304 ; CHECK-BASE-LABEL: add_pair_v4i32_v4i32:
2305 ; CHECK-BASE: // %bb.0: // %entry
2306 ; CHECK-BASE-NEXT: add v0.4s, v0.4s, v1.4s
2307 ; CHECK-BASE-NEXT: addv s0, v0.4s
2308 ; CHECK-BASE-NEXT: fmov w0, s0
2309 ; CHECK-BASE-NEXT: ret
2311 ; CHECK-DOT-LABEL: add_pair_v4i32_v4i32:
2312 ; CHECK-DOT: // %bb.0: // %entry
2313 ; CHECK-DOT-NEXT: add v0.4s, v0.4s, v1.4s
2314 ; CHECK-DOT-NEXT: addv s0, v0.4s
2315 ; CHECK-DOT-NEXT: fmov w0, s0
2316 ; CHECK-DOT-NEXT: ret
2318 ; CHECK-GI-LABEL: add_pair_v4i32_v4i32:
2319 ; CHECK-GI: // %bb.0: // %entry
2320 ; CHECK-GI-NEXT: addv s0, v0.4s
2321 ; CHECK-GI-NEXT: addv s1, v1.4s
2322 ; CHECK-GI-NEXT: fmov w8, s0
2323 ; CHECK-GI-NEXT: fmov w9, s1
2324 ; CHECK-GI-NEXT: add w0, w8, w9
2325 ; CHECK-GI-NEXT: ret
2327 %z1 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %x)
2328 %z2 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %y)
2329 %z = add i32 %z1, %z2
2333 define i64 @add_pair_v4i32_v4i64_zext(<4 x i32> %x, <4 x i32> %y) {
2334 ; CHECK-BASE-LABEL: add_pair_v4i32_v4i64_zext:
2335 ; CHECK-BASE: // %bb.0: // %entry
2336 ; CHECK-BASE-NEXT: uaddlp v1.2d, v1.4s
2337 ; CHECK-BASE-NEXT: uadalp v1.2d, v0.4s
2338 ; CHECK-BASE-NEXT: addp d0, v1.2d
2339 ; CHECK-BASE-NEXT: fmov x0, d0
2340 ; CHECK-BASE-NEXT: ret
2342 ; CHECK-DOT-LABEL: add_pair_v4i32_v4i64_zext:
2343 ; CHECK-DOT: // %bb.0: // %entry
2344 ; CHECK-DOT-NEXT: uaddlp v1.2d, v1.4s
2345 ; CHECK-DOT-NEXT: uadalp v1.2d, v0.4s
2346 ; CHECK-DOT-NEXT: addp d0, v1.2d
2347 ; CHECK-DOT-NEXT: fmov x0, d0
2348 ; CHECK-DOT-NEXT: ret
2350 ; CHECK-GI-LABEL: add_pair_v4i32_v4i64_zext:
2351 ; CHECK-GI: // %bb.0: // %entry
2352 ; CHECK-GI-NEXT: ushll v2.2d, v0.2s, #0
2353 ; CHECK-GI-NEXT: ushll v3.2d, v1.2s, #0
2354 ; CHECK-GI-NEXT: uaddw2 v0.2d, v2.2d, v0.4s
2355 ; CHECK-GI-NEXT: uaddw2 v1.2d, v3.2d, v1.4s
2356 ; CHECK-GI-NEXT: addp d0, v0.2d
2357 ; CHECK-GI-NEXT: addp d1, v1.2d
2358 ; CHECK-GI-NEXT: fmov x8, d0
2359 ; CHECK-GI-NEXT: fmov x9, d1
2360 ; CHECK-GI-NEXT: add x0, x8, x9
2361 ; CHECK-GI-NEXT: ret
2363 %xx = zext <4 x i32> %x to <4 x i64>
2364 %z1 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %xx)
2365 %yy = zext <4 x i32> %y to <4 x i64>
2366 %z2 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %yy)
2367 %z = add i64 %z1, %z2
2371 define i64 @add_pair_v4i32_v4i64_sext(<4 x i32> %x, <4 x i32> %y) {
2372 ; CHECK-BASE-LABEL: add_pair_v4i32_v4i64_sext:
2373 ; CHECK-BASE: // %bb.0: // %entry
2374 ; CHECK-BASE-NEXT: saddlp v1.2d, v1.4s
2375 ; CHECK-BASE-NEXT: sadalp v1.2d, v0.4s
2376 ; CHECK-BASE-NEXT: addp d0, v1.2d
2377 ; CHECK-BASE-NEXT: fmov x0, d0
2378 ; CHECK-BASE-NEXT: ret
2380 ; CHECK-DOT-LABEL: add_pair_v4i32_v4i64_sext:
2381 ; CHECK-DOT: // %bb.0: // %entry
2382 ; CHECK-DOT-NEXT: saddlp v1.2d, v1.4s
2383 ; CHECK-DOT-NEXT: sadalp v1.2d, v0.4s
2384 ; CHECK-DOT-NEXT: addp d0, v1.2d
2385 ; CHECK-DOT-NEXT: fmov x0, d0
2386 ; CHECK-DOT-NEXT: ret
2388 ; CHECK-GI-LABEL: add_pair_v4i32_v4i64_sext:
2389 ; CHECK-GI: // %bb.0: // %entry
2390 ; CHECK-GI-NEXT: sshll v2.2d, v0.2s, #0
2391 ; CHECK-GI-NEXT: sshll v3.2d, v1.2s, #0
2392 ; CHECK-GI-NEXT: saddw2 v0.2d, v2.2d, v0.4s
2393 ; CHECK-GI-NEXT: saddw2 v1.2d, v3.2d, v1.4s
2394 ; CHECK-GI-NEXT: addp d0, v0.2d
2395 ; CHECK-GI-NEXT: addp d1, v1.2d
2396 ; CHECK-GI-NEXT: fmov x8, d0
2397 ; CHECK-GI-NEXT: fmov x9, d1
2398 ; CHECK-GI-NEXT: add x0, x8, x9
2399 ; CHECK-GI-NEXT: ret
2401 %xx = sext <4 x i32> %x to <4 x i64>
2402 %z1 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %xx)
2403 %yy = sext <4 x i32> %y to <4 x i64>
2404 %z2 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %yy)
2405 %z = add i64 %z1, %z2
2409 define i64 @add_pair_v2i32_v2i64_zext(<2 x i32> %x, <2 x i32> %y) {
2410 ; CHECK-BASE-LABEL: add_pair_v2i32_v2i64_zext:
2411 ; CHECK-BASE: // %bb.0: // %entry
2412 ; CHECK-BASE-NEXT: uaddl v0.2d, v0.2s, v1.2s
2413 ; CHECK-BASE-NEXT: addp d0, v0.2d
2414 ; CHECK-BASE-NEXT: fmov x0, d0
2415 ; CHECK-BASE-NEXT: ret
2417 ; CHECK-DOT-LABEL: add_pair_v2i32_v2i64_zext:
2418 ; CHECK-DOT: // %bb.0: // %entry
2419 ; CHECK-DOT-NEXT: uaddl v0.2d, v0.2s, v1.2s
2420 ; CHECK-DOT-NEXT: addp d0, v0.2d
2421 ; CHECK-DOT-NEXT: fmov x0, d0
2422 ; CHECK-DOT-NEXT: ret
2424 ; CHECK-GI-LABEL: add_pair_v2i32_v2i64_zext:
2425 ; CHECK-GI: // %bb.0: // %entry
2426 ; CHECK-GI-NEXT: ushll v0.2d, v0.2s, #0
2427 ; CHECK-GI-NEXT: ushll v1.2d, v1.2s, #0
2428 ; CHECK-GI-NEXT: addp d0, v0.2d
2429 ; CHECK-GI-NEXT: addp d1, v1.2d
2430 ; CHECK-GI-NEXT: fmov x8, d0
2431 ; CHECK-GI-NEXT: fmov x9, d1
2432 ; CHECK-GI-NEXT: add x0, x8, x9
2433 ; CHECK-GI-NEXT: ret
2435 %xx = zext <2 x i32> %x to <2 x i64>
2436 %z1 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %xx)
2437 %yy = zext <2 x i32> %y to <2 x i64>
2438 %z2 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %yy)
2439 %z = add i64 %z1, %z2
2443 define i64 @add_pair_v2i32_v2i64_sext(<2 x i32> %x, <2 x i32> %y) {
2444 ; CHECK-BASE-LABEL: add_pair_v2i32_v2i64_sext:
2445 ; CHECK-BASE: // %bb.0: // %entry
2446 ; CHECK-BASE-NEXT: saddl v0.2d, v0.2s, v1.2s
2447 ; CHECK-BASE-NEXT: addp d0, v0.2d
2448 ; CHECK-BASE-NEXT: fmov x0, d0
2449 ; CHECK-BASE-NEXT: ret
2451 ; CHECK-DOT-LABEL: add_pair_v2i32_v2i64_sext:
2452 ; CHECK-DOT: // %bb.0: // %entry
2453 ; CHECK-DOT-NEXT: saddl v0.2d, v0.2s, v1.2s
2454 ; CHECK-DOT-NEXT: addp d0, v0.2d
2455 ; CHECK-DOT-NEXT: fmov x0, d0
2456 ; CHECK-DOT-NEXT: ret
2458 ; CHECK-GI-LABEL: add_pair_v2i32_v2i64_sext:
2459 ; CHECK-GI: // %bb.0: // %entry
2460 ; CHECK-GI-NEXT: sshll v0.2d, v0.2s, #0
2461 ; CHECK-GI-NEXT: sshll v1.2d, v1.2s, #0
2462 ; CHECK-GI-NEXT: addp d0, v0.2d
2463 ; CHECK-GI-NEXT: addp d1, v1.2d
2464 ; CHECK-GI-NEXT: fmov x8, d0
2465 ; CHECK-GI-NEXT: fmov x9, d1
2466 ; CHECK-GI-NEXT: add x0, x8, x9
2467 ; CHECK-GI-NEXT: ret
2469 %xx = sext <2 x i32> %x to <2 x i64>
2470 %z1 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %xx)
2471 %yy = sext <2 x i32> %y to <2 x i64>
2472 %z2 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %yy)
2473 %z = add i64 %z1, %z2
2477 define i32 @add_pair_v8i16_v8i32_zext(<8 x i16> %x, <8 x i16> %y) {
2478 ; CHECK-BASE-LABEL: add_pair_v8i16_v8i32_zext:
2479 ; CHECK-BASE: // %bb.0: // %entry
2480 ; CHECK-BASE-NEXT: uaddlp v1.4s, v1.8h
2481 ; CHECK-BASE-NEXT: uadalp v1.4s, v0.8h
2482 ; CHECK-BASE-NEXT: addv s0, v1.4s
2483 ; CHECK-BASE-NEXT: fmov w0, s0
2484 ; CHECK-BASE-NEXT: ret
2486 ; CHECK-DOT-LABEL: add_pair_v8i16_v8i32_zext:
2487 ; CHECK-DOT: // %bb.0: // %entry
2488 ; CHECK-DOT-NEXT: uaddlp v1.4s, v1.8h
2489 ; CHECK-DOT-NEXT: uadalp v1.4s, v0.8h
2490 ; CHECK-DOT-NEXT: addv s0, v1.4s
2491 ; CHECK-DOT-NEXT: fmov w0, s0
2492 ; CHECK-DOT-NEXT: ret
2494 ; CHECK-GI-LABEL: add_pair_v8i16_v8i32_zext:
2495 ; CHECK-GI: // %bb.0: // %entry
2496 ; CHECK-GI-NEXT: ushll v2.4s, v0.4h, #0
2497 ; CHECK-GI-NEXT: ushll v3.4s, v1.4h, #0
2498 ; CHECK-GI-NEXT: uaddw2 v0.4s, v2.4s, v0.8h
2499 ; CHECK-GI-NEXT: uaddw2 v1.4s, v3.4s, v1.8h
2500 ; CHECK-GI-NEXT: addv s0, v0.4s
2501 ; CHECK-GI-NEXT: addv s1, v1.4s
2502 ; CHECK-GI-NEXT: fmov w8, s0
2503 ; CHECK-GI-NEXT: fmov w9, s1
2504 ; CHECK-GI-NEXT: add w0, w8, w9
2505 ; CHECK-GI-NEXT: ret
2507 %xx = zext <8 x i16> %x to <8 x i32>
2508 %z1 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %xx)
2509 %yy = zext <8 x i16> %y to <8 x i32>
2510 %z2 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %yy)
2511 %z = add i32 %z1, %z2
2515 define i32 @add_pair_v8i16_v8i32_sext(<8 x i16> %x, <8 x i16> %y) {
2516 ; CHECK-BASE-LABEL: add_pair_v8i16_v8i32_sext:
2517 ; CHECK-BASE: // %bb.0: // %entry
2518 ; CHECK-BASE-NEXT: saddlp v1.4s, v1.8h
2519 ; CHECK-BASE-NEXT: sadalp v1.4s, v0.8h
2520 ; CHECK-BASE-NEXT: addv s0, v1.4s
2521 ; CHECK-BASE-NEXT: fmov w0, s0
2522 ; CHECK-BASE-NEXT: ret
2524 ; CHECK-DOT-LABEL: add_pair_v8i16_v8i32_sext:
2525 ; CHECK-DOT: // %bb.0: // %entry
2526 ; CHECK-DOT-NEXT: saddlp v1.4s, v1.8h
2527 ; CHECK-DOT-NEXT: sadalp v1.4s, v0.8h
2528 ; CHECK-DOT-NEXT: addv s0, v1.4s
2529 ; CHECK-DOT-NEXT: fmov w0, s0
2530 ; CHECK-DOT-NEXT: ret
2532 ; CHECK-GI-LABEL: add_pair_v8i16_v8i32_sext:
2533 ; CHECK-GI: // %bb.0: // %entry
2534 ; CHECK-GI-NEXT: sshll v2.4s, v0.4h, #0
2535 ; CHECK-GI-NEXT: sshll v3.4s, v1.4h, #0
2536 ; CHECK-GI-NEXT: saddw2 v0.4s, v2.4s, v0.8h
2537 ; CHECK-GI-NEXT: saddw2 v1.4s, v3.4s, v1.8h
2538 ; CHECK-GI-NEXT: addv s0, v0.4s
2539 ; CHECK-GI-NEXT: addv s1, v1.4s
2540 ; CHECK-GI-NEXT: fmov w8, s0
2541 ; CHECK-GI-NEXT: fmov w9, s1
2542 ; CHECK-GI-NEXT: add w0, w8, w9
2543 ; CHECK-GI-NEXT: ret
2545 %xx = sext <8 x i16> %x to <8 x i32>
2546 %z1 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %xx)
2547 %yy = sext <8 x i16> %y to <8 x i32>
2548 %z2 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %yy)
2549 %z = add i32 %z1, %z2
2553 define i32 @add_pair_v4i16_v4i32_zext(<4 x i16> %x, <4 x i16> %y) {
2554 ; CHECK-BASE-LABEL: add_pair_v4i16_v4i32_zext:
2555 ; CHECK-BASE: // %bb.0: // %entry
2556 ; CHECK-BASE-NEXT: uaddl v0.4s, v0.4h, v1.4h
2557 ; CHECK-BASE-NEXT: addv s0, v0.4s
2558 ; CHECK-BASE-NEXT: fmov w0, s0
2559 ; CHECK-BASE-NEXT: ret
2561 ; CHECK-DOT-LABEL: add_pair_v4i16_v4i32_zext:
2562 ; CHECK-DOT: // %bb.0: // %entry
2563 ; CHECK-DOT-NEXT: uaddl v0.4s, v0.4h, v1.4h
2564 ; CHECK-DOT-NEXT: addv s0, v0.4s
2565 ; CHECK-DOT-NEXT: fmov w0, s0
2566 ; CHECK-DOT-NEXT: ret
2568 ; CHECK-GI-LABEL: add_pair_v4i16_v4i32_zext:
2569 ; CHECK-GI: // %bb.0: // %entry
2570 ; CHECK-GI-NEXT: ushll v0.4s, v0.4h, #0
2571 ; CHECK-GI-NEXT: ushll v1.4s, v1.4h, #0
2572 ; CHECK-GI-NEXT: addv s0, v0.4s
2573 ; CHECK-GI-NEXT: addv s1, v1.4s
2574 ; CHECK-GI-NEXT: fmov w8, s0
2575 ; CHECK-GI-NEXT: fmov w9, s1
2576 ; CHECK-GI-NEXT: add w0, w8, w9
2577 ; CHECK-GI-NEXT: ret
2579 %xx = zext <4 x i16> %x to <4 x i32>
2580 %z1 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %xx)
2581 %yy = zext <4 x i16> %y to <4 x i32>
2582 %z2 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %yy)
2583 %z = add i32 %z1, %z2
2587 define i32 @add_pair_v4i16_v4i32_sext(<4 x i16> %x, <4 x i16> %y) {
2588 ; CHECK-BASE-LABEL: add_pair_v4i16_v4i32_sext:
2589 ; CHECK-BASE: // %bb.0: // %entry
2590 ; CHECK-BASE-NEXT: saddl v0.4s, v0.4h, v1.4h
2591 ; CHECK-BASE-NEXT: addv s0, v0.4s
2592 ; CHECK-BASE-NEXT: fmov w0, s0
2593 ; CHECK-BASE-NEXT: ret
2595 ; CHECK-DOT-LABEL: add_pair_v4i16_v4i32_sext:
2596 ; CHECK-DOT: // %bb.0: // %entry
2597 ; CHECK-DOT-NEXT: saddl v0.4s, v0.4h, v1.4h
2598 ; CHECK-DOT-NEXT: addv s0, v0.4s
2599 ; CHECK-DOT-NEXT: fmov w0, s0
2600 ; CHECK-DOT-NEXT: ret
2602 ; CHECK-GI-LABEL: add_pair_v4i16_v4i32_sext:
2603 ; CHECK-GI: // %bb.0: // %entry
2604 ; CHECK-GI-NEXT: sshll v0.4s, v0.4h, #0
2605 ; CHECK-GI-NEXT: sshll v1.4s, v1.4h, #0
2606 ; CHECK-GI-NEXT: addv s0, v0.4s
2607 ; CHECK-GI-NEXT: addv s1, v1.4s
2608 ; CHECK-GI-NEXT: fmov w8, s0
2609 ; CHECK-GI-NEXT: fmov w9, s1
2610 ; CHECK-GI-NEXT: add w0, w8, w9
2611 ; CHECK-GI-NEXT: ret
2613 %xx = sext <4 x i16> %x to <4 x i32>
2614 %z1 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %xx)
2615 %yy = sext <4 x i16> %y to <4 x i32>
2616 %z2 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %yy)
2617 %z = add i32 %z1, %z2
2621 define zeroext i16 @add_pair_v8i16_v8i16(<8 x i16> %x, <8 x i16> %y) {
2622 ; CHECK-BASE-LABEL: add_pair_v8i16_v8i16:
2623 ; CHECK-BASE: // %bb.0: // %entry
2624 ; CHECK-BASE-NEXT: add v0.8h, v0.8h, v1.8h
2625 ; CHECK-BASE-NEXT: addv h0, v0.8h
2626 ; CHECK-BASE-NEXT: fmov w0, s0
2627 ; CHECK-BASE-NEXT: ret
2629 ; CHECK-DOT-LABEL: add_pair_v8i16_v8i16:
2630 ; CHECK-DOT: // %bb.0: // %entry
2631 ; CHECK-DOT-NEXT: add v0.8h, v0.8h, v1.8h
2632 ; CHECK-DOT-NEXT: addv h0, v0.8h
2633 ; CHECK-DOT-NEXT: fmov w0, s0
2634 ; CHECK-DOT-NEXT: ret
2636 ; CHECK-GI-LABEL: add_pair_v8i16_v8i16:
2637 ; CHECK-GI: // %bb.0: // %entry
2638 ; CHECK-GI-NEXT: addv h0, v0.8h
2639 ; CHECK-GI-NEXT: addv h1, v1.8h
2640 ; CHECK-GI-NEXT: fmov w8, s0
2641 ; CHECK-GI-NEXT: fmov w9, s1
2642 ; CHECK-GI-NEXT: add w8, w9, w8, uxth
2643 ; CHECK-GI-NEXT: and w0, w8, #0xffff
2644 ; CHECK-GI-NEXT: ret
2646 %z1 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> %x)
2647 %z2 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> %y)
2648 %z = add i16 %z1, %z2
2652 define i64 @add_pair_v8i16_v8i64_zext(<8 x i16> %x, <8 x i16> %y) {
2653 ; CHECK-BASE-LABEL: add_pair_v8i16_v8i64_zext:
2654 ; CHECK-BASE: // %bb.0: // %entry
2655 ; CHECK-BASE-NEXT: ushll2 v2.4s, v0.8h, #0
2656 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
2657 ; CHECK-BASE-NEXT: ushll2 v3.4s, v1.8h, #0
2658 ; CHECK-BASE-NEXT: ushll v1.4s, v1.4h, #0
2659 ; CHECK-BASE-NEXT: uaddl2 v4.2d, v0.4s, v2.4s
2660 ; CHECK-BASE-NEXT: uaddl v0.2d, v0.2s, v2.2s
2661 ; CHECK-BASE-NEXT: uaddl2 v2.2d, v1.4s, v3.4s
2662 ; CHECK-BASE-NEXT: uaddl v1.2d, v1.2s, v3.2s
2663 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v4.2d
2664 ; CHECK-BASE-NEXT: add v1.2d, v1.2d, v2.2d
2665 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v1.2d
2666 ; CHECK-BASE-NEXT: addp d0, v0.2d
2667 ; CHECK-BASE-NEXT: fmov x0, d0
2668 ; CHECK-BASE-NEXT: ret
2670 ; CHECK-DOT-LABEL: add_pair_v8i16_v8i64_zext:
2671 ; CHECK-DOT: // %bb.0: // %entry
2672 ; CHECK-DOT-NEXT: ushll2 v2.4s, v0.8h, #0
2673 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
2674 ; CHECK-DOT-NEXT: ushll2 v3.4s, v1.8h, #0
2675 ; CHECK-DOT-NEXT: ushll v1.4s, v1.4h, #0
2676 ; CHECK-DOT-NEXT: uaddl2 v4.2d, v0.4s, v2.4s
2677 ; CHECK-DOT-NEXT: uaddl v0.2d, v0.2s, v2.2s
2678 ; CHECK-DOT-NEXT: uaddl2 v2.2d, v1.4s, v3.4s
2679 ; CHECK-DOT-NEXT: uaddl v1.2d, v1.2s, v3.2s
2680 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v4.2d
2681 ; CHECK-DOT-NEXT: add v1.2d, v1.2d, v2.2d
2682 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v1.2d
2683 ; CHECK-DOT-NEXT: addp d0, v0.2d
2684 ; CHECK-DOT-NEXT: fmov x0, d0
2685 ; CHECK-DOT-NEXT: ret
2687 ; CHECK-GI-LABEL: add_pair_v8i16_v8i64_zext:
2688 ; CHECK-GI: // %bb.0: // %entry
2689 ; CHECK-GI-NEXT: ushll v2.4s, v0.4h, #0
2690 ; CHECK-GI-NEXT: ushll2 v0.4s, v0.8h, #0
2691 ; CHECK-GI-NEXT: ushll v3.4s, v1.4h, #0
2692 ; CHECK-GI-NEXT: ushll2 v1.4s, v1.8h, #0
2693 ; CHECK-GI-NEXT: ushll v4.2d, v2.2s, #0
2694 ; CHECK-GI-NEXT: ushll v5.2d, v0.2s, #0
2695 ; CHECK-GI-NEXT: ushll v6.2d, v3.2s, #0
2696 ; CHECK-GI-NEXT: ushll v7.2d, v1.2s, #0
2697 ; CHECK-GI-NEXT: uaddw2 v2.2d, v4.2d, v2.4s
2698 ; CHECK-GI-NEXT: uaddw2 v0.2d, v5.2d, v0.4s
2699 ; CHECK-GI-NEXT: uaddw2 v3.2d, v6.2d, v3.4s
2700 ; CHECK-GI-NEXT: uaddw2 v1.2d, v7.2d, v1.4s
2701 ; CHECK-GI-NEXT: add v0.2d, v2.2d, v0.2d
2702 ; CHECK-GI-NEXT: add v1.2d, v3.2d, v1.2d
2703 ; CHECK-GI-NEXT: addp d0, v0.2d
2704 ; CHECK-GI-NEXT: addp d1, v1.2d
2705 ; CHECK-GI-NEXT: fmov x8, d0
2706 ; CHECK-GI-NEXT: fmov x9, d1
2707 ; CHECK-GI-NEXT: add x0, x8, x9
2708 ; CHECK-GI-NEXT: ret
2710 %xx = zext <8 x i16> %x to <8 x i64>
2711 %z1 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> %xx)
2712 %yy = zext <8 x i16> %y to <8 x i64>
2713 %z2 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> %yy)
2714 %z = add i64 %z1, %z2
2718 define i64 @add_pair_v8i16_v8i64_sext(<8 x i16> %x, <8 x i16> %y) {
2719 ; CHECK-BASE-LABEL: add_pair_v8i16_v8i64_sext:
2720 ; CHECK-BASE: // %bb.0: // %entry
2721 ; CHECK-BASE-NEXT: sshll2 v2.4s, v0.8h, #0
2722 ; CHECK-BASE-NEXT: sshll v0.4s, v0.4h, #0
2723 ; CHECK-BASE-NEXT: sshll2 v3.4s, v1.8h, #0
2724 ; CHECK-BASE-NEXT: sshll v1.4s, v1.4h, #0
2725 ; CHECK-BASE-NEXT: saddl2 v4.2d, v0.4s, v2.4s
2726 ; CHECK-BASE-NEXT: saddl v0.2d, v0.2s, v2.2s
2727 ; CHECK-BASE-NEXT: saddl2 v2.2d, v1.4s, v3.4s
2728 ; CHECK-BASE-NEXT: saddl v1.2d, v1.2s, v3.2s
2729 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v4.2d
2730 ; CHECK-BASE-NEXT: add v1.2d, v1.2d, v2.2d
2731 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v1.2d
2732 ; CHECK-BASE-NEXT: addp d0, v0.2d
2733 ; CHECK-BASE-NEXT: fmov x0, d0
2734 ; CHECK-BASE-NEXT: ret
2736 ; CHECK-DOT-LABEL: add_pair_v8i16_v8i64_sext:
2737 ; CHECK-DOT: // %bb.0: // %entry
2738 ; CHECK-DOT-NEXT: sshll2 v2.4s, v0.8h, #0
2739 ; CHECK-DOT-NEXT: sshll v0.4s, v0.4h, #0
2740 ; CHECK-DOT-NEXT: sshll2 v3.4s, v1.8h, #0
2741 ; CHECK-DOT-NEXT: sshll v1.4s, v1.4h, #0
2742 ; CHECK-DOT-NEXT: saddl2 v4.2d, v0.4s, v2.4s
2743 ; CHECK-DOT-NEXT: saddl v0.2d, v0.2s, v2.2s
2744 ; CHECK-DOT-NEXT: saddl2 v2.2d, v1.4s, v3.4s
2745 ; CHECK-DOT-NEXT: saddl v1.2d, v1.2s, v3.2s
2746 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v4.2d
2747 ; CHECK-DOT-NEXT: add v1.2d, v1.2d, v2.2d
2748 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v1.2d
2749 ; CHECK-DOT-NEXT: addp d0, v0.2d
2750 ; CHECK-DOT-NEXT: fmov x0, d0
2751 ; CHECK-DOT-NEXT: ret
2753 ; CHECK-GI-LABEL: add_pair_v8i16_v8i64_sext:
2754 ; CHECK-GI: // %bb.0: // %entry
2755 ; CHECK-GI-NEXT: sshll v2.4s, v0.4h, #0
2756 ; CHECK-GI-NEXT: sshll2 v0.4s, v0.8h, #0
2757 ; CHECK-GI-NEXT: sshll v3.4s, v1.4h, #0
2758 ; CHECK-GI-NEXT: sshll2 v1.4s, v1.8h, #0
2759 ; CHECK-GI-NEXT: sshll v4.2d, v2.2s, #0
2760 ; CHECK-GI-NEXT: sshll v5.2d, v0.2s, #0
2761 ; CHECK-GI-NEXT: sshll v6.2d, v3.2s, #0
2762 ; CHECK-GI-NEXT: sshll v7.2d, v1.2s, #0
2763 ; CHECK-GI-NEXT: saddw2 v2.2d, v4.2d, v2.4s
2764 ; CHECK-GI-NEXT: saddw2 v0.2d, v5.2d, v0.4s
2765 ; CHECK-GI-NEXT: saddw2 v3.2d, v6.2d, v3.4s
2766 ; CHECK-GI-NEXT: saddw2 v1.2d, v7.2d, v1.4s
2767 ; CHECK-GI-NEXT: add v0.2d, v2.2d, v0.2d
2768 ; CHECK-GI-NEXT: add v1.2d, v3.2d, v1.2d
2769 ; CHECK-GI-NEXT: addp d0, v0.2d
2770 ; CHECK-GI-NEXT: addp d1, v1.2d
2771 ; CHECK-GI-NEXT: fmov x8, d0
2772 ; CHECK-GI-NEXT: fmov x9, d1
2773 ; CHECK-GI-NEXT: add x0, x8, x9
2774 ; CHECK-GI-NEXT: ret
2776 %xx = sext <8 x i16> %x to <8 x i64>
2777 %z1 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> %xx)
2778 %yy = sext <8 x i16> %y to <8 x i64>
2779 %z2 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> %yy)
2780 %z = add i64 %z1, %z2
2784 define i64 @add_pair_v4i16_v4i64_zext(<4 x i16> %x, <4 x i16> %y) {
2785 ; CHECK-BASE-LABEL: add_pair_v4i16_v4i64_zext:
2786 ; CHECK-BASE: // %bb.0: // %entry
2787 ; CHECK-BASE-NEXT: ushll v1.4s, v1.4h, #0
2788 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
2789 ; CHECK-BASE-NEXT: uaddlp v1.2d, v1.4s
2790 ; CHECK-BASE-NEXT: uadalp v1.2d, v0.4s
2791 ; CHECK-BASE-NEXT: addp d0, v1.2d
2792 ; CHECK-BASE-NEXT: fmov x0, d0
2793 ; CHECK-BASE-NEXT: ret
2795 ; CHECK-DOT-LABEL: add_pair_v4i16_v4i64_zext:
2796 ; CHECK-DOT: // %bb.0: // %entry
2797 ; CHECK-DOT-NEXT: ushll v1.4s, v1.4h, #0
2798 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
2799 ; CHECK-DOT-NEXT: uaddlp v1.2d, v1.4s
2800 ; CHECK-DOT-NEXT: uadalp v1.2d, v0.4s
2801 ; CHECK-DOT-NEXT: addp d0, v1.2d
2802 ; CHECK-DOT-NEXT: fmov x0, d0
2803 ; CHECK-DOT-NEXT: ret
2805 ; CHECK-GI-LABEL: add_pair_v4i16_v4i64_zext:
2806 ; CHECK-GI: // %bb.0: // %entry
2807 ; CHECK-GI-NEXT: ushll v0.4s, v0.4h, #0
2808 ; CHECK-GI-NEXT: ushll v1.4s, v1.4h, #0
2809 ; CHECK-GI-NEXT: ushll v2.2d, v0.2s, #0
2810 ; CHECK-GI-NEXT: ushll v3.2d, v1.2s, #0
2811 ; CHECK-GI-NEXT: uaddw2 v0.2d, v2.2d, v0.4s
2812 ; CHECK-GI-NEXT: uaddw2 v1.2d, v3.2d, v1.4s
2813 ; CHECK-GI-NEXT: addp d0, v0.2d
2814 ; CHECK-GI-NEXT: addp d1, v1.2d
2815 ; CHECK-GI-NEXT: fmov x8, d0
2816 ; CHECK-GI-NEXT: fmov x9, d1
2817 ; CHECK-GI-NEXT: add x0, x8, x9
2818 ; CHECK-GI-NEXT: ret
2820 %xx = zext <4 x i16> %x to <4 x i64>
2821 %z1 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %xx)
2822 %yy = zext <4 x i16> %y to <4 x i64>
2823 %z2 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %yy)
2824 %z = add i64 %z1, %z2
2828 define i64 @add_pair_v4i16_v4i64_sext(<4 x i16> %x, <4 x i16> %y) {
2829 ; CHECK-BASE-LABEL: add_pair_v4i16_v4i64_sext:
2830 ; CHECK-BASE: // %bb.0: // %entry
2831 ; CHECK-BASE-NEXT: sshll v1.4s, v1.4h, #0
2832 ; CHECK-BASE-NEXT: sshll v0.4s, v0.4h, #0
2833 ; CHECK-BASE-NEXT: saddlp v1.2d, v1.4s
2834 ; CHECK-BASE-NEXT: sadalp v1.2d, v0.4s
2835 ; CHECK-BASE-NEXT: addp d0, v1.2d
2836 ; CHECK-BASE-NEXT: fmov x0, d0
2837 ; CHECK-BASE-NEXT: ret
2839 ; CHECK-DOT-LABEL: add_pair_v4i16_v4i64_sext:
2840 ; CHECK-DOT: // %bb.0: // %entry
2841 ; CHECK-DOT-NEXT: sshll v1.4s, v1.4h, #0
2842 ; CHECK-DOT-NEXT: sshll v0.4s, v0.4h, #0
2843 ; CHECK-DOT-NEXT: saddlp v1.2d, v1.4s
2844 ; CHECK-DOT-NEXT: sadalp v1.2d, v0.4s
2845 ; CHECK-DOT-NEXT: addp d0, v1.2d
2846 ; CHECK-DOT-NEXT: fmov x0, d0
2847 ; CHECK-DOT-NEXT: ret
2849 ; CHECK-GI-LABEL: add_pair_v4i16_v4i64_sext:
2850 ; CHECK-GI: // %bb.0: // %entry
2851 ; CHECK-GI-NEXT: sshll v0.4s, v0.4h, #0
2852 ; CHECK-GI-NEXT: sshll v1.4s, v1.4h, #0
2853 ; CHECK-GI-NEXT: sshll v2.2d, v0.2s, #0
2854 ; CHECK-GI-NEXT: sshll v3.2d, v1.2s, #0
2855 ; CHECK-GI-NEXT: saddw2 v0.2d, v2.2d, v0.4s
2856 ; CHECK-GI-NEXT: saddw2 v1.2d, v3.2d, v1.4s
2857 ; CHECK-GI-NEXT: addp d0, v0.2d
2858 ; CHECK-GI-NEXT: addp d1, v1.2d
2859 ; CHECK-GI-NEXT: fmov x8, d0
2860 ; CHECK-GI-NEXT: fmov x9, d1
2861 ; CHECK-GI-NEXT: add x0, x8, x9
2862 ; CHECK-GI-NEXT: ret
2864 %xx = sext <4 x i16> %x to <4 x i64>
2865 %z1 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %xx)
2866 %yy = sext <4 x i16> %y to <4 x i64>
2867 %z2 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %yy)
2868 %z = add i64 %z1, %z2
2872 define i64 @add_pair_v2i16_v2i64_zext(<2 x i16> %x, <2 x i16> %y) {
2873 ; CHECK-BASE-LABEL: add_pair_v2i16_v2i64_zext:
2874 ; CHECK-BASE: // %bb.0: // %entry
2875 ; CHECK-BASE-NEXT: movi d2, #0x00ffff0000ffff
2876 ; CHECK-BASE-NEXT: and v0.8b, v0.8b, v2.8b
2877 ; CHECK-BASE-NEXT: and v1.8b, v1.8b, v2.8b
2878 ; CHECK-BASE-NEXT: uaddl v0.2d, v0.2s, v1.2s
2879 ; CHECK-BASE-NEXT: addp d0, v0.2d
2880 ; CHECK-BASE-NEXT: fmov x0, d0
2881 ; CHECK-BASE-NEXT: ret
2883 ; CHECK-DOT-LABEL: add_pair_v2i16_v2i64_zext:
2884 ; CHECK-DOT: // %bb.0: // %entry
2885 ; CHECK-DOT-NEXT: movi d2, #0x00ffff0000ffff
2886 ; CHECK-DOT-NEXT: and v0.8b, v0.8b, v2.8b
2887 ; CHECK-DOT-NEXT: and v1.8b, v1.8b, v2.8b
2888 ; CHECK-DOT-NEXT: uaddl v0.2d, v0.2s, v1.2s
2889 ; CHECK-DOT-NEXT: addp d0, v0.2d
2890 ; CHECK-DOT-NEXT: fmov x0, d0
2891 ; CHECK-DOT-NEXT: ret
2893 ; CHECK-GI-LABEL: add_pair_v2i16_v2i64_zext:
2894 ; CHECK-GI: // %bb.0: // %entry
2895 ; CHECK-GI-NEXT: movi v2.2d, #0x0000000000ffff
2896 ; CHECK-GI-NEXT: ushll v0.2d, v0.2s, #0
2897 ; CHECK-GI-NEXT: ushll v1.2d, v1.2s, #0
2898 ; CHECK-GI-NEXT: and v0.16b, v0.16b, v2.16b
2899 ; CHECK-GI-NEXT: and v1.16b, v1.16b, v2.16b
2900 ; CHECK-GI-NEXT: addp d0, v0.2d
2901 ; CHECK-GI-NEXT: addp d1, v1.2d
2902 ; CHECK-GI-NEXT: fmov x8, d0
2903 ; CHECK-GI-NEXT: fmov x9, d1
2904 ; CHECK-GI-NEXT: add x0, x8, x9
2905 ; CHECK-GI-NEXT: ret
2907 %xx = zext <2 x i16> %x to <2 x i64>
2908 %z1 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %xx)
2909 %yy = zext <2 x i16> %y to <2 x i64>
2910 %z2 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %yy)
2911 %z = add i64 %z1, %z2
2915 define i64 @add_pair_v2i16_v2i64_sext(<2 x i16> %x, <2 x i16> %y) {
2916 ; CHECK-BASE-LABEL: add_pair_v2i16_v2i64_sext:
2917 ; CHECK-BASE: // %bb.0: // %entry
2918 ; CHECK-BASE-NEXT: ushll v0.2d, v0.2s, #0
2919 ; CHECK-BASE-NEXT: ushll v1.2d, v1.2s, #0
2920 ; CHECK-BASE-NEXT: shl v0.2d, v0.2d, #48
2921 ; CHECK-BASE-NEXT: shl v1.2d, v1.2d, #48
2922 ; CHECK-BASE-NEXT: sshr v0.2d, v0.2d, #48
2923 ; CHECK-BASE-NEXT: ssra v0.2d, v1.2d, #48
2924 ; CHECK-BASE-NEXT: addp d0, v0.2d
2925 ; CHECK-BASE-NEXT: fmov x0, d0
2926 ; CHECK-BASE-NEXT: ret
2928 ; CHECK-DOT-LABEL: add_pair_v2i16_v2i64_sext:
2929 ; CHECK-DOT: // %bb.0: // %entry
2930 ; CHECK-DOT-NEXT: ushll v0.2d, v0.2s, #0
2931 ; CHECK-DOT-NEXT: ushll v1.2d, v1.2s, #0
2932 ; CHECK-DOT-NEXT: shl v0.2d, v0.2d, #48
2933 ; CHECK-DOT-NEXT: shl v1.2d, v1.2d, #48
2934 ; CHECK-DOT-NEXT: sshr v0.2d, v0.2d, #48
2935 ; CHECK-DOT-NEXT: ssra v0.2d, v1.2d, #48
2936 ; CHECK-DOT-NEXT: addp d0, v0.2d
2937 ; CHECK-DOT-NEXT: fmov x0, d0
2938 ; CHECK-DOT-NEXT: ret
2940 ; CHECK-GI-LABEL: add_pair_v2i16_v2i64_sext:
2941 ; CHECK-GI: // %bb.0: // %entry
2942 ; CHECK-GI-NEXT: ushll v0.2d, v0.2s, #0
2943 ; CHECK-GI-NEXT: ushll v1.2d, v1.2s, #0
2944 ; CHECK-GI-NEXT: shl v0.2d, v0.2d, #48
2945 ; CHECK-GI-NEXT: shl v1.2d, v1.2d, #48
2946 ; CHECK-GI-NEXT: sshr v0.2d, v0.2d, #48
2947 ; CHECK-GI-NEXT: sshr v1.2d, v1.2d, #48
2948 ; CHECK-GI-NEXT: addp d0, v0.2d
2949 ; CHECK-GI-NEXT: addp d1, v1.2d
2950 ; CHECK-GI-NEXT: fmov x8, d0
2951 ; CHECK-GI-NEXT: fmov x9, d1
2952 ; CHECK-GI-NEXT: add x0, x8, x9
2953 ; CHECK-GI-NEXT: ret
2955 %xx = sext <2 x i16> %x to <2 x i64>
2956 %z1 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %xx)
2957 %yy = sext <2 x i16> %y to <2 x i64>
2958 %z2 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %yy)
2959 %z = add i64 %z1, %z2
2963 define i32 @add_pair_v16i8_v16i32_zext(<16 x i8> %x, <16 x i8> %y) {
2964 ; CHECK-BASE-LABEL: add_pair_v16i8_v16i32_zext:
2965 ; CHECK-BASE: // %bb.0: // %entry
2966 ; CHECK-BASE-NEXT: ushll2 v2.8h, v0.16b, #0
2967 ; CHECK-BASE-NEXT: ushll v0.8h, v0.8b, #0
2968 ; CHECK-BASE-NEXT: ushll2 v3.8h, v1.16b, #0
2969 ; CHECK-BASE-NEXT: ushll v1.8h, v1.8b, #0
2970 ; CHECK-BASE-NEXT: uaddl2 v4.4s, v0.8h, v2.8h
2971 ; CHECK-BASE-NEXT: uaddl v0.4s, v0.4h, v2.4h
2972 ; CHECK-BASE-NEXT: uaddl2 v2.4s, v1.8h, v3.8h
2973 ; CHECK-BASE-NEXT: uaddl v1.4s, v1.4h, v3.4h
2974 ; CHECK-BASE-NEXT: add v0.4s, v0.4s, v4.4s
2975 ; CHECK-BASE-NEXT: add v1.4s, v1.4s, v2.4s
2976 ; CHECK-BASE-NEXT: add v0.4s, v0.4s, v1.4s
2977 ; CHECK-BASE-NEXT: addv s0, v0.4s
2978 ; CHECK-BASE-NEXT: fmov w0, s0
2979 ; CHECK-BASE-NEXT: ret
2981 ; CHECK-DOT-LABEL: add_pair_v16i8_v16i32_zext:
2982 ; CHECK-DOT: // %bb.0: // %entry
2983 ; CHECK-DOT-NEXT: movi v2.16b, #1
2984 ; CHECK-DOT-NEXT: movi v3.2d, #0000000000000000
2985 ; CHECK-DOT-NEXT: udot v3.4s, v1.16b, v2.16b
2986 ; CHECK-DOT-NEXT: udot v3.4s, v0.16b, v2.16b
2987 ; CHECK-DOT-NEXT: addv s0, v3.4s
2988 ; CHECK-DOT-NEXT: fmov w0, s0
2989 ; CHECK-DOT-NEXT: ret
2991 ; CHECK-GI-LABEL: add_pair_v16i8_v16i32_zext:
2992 ; CHECK-GI: // %bb.0: // %entry
2993 ; CHECK-GI-NEXT: ushll v2.8h, v0.8b, #0
2994 ; CHECK-GI-NEXT: ushll2 v0.8h, v0.16b, #0
2995 ; CHECK-GI-NEXT: ushll v3.8h, v1.8b, #0
2996 ; CHECK-GI-NEXT: ushll2 v1.8h, v1.16b, #0
2997 ; CHECK-GI-NEXT: ushll v4.4s, v2.4h, #0
2998 ; CHECK-GI-NEXT: ushll v5.4s, v0.4h, #0
2999 ; CHECK-GI-NEXT: ushll v6.4s, v3.4h, #0
3000 ; CHECK-GI-NEXT: ushll v7.4s, v1.4h, #0
3001 ; CHECK-GI-NEXT: uaddw2 v2.4s, v4.4s, v2.8h
3002 ; CHECK-GI-NEXT: uaddw2 v0.4s, v5.4s, v0.8h
3003 ; CHECK-GI-NEXT: uaddw2 v3.4s, v6.4s, v3.8h
3004 ; CHECK-GI-NEXT: uaddw2 v1.4s, v7.4s, v1.8h
3005 ; CHECK-GI-NEXT: add v0.4s, v2.4s, v0.4s
3006 ; CHECK-GI-NEXT: add v1.4s, v3.4s, v1.4s
3007 ; CHECK-GI-NEXT: addv s0, v0.4s
3008 ; CHECK-GI-NEXT: addv s1, v1.4s
3009 ; CHECK-GI-NEXT: fmov w8, s0
3010 ; CHECK-GI-NEXT: fmov w9, s1
3011 ; CHECK-GI-NEXT: add w0, w8, w9
3012 ; CHECK-GI-NEXT: ret
3014 %xx = zext <16 x i8> %x to <16 x i32>
3015 %z1 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> %xx)
3016 %yy = zext <16 x i8> %y to <16 x i32>
3017 %z2 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> %yy)
3018 %z = add i32 %z1, %z2
3022 define i32 @add_pair_v16i8_v16i32_sext(<16 x i8> %x, <16 x i8> %y) {
3023 ; CHECK-BASE-LABEL: add_pair_v16i8_v16i32_sext:
3024 ; CHECK-BASE: // %bb.0: // %entry
3025 ; CHECK-BASE-NEXT: sshll2 v2.8h, v0.16b, #0
3026 ; CHECK-BASE-NEXT: sshll v0.8h, v0.8b, #0
3027 ; CHECK-BASE-NEXT: sshll2 v3.8h, v1.16b, #0
3028 ; CHECK-BASE-NEXT: sshll v1.8h, v1.8b, #0
3029 ; CHECK-BASE-NEXT: saddl2 v4.4s, v0.8h, v2.8h
3030 ; CHECK-BASE-NEXT: saddl v0.4s, v0.4h, v2.4h
3031 ; CHECK-BASE-NEXT: saddl2 v2.4s, v1.8h, v3.8h
3032 ; CHECK-BASE-NEXT: saddl v1.4s, v1.4h, v3.4h
3033 ; CHECK-BASE-NEXT: add v0.4s, v0.4s, v4.4s
3034 ; CHECK-BASE-NEXT: add v1.4s, v1.4s, v2.4s
3035 ; CHECK-BASE-NEXT: add v0.4s, v0.4s, v1.4s
3036 ; CHECK-BASE-NEXT: addv s0, v0.4s
3037 ; CHECK-BASE-NEXT: fmov w0, s0
3038 ; CHECK-BASE-NEXT: ret
3040 ; CHECK-DOT-LABEL: add_pair_v16i8_v16i32_sext:
3041 ; CHECK-DOT: // %bb.0: // %entry
3042 ; CHECK-DOT-NEXT: movi v2.16b, #1
3043 ; CHECK-DOT-NEXT: movi v3.2d, #0000000000000000
3044 ; CHECK-DOT-NEXT: sdot v3.4s, v1.16b, v2.16b
3045 ; CHECK-DOT-NEXT: sdot v3.4s, v0.16b, v2.16b
3046 ; CHECK-DOT-NEXT: addv s0, v3.4s
3047 ; CHECK-DOT-NEXT: fmov w0, s0
3048 ; CHECK-DOT-NEXT: ret
3050 ; CHECK-GI-LABEL: add_pair_v16i8_v16i32_sext:
3051 ; CHECK-GI: // %bb.0: // %entry
3052 ; CHECK-GI-NEXT: sshll v2.8h, v0.8b, #0
3053 ; CHECK-GI-NEXT: sshll2 v0.8h, v0.16b, #0
3054 ; CHECK-GI-NEXT: sshll v3.8h, v1.8b, #0
3055 ; CHECK-GI-NEXT: sshll2 v1.8h, v1.16b, #0
3056 ; CHECK-GI-NEXT: sshll v4.4s, v2.4h, #0
3057 ; CHECK-GI-NEXT: sshll v5.4s, v0.4h, #0
3058 ; CHECK-GI-NEXT: sshll v6.4s, v3.4h, #0
3059 ; CHECK-GI-NEXT: sshll v7.4s, v1.4h, #0
3060 ; CHECK-GI-NEXT: saddw2 v2.4s, v4.4s, v2.8h
3061 ; CHECK-GI-NEXT: saddw2 v0.4s, v5.4s, v0.8h
3062 ; CHECK-GI-NEXT: saddw2 v3.4s, v6.4s, v3.8h
3063 ; CHECK-GI-NEXT: saddw2 v1.4s, v7.4s, v1.8h
3064 ; CHECK-GI-NEXT: add v0.4s, v2.4s, v0.4s
3065 ; CHECK-GI-NEXT: add v1.4s, v3.4s, v1.4s
3066 ; CHECK-GI-NEXT: addv s0, v0.4s
3067 ; CHECK-GI-NEXT: addv s1, v1.4s
3068 ; CHECK-GI-NEXT: fmov w8, s0
3069 ; CHECK-GI-NEXT: fmov w9, s1
3070 ; CHECK-GI-NEXT: add w0, w8, w9
3071 ; CHECK-GI-NEXT: ret
3073 %xx = sext <16 x i8> %x to <16 x i32>
3074 %z1 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> %xx)
3075 %yy = sext <16 x i8> %y to <16 x i32>
3076 %z2 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> %yy)
3077 %z = add i32 %z1, %z2
3081 define i32 @add_pair_v8i8_v8i32_zext(<8 x i8> %x, <8 x i8> %y) {
3082 ; CHECK-BASE-LABEL: add_pair_v8i8_v8i32_zext:
3083 ; CHECK-BASE: // %bb.0: // %entry
3084 ; CHECK-BASE-NEXT: ushll v1.8h, v1.8b, #0
3085 ; CHECK-BASE-NEXT: ushll v0.8h, v0.8b, #0
3086 ; CHECK-BASE-NEXT: uaddlp v1.4s, v1.8h
3087 ; CHECK-BASE-NEXT: uadalp v1.4s, v0.8h
3088 ; CHECK-BASE-NEXT: addv s0, v1.4s
3089 ; CHECK-BASE-NEXT: fmov w0, s0
3090 ; CHECK-BASE-NEXT: ret
3092 ; CHECK-DOT-LABEL: add_pair_v8i8_v8i32_zext:
3093 ; CHECK-DOT: // %bb.0: // %entry
3094 ; CHECK-DOT-NEXT: movi v2.2d, #0000000000000000
3095 ; CHECK-DOT-NEXT: movi v3.8b, #1
3096 ; CHECK-DOT-NEXT: udot v2.2s, v1.8b, v3.8b
3097 ; CHECK-DOT-NEXT: udot v2.2s, v0.8b, v3.8b
3098 ; CHECK-DOT-NEXT: addp v0.2s, v2.2s, v2.2s
3099 ; CHECK-DOT-NEXT: fmov w0, s0
3100 ; CHECK-DOT-NEXT: ret
3102 ; CHECK-GI-LABEL: add_pair_v8i8_v8i32_zext:
3103 ; CHECK-GI: // %bb.0: // %entry
3104 ; CHECK-GI-NEXT: ushll v0.8h, v0.8b, #0
3105 ; CHECK-GI-NEXT: ushll v1.8h, v1.8b, #0
3106 ; CHECK-GI-NEXT: ushll v2.4s, v0.4h, #0
3107 ; CHECK-GI-NEXT: ushll v3.4s, v1.4h, #0
3108 ; CHECK-GI-NEXT: uaddw2 v0.4s, v2.4s, v0.8h
3109 ; CHECK-GI-NEXT: uaddw2 v1.4s, v3.4s, v1.8h
3110 ; CHECK-GI-NEXT: addv s0, v0.4s
3111 ; CHECK-GI-NEXT: addv s1, v1.4s
3112 ; CHECK-GI-NEXT: fmov w8, s0
3113 ; CHECK-GI-NEXT: fmov w9, s1
3114 ; CHECK-GI-NEXT: add w0, w8, w9
3115 ; CHECK-GI-NEXT: ret
3117 %xx = zext <8 x i8> %x to <8 x i32>
3118 %z1 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %xx)
3119 %yy = zext <8 x i8> %y to <8 x i32>
3120 %z2 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %yy)
3121 %z = add i32 %z1, %z2
3125 define i32 @add_pair_v8i8_v8i32_sext(<8 x i8> %x, <8 x i8> %y) {
3126 ; CHECK-BASE-LABEL: add_pair_v8i8_v8i32_sext:
3127 ; CHECK-BASE: // %bb.0: // %entry
3128 ; CHECK-BASE-NEXT: sshll v1.8h, v1.8b, #0
3129 ; CHECK-BASE-NEXT: sshll v0.8h, v0.8b, #0
3130 ; CHECK-BASE-NEXT: saddlp v1.4s, v1.8h
3131 ; CHECK-BASE-NEXT: sadalp v1.4s, v0.8h
3132 ; CHECK-BASE-NEXT: addv s0, v1.4s
3133 ; CHECK-BASE-NEXT: fmov w0, s0
3134 ; CHECK-BASE-NEXT: ret
3136 ; CHECK-DOT-LABEL: add_pair_v8i8_v8i32_sext:
3137 ; CHECK-DOT: // %bb.0: // %entry
3138 ; CHECK-DOT-NEXT: movi v2.2d, #0000000000000000
3139 ; CHECK-DOT-NEXT: movi v3.8b, #1
3140 ; CHECK-DOT-NEXT: sdot v2.2s, v1.8b, v3.8b
3141 ; CHECK-DOT-NEXT: sdot v2.2s, v0.8b, v3.8b
3142 ; CHECK-DOT-NEXT: addp v0.2s, v2.2s, v2.2s
3143 ; CHECK-DOT-NEXT: fmov w0, s0
3144 ; CHECK-DOT-NEXT: ret
3146 ; CHECK-GI-LABEL: add_pair_v8i8_v8i32_sext:
3147 ; CHECK-GI: // %bb.0: // %entry
3148 ; CHECK-GI-NEXT: sshll v0.8h, v0.8b, #0
3149 ; CHECK-GI-NEXT: sshll v1.8h, v1.8b, #0
3150 ; CHECK-GI-NEXT: sshll v2.4s, v0.4h, #0
3151 ; CHECK-GI-NEXT: sshll v3.4s, v1.4h, #0
3152 ; CHECK-GI-NEXT: saddw2 v0.4s, v2.4s, v0.8h
3153 ; CHECK-GI-NEXT: saddw2 v1.4s, v3.4s, v1.8h
3154 ; CHECK-GI-NEXT: addv s0, v0.4s
3155 ; CHECK-GI-NEXT: addv s1, v1.4s
3156 ; CHECK-GI-NEXT: fmov w8, s0
3157 ; CHECK-GI-NEXT: fmov w9, s1
3158 ; CHECK-GI-NEXT: add w0, w8, w9
3159 ; CHECK-GI-NEXT: ret
3161 %xx = sext <8 x i8> %x to <8 x i32>
3162 %z1 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %xx)
3163 %yy = sext <8 x i8> %y to <8 x i32>
3164 %z2 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %yy)
3165 %z = add i32 %z1, %z2
3169 define i32 @add_pair_v4i8_v4i32_zext(<4 x i8> %x, <4 x i8> %y) {
3170 ; CHECK-BASE-LABEL: add_pair_v4i8_v4i32_zext:
3171 ; CHECK-BASE: // %bb.0: // %entry
3172 ; CHECK-BASE-NEXT: bic v0.4h, #255, lsl #8
3173 ; CHECK-BASE-NEXT: bic v1.4h, #255, lsl #8
3174 ; CHECK-BASE-NEXT: uaddl v0.4s, v0.4h, v1.4h
3175 ; CHECK-BASE-NEXT: addv s0, v0.4s
3176 ; CHECK-BASE-NEXT: fmov w0, s0
3177 ; CHECK-BASE-NEXT: ret
3179 ; CHECK-DOT-LABEL: add_pair_v4i8_v4i32_zext:
3180 ; CHECK-DOT: // %bb.0: // %entry
3181 ; CHECK-DOT-NEXT: bic v0.4h, #255, lsl #8
3182 ; CHECK-DOT-NEXT: bic v1.4h, #255, lsl #8
3183 ; CHECK-DOT-NEXT: uaddl v0.4s, v0.4h, v1.4h
3184 ; CHECK-DOT-NEXT: addv s0, v0.4s
3185 ; CHECK-DOT-NEXT: fmov w0, s0
3186 ; CHECK-DOT-NEXT: ret
3188 ; CHECK-GI-LABEL: add_pair_v4i8_v4i32_zext:
3189 ; CHECK-GI: // %bb.0: // %entry
3190 ; CHECK-GI-NEXT: movi v2.2d, #0x0000ff000000ff
3191 ; CHECK-GI-NEXT: ushll v0.4s, v0.4h, #0
3192 ; CHECK-GI-NEXT: ushll v1.4s, v1.4h, #0
3193 ; CHECK-GI-NEXT: and v0.16b, v0.16b, v2.16b
3194 ; CHECK-GI-NEXT: and v1.16b, v1.16b, v2.16b
3195 ; CHECK-GI-NEXT: addv s0, v0.4s
3196 ; CHECK-GI-NEXT: addv s1, v1.4s
3197 ; CHECK-GI-NEXT: fmov w8, s0
3198 ; CHECK-GI-NEXT: fmov w9, s1
3199 ; CHECK-GI-NEXT: add w0, w8, w9
3200 ; CHECK-GI-NEXT: ret
3202 %xx = zext <4 x i8> %x to <4 x i32>
3203 %z1 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %xx)
3204 %yy = zext <4 x i8> %y to <4 x i32>
3205 %z2 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %yy)
3206 %z = add i32 %z1, %z2
3210 define i32 @add_pair_v4i8_v4i32_sext(<4 x i8> %x, <4 x i8> %y) {
3211 ; CHECK-BASE-LABEL: add_pair_v4i8_v4i32_sext:
3212 ; CHECK-BASE: // %bb.0: // %entry
3213 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
3214 ; CHECK-BASE-NEXT: ushll v1.4s, v1.4h, #0
3215 ; CHECK-BASE-NEXT: shl v0.4s, v0.4s, #24
3216 ; CHECK-BASE-NEXT: shl v1.4s, v1.4s, #24
3217 ; CHECK-BASE-NEXT: sshr v0.4s, v0.4s, #24
3218 ; CHECK-BASE-NEXT: ssra v0.4s, v1.4s, #24
3219 ; CHECK-BASE-NEXT: addv s0, v0.4s
3220 ; CHECK-BASE-NEXT: fmov w0, s0
3221 ; CHECK-BASE-NEXT: ret
3223 ; CHECK-DOT-LABEL: add_pair_v4i8_v4i32_sext:
3224 ; CHECK-DOT: // %bb.0: // %entry
3225 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
3226 ; CHECK-DOT-NEXT: ushll v1.4s, v1.4h, #0
3227 ; CHECK-DOT-NEXT: shl v0.4s, v0.4s, #24
3228 ; CHECK-DOT-NEXT: shl v1.4s, v1.4s, #24
3229 ; CHECK-DOT-NEXT: sshr v0.4s, v0.4s, #24
3230 ; CHECK-DOT-NEXT: ssra v0.4s, v1.4s, #24
3231 ; CHECK-DOT-NEXT: addv s0, v0.4s
3232 ; CHECK-DOT-NEXT: fmov w0, s0
3233 ; CHECK-DOT-NEXT: ret
3235 ; CHECK-GI-LABEL: add_pair_v4i8_v4i32_sext:
3236 ; CHECK-GI: // %bb.0: // %entry
3237 ; CHECK-GI-NEXT: ushll v0.4s, v0.4h, #0
3238 ; CHECK-GI-NEXT: ushll v1.4s, v1.4h, #0
3239 ; CHECK-GI-NEXT: shl v0.4s, v0.4s, #24
3240 ; CHECK-GI-NEXT: shl v1.4s, v1.4s, #24
3241 ; CHECK-GI-NEXT: sshr v0.4s, v0.4s, #24
3242 ; CHECK-GI-NEXT: sshr v1.4s, v1.4s, #24
3243 ; CHECK-GI-NEXT: addv s0, v0.4s
3244 ; CHECK-GI-NEXT: addv s1, v1.4s
3245 ; CHECK-GI-NEXT: fmov w8, s0
3246 ; CHECK-GI-NEXT: fmov w9, s1
3247 ; CHECK-GI-NEXT: add w0, w8, w9
3248 ; CHECK-GI-NEXT: ret
3250 %xx = sext <4 x i8> %x to <4 x i32>
3251 %z1 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %xx)
3252 %yy = sext <4 x i8> %y to <4 x i32>
3253 %z2 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %yy)
3254 %z = add i32 %z1, %z2
3258 define zeroext i16 @add_pair_v16i8_v16i16_zext(<16 x i8> %x, <16 x i8> %y) {
3259 ; CHECK-BASE-LABEL: add_pair_v16i8_v16i16_zext:
3260 ; CHECK-BASE: // %bb.0: // %entry
3261 ; CHECK-BASE-NEXT: uaddlp v1.8h, v1.16b
3262 ; CHECK-BASE-NEXT: uadalp v1.8h, v0.16b
3263 ; CHECK-BASE-NEXT: addv h0, v1.8h
3264 ; CHECK-BASE-NEXT: fmov w0, s0
3265 ; CHECK-BASE-NEXT: ret
3267 ; CHECK-DOT-LABEL: add_pair_v16i8_v16i16_zext:
3268 ; CHECK-DOT: // %bb.0: // %entry
3269 ; CHECK-DOT-NEXT: uaddlp v1.8h, v1.16b
3270 ; CHECK-DOT-NEXT: uadalp v1.8h, v0.16b
3271 ; CHECK-DOT-NEXT: addv h0, v1.8h
3272 ; CHECK-DOT-NEXT: fmov w0, s0
3273 ; CHECK-DOT-NEXT: ret
3275 ; CHECK-GI-LABEL: add_pair_v16i8_v16i16_zext:
3276 ; CHECK-GI: // %bb.0: // %entry
3277 ; CHECK-GI-NEXT: ushll v2.8h, v0.8b, #0
3278 ; CHECK-GI-NEXT: ushll v3.8h, v1.8b, #0
3279 ; CHECK-GI-NEXT: uaddw2 v0.8h, v2.8h, v0.16b
3280 ; CHECK-GI-NEXT: uaddw2 v1.8h, v3.8h, v1.16b
3281 ; CHECK-GI-NEXT: addv h0, v0.8h
3282 ; CHECK-GI-NEXT: addv h1, v1.8h
3283 ; CHECK-GI-NEXT: fmov w8, s0
3284 ; CHECK-GI-NEXT: fmov w9, s1
3285 ; CHECK-GI-NEXT: add w8, w9, w8, uxth
3286 ; CHECK-GI-NEXT: and w0, w8, #0xffff
3287 ; CHECK-GI-NEXT: ret
3289 %xx = zext <16 x i8> %x to <16 x i16>
3290 %z1 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> %xx)
3291 %yy = zext <16 x i8> %y to <16 x i16>
3292 %z2 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> %yy)
3293 %z = add i16 %z1, %z2
3297 define signext i16 @add_pair_v16i8_v16i16_sext(<16 x i8> %x, <16 x i8> %y) {
3298 ; CHECK-BASE-LABEL: add_pair_v16i8_v16i16_sext:
3299 ; CHECK-BASE: // %bb.0: // %entry
3300 ; CHECK-BASE-NEXT: saddlp v1.8h, v1.16b
3301 ; CHECK-BASE-NEXT: sadalp v1.8h, v0.16b
3302 ; CHECK-BASE-NEXT: addv h0, v1.8h
3303 ; CHECK-BASE-NEXT: smov w0, v0.h[0]
3304 ; CHECK-BASE-NEXT: ret
3306 ; CHECK-DOT-LABEL: add_pair_v16i8_v16i16_sext:
3307 ; CHECK-DOT: // %bb.0: // %entry
3308 ; CHECK-DOT-NEXT: saddlp v1.8h, v1.16b
3309 ; CHECK-DOT-NEXT: sadalp v1.8h, v0.16b
3310 ; CHECK-DOT-NEXT: addv h0, v1.8h
3311 ; CHECK-DOT-NEXT: smov w0, v0.h[0]
3312 ; CHECK-DOT-NEXT: ret
3314 ; CHECK-GI-LABEL: add_pair_v16i8_v16i16_sext:
3315 ; CHECK-GI: // %bb.0: // %entry
3316 ; CHECK-GI-NEXT: sshll v2.8h, v0.8b, #0
3317 ; CHECK-GI-NEXT: sshll v3.8h, v1.8b, #0
3318 ; CHECK-GI-NEXT: saddw2 v0.8h, v2.8h, v0.16b
3319 ; CHECK-GI-NEXT: saddw2 v1.8h, v3.8h, v1.16b
3320 ; CHECK-GI-NEXT: addv h0, v0.8h
3321 ; CHECK-GI-NEXT: addv h1, v1.8h
3322 ; CHECK-GI-NEXT: fmov w8, s0
3323 ; CHECK-GI-NEXT: fmov w9, s1
3324 ; CHECK-GI-NEXT: add w8, w9, w8, uxth
3325 ; CHECK-GI-NEXT: sxth w0, w8
3326 ; CHECK-GI-NEXT: ret
3328 %xx = sext <16 x i8> %x to <16 x i16>
3329 %z1 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> %xx)
3330 %yy = sext <16 x i8> %y to <16 x i16>
3331 %z2 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> %yy)
3332 %z = add i16 %z1, %z2
3336 define zeroext i16 @add_pair_v8i8_v8i16_zext(<8 x i8> %x, <8 x i8> %y) {
3337 ; CHECK-BASE-LABEL: add_pair_v8i8_v8i16_zext:
3338 ; CHECK-BASE: // %bb.0: // %entry
3339 ; CHECK-BASE-NEXT: uaddl v0.8h, v0.8b, v1.8b
3340 ; CHECK-BASE-NEXT: addv h0, v0.8h
3341 ; CHECK-BASE-NEXT: fmov w0, s0
3342 ; CHECK-BASE-NEXT: ret
3344 ; CHECK-DOT-LABEL: add_pair_v8i8_v8i16_zext:
3345 ; CHECK-DOT: // %bb.0: // %entry
3346 ; CHECK-DOT-NEXT: uaddl v0.8h, v0.8b, v1.8b
3347 ; CHECK-DOT-NEXT: addv h0, v0.8h
3348 ; CHECK-DOT-NEXT: fmov w0, s0
3349 ; CHECK-DOT-NEXT: ret
3351 ; CHECK-GI-LABEL: add_pair_v8i8_v8i16_zext:
3352 ; CHECK-GI: // %bb.0: // %entry
3353 ; CHECK-GI-NEXT: ushll v0.8h, v0.8b, #0
3354 ; CHECK-GI-NEXT: ushll v1.8h, v1.8b, #0
3355 ; CHECK-GI-NEXT: addv h0, v0.8h
3356 ; CHECK-GI-NEXT: addv h1, v1.8h
3357 ; CHECK-GI-NEXT: fmov w8, s0
3358 ; CHECK-GI-NEXT: fmov w9, s1
3359 ; CHECK-GI-NEXT: add w8, w9, w8, uxth
3360 ; CHECK-GI-NEXT: and w0, w8, #0xffff
3361 ; CHECK-GI-NEXT: ret
3363 %xx = zext <8 x i8> %x to <8 x i16>
3364 %z1 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> %xx)
3365 %yy = zext <8 x i8> %y to <8 x i16>
3366 %z2 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> %yy)
3367 %z = add i16 %z1, %z2
3371 define signext i16 @add_pair_v8i8_v8i16_sext(<8 x i8> %x, <8 x i8> %y) {
3372 ; CHECK-BASE-LABEL: add_pair_v8i8_v8i16_sext:
3373 ; CHECK-BASE: // %bb.0: // %entry
3374 ; CHECK-BASE-NEXT: saddl v0.8h, v0.8b, v1.8b
3375 ; CHECK-BASE-NEXT: addv h0, v0.8h
3376 ; CHECK-BASE-NEXT: smov w0, v0.h[0]
3377 ; CHECK-BASE-NEXT: ret
3379 ; CHECK-DOT-LABEL: add_pair_v8i8_v8i16_sext:
3380 ; CHECK-DOT: // %bb.0: // %entry
3381 ; CHECK-DOT-NEXT: saddl v0.8h, v0.8b, v1.8b
3382 ; CHECK-DOT-NEXT: addv h0, v0.8h
3383 ; CHECK-DOT-NEXT: smov w0, v0.h[0]
3384 ; CHECK-DOT-NEXT: ret
3386 ; CHECK-GI-LABEL: add_pair_v8i8_v8i16_sext:
3387 ; CHECK-GI: // %bb.0: // %entry
3388 ; CHECK-GI-NEXT: sshll v0.8h, v0.8b, #0
3389 ; CHECK-GI-NEXT: sshll v1.8h, v1.8b, #0
3390 ; CHECK-GI-NEXT: addv h0, v0.8h
3391 ; CHECK-GI-NEXT: addv h1, v1.8h
3392 ; CHECK-GI-NEXT: fmov w8, s0
3393 ; CHECK-GI-NEXT: fmov w9, s1
3394 ; CHECK-GI-NEXT: add w8, w9, w8, uxth
3395 ; CHECK-GI-NEXT: sxth w0, w8
3396 ; CHECK-GI-NEXT: ret
3398 %xx = sext <8 x i8> %x to <8 x i16>
3399 %z1 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> %xx)
3400 %yy = sext <8 x i8> %y to <8 x i16>
3401 %z2 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> %yy)
3402 %z = add i16 %z1, %z2
3406 define zeroext i8 @add_pair_v16i8_v16i8(<16 x i8> %x, <16 x i8> %y) {
3407 ; CHECK-BASE-LABEL: add_pair_v16i8_v16i8:
3408 ; CHECK-BASE: // %bb.0: // %entry
3409 ; CHECK-BASE-NEXT: add v0.16b, v0.16b, v1.16b
3410 ; CHECK-BASE-NEXT: addv b0, v0.16b
3411 ; CHECK-BASE-NEXT: fmov w0, s0
3412 ; CHECK-BASE-NEXT: ret
3414 ; CHECK-DOT-LABEL: add_pair_v16i8_v16i8:
3415 ; CHECK-DOT: // %bb.0: // %entry
3416 ; CHECK-DOT-NEXT: add v0.16b, v0.16b, v1.16b
3417 ; CHECK-DOT-NEXT: addv b0, v0.16b
3418 ; CHECK-DOT-NEXT: fmov w0, s0
3419 ; CHECK-DOT-NEXT: ret
3421 ; CHECK-GI-LABEL: add_pair_v16i8_v16i8:
3422 ; CHECK-GI: // %bb.0: // %entry
3423 ; CHECK-GI-NEXT: addv b0, v0.16b
3424 ; CHECK-GI-NEXT: addv b1, v1.16b
3425 ; CHECK-GI-NEXT: fmov w8, s0
3426 ; CHECK-GI-NEXT: fmov w9, s1
3427 ; CHECK-GI-NEXT: add w8, w9, w8, uxtb
3428 ; CHECK-GI-NEXT: and w0, w8, #0xff
3429 ; CHECK-GI-NEXT: ret
3431 %z1 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> %x)
3432 %z2 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> %y)
3433 %z = add i8 %z1, %z2
3437 define i64 @add_pair_v16i8_v16i64_zext(<16 x i8> %x, <16 x i8> %y) {
3438 ; CHECK-BASE-LABEL: add_pair_v16i8_v16i64_zext:
3439 ; CHECK-BASE: // %bb.0: // %entry
3440 ; CHECK-BASE-NEXT: ushll2 v2.8h, v0.16b, #0
3441 ; CHECK-BASE-NEXT: ushll v0.8h, v0.8b, #0
3442 ; CHECK-BASE-NEXT: ushll2 v3.8h, v1.16b, #0
3443 ; CHECK-BASE-NEXT: ushll v1.8h, v1.8b, #0
3444 ; CHECK-BASE-NEXT: ushll v4.4s, v2.4h, #0
3445 ; CHECK-BASE-NEXT: ushll2 v2.4s, v2.8h, #0
3446 ; CHECK-BASE-NEXT: ushll2 v5.4s, v0.8h, #0
3447 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
3448 ; CHECK-BASE-NEXT: ushll2 v6.4s, v3.8h, #0
3449 ; CHECK-BASE-NEXT: ushll2 v7.4s, v1.8h, #0
3450 ; CHECK-BASE-NEXT: ushll v3.4s, v3.4h, #0
3451 ; CHECK-BASE-NEXT: ushll v1.4s, v1.4h, #0
3452 ; CHECK-BASE-NEXT: uaddl2 v16.2d, v5.4s, v2.4s
3453 ; CHECK-BASE-NEXT: uaddl v2.2d, v5.2s, v2.2s
3454 ; CHECK-BASE-NEXT: uaddl2 v5.2d, v0.4s, v4.4s
3455 ; CHECK-BASE-NEXT: uaddl v0.2d, v0.2s, v4.2s
3456 ; CHECK-BASE-NEXT: uaddl2 v4.2d, v7.4s, v6.4s
3457 ; CHECK-BASE-NEXT: uaddl v6.2d, v7.2s, v6.2s
3458 ; CHECK-BASE-NEXT: uaddl2 v7.2d, v1.4s, v3.4s
3459 ; CHECK-BASE-NEXT: uaddl v1.2d, v1.2s, v3.2s
3460 ; CHECK-BASE-NEXT: add v3.2d, v5.2d, v16.2d
3461 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v2.2d
3462 ; CHECK-BASE-NEXT: add v2.2d, v7.2d, v4.2d
3463 ; CHECK-BASE-NEXT: add v1.2d, v1.2d, v6.2d
3464 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v3.2d
3465 ; CHECK-BASE-NEXT: add v1.2d, v1.2d, v2.2d
3466 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v1.2d
3467 ; CHECK-BASE-NEXT: addp d0, v0.2d
3468 ; CHECK-BASE-NEXT: fmov x0, d0
3469 ; CHECK-BASE-NEXT: ret
3471 ; CHECK-DOT-LABEL: add_pair_v16i8_v16i64_zext:
3472 ; CHECK-DOT: // %bb.0: // %entry
3473 ; CHECK-DOT-NEXT: ushll2 v2.8h, v0.16b, #0
3474 ; CHECK-DOT-NEXT: ushll v0.8h, v0.8b, #0
3475 ; CHECK-DOT-NEXT: ushll2 v3.8h, v1.16b, #0
3476 ; CHECK-DOT-NEXT: ushll v1.8h, v1.8b, #0
3477 ; CHECK-DOT-NEXT: ushll v4.4s, v2.4h, #0
3478 ; CHECK-DOT-NEXT: ushll2 v2.4s, v2.8h, #0
3479 ; CHECK-DOT-NEXT: ushll2 v5.4s, v0.8h, #0
3480 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
3481 ; CHECK-DOT-NEXT: ushll2 v6.4s, v3.8h, #0
3482 ; CHECK-DOT-NEXT: ushll2 v7.4s, v1.8h, #0
3483 ; CHECK-DOT-NEXT: ushll v3.4s, v3.4h, #0
3484 ; CHECK-DOT-NEXT: ushll v1.4s, v1.4h, #0
3485 ; CHECK-DOT-NEXT: uaddl2 v16.2d, v5.4s, v2.4s
3486 ; CHECK-DOT-NEXT: uaddl v2.2d, v5.2s, v2.2s
3487 ; CHECK-DOT-NEXT: uaddl2 v5.2d, v0.4s, v4.4s
3488 ; CHECK-DOT-NEXT: uaddl v0.2d, v0.2s, v4.2s
3489 ; CHECK-DOT-NEXT: uaddl2 v4.2d, v7.4s, v6.4s
3490 ; CHECK-DOT-NEXT: uaddl v6.2d, v7.2s, v6.2s
3491 ; CHECK-DOT-NEXT: uaddl2 v7.2d, v1.4s, v3.4s
3492 ; CHECK-DOT-NEXT: uaddl v1.2d, v1.2s, v3.2s
3493 ; CHECK-DOT-NEXT: add v3.2d, v5.2d, v16.2d
3494 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v2.2d
3495 ; CHECK-DOT-NEXT: add v2.2d, v7.2d, v4.2d
3496 ; CHECK-DOT-NEXT: add v1.2d, v1.2d, v6.2d
3497 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v3.2d
3498 ; CHECK-DOT-NEXT: add v1.2d, v1.2d, v2.2d
3499 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v1.2d
3500 ; CHECK-DOT-NEXT: addp d0, v0.2d
3501 ; CHECK-DOT-NEXT: fmov x0, d0
3502 ; CHECK-DOT-NEXT: ret
3504 ; CHECK-GI-LABEL: add_pair_v16i8_v16i64_zext:
3505 ; CHECK-GI: // %bb.0: // %entry
3506 ; CHECK-GI-NEXT: ushll v2.8h, v0.8b, #0
3507 ; CHECK-GI-NEXT: ushll2 v0.8h, v0.16b, #0
3508 ; CHECK-GI-NEXT: ushll v3.8h, v1.8b, #0
3509 ; CHECK-GI-NEXT: ushll2 v1.8h, v1.16b, #0
3510 ; CHECK-GI-NEXT: ushll v4.4s, v2.4h, #0
3511 ; CHECK-GI-NEXT: ushll2 v2.4s, v2.8h, #0
3512 ; CHECK-GI-NEXT: ushll v5.4s, v0.4h, #0
3513 ; CHECK-GI-NEXT: ushll2 v0.4s, v0.8h, #0
3514 ; CHECK-GI-NEXT: ushll v6.4s, v3.4h, #0
3515 ; CHECK-GI-NEXT: ushll2 v3.4s, v3.8h, #0
3516 ; CHECK-GI-NEXT: ushll v7.4s, v1.4h, #0
3517 ; CHECK-GI-NEXT: ushll2 v1.4s, v1.8h, #0
3518 ; CHECK-GI-NEXT: ushll v16.2d, v4.2s, #0
3519 ; CHECK-GI-NEXT: ushll v17.2d, v2.2s, #0
3520 ; CHECK-GI-NEXT: ushll v18.2d, v5.2s, #0
3521 ; CHECK-GI-NEXT: ushll v19.2d, v0.2s, #0
3522 ; CHECK-GI-NEXT: ushll v20.2d, v6.2s, #0
3523 ; CHECK-GI-NEXT: ushll v21.2d, v3.2s, #0
3524 ; CHECK-GI-NEXT: ushll v22.2d, v7.2s, #0
3525 ; CHECK-GI-NEXT: ushll v23.2d, v1.2s, #0
3526 ; CHECK-GI-NEXT: uaddw2 v4.2d, v16.2d, v4.4s
3527 ; CHECK-GI-NEXT: uaddw2 v2.2d, v17.2d, v2.4s
3528 ; CHECK-GI-NEXT: uaddw2 v5.2d, v18.2d, v5.4s
3529 ; CHECK-GI-NEXT: uaddw2 v0.2d, v19.2d, v0.4s
3530 ; CHECK-GI-NEXT: uaddw2 v6.2d, v20.2d, v6.4s
3531 ; CHECK-GI-NEXT: uaddw2 v3.2d, v21.2d, v3.4s
3532 ; CHECK-GI-NEXT: uaddw2 v7.2d, v22.2d, v7.4s
3533 ; CHECK-GI-NEXT: uaddw2 v1.2d, v23.2d, v1.4s
3534 ; CHECK-GI-NEXT: add v2.2d, v4.2d, v2.2d
3535 ; CHECK-GI-NEXT: add v0.2d, v5.2d, v0.2d
3536 ; CHECK-GI-NEXT: add v3.2d, v6.2d, v3.2d
3537 ; CHECK-GI-NEXT: add v1.2d, v7.2d, v1.2d
3538 ; CHECK-GI-NEXT: add v0.2d, v2.2d, v0.2d
3539 ; CHECK-GI-NEXT: add v1.2d, v3.2d, v1.2d
3540 ; CHECK-GI-NEXT: addp d0, v0.2d
3541 ; CHECK-GI-NEXT: addp d1, v1.2d
3542 ; CHECK-GI-NEXT: fmov x8, d0
3543 ; CHECK-GI-NEXT: fmov x9, d1
3544 ; CHECK-GI-NEXT: add x0, x8, x9
3545 ; CHECK-GI-NEXT: ret
3547 %xx = zext <16 x i8> %x to <16 x i64>
3548 %z1 = call i64 @llvm.vector.reduce.add.v16i64(<16 x i64> %xx)
3549 %yy = zext <16 x i8> %y to <16 x i64>
3550 %z2 = call i64 @llvm.vector.reduce.add.v16i64(<16 x i64> %yy)
3551 %z = add i64 %z1, %z2
3555 define i64 @add_pair_v16i8_v16i64_sext(<16 x i8> %x, <16 x i8> %y) {
3556 ; CHECK-BASE-LABEL: add_pair_v16i8_v16i64_sext:
3557 ; CHECK-BASE: // %bb.0: // %entry
3558 ; CHECK-BASE-NEXT: sshll2 v2.8h, v0.16b, #0
3559 ; CHECK-BASE-NEXT: sshll v0.8h, v0.8b, #0
3560 ; CHECK-BASE-NEXT: sshll2 v3.8h, v1.16b, #0
3561 ; CHECK-BASE-NEXT: sshll v1.8h, v1.8b, #0
3562 ; CHECK-BASE-NEXT: sshll v4.4s, v2.4h, #0
3563 ; CHECK-BASE-NEXT: sshll2 v2.4s, v2.8h, #0
3564 ; CHECK-BASE-NEXT: sshll2 v5.4s, v0.8h, #0
3565 ; CHECK-BASE-NEXT: sshll v0.4s, v0.4h, #0
3566 ; CHECK-BASE-NEXT: sshll2 v6.4s, v3.8h, #0
3567 ; CHECK-BASE-NEXT: sshll2 v7.4s, v1.8h, #0
3568 ; CHECK-BASE-NEXT: sshll v3.4s, v3.4h, #0
3569 ; CHECK-BASE-NEXT: sshll v1.4s, v1.4h, #0
3570 ; CHECK-BASE-NEXT: saddl2 v16.2d, v5.4s, v2.4s
3571 ; CHECK-BASE-NEXT: saddl v2.2d, v5.2s, v2.2s
3572 ; CHECK-BASE-NEXT: saddl2 v5.2d, v0.4s, v4.4s
3573 ; CHECK-BASE-NEXT: saddl v0.2d, v0.2s, v4.2s
3574 ; CHECK-BASE-NEXT: saddl2 v4.2d, v7.4s, v6.4s
3575 ; CHECK-BASE-NEXT: saddl v6.2d, v7.2s, v6.2s
3576 ; CHECK-BASE-NEXT: saddl2 v7.2d, v1.4s, v3.4s
3577 ; CHECK-BASE-NEXT: saddl v1.2d, v1.2s, v3.2s
3578 ; CHECK-BASE-NEXT: add v3.2d, v5.2d, v16.2d
3579 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v2.2d
3580 ; CHECK-BASE-NEXT: add v2.2d, v7.2d, v4.2d
3581 ; CHECK-BASE-NEXT: add v1.2d, v1.2d, v6.2d
3582 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v3.2d
3583 ; CHECK-BASE-NEXT: add v1.2d, v1.2d, v2.2d
3584 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v1.2d
3585 ; CHECK-BASE-NEXT: addp d0, v0.2d
3586 ; CHECK-BASE-NEXT: fmov x0, d0
3587 ; CHECK-BASE-NEXT: ret
3589 ; CHECK-DOT-LABEL: add_pair_v16i8_v16i64_sext:
3590 ; CHECK-DOT: // %bb.0: // %entry
3591 ; CHECK-DOT-NEXT: sshll2 v2.8h, v0.16b, #0
3592 ; CHECK-DOT-NEXT: sshll v0.8h, v0.8b, #0
3593 ; CHECK-DOT-NEXT: sshll2 v3.8h, v1.16b, #0
3594 ; CHECK-DOT-NEXT: sshll v1.8h, v1.8b, #0
3595 ; CHECK-DOT-NEXT: sshll v4.4s, v2.4h, #0
3596 ; CHECK-DOT-NEXT: sshll2 v2.4s, v2.8h, #0
3597 ; CHECK-DOT-NEXT: sshll2 v5.4s, v0.8h, #0
3598 ; CHECK-DOT-NEXT: sshll v0.4s, v0.4h, #0
3599 ; CHECK-DOT-NEXT: sshll2 v6.4s, v3.8h, #0
3600 ; CHECK-DOT-NEXT: sshll2 v7.4s, v1.8h, #0
3601 ; CHECK-DOT-NEXT: sshll v3.4s, v3.4h, #0
3602 ; CHECK-DOT-NEXT: sshll v1.4s, v1.4h, #0
3603 ; CHECK-DOT-NEXT: saddl2 v16.2d, v5.4s, v2.4s
3604 ; CHECK-DOT-NEXT: saddl v2.2d, v5.2s, v2.2s
3605 ; CHECK-DOT-NEXT: saddl2 v5.2d, v0.4s, v4.4s
3606 ; CHECK-DOT-NEXT: saddl v0.2d, v0.2s, v4.2s
3607 ; CHECK-DOT-NEXT: saddl2 v4.2d, v7.4s, v6.4s
3608 ; CHECK-DOT-NEXT: saddl v6.2d, v7.2s, v6.2s
3609 ; CHECK-DOT-NEXT: saddl2 v7.2d, v1.4s, v3.4s
3610 ; CHECK-DOT-NEXT: saddl v1.2d, v1.2s, v3.2s
3611 ; CHECK-DOT-NEXT: add v3.2d, v5.2d, v16.2d
3612 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v2.2d
3613 ; CHECK-DOT-NEXT: add v2.2d, v7.2d, v4.2d
3614 ; CHECK-DOT-NEXT: add v1.2d, v1.2d, v6.2d
3615 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v3.2d
3616 ; CHECK-DOT-NEXT: add v1.2d, v1.2d, v2.2d
3617 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v1.2d
3618 ; CHECK-DOT-NEXT: addp d0, v0.2d
3619 ; CHECK-DOT-NEXT: fmov x0, d0
3620 ; CHECK-DOT-NEXT: ret
3622 ; CHECK-GI-LABEL: add_pair_v16i8_v16i64_sext:
3623 ; CHECK-GI: // %bb.0: // %entry
3624 ; CHECK-GI-NEXT: sshll v2.8h, v0.8b, #0
3625 ; CHECK-GI-NEXT: sshll2 v0.8h, v0.16b, #0
3626 ; CHECK-GI-NEXT: sshll v3.8h, v1.8b, #0
3627 ; CHECK-GI-NEXT: sshll2 v1.8h, v1.16b, #0
3628 ; CHECK-GI-NEXT: sshll v4.4s, v2.4h, #0
3629 ; CHECK-GI-NEXT: sshll2 v2.4s, v2.8h, #0
3630 ; CHECK-GI-NEXT: sshll v5.4s, v0.4h, #0
3631 ; CHECK-GI-NEXT: sshll2 v0.4s, v0.8h, #0
3632 ; CHECK-GI-NEXT: sshll v6.4s, v3.4h, #0
3633 ; CHECK-GI-NEXT: sshll2 v3.4s, v3.8h, #0
3634 ; CHECK-GI-NEXT: sshll v7.4s, v1.4h, #0
3635 ; CHECK-GI-NEXT: sshll2 v1.4s, v1.8h, #0
3636 ; CHECK-GI-NEXT: sshll v16.2d, v4.2s, #0
3637 ; CHECK-GI-NEXT: sshll v17.2d, v2.2s, #0
3638 ; CHECK-GI-NEXT: sshll v18.2d, v5.2s, #0
3639 ; CHECK-GI-NEXT: sshll v19.2d, v0.2s, #0
3640 ; CHECK-GI-NEXT: sshll v20.2d, v6.2s, #0
3641 ; CHECK-GI-NEXT: sshll v21.2d, v3.2s, #0
3642 ; CHECK-GI-NEXT: sshll v22.2d, v7.2s, #0
3643 ; CHECK-GI-NEXT: sshll v23.2d, v1.2s, #0
3644 ; CHECK-GI-NEXT: saddw2 v4.2d, v16.2d, v4.4s
3645 ; CHECK-GI-NEXT: saddw2 v2.2d, v17.2d, v2.4s
3646 ; CHECK-GI-NEXT: saddw2 v5.2d, v18.2d, v5.4s
3647 ; CHECK-GI-NEXT: saddw2 v0.2d, v19.2d, v0.4s
3648 ; CHECK-GI-NEXT: saddw2 v6.2d, v20.2d, v6.4s
3649 ; CHECK-GI-NEXT: saddw2 v3.2d, v21.2d, v3.4s
3650 ; CHECK-GI-NEXT: saddw2 v7.2d, v22.2d, v7.4s
3651 ; CHECK-GI-NEXT: saddw2 v1.2d, v23.2d, v1.4s
3652 ; CHECK-GI-NEXT: add v2.2d, v4.2d, v2.2d
3653 ; CHECK-GI-NEXT: add v0.2d, v5.2d, v0.2d
3654 ; CHECK-GI-NEXT: add v3.2d, v6.2d, v3.2d
3655 ; CHECK-GI-NEXT: add v1.2d, v7.2d, v1.2d
3656 ; CHECK-GI-NEXT: add v0.2d, v2.2d, v0.2d
3657 ; CHECK-GI-NEXT: add v1.2d, v3.2d, v1.2d
3658 ; CHECK-GI-NEXT: addp d0, v0.2d
3659 ; CHECK-GI-NEXT: addp d1, v1.2d
3660 ; CHECK-GI-NEXT: fmov x8, d0
3661 ; CHECK-GI-NEXT: fmov x9, d1
3662 ; CHECK-GI-NEXT: add x0, x8, x9
3663 ; CHECK-GI-NEXT: ret
3665 %xx = sext <16 x i8> %x to <16 x i64>
3666 %z1 = call i64 @llvm.vector.reduce.add.v16i64(<16 x i64> %xx)
3667 %yy = sext <16 x i8> %y to <16 x i64>
3668 %z2 = call i64 @llvm.vector.reduce.add.v16i64(<16 x i64> %yy)
3669 %z = add i64 %z1, %z2
3673 define i64 @add_pair_v8i8_v8i64_zext(<8 x i8> %x, <8 x i8> %y) {
3674 ; CHECK-BASE-LABEL: add_pair_v8i8_v8i64_zext:
3675 ; CHECK-BASE: // %bb.0: // %entry
3676 ; CHECK-BASE-NEXT: ushll v0.8h, v0.8b, #0
3677 ; CHECK-BASE-NEXT: ushll v1.8h, v1.8b, #0
3678 ; CHECK-BASE-NEXT: ushll2 v2.4s, v0.8h, #0
3679 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
3680 ; CHECK-BASE-NEXT: ushll2 v3.4s, v1.8h, #0
3681 ; CHECK-BASE-NEXT: ushll v1.4s, v1.4h, #0
3682 ; CHECK-BASE-NEXT: uaddl2 v4.2d, v0.4s, v2.4s
3683 ; CHECK-BASE-NEXT: uaddl v0.2d, v0.2s, v2.2s
3684 ; CHECK-BASE-NEXT: uaddl2 v2.2d, v1.4s, v3.4s
3685 ; CHECK-BASE-NEXT: uaddl v1.2d, v1.2s, v3.2s
3686 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v4.2d
3687 ; CHECK-BASE-NEXT: add v1.2d, v1.2d, v2.2d
3688 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v1.2d
3689 ; CHECK-BASE-NEXT: addp d0, v0.2d
3690 ; CHECK-BASE-NEXT: fmov x0, d0
3691 ; CHECK-BASE-NEXT: ret
3693 ; CHECK-DOT-LABEL: add_pair_v8i8_v8i64_zext:
3694 ; CHECK-DOT: // %bb.0: // %entry
3695 ; CHECK-DOT-NEXT: ushll v0.8h, v0.8b, #0
3696 ; CHECK-DOT-NEXT: ushll v1.8h, v1.8b, #0
3697 ; CHECK-DOT-NEXT: ushll2 v2.4s, v0.8h, #0
3698 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
3699 ; CHECK-DOT-NEXT: ushll2 v3.4s, v1.8h, #0
3700 ; CHECK-DOT-NEXT: ushll v1.4s, v1.4h, #0
3701 ; CHECK-DOT-NEXT: uaddl2 v4.2d, v0.4s, v2.4s
3702 ; CHECK-DOT-NEXT: uaddl v0.2d, v0.2s, v2.2s
3703 ; CHECK-DOT-NEXT: uaddl2 v2.2d, v1.4s, v3.4s
3704 ; CHECK-DOT-NEXT: uaddl v1.2d, v1.2s, v3.2s
3705 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v4.2d
3706 ; CHECK-DOT-NEXT: add v1.2d, v1.2d, v2.2d
3707 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v1.2d
3708 ; CHECK-DOT-NEXT: addp d0, v0.2d
3709 ; CHECK-DOT-NEXT: fmov x0, d0
3710 ; CHECK-DOT-NEXT: ret
3712 ; CHECK-GI-LABEL: add_pair_v8i8_v8i64_zext:
3713 ; CHECK-GI: // %bb.0: // %entry
3714 ; CHECK-GI-NEXT: ushll v0.8h, v0.8b, #0
3715 ; CHECK-GI-NEXT: ushll v1.8h, v1.8b, #0
3716 ; CHECK-GI-NEXT: ushll v2.4s, v0.4h, #0
3717 ; CHECK-GI-NEXT: ushll2 v0.4s, v0.8h, #0
3718 ; CHECK-GI-NEXT: ushll v3.4s, v1.4h, #0
3719 ; CHECK-GI-NEXT: ushll2 v1.4s, v1.8h, #0
3720 ; CHECK-GI-NEXT: ushll v4.2d, v2.2s, #0
3721 ; CHECK-GI-NEXT: ushll v5.2d, v0.2s, #0
3722 ; CHECK-GI-NEXT: ushll v6.2d, v3.2s, #0
3723 ; CHECK-GI-NEXT: ushll v7.2d, v1.2s, #0
3724 ; CHECK-GI-NEXT: uaddw2 v2.2d, v4.2d, v2.4s
3725 ; CHECK-GI-NEXT: uaddw2 v0.2d, v5.2d, v0.4s
3726 ; CHECK-GI-NEXT: uaddw2 v3.2d, v6.2d, v3.4s
3727 ; CHECK-GI-NEXT: uaddw2 v1.2d, v7.2d, v1.4s
3728 ; CHECK-GI-NEXT: add v0.2d, v2.2d, v0.2d
3729 ; CHECK-GI-NEXT: add v1.2d, v3.2d, v1.2d
3730 ; CHECK-GI-NEXT: addp d0, v0.2d
3731 ; CHECK-GI-NEXT: addp d1, v1.2d
3732 ; CHECK-GI-NEXT: fmov x8, d0
3733 ; CHECK-GI-NEXT: fmov x9, d1
3734 ; CHECK-GI-NEXT: add x0, x8, x9
3735 ; CHECK-GI-NEXT: ret
3737 %xx = zext <8 x i8> %x to <8 x i64>
3738 %z1 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> %xx)
3739 %yy = zext <8 x i8> %y to <8 x i64>
3740 %z2 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> %yy)
3741 %z = add i64 %z1, %z2
3745 define i64 @add_pair_v8i8_v8i64_sext(<8 x i8> %x, <8 x i8> %y) {
3746 ; CHECK-BASE-LABEL: add_pair_v8i8_v8i64_sext:
3747 ; CHECK-BASE: // %bb.0: // %entry
3748 ; CHECK-BASE-NEXT: sshll v0.8h, v0.8b, #0
3749 ; CHECK-BASE-NEXT: sshll v1.8h, v1.8b, #0
3750 ; CHECK-BASE-NEXT: sshll2 v2.4s, v0.8h, #0
3751 ; CHECK-BASE-NEXT: sshll v0.4s, v0.4h, #0
3752 ; CHECK-BASE-NEXT: sshll2 v3.4s, v1.8h, #0
3753 ; CHECK-BASE-NEXT: sshll v1.4s, v1.4h, #0
3754 ; CHECK-BASE-NEXT: saddl2 v4.2d, v0.4s, v2.4s
3755 ; CHECK-BASE-NEXT: saddl v0.2d, v0.2s, v2.2s
3756 ; CHECK-BASE-NEXT: saddl2 v2.2d, v1.4s, v3.4s
3757 ; CHECK-BASE-NEXT: saddl v1.2d, v1.2s, v3.2s
3758 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v4.2d
3759 ; CHECK-BASE-NEXT: add v1.2d, v1.2d, v2.2d
3760 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v1.2d
3761 ; CHECK-BASE-NEXT: addp d0, v0.2d
3762 ; CHECK-BASE-NEXT: fmov x0, d0
3763 ; CHECK-BASE-NEXT: ret
3765 ; CHECK-DOT-LABEL: add_pair_v8i8_v8i64_sext:
3766 ; CHECK-DOT: // %bb.0: // %entry
3767 ; CHECK-DOT-NEXT: sshll v0.8h, v0.8b, #0
3768 ; CHECK-DOT-NEXT: sshll v1.8h, v1.8b, #0
3769 ; CHECK-DOT-NEXT: sshll2 v2.4s, v0.8h, #0
3770 ; CHECK-DOT-NEXT: sshll v0.4s, v0.4h, #0
3771 ; CHECK-DOT-NEXT: sshll2 v3.4s, v1.8h, #0
3772 ; CHECK-DOT-NEXT: sshll v1.4s, v1.4h, #0
3773 ; CHECK-DOT-NEXT: saddl2 v4.2d, v0.4s, v2.4s
3774 ; CHECK-DOT-NEXT: saddl v0.2d, v0.2s, v2.2s
3775 ; CHECK-DOT-NEXT: saddl2 v2.2d, v1.4s, v3.4s
3776 ; CHECK-DOT-NEXT: saddl v1.2d, v1.2s, v3.2s
3777 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v4.2d
3778 ; CHECK-DOT-NEXT: add v1.2d, v1.2d, v2.2d
3779 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v1.2d
3780 ; CHECK-DOT-NEXT: addp d0, v0.2d
3781 ; CHECK-DOT-NEXT: fmov x0, d0
3782 ; CHECK-DOT-NEXT: ret
3784 ; CHECK-GI-LABEL: add_pair_v8i8_v8i64_sext:
3785 ; CHECK-GI: // %bb.0: // %entry
3786 ; CHECK-GI-NEXT: sshll v0.8h, v0.8b, #0
3787 ; CHECK-GI-NEXT: sshll v1.8h, v1.8b, #0
3788 ; CHECK-GI-NEXT: sshll v2.4s, v0.4h, #0
3789 ; CHECK-GI-NEXT: sshll2 v0.4s, v0.8h, #0
3790 ; CHECK-GI-NEXT: sshll v3.4s, v1.4h, #0
3791 ; CHECK-GI-NEXT: sshll2 v1.4s, v1.8h, #0
3792 ; CHECK-GI-NEXT: sshll v4.2d, v2.2s, #0
3793 ; CHECK-GI-NEXT: sshll v5.2d, v0.2s, #0
3794 ; CHECK-GI-NEXT: sshll v6.2d, v3.2s, #0
3795 ; CHECK-GI-NEXT: sshll v7.2d, v1.2s, #0
3796 ; CHECK-GI-NEXT: saddw2 v2.2d, v4.2d, v2.4s
3797 ; CHECK-GI-NEXT: saddw2 v0.2d, v5.2d, v0.4s
3798 ; CHECK-GI-NEXT: saddw2 v3.2d, v6.2d, v3.4s
3799 ; CHECK-GI-NEXT: saddw2 v1.2d, v7.2d, v1.4s
3800 ; CHECK-GI-NEXT: add v0.2d, v2.2d, v0.2d
3801 ; CHECK-GI-NEXT: add v1.2d, v3.2d, v1.2d
3802 ; CHECK-GI-NEXT: addp d0, v0.2d
3803 ; CHECK-GI-NEXT: addp d1, v1.2d
3804 ; CHECK-GI-NEXT: fmov x8, d0
3805 ; CHECK-GI-NEXT: fmov x9, d1
3806 ; CHECK-GI-NEXT: add x0, x8, x9
3807 ; CHECK-GI-NEXT: ret
3809 %xx = sext <8 x i8> %x to <8 x i64>
3810 %z1 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> %xx)
3811 %yy = sext <8 x i8> %y to <8 x i64>
3812 %z2 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> %yy)
3813 %z = add i64 %z1, %z2
3817 define i64 @add_pair_v4i8_v4i64_zext(<4 x i8> %x, <4 x i8> %y) {
3818 ; CHECK-BASE-LABEL: add_pair_v4i8_v4i64_zext:
3819 ; CHECK-BASE: // %bb.0: // %entry
3820 ; CHECK-BASE-NEXT: bic v1.4h, #255, lsl #8
3821 ; CHECK-BASE-NEXT: bic v0.4h, #255, lsl #8
3822 ; CHECK-BASE-NEXT: ushll v1.4s, v1.4h, #0
3823 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
3824 ; CHECK-BASE-NEXT: uaddlp v1.2d, v1.4s
3825 ; CHECK-BASE-NEXT: uadalp v1.2d, v0.4s
3826 ; CHECK-BASE-NEXT: addp d0, v1.2d
3827 ; CHECK-BASE-NEXT: fmov x0, d0
3828 ; CHECK-BASE-NEXT: ret
3830 ; CHECK-DOT-LABEL: add_pair_v4i8_v4i64_zext:
3831 ; CHECK-DOT: // %bb.0: // %entry
3832 ; CHECK-DOT-NEXT: bic v1.4h, #255, lsl #8
3833 ; CHECK-DOT-NEXT: bic v0.4h, #255, lsl #8
3834 ; CHECK-DOT-NEXT: ushll v1.4s, v1.4h, #0
3835 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
3836 ; CHECK-DOT-NEXT: uaddlp v1.2d, v1.4s
3837 ; CHECK-DOT-NEXT: uadalp v1.2d, v0.4s
3838 ; CHECK-DOT-NEXT: addp d0, v1.2d
3839 ; CHECK-DOT-NEXT: fmov x0, d0
3840 ; CHECK-DOT-NEXT: ret
3842 ; CHECK-GI-LABEL: add_pair_v4i8_v4i64_zext:
3843 ; CHECK-GI: // %bb.0: // %entry
3844 ; CHECK-GI-NEXT: ushll v0.4s, v0.4h, #0
3845 ; CHECK-GI-NEXT: ushll v1.4s, v1.4h, #0
3846 ; CHECK-GI-NEXT: movi v2.2d, #0x000000000000ff
3847 ; CHECK-GI-NEXT: ushll v3.2d, v0.2s, #0
3848 ; CHECK-GI-NEXT: ushll2 v0.2d, v0.4s, #0
3849 ; CHECK-GI-NEXT: ushll v4.2d, v1.2s, #0
3850 ; CHECK-GI-NEXT: ushll2 v1.2d, v1.4s, #0
3851 ; CHECK-GI-NEXT: and v3.16b, v3.16b, v2.16b
3852 ; CHECK-GI-NEXT: and v0.16b, v0.16b, v2.16b
3853 ; CHECK-GI-NEXT: and v4.16b, v4.16b, v2.16b
3854 ; CHECK-GI-NEXT: and v1.16b, v1.16b, v2.16b
3855 ; CHECK-GI-NEXT: add v0.2d, v3.2d, v0.2d
3856 ; CHECK-GI-NEXT: add v1.2d, v4.2d, v1.2d
3857 ; CHECK-GI-NEXT: addp d0, v0.2d
3858 ; CHECK-GI-NEXT: addp d1, v1.2d
3859 ; CHECK-GI-NEXT: fmov x8, d0
3860 ; CHECK-GI-NEXT: fmov x9, d1
3861 ; CHECK-GI-NEXT: add x0, x8, x9
3862 ; CHECK-GI-NEXT: ret
3864 %xx = zext <4 x i8> %x to <4 x i64>
3865 %z1 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %xx)
3866 %yy = zext <4 x i8> %y to <4 x i64>
3867 %z2 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %yy)
3868 %z = add i64 %z1, %z2
3872 define i64 @add_pair_v4i8_v4i64_sext(<4 x i8> %x, <4 x i8> %y) {
3873 ; CHECK-BASE-LABEL: add_pair_v4i8_v4i64_sext:
3874 ; CHECK-BASE: // %bb.0: // %entry
3875 ; CHECK-BASE-NEXT: ushll v0.4s, v0.4h, #0
3876 ; CHECK-BASE-NEXT: ushll v1.4s, v1.4h, #0
3877 ; CHECK-BASE-NEXT: ushll v2.2d, v0.2s, #0
3878 ; CHECK-BASE-NEXT: ushll v3.2d, v1.2s, #0
3879 ; CHECK-BASE-NEXT: ushll2 v0.2d, v0.4s, #0
3880 ; CHECK-BASE-NEXT: ushll2 v1.2d, v1.4s, #0
3881 ; CHECK-BASE-NEXT: shl v2.2d, v2.2d, #56
3882 ; CHECK-BASE-NEXT: shl v3.2d, v3.2d, #56
3883 ; CHECK-BASE-NEXT: shl v0.2d, v0.2d, #56
3884 ; CHECK-BASE-NEXT: shl v1.2d, v1.2d, #56
3885 ; CHECK-BASE-NEXT: sshr v2.2d, v2.2d, #56
3886 ; CHECK-BASE-NEXT: sshr v3.2d, v3.2d, #56
3887 ; CHECK-BASE-NEXT: ssra v2.2d, v0.2d, #56
3888 ; CHECK-BASE-NEXT: ssra v3.2d, v1.2d, #56
3889 ; CHECK-BASE-NEXT: add v0.2d, v2.2d, v3.2d
3890 ; CHECK-BASE-NEXT: addp d0, v0.2d
3891 ; CHECK-BASE-NEXT: fmov x0, d0
3892 ; CHECK-BASE-NEXT: ret
3894 ; CHECK-DOT-LABEL: add_pair_v4i8_v4i64_sext:
3895 ; CHECK-DOT: // %bb.0: // %entry
3896 ; CHECK-DOT-NEXT: ushll v0.4s, v0.4h, #0
3897 ; CHECK-DOT-NEXT: ushll v1.4s, v1.4h, #0
3898 ; CHECK-DOT-NEXT: ushll v2.2d, v0.2s, #0
3899 ; CHECK-DOT-NEXT: ushll v3.2d, v1.2s, #0
3900 ; CHECK-DOT-NEXT: ushll2 v0.2d, v0.4s, #0
3901 ; CHECK-DOT-NEXT: ushll2 v1.2d, v1.4s, #0
3902 ; CHECK-DOT-NEXT: shl v2.2d, v2.2d, #56
3903 ; CHECK-DOT-NEXT: shl v3.2d, v3.2d, #56
3904 ; CHECK-DOT-NEXT: shl v0.2d, v0.2d, #56
3905 ; CHECK-DOT-NEXT: shl v1.2d, v1.2d, #56
3906 ; CHECK-DOT-NEXT: sshr v2.2d, v2.2d, #56
3907 ; CHECK-DOT-NEXT: sshr v3.2d, v3.2d, #56
3908 ; CHECK-DOT-NEXT: ssra v2.2d, v0.2d, #56
3909 ; CHECK-DOT-NEXT: ssra v3.2d, v1.2d, #56
3910 ; CHECK-DOT-NEXT: add v0.2d, v2.2d, v3.2d
3911 ; CHECK-DOT-NEXT: addp d0, v0.2d
3912 ; CHECK-DOT-NEXT: fmov x0, d0
3913 ; CHECK-DOT-NEXT: ret
3915 ; CHECK-GI-LABEL: add_pair_v4i8_v4i64_sext:
3916 ; CHECK-GI: // %bb.0: // %entry
3917 ; CHECK-GI-NEXT: ushll v0.4s, v0.4h, #0
3918 ; CHECK-GI-NEXT: ushll v1.4s, v1.4h, #0
3919 ; CHECK-GI-NEXT: ushll2 v2.2d, v0.4s, #0
3920 ; CHECK-GI-NEXT: ushll2 v3.2d, v1.4s, #0
3921 ; CHECK-GI-NEXT: ushll v0.2d, v0.2s, #0
3922 ; CHECK-GI-NEXT: ushll v1.2d, v1.2s, #0
3923 ; CHECK-GI-NEXT: shl v2.2d, v2.2d, #56
3924 ; CHECK-GI-NEXT: shl v3.2d, v3.2d, #56
3925 ; CHECK-GI-NEXT: shl v0.2d, v0.2d, #56
3926 ; CHECK-GI-NEXT: shl v1.2d, v1.2d, #56
3927 ; CHECK-GI-NEXT: sshr v2.2d, v2.2d, #56
3928 ; CHECK-GI-NEXT: sshr v3.2d, v3.2d, #56
3929 ; CHECK-GI-NEXT: ssra v2.2d, v0.2d, #56
3930 ; CHECK-GI-NEXT: ssra v3.2d, v1.2d, #56
3931 ; CHECK-GI-NEXT: addp d0, v2.2d
3932 ; CHECK-GI-NEXT: addp d1, v3.2d
3933 ; CHECK-GI-NEXT: fmov x8, d0
3934 ; CHECK-GI-NEXT: fmov x9, d1
3935 ; CHECK-GI-NEXT: add x0, x8, x9
3936 ; CHECK-GI-NEXT: ret
3938 %xx = sext <4 x i8> %x to <4 x i64>
3939 %z1 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %xx)
3940 %yy = sext <4 x i8> %y to <4 x i64>
3941 %z2 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %yy)
3942 %z = add i64 %z1, %z2
3946 define i64 @add_pair_v2i8_v2i64_zext(<2 x i8> %x, <2 x i8> %y) {
3947 ; CHECK-BASE-LABEL: add_pair_v2i8_v2i64_zext:
3948 ; CHECK-BASE: // %bb.0: // %entry
3949 ; CHECK-BASE-NEXT: movi d2, #0x0000ff000000ff
3950 ; CHECK-BASE-NEXT: and v0.8b, v0.8b, v2.8b
3951 ; CHECK-BASE-NEXT: and v1.8b, v1.8b, v2.8b
3952 ; CHECK-BASE-NEXT: uaddl v0.2d, v0.2s, v1.2s
3953 ; CHECK-BASE-NEXT: addp d0, v0.2d
3954 ; CHECK-BASE-NEXT: fmov x0, d0
3955 ; CHECK-BASE-NEXT: ret
3957 ; CHECK-DOT-LABEL: add_pair_v2i8_v2i64_zext:
3958 ; CHECK-DOT: // %bb.0: // %entry
3959 ; CHECK-DOT-NEXT: movi d2, #0x0000ff000000ff
3960 ; CHECK-DOT-NEXT: and v0.8b, v0.8b, v2.8b
3961 ; CHECK-DOT-NEXT: and v1.8b, v1.8b, v2.8b
3962 ; CHECK-DOT-NEXT: uaddl v0.2d, v0.2s, v1.2s
3963 ; CHECK-DOT-NEXT: addp d0, v0.2d
3964 ; CHECK-DOT-NEXT: fmov x0, d0
3965 ; CHECK-DOT-NEXT: ret
3967 ; CHECK-GI-LABEL: add_pair_v2i8_v2i64_zext:
3968 ; CHECK-GI: // %bb.0: // %entry
3969 ; CHECK-GI-NEXT: movi v2.2d, #0x000000000000ff
3970 ; CHECK-GI-NEXT: ushll v0.2d, v0.2s, #0
3971 ; CHECK-GI-NEXT: ushll v1.2d, v1.2s, #0
3972 ; CHECK-GI-NEXT: and v0.16b, v0.16b, v2.16b
3973 ; CHECK-GI-NEXT: and v1.16b, v1.16b, v2.16b
3974 ; CHECK-GI-NEXT: addp d0, v0.2d
3975 ; CHECK-GI-NEXT: addp d1, v1.2d
3976 ; CHECK-GI-NEXT: fmov x8, d0
3977 ; CHECK-GI-NEXT: fmov x9, d1
3978 ; CHECK-GI-NEXT: add x0, x8, x9
3979 ; CHECK-GI-NEXT: ret
3981 %xx = zext <2 x i8> %x to <2 x i64>
3982 %z1 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %xx)
3983 %yy = zext <2 x i8> %y to <2 x i64>
3984 %z2 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %yy)
3985 %z = add i64 %z1, %z2
3989 define i64 @add_pair_v2i8_v2i64_sext(<2 x i8> %x, <2 x i8> %y) {
3990 ; CHECK-BASE-LABEL: add_pair_v2i8_v2i64_sext:
3991 ; CHECK-BASE: // %bb.0: // %entry
3992 ; CHECK-BASE-NEXT: ushll v0.2d, v0.2s, #0
3993 ; CHECK-BASE-NEXT: ushll v1.2d, v1.2s, #0
3994 ; CHECK-BASE-NEXT: shl v0.2d, v0.2d, #56
3995 ; CHECK-BASE-NEXT: shl v1.2d, v1.2d, #56
3996 ; CHECK-BASE-NEXT: sshr v0.2d, v0.2d, #56
3997 ; CHECK-BASE-NEXT: ssra v0.2d, v1.2d, #56
3998 ; CHECK-BASE-NEXT: addp d0, v0.2d
3999 ; CHECK-BASE-NEXT: fmov x0, d0
4000 ; CHECK-BASE-NEXT: ret
4002 ; CHECK-DOT-LABEL: add_pair_v2i8_v2i64_sext:
4003 ; CHECK-DOT: // %bb.0: // %entry
4004 ; CHECK-DOT-NEXT: ushll v0.2d, v0.2s, #0
4005 ; CHECK-DOT-NEXT: ushll v1.2d, v1.2s, #0
4006 ; CHECK-DOT-NEXT: shl v0.2d, v0.2d, #56
4007 ; CHECK-DOT-NEXT: shl v1.2d, v1.2d, #56
4008 ; CHECK-DOT-NEXT: sshr v0.2d, v0.2d, #56
4009 ; CHECK-DOT-NEXT: ssra v0.2d, v1.2d, #56
4010 ; CHECK-DOT-NEXT: addp d0, v0.2d
4011 ; CHECK-DOT-NEXT: fmov x0, d0
4012 ; CHECK-DOT-NEXT: ret
4014 ; CHECK-GI-LABEL: add_pair_v2i8_v2i64_sext:
4015 ; CHECK-GI: // %bb.0: // %entry
4016 ; CHECK-GI-NEXT: ushll v0.2d, v0.2s, #0
4017 ; CHECK-GI-NEXT: ushll v1.2d, v1.2s, #0
4018 ; CHECK-GI-NEXT: shl v0.2d, v0.2d, #56
4019 ; CHECK-GI-NEXT: shl v1.2d, v1.2d, #56
4020 ; CHECK-GI-NEXT: sshr v0.2d, v0.2d, #56
4021 ; CHECK-GI-NEXT: sshr v1.2d, v1.2d, #56
4022 ; CHECK-GI-NEXT: addp d0, v0.2d
4023 ; CHECK-GI-NEXT: addp d1, v1.2d
4024 ; CHECK-GI-NEXT: fmov x8, d0
4025 ; CHECK-GI-NEXT: fmov x9, d1
4026 ; CHECK-GI-NEXT: add x0, x8, x9
4027 ; CHECK-GI-NEXT: ret
4029 %xx = sext <2 x i8> %x to <2 x i64>
4030 %z1 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %xx)
4031 %yy = sext <2 x i8> %y to <2 x i64>
4032 %z2 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %yy)
4033 %z = add i64 %z1, %z2
4037 define i32 @add_pair_v8i8_v8i32_double_sext_zext(<8 x i8> %ax, <8 x i8> %ay, <8 x i8> %bx, <8 x i8> %by) {
4038 ; CHECK-BASE-LABEL: add_pair_v8i8_v8i32_double_sext_zext:
4039 ; CHECK-BASE: // %bb.0: // %entry
4040 ; CHECK-BASE-NEXT: ushll v1.8h, v1.8b, #0
4041 ; CHECK-BASE-NEXT: sshll v3.8h, v3.8b, #0
4042 ; CHECK-BASE-NEXT: ushll v0.8h, v0.8b, #0
4043 ; CHECK-BASE-NEXT: sshll v2.8h, v2.8b, #0
4044 ; CHECK-BASE-NEXT: uaddlp v1.4s, v1.8h
4045 ; CHECK-BASE-NEXT: saddlp v3.4s, v3.8h
4046 ; CHECK-BASE-NEXT: uadalp v1.4s, v0.8h
4047 ; CHECK-BASE-NEXT: sadalp v3.4s, v2.8h
4048 ; CHECK-BASE-NEXT: add v0.4s, v3.4s, v1.4s
4049 ; CHECK-BASE-NEXT: addv s0, v0.4s
4050 ; CHECK-BASE-NEXT: fmov w0, s0
4051 ; CHECK-BASE-NEXT: ret
4053 ; CHECK-DOT-LABEL: add_pair_v8i8_v8i32_double_sext_zext:
4054 ; CHECK-DOT: // %bb.0: // %entry
4055 ; CHECK-DOT-NEXT: movi v4.2d, #0000000000000000
4056 ; CHECK-DOT-NEXT: movi v5.8b, #1
4057 ; CHECK-DOT-NEXT: movi v6.2d, #0000000000000000
4058 ; CHECK-DOT-NEXT: udot v6.2s, v1.8b, v5.8b
4059 ; CHECK-DOT-NEXT: sdot v4.2s, v3.8b, v5.8b
4060 ; CHECK-DOT-NEXT: udot v6.2s, v0.8b, v5.8b
4061 ; CHECK-DOT-NEXT: sdot v4.2s, v2.8b, v5.8b
4062 ; CHECK-DOT-NEXT: add v0.2s, v6.2s, v4.2s
4063 ; CHECK-DOT-NEXT: addp v0.2s, v0.2s, v0.2s
4064 ; CHECK-DOT-NEXT: fmov w0, s0
4065 ; CHECK-DOT-NEXT: ret
4067 ; CHECK-GI-LABEL: add_pair_v8i8_v8i32_double_sext_zext:
4068 ; CHECK-GI: // %bb.0: // %entry
4069 ; CHECK-GI-NEXT: ushll v0.8h, v0.8b, #0
4070 ; CHECK-GI-NEXT: ushll v1.8h, v1.8b, #0
4071 ; CHECK-GI-NEXT: sshll v2.8h, v2.8b, #0
4072 ; CHECK-GI-NEXT: sshll v3.8h, v3.8b, #0
4073 ; CHECK-GI-NEXT: ushll v4.4s, v0.4h, #0
4074 ; CHECK-GI-NEXT: ushll v5.4s, v1.4h, #0
4075 ; CHECK-GI-NEXT: sshll v6.4s, v2.4h, #0
4076 ; CHECK-GI-NEXT: sshll v7.4s, v3.4h, #0
4077 ; CHECK-GI-NEXT: uaddw2 v0.4s, v4.4s, v0.8h
4078 ; CHECK-GI-NEXT: uaddw2 v1.4s, v5.4s, v1.8h
4079 ; CHECK-GI-NEXT: saddw2 v2.4s, v6.4s, v2.8h
4080 ; CHECK-GI-NEXT: saddw2 v3.4s, v7.4s, v3.8h
4081 ; CHECK-GI-NEXT: addv s0, v0.4s
4082 ; CHECK-GI-NEXT: addv s1, v1.4s
4083 ; CHECK-GI-NEXT: addv s2, v2.4s
4084 ; CHECK-GI-NEXT: addv s3, v3.4s
4085 ; CHECK-GI-NEXT: fmov w8, s0
4086 ; CHECK-GI-NEXT: fmov w9, s1
4087 ; CHECK-GI-NEXT: fmov w10, s2
4088 ; CHECK-GI-NEXT: fmov w11, s3
4089 ; CHECK-GI-NEXT: add w8, w8, w9
4090 ; CHECK-GI-NEXT: add w9, w10, w11
4091 ; CHECK-GI-NEXT: add w0, w8, w9
4092 ; CHECK-GI-NEXT: ret
4094 %axx = zext <8 x i8> %ax to <8 x i32>
4095 %az1 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %axx)
4096 %ayy = zext <8 x i8> %ay to <8 x i32>
4097 %az2 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %ayy)
4098 %az = add i32 %az1, %az2
4099 %bxx = sext <8 x i8> %bx to <8 x i32>
4100 %bz1 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %bxx)
4101 %byy = sext <8 x i8> %by to <8 x i32>
4102 %bz2 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %byy)
4103 %bz = add i32 %bz1, %bz2
4104 %z = add i32 %az, %bz
4108 define i32 @add_pair_v8i16_v4i32_double_sext_zext_shuffle(<8 x i16> %ax, <8 x i16> %ay, <8 x i16> %bx, <8 x i16> %by) {
4109 ; CHECK-BASE-LABEL: add_pair_v8i16_v4i32_double_sext_zext_shuffle:
4110 ; CHECK-BASE: // %bb.0: // %entry
4111 ; CHECK-BASE-NEXT: uaddlp v1.4s, v1.8h
4112 ; CHECK-BASE-NEXT: uaddlp v3.4s, v3.8h
4113 ; CHECK-BASE-NEXT: uadalp v1.4s, v0.8h
4114 ; CHECK-BASE-NEXT: uadalp v3.4s, v2.8h
4115 ; CHECK-BASE-NEXT: add v0.4s, v3.4s, v1.4s
4116 ; CHECK-BASE-NEXT: addv s0, v0.4s
4117 ; CHECK-BASE-NEXT: fmov w0, s0
4118 ; CHECK-BASE-NEXT: ret
4120 ; CHECK-DOT-LABEL: add_pair_v8i16_v4i32_double_sext_zext_shuffle:
4121 ; CHECK-DOT: // %bb.0: // %entry
4122 ; CHECK-DOT-NEXT: uaddlp v1.4s, v1.8h
4123 ; CHECK-DOT-NEXT: uaddlp v3.4s, v3.8h
4124 ; CHECK-DOT-NEXT: uadalp v1.4s, v0.8h
4125 ; CHECK-DOT-NEXT: uadalp v3.4s, v2.8h
4126 ; CHECK-DOT-NEXT: add v0.4s, v3.4s, v1.4s
4127 ; CHECK-DOT-NEXT: addv s0, v0.4s
4128 ; CHECK-DOT-NEXT: fmov w0, s0
4129 ; CHECK-DOT-NEXT: ret
4131 ; CHECK-GI-LABEL: add_pair_v8i16_v4i32_double_sext_zext_shuffle:
4132 ; CHECK-GI: // %bb.0: // %entry
4133 ; CHECK-GI-NEXT: ushll v4.4s, v0.4h, #0
4134 ; CHECK-GI-NEXT: ushll2 v0.4s, v0.8h, #0
4135 ; CHECK-GI-NEXT: ushll v5.4s, v1.4h, #0
4136 ; CHECK-GI-NEXT: ushll2 v1.4s, v1.8h, #0
4137 ; CHECK-GI-NEXT: ushll v6.4s, v2.4h, #0
4138 ; CHECK-GI-NEXT: ushll2 v2.4s, v2.8h, #0
4139 ; CHECK-GI-NEXT: ushll v7.4s, v3.4h, #0
4140 ; CHECK-GI-NEXT: ushll2 v3.4s, v3.8h, #0
4141 ; CHECK-GI-NEXT: add v0.4s, v4.4s, v0.4s
4142 ; CHECK-GI-NEXT: add v1.4s, v5.4s, v1.4s
4143 ; CHECK-GI-NEXT: add v2.4s, v6.4s, v2.4s
4144 ; CHECK-GI-NEXT: add v3.4s, v7.4s, v3.4s
4145 ; CHECK-GI-NEXT: add v0.4s, v0.4s, v1.4s
4146 ; CHECK-GI-NEXT: add v1.4s, v2.4s, v3.4s
4147 ; CHECK-GI-NEXT: add v0.4s, v0.4s, v1.4s
4148 ; CHECK-GI-NEXT: addv s0, v0.4s
4149 ; CHECK-GI-NEXT: fmov w0, s0
4150 ; CHECK-GI-NEXT: ret
4152 %axx = zext <8 x i16> %ax to <8 x i32>
4153 %s1h = shufflevector <8 x i32> %axx, <8 x i32> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
4154 %s1l = shufflevector <8 x i32> %axx, <8 x i32> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
4155 %axs = add <4 x i32> %s1h, %s1l
4156 %ayy = zext <8 x i16> %ay to <8 x i32>
4157 %s2h = shufflevector <8 x i32> %ayy, <8 x i32> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
4158 %s2l = shufflevector <8 x i32> %ayy, <8 x i32> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
4159 %ays = add <4 x i32> %s2h, %s2l
4160 %az = add <4 x i32> %axs, %ays
4161 %bxx = zext <8 x i16> %bx to <8 x i32>
4162 %s3h = shufflevector <8 x i32> %bxx, <8 x i32> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
4163 %s3l = shufflevector <8 x i32> %bxx, <8 x i32> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
4164 %bxs = add <4 x i32> %s3h, %s3l
4165 %byy = zext <8 x i16> %by to <8 x i32>
4166 %s4h = shufflevector <8 x i32> %byy, <8 x i32> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
4167 %s4l = shufflevector <8 x i32> %byy, <8 x i32> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
4168 %bys = add <4 x i32> %s4h, %s4l
4169 %bz = add <4 x i32> %bxs, %bys
4170 %z = add <4 x i32> %az, %bz
4171 %z2 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %z)
4175 define i64 @add_pair_v2i64_v2i64(<2 x i64> %x, <2 x i64> %y) {
4176 ; CHECK-BASE-LABEL: add_pair_v2i64_v2i64:
4177 ; CHECK-BASE: // %bb.0: // %entry
4178 ; CHECK-BASE-NEXT: add v0.2d, v0.2d, v1.2d
4179 ; CHECK-BASE-NEXT: addp d0, v0.2d
4180 ; CHECK-BASE-NEXT: fmov x0, d0
4181 ; CHECK-BASE-NEXT: ret
4183 ; CHECK-DOT-LABEL: add_pair_v2i64_v2i64:
4184 ; CHECK-DOT: // %bb.0: // %entry
4185 ; CHECK-DOT-NEXT: add v0.2d, v0.2d, v1.2d
4186 ; CHECK-DOT-NEXT: addp d0, v0.2d
4187 ; CHECK-DOT-NEXT: fmov x0, d0
4188 ; CHECK-DOT-NEXT: ret
4190 ; CHECK-GI-LABEL: add_pair_v2i64_v2i64:
4191 ; CHECK-GI: // %bb.0: // %entry
4192 ; CHECK-GI-NEXT: addp d0, v0.2d
4193 ; CHECK-GI-NEXT: addp d1, v1.2d
4194 ; CHECK-GI-NEXT: fmov x8, d0
4195 ; CHECK-GI-NEXT: fmov x9, d1
4196 ; CHECK-GI-NEXT: add x0, x8, x9
4197 ; CHECK-GI-NEXT: ret
4199 %z1 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %x)
4200 %z2 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %y)
4201 %z = add i64 %z1, %z2
4205 define i32 @full(ptr %p1, i32 noundef %s1, ptr %p2, i32 noundef %s2) {
4206 ; CHECK-BASE-LABEL: full:
4207 ; CHECK-BASE: // %bb.0: // %entry
4208 ; CHECK-BASE-NEXT: ldr d0, [x2]
4209 ; CHECK-BASE-NEXT: ldr d1, [x0]
4210 ; CHECK-BASE-NEXT: // kill: def $w3 killed $w3 def $x3
4211 ; CHECK-BASE-NEXT: // kill: def $w1 killed $w1 def $x1
4212 ; CHECK-BASE-NEXT: sxtw x8, w3
4213 ; CHECK-BASE-NEXT: sxtw x9, w1
4214 ; CHECK-BASE-NEXT: uabdl v0.8h, v1.8b, v0.8b
4215 ; CHECK-BASE-NEXT: add x11, x2, x8
4216 ; CHECK-BASE-NEXT: add x10, x0, x9
4217 ; CHECK-BASE-NEXT: ldr d2, [x11]
4218 ; CHECK-BASE-NEXT: add x11, x11, x8
4219 ; CHECK-BASE-NEXT: ldr d1, [x10]
4220 ; CHECK-BASE-NEXT: add x10, x10, x9
4221 ; CHECK-BASE-NEXT: uaddlp v0.4s, v0.8h
4222 ; CHECK-BASE-NEXT: uabdl v1.8h, v1.8b, v2.8b
4223 ; CHECK-BASE-NEXT: ldr d2, [x11]
4224 ; CHECK-BASE-NEXT: add x11, x11, x8
4225 ; CHECK-BASE-NEXT: uadalp v0.4s, v1.8h
4226 ; CHECK-BASE-NEXT: ldr d1, [x10]
4227 ; CHECK-BASE-NEXT: add x10, x10, x9
4228 ; CHECK-BASE-NEXT: uabdl v1.8h, v1.8b, v2.8b
4229 ; CHECK-BASE-NEXT: ldr d2, [x11]
4230 ; CHECK-BASE-NEXT: add x11, x11, x8
4231 ; CHECK-BASE-NEXT: uadalp v0.4s, v1.8h
4232 ; CHECK-BASE-NEXT: ldr d1, [x10]
4233 ; CHECK-BASE-NEXT: add x10, x10, x9
4234 ; CHECK-BASE-NEXT: uabdl v1.8h, v1.8b, v2.8b
4235 ; CHECK-BASE-NEXT: ldr d2, [x11]
4236 ; CHECK-BASE-NEXT: add x11, x11, x8
4237 ; CHECK-BASE-NEXT: uadalp v0.4s, v1.8h
4238 ; CHECK-BASE-NEXT: ldr d1, [x10]
4239 ; CHECK-BASE-NEXT: add x10, x10, x9
4240 ; CHECK-BASE-NEXT: uabdl v1.8h, v1.8b, v2.8b
4241 ; CHECK-BASE-NEXT: ldr d2, [x11]
4242 ; CHECK-BASE-NEXT: add x11, x11, x8
4243 ; CHECK-BASE-NEXT: uadalp v0.4s, v1.8h
4244 ; CHECK-BASE-NEXT: ldr d1, [x10]
4245 ; CHECK-BASE-NEXT: add x10, x10, x9
4246 ; CHECK-BASE-NEXT: uabdl v1.8h, v1.8b, v2.8b
4247 ; CHECK-BASE-NEXT: ldr d2, [x11]
4248 ; CHECK-BASE-NEXT: uadalp v0.4s, v1.8h
4249 ; CHECK-BASE-NEXT: ldr d1, [x10]
4250 ; CHECK-BASE-NEXT: uabdl v1.8h, v1.8b, v2.8b
4251 ; CHECK-BASE-NEXT: ldr d2, [x11, x8]
4252 ; CHECK-BASE-NEXT: uadalp v0.4s, v1.8h
4253 ; CHECK-BASE-NEXT: ldr d1, [x10, x9]
4254 ; CHECK-BASE-NEXT: uabdl v1.8h, v1.8b, v2.8b
4255 ; CHECK-BASE-NEXT: uadalp v0.4s, v1.8h
4256 ; CHECK-BASE-NEXT: addv s0, v0.4s
4257 ; CHECK-BASE-NEXT: fmov w0, s0
4258 ; CHECK-BASE-NEXT: ret
4260 ; CHECK-DOT-LABEL: full:
4261 ; CHECK-DOT: // %bb.0: // %entry
4262 ; CHECK-DOT-NEXT: ldr d0, [x0]
4263 ; CHECK-DOT-NEXT: ldr d1, [x2]
4264 ; CHECK-DOT-NEXT: // kill: def $w3 killed $w3 def $x3
4265 ; CHECK-DOT-NEXT: // kill: def $w1 killed $w1 def $x1
4266 ; CHECK-DOT-NEXT: sxtw x8, w3
4267 ; CHECK-DOT-NEXT: sxtw x9, w1
4268 ; CHECK-DOT-NEXT: movi v2.2d, #0000000000000000
4269 ; CHECK-DOT-NEXT: movi v3.8b, #1
4270 ; CHECK-DOT-NEXT: uabd v0.8b, v0.8b, v1.8b
4271 ; CHECK-DOT-NEXT: add x11, x2, x8
4272 ; CHECK-DOT-NEXT: add x10, x0, x9
4273 ; CHECK-DOT-NEXT: ldr d4, [x11]
4274 ; CHECK-DOT-NEXT: add x11, x11, x8
4275 ; CHECK-DOT-NEXT: ldr d1, [x10]
4276 ; CHECK-DOT-NEXT: add x10, x10, x9
4277 ; CHECK-DOT-NEXT: udot v2.2s, v0.8b, v3.8b
4278 ; CHECK-DOT-NEXT: uabd v0.8b, v1.8b, v4.8b
4279 ; CHECK-DOT-NEXT: ldr d1, [x10]
4280 ; CHECK-DOT-NEXT: ldr d4, [x11]
4281 ; CHECK-DOT-NEXT: add x10, x10, x9
4282 ; CHECK-DOT-NEXT: add x11, x11, x8
4283 ; CHECK-DOT-NEXT: udot v2.2s, v0.8b, v3.8b
4284 ; CHECK-DOT-NEXT: uabd v0.8b, v1.8b, v4.8b
4285 ; CHECK-DOT-NEXT: ldr d1, [x10]
4286 ; CHECK-DOT-NEXT: ldr d4, [x11]
4287 ; CHECK-DOT-NEXT: add x10, x10, x9
4288 ; CHECK-DOT-NEXT: add x11, x11, x8
4289 ; CHECK-DOT-NEXT: udot v2.2s, v0.8b, v3.8b
4290 ; CHECK-DOT-NEXT: uabd v0.8b, v1.8b, v4.8b
4291 ; CHECK-DOT-NEXT: ldr d1, [x10]
4292 ; CHECK-DOT-NEXT: ldr d4, [x11]
4293 ; CHECK-DOT-NEXT: add x10, x10, x9
4294 ; CHECK-DOT-NEXT: add x11, x11, x8
4295 ; CHECK-DOT-NEXT: udot v2.2s, v0.8b, v3.8b
4296 ; CHECK-DOT-NEXT: uabd v0.8b, v1.8b, v4.8b
4297 ; CHECK-DOT-NEXT: ldr d1, [x10]
4298 ; CHECK-DOT-NEXT: ldr d4, [x11]
4299 ; CHECK-DOT-NEXT: add x10, x10, x9
4300 ; CHECK-DOT-NEXT: add x11, x11, x8
4301 ; CHECK-DOT-NEXT: udot v2.2s, v0.8b, v3.8b
4302 ; CHECK-DOT-NEXT: uabd v0.8b, v1.8b, v4.8b
4303 ; CHECK-DOT-NEXT: ldr d1, [x10]
4304 ; CHECK-DOT-NEXT: ldr d4, [x11]
4305 ; CHECK-DOT-NEXT: udot v2.2s, v0.8b, v3.8b
4306 ; CHECK-DOT-NEXT: uabd v0.8b, v1.8b, v4.8b
4307 ; CHECK-DOT-NEXT: ldr d1, [x10, x9]
4308 ; CHECK-DOT-NEXT: ldr d4, [x11, x8]
4309 ; CHECK-DOT-NEXT: udot v2.2s, v0.8b, v3.8b
4310 ; CHECK-DOT-NEXT: uabd v0.8b, v1.8b, v4.8b
4311 ; CHECK-DOT-NEXT: udot v2.2s, v0.8b, v3.8b
4312 ; CHECK-DOT-NEXT: addp v0.2s, v2.2s, v2.2s
4313 ; CHECK-DOT-NEXT: fmov w0, s0
4314 ; CHECK-DOT-NEXT: ret
4316 ; CHECK-GI-LABEL: full:
4317 ; CHECK-GI: // %bb.0: // %entry
4318 ; CHECK-GI-NEXT: ldr d0, [x0]
4319 ; CHECK-GI-NEXT: ldr d1, [x2]
4320 ; CHECK-GI-NEXT: // kill: def $w3 killed $w3 def $x3
4321 ; CHECK-GI-NEXT: // kill: def $w1 killed $w1 def $x1
4322 ; CHECK-GI-NEXT: sxtw x8, w3
4323 ; CHECK-GI-NEXT: sxtw x9, w1
4324 ; CHECK-GI-NEXT: movi v2.2d, #0000000000000000
4325 ; CHECK-GI-NEXT: movi v3.8b, #1
4326 ; CHECK-GI-NEXT: uabd v0.8b, v0.8b, v1.8b
4327 ; CHECK-GI-NEXT: add x11, x2, x8
4328 ; CHECK-GI-NEXT: add x10, x0, x9
4329 ; CHECK-GI-NEXT: ldr d4, [x11]
4330 ; CHECK-GI-NEXT: add x11, x11, x8
4331 ; CHECK-GI-NEXT: ldr d1, [x10]
4332 ; CHECK-GI-NEXT: add x10, x10, x9
4333 ; CHECK-GI-NEXT: udot v2.2s, v0.8b, v3.8b
4334 ; CHECK-GI-NEXT: uabd v0.8b, v1.8b, v4.8b
4335 ; CHECK-GI-NEXT: ldr d1, [x10]
4336 ; CHECK-GI-NEXT: ldr d4, [x11]
4337 ; CHECK-GI-NEXT: add x10, x10, x9
4338 ; CHECK-GI-NEXT: add x11, x11, x8
4339 ; CHECK-GI-NEXT: udot v2.2s, v0.8b, v3.8b
4340 ; CHECK-GI-NEXT: uabd v0.8b, v1.8b, v4.8b
4341 ; CHECK-GI-NEXT: ldr d1, [x10]
4342 ; CHECK-GI-NEXT: ldr d4, [x11]
4343 ; CHECK-GI-NEXT: add x10, x10, x9
4344 ; CHECK-GI-NEXT: add x11, x11, x8
4345 ; CHECK-GI-NEXT: udot v2.2s, v0.8b, v3.8b
4346 ; CHECK-GI-NEXT: uabd v0.8b, v1.8b, v4.8b
4347 ; CHECK-GI-NEXT: ldr d1, [x10]
4348 ; CHECK-GI-NEXT: ldr d4, [x11]
4349 ; CHECK-GI-NEXT: add x10, x10, x9
4350 ; CHECK-GI-NEXT: add x11, x11, x8
4351 ; CHECK-GI-NEXT: udot v2.2s, v0.8b, v3.8b
4352 ; CHECK-GI-NEXT: uabd v0.8b, v1.8b, v4.8b
4353 ; CHECK-GI-NEXT: ldr d1, [x10]
4354 ; CHECK-GI-NEXT: ldr d4, [x11]
4355 ; CHECK-GI-NEXT: add x10, x10, x9
4356 ; CHECK-GI-NEXT: add x11, x11, x8
4357 ; CHECK-GI-NEXT: udot v2.2s, v0.8b, v3.8b
4358 ; CHECK-GI-NEXT: uabd v0.8b, v1.8b, v4.8b
4359 ; CHECK-GI-NEXT: ldr d1, [x10]
4360 ; CHECK-GI-NEXT: ldr d4, [x11]
4361 ; CHECK-GI-NEXT: udot v2.2s, v0.8b, v3.8b
4362 ; CHECK-GI-NEXT: uabd v0.8b, v1.8b, v4.8b
4363 ; CHECK-GI-NEXT: ldr d1, [x10, x9]
4364 ; CHECK-GI-NEXT: ldr d4, [x11, x8]
4365 ; CHECK-GI-NEXT: udot v2.2s, v0.8b, v3.8b
4366 ; CHECK-GI-NEXT: uabd v0.8b, v1.8b, v4.8b
4367 ; CHECK-GI-NEXT: udot v2.2s, v0.8b, v3.8b
4368 ; CHECK-GI-NEXT: addp v0.2s, v2.2s, v2.2s
4369 ; CHECK-GI-NEXT: fmov w0, s0
4370 ; CHECK-GI-NEXT: ret
4372 %idx.ext8 = sext i32 %s2 to i64
4373 %idx.ext = sext i32 %s1 to i64
4374 %0 = load <8 x i8>, ptr %p1, align 1
4375 %1 = zext <8 x i8> %0 to <8 x i32>
4376 %2 = load <8 x i8>, ptr %p2, align 1
4377 %3 = zext <8 x i8> %2 to <8 x i32>
4378 %4 = sub nsw <8 x i32> %1, %3
4379 %5 = tail call <8 x i32> @llvm.abs.v8i32(<8 x i32> %4, i1 true)
4380 %6 = tail call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %5)
4381 %add.ptr = getelementptr inbounds i8, ptr %p1, i64 %idx.ext
4382 %add.ptr9 = getelementptr inbounds i8, ptr %p2, i64 %idx.ext8
4383 %7 = load <8 x i8>, ptr %add.ptr, align 1
4384 %8 = zext <8 x i8> %7 to <8 x i32>
4385 %9 = load <8 x i8>, ptr %add.ptr9, align 1
4386 %10 = zext <8 x i8> %9 to <8 x i32>
4387 %11 = sub nsw <8 x i32> %8, %10
4388 %12 = tail call <8 x i32> @llvm.abs.v8i32(<8 x i32> %11, i1 true)
4389 %13 = tail call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %12)
4390 %op.rdx.1 = add i32 %13, %6
4391 %add.ptr.1 = getelementptr inbounds i8, ptr %add.ptr, i64 %idx.ext
4392 %add.ptr9.1 = getelementptr inbounds i8, ptr %add.ptr9, i64 %idx.ext8
4393 %14 = load <8 x i8>, ptr %add.ptr.1, align 1
4394 %15 = zext <8 x i8> %14 to <8 x i32>
4395 %16 = load <8 x i8>, ptr %add.ptr9.1, align 1
4396 %17 = zext <8 x i8> %16 to <8 x i32>
4397 %18 = sub nsw <8 x i32> %15, %17
4398 %19 = tail call <8 x i32> @llvm.abs.v8i32(<8 x i32> %18, i1 true)
4399 %20 = tail call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %19)
4400 %op.rdx.2 = add i32 %20, %op.rdx.1
4401 %add.ptr.2 = getelementptr inbounds i8, ptr %add.ptr.1, i64 %idx.ext
4402 %add.ptr9.2 = getelementptr inbounds i8, ptr %add.ptr9.1, i64 %idx.ext8
4403 %21 = load <8 x i8>, ptr %add.ptr.2, align 1
4404 %22 = zext <8 x i8> %21 to <8 x i32>
4405 %23 = load <8 x i8>, ptr %add.ptr9.2, align 1
4406 %24 = zext <8 x i8> %23 to <8 x i32>
4407 %25 = sub nsw <8 x i32> %22, %24
4408 %26 = tail call <8 x i32> @llvm.abs.v8i32(<8 x i32> %25, i1 true)
4409 %27 = tail call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %26)
4410 %op.rdx.3 = add i32 %27, %op.rdx.2
4411 %add.ptr.3 = getelementptr inbounds i8, ptr %add.ptr.2, i64 %idx.ext
4412 %add.ptr9.3 = getelementptr inbounds i8, ptr %add.ptr9.2, i64 %idx.ext8
4413 %28 = load <8 x i8>, ptr %add.ptr.3, align 1
4414 %29 = zext <8 x i8> %28 to <8 x i32>
4415 %30 = load <8 x i8>, ptr %add.ptr9.3, align 1
4416 %31 = zext <8 x i8> %30 to <8 x i32>
4417 %32 = sub nsw <8 x i32> %29, %31
4418 %33 = tail call <8 x i32> @llvm.abs.v8i32(<8 x i32> %32, i1 true)
4419 %34 = tail call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %33)
4420 %op.rdx.4 = add i32 %34, %op.rdx.3
4421 %add.ptr.4 = getelementptr inbounds i8, ptr %add.ptr.3, i64 %idx.ext
4422 %add.ptr9.4 = getelementptr inbounds i8, ptr %add.ptr9.3, i64 %idx.ext8
4423 %35 = load <8 x i8>, ptr %add.ptr.4, align 1
4424 %36 = zext <8 x i8> %35 to <8 x i32>
4425 %37 = load <8 x i8>, ptr %add.ptr9.4, align 1
4426 %38 = zext <8 x i8> %37 to <8 x i32>
4427 %39 = sub nsw <8 x i32> %36, %38
4428 %40 = tail call <8 x i32> @llvm.abs.v8i32(<8 x i32> %39, i1 true)
4429 %41 = tail call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %40)
4430 %op.rdx.5 = add i32 %41, %op.rdx.4
4431 %add.ptr.5 = getelementptr inbounds i8, ptr %add.ptr.4, i64 %idx.ext
4432 %add.ptr9.5 = getelementptr inbounds i8, ptr %add.ptr9.4, i64 %idx.ext8
4433 %42 = load <8 x i8>, ptr %add.ptr.5, align 1
4434 %43 = zext <8 x i8> %42 to <8 x i32>
4435 %44 = load <8 x i8>, ptr %add.ptr9.5, align 1
4436 %45 = zext <8 x i8> %44 to <8 x i32>
4437 %46 = sub nsw <8 x i32> %43, %45
4438 %47 = tail call <8 x i32> @llvm.abs.v8i32(<8 x i32> %46, i1 true)
4439 %48 = tail call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %47)
4440 %op.rdx.6 = add i32 %48, %op.rdx.5
4441 %add.ptr.6 = getelementptr inbounds i8, ptr %add.ptr.5, i64 %idx.ext
4442 %add.ptr9.6 = getelementptr inbounds i8, ptr %add.ptr9.5, i64 %idx.ext8
4443 %49 = load <8 x i8>, ptr %add.ptr.6, align 1
4444 %50 = zext <8 x i8> %49 to <8 x i32>
4445 %51 = load <8 x i8>, ptr %add.ptr9.6, align 1
4446 %52 = zext <8 x i8> %51 to <8 x i32>
4447 %53 = sub nsw <8 x i32> %50, %52
4448 %54 = tail call <8 x i32> @llvm.abs.v8i32(<8 x i32> %53, i1 true)
4449 %55 = tail call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %54)
4450 %op.rdx.7 = add i32 %55, %op.rdx.6
4454 declare <8 x i32> @llvm.abs.v8i32(<8 x i32>, i1 immarg) #1
4455 declare i16 @llvm.vector.reduce.add.v16i16(<16 x i16>)
4456 declare i16 @llvm.vector.reduce.add.v8i16(<8 x i16>)
4457 declare i16 @llvm.vector.reduce.add.v4i16(<4 x i16>)
4458 declare i32 @llvm.vector.reduce.add.v16i32(<16 x i32>)
4459 declare i32 @llvm.vector.reduce.add.v2i32(<2 x i32>)
4460 declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>)
4461 declare i32 @llvm.vector.reduce.add.v8i32(<8 x i32>)
4462 declare i64 @llvm.vector.reduce.add.v16i64(<16 x i64>)
4463 declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>)
4464 declare i64 @llvm.vector.reduce.add.v4i64(<4 x i64>)
4465 declare i64 @llvm.vector.reduce.add.v8i64(<8 x i64>)
4466 declare i8 @llvm.vector.reduce.add.v16i8(<16 x i8>)
4467 declare i8 @llvm.vector.reduce.add.v8i8(<8 x i8>)