1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
6 define i1 @reduce_and_nxv16i1(<vscale x 16 x i1> %vec) {
7 ; CHECK-LABEL: reduce_and_nxv16i1:
9 ; CHECK-NEXT: ptrue p1.b
10 ; CHECK-NEXT: nots p0.b, p1/z, p0.b
11 ; CHECK-NEXT: cset w0, eq
13 %res = call i1 @llvm.vector.reduce.and.i1.nxv16i1(<vscale x 16 x i1> %vec)
17 define i1 @reduce_and_nxv8i1(<vscale x 8 x i1> %vec) {
18 ; CHECK-LABEL: reduce_and_nxv8i1:
20 ; CHECK-NEXT: ptrue p1.h
21 ; CHECK-NEXT: nots p0.b, p1/z, p0.b
22 ; CHECK-NEXT: cset w0, eq
24 %res = call i1 @llvm.vector.reduce.and.i1.nxv8i1(<vscale x 8 x i1> %vec)
28 define i1 @reduce_and_nxv4i1(<vscale x 4 x i1> %vec) {
29 ; CHECK-LABEL: reduce_and_nxv4i1:
31 ; CHECK-NEXT: ptrue p1.s
32 ; CHECK-NEXT: nots p0.b, p1/z, p0.b
33 ; CHECK-NEXT: cset w0, eq
35 %res = call i1 @llvm.vector.reduce.and.i1.nxv4i1(<vscale x 4 x i1> %vec)
39 define i1 @reduce_and_nxv2i1(<vscale x 2 x i1> %vec) {
40 ; CHECK-LABEL: reduce_and_nxv2i1:
42 ; CHECK-NEXT: ptrue p1.d
43 ; CHECK-NEXT: nots p0.b, p1/z, p0.b
44 ; CHECK-NEXT: cset w0, eq
46 %res = call i1 @llvm.vector.reduce.and.i1.nxv2i1(<vscale x 2 x i1> %vec)
50 define i1 @reduce_and_nxv1i1(<vscale x 1 x i1> %vec) {
51 ; CHECK-LABEL: reduce_and_nxv1i1:
53 ; CHECK-NEXT: ptrue p1.d
54 ; CHECK-NEXT: punpklo p2.h, p1.b
55 ; CHECK-NEXT: eor p0.b, p1/z, p0.b, p2.b
56 ; CHECK-NEXT: ptest p2, p0.b
57 ; CHECK-NEXT: cset w0, eq
59 %res = call i1 @llvm.vector.reduce.and.i1.nxv1i1(<vscale x 1 x i1> %vec)
65 define i1 @reduce_or_nxv16i1(<vscale x 16 x i1> %vec) {
66 ; CHECK-LABEL: reduce_or_nxv16i1:
68 ; CHECK-NEXT: ptest p0, p0.b
69 ; CHECK-NEXT: cset w0, ne
71 %res = call i1 @llvm.vector.reduce.or.i1.nxv16i1(<vscale x 16 x i1> %vec)
75 define i1 @reduce_or_nxv8i1(<vscale x 8 x i1> %vec) {
76 ; CHECK-LABEL: reduce_or_nxv8i1:
78 ; CHECK-NEXT: ptrue p1.h
79 ; CHECK-NEXT: ptest p1, p0.b
80 ; CHECK-NEXT: cset w0, ne
82 %res = call i1 @llvm.vector.reduce.or.i1.nxv8i1(<vscale x 8 x i1> %vec)
86 define i1 @reduce_or_nxv4i1(<vscale x 4 x i1> %vec) {
87 ; CHECK-LABEL: reduce_or_nxv4i1:
89 ; CHECK-NEXT: ptrue p1.s
90 ; CHECK-NEXT: ptest p1, p0.b
91 ; CHECK-NEXT: cset w0, ne
93 %res = call i1 @llvm.vector.reduce.or.i1.nxv4i1(<vscale x 4 x i1> %vec)
97 define i1 @reduce_or_nxv2i1(<vscale x 2 x i1> %vec) {
98 ; CHECK-LABEL: reduce_or_nxv2i1:
100 ; CHECK-NEXT: ptrue p1.d
101 ; CHECK-NEXT: ptest p1, p0.b
102 ; CHECK-NEXT: cset w0, ne
104 %res = call i1 @llvm.vector.reduce.or.i1.nxv2i1(<vscale x 2 x i1> %vec)
108 define i1 @reduce_or_nxv1i1(<vscale x 1 x i1> %vec) {
109 ; CHECK-LABEL: reduce_or_nxv1i1:
111 ; CHECK-NEXT: ptrue p1.d
112 ; CHECK-NEXT: punpklo p1.h, p1.b
113 ; CHECK-NEXT: ptest p1, p0.b
114 ; CHECK-NEXT: cset w0, ne
116 %res = call i1 @llvm.vector.reduce.or.i1.nxv1i1(<vscale x 1 x i1> %vec)
122 define i1 @reduce_xor_nxv16i1(<vscale x 16 x i1> %vec) {
123 ; CHECK-LABEL: reduce_xor_nxv16i1:
125 ; CHECK-NEXT: ptrue p1.b
126 ; CHECK-NEXT: cntp x8, p1, p0.b
127 ; CHECK-NEXT: and w0, w8, #0x1
129 %res = call i1 @llvm.vector.reduce.xor.i1.nxv16i1(<vscale x 16 x i1> %vec)
133 define i1 @reduce_xor_nxv8i1(<vscale x 8 x i1> %vec) {
134 ; CHECK-LABEL: reduce_xor_nxv8i1:
136 ; CHECK-NEXT: ptrue p1.h
137 ; CHECK-NEXT: cntp x8, p1, p0.h
138 ; CHECK-NEXT: and w0, w8, #0x1
140 %res = call i1 @llvm.vector.reduce.xor.i1.nxv8i1(<vscale x 8 x i1> %vec)
144 define i1 @reduce_xor_nxv4i1(<vscale x 4 x i1> %vec) {
145 ; CHECK-LABEL: reduce_xor_nxv4i1:
147 ; CHECK-NEXT: ptrue p1.s
148 ; CHECK-NEXT: cntp x8, p1, p0.s
149 ; CHECK-NEXT: and w0, w8, #0x1
151 %res = call i1 @llvm.vector.reduce.xor.i1.nxv4i1(<vscale x 4 x i1> %vec)
155 define i1 @reduce_xor_nxv2i1(<vscale x 2 x i1> %vec) {
156 ; CHECK-LABEL: reduce_xor_nxv2i1:
158 ; CHECK-NEXT: ptrue p1.d
159 ; CHECK-NEXT: cntp x8, p1, p0.d
160 ; CHECK-NEXT: and w0, w8, #0x1
162 %res = call i1 @llvm.vector.reduce.xor.i1.nxv2i1(<vscale x 2 x i1> %vec)
166 define i1 @reduce_xor_nxv1i1(<vscale x 1 x i1> %vec) {
167 ; CHECK-LABEL: reduce_xor_nxv1i1:
169 ; CHECK-NEXT: ptrue p1.d
170 ; CHECK-NEXT: punpklo p1.h, p1.b
171 ; CHECK-NEXT: cntp x8, p1, p0.d
172 ; CHECK-NEXT: and w0, w8, #0x1
174 %res = call i1 @llvm.vector.reduce.xor.i1.nxv1i1(<vscale x 1 x i1> %vec)
180 define i1 @reduce_smax_nxv16i1(<vscale x 16 x i1> %vec) {
181 ; CHECK-LABEL: reduce_smax_nxv16i1:
183 ; CHECK-NEXT: ptrue p1.b
184 ; CHECK-NEXT: nots p0.b, p1/z, p0.b
185 ; CHECK-NEXT: cset w0, eq
187 %res = call i1 @llvm.vector.reduce.smax.i1.nxv16i1(<vscale x 16 x i1> %vec)
191 define i1 @reduce_smax_nxv8i1(<vscale x 8 x i1> %vec) {
192 ; CHECK-LABEL: reduce_smax_nxv8i1:
194 ; CHECK-NEXT: ptrue p1.h
195 ; CHECK-NEXT: nots p0.b, p1/z, p0.b
196 ; CHECK-NEXT: cset w0, eq
198 %res = call i1 @llvm.vector.reduce.smax.i1.nxv8i1(<vscale x 8 x i1> %vec)
202 define i1 @reduce_smax_nxv4i1(<vscale x 4 x i1> %vec) {
203 ; CHECK-LABEL: reduce_smax_nxv4i1:
205 ; CHECK-NEXT: ptrue p1.s
206 ; CHECK-NEXT: nots p0.b, p1/z, p0.b
207 ; CHECK-NEXT: cset w0, eq
209 %res = call i1 @llvm.vector.reduce.smax.i1.nxv4i1(<vscale x 4 x i1> %vec)
213 define i1 @reduce_smax_nxv2i1(<vscale x 2 x i1> %vec) {
214 ; CHECK-LABEL: reduce_smax_nxv2i1:
216 ; CHECK-NEXT: ptrue p1.d
217 ; CHECK-NEXT: nots p0.b, p1/z, p0.b
218 ; CHECK-NEXT: cset w0, eq
220 %res = call i1 @llvm.vector.reduce.smax.i1.nxv2i1(<vscale x 2 x i1> %vec)
224 define i1 @reduce_smax_nxv1i1(<vscale x 1 x i1> %vec) {
225 ; CHECK-LABEL: reduce_smax_nxv1i1:
227 ; CHECK-NEXT: ptrue p1.d
228 ; CHECK-NEXT: punpklo p2.h, p1.b
229 ; CHECK-NEXT: eor p0.b, p1/z, p0.b, p2.b
230 ; CHECK-NEXT: ptest p2, p0.b
231 ; CHECK-NEXT: cset w0, eq
233 %res = call i1 @llvm.vector.reduce.smax.i1.nxv1i1(<vscale x 1 x i1> %vec)
239 define i1 @reduce_smin_nxv16i1(<vscale x 16 x i1> %vec) {
240 ; CHECK-LABEL: reduce_smin_nxv16i1:
242 ; CHECK-NEXT: ptest p0, p0.b
243 ; CHECK-NEXT: cset w0, ne
245 %res = call i1 @llvm.vector.reduce.smin.i1.nxv16i1(<vscale x 16 x i1> %vec)
249 define i1 @reduce_smin_nxv8i1(<vscale x 8 x i1> %vec) {
250 ; CHECK-LABEL: reduce_smin_nxv8i1:
252 ; CHECK-NEXT: ptrue p1.h
253 ; CHECK-NEXT: ptest p1, p0.b
254 ; CHECK-NEXT: cset w0, ne
256 %res = call i1 @llvm.vector.reduce.smin.i1.nxv8i1(<vscale x 8 x i1> %vec)
260 define i1 @reduce_smin_nxv4i1(<vscale x 4 x i1> %vec) {
261 ; CHECK-LABEL: reduce_smin_nxv4i1:
263 ; CHECK-NEXT: ptrue p1.s
264 ; CHECK-NEXT: ptest p1, p0.b
265 ; CHECK-NEXT: cset w0, ne
267 %res = call i1 @llvm.vector.reduce.smin.i1.nxv4i1(<vscale x 4 x i1> %vec)
271 define i1 @reduce_smin_nxv2i1(<vscale x 2 x i1> %vec) {
272 ; CHECK-LABEL: reduce_smin_nxv2i1:
274 ; CHECK-NEXT: ptrue p1.d
275 ; CHECK-NEXT: ptest p1, p0.b
276 ; CHECK-NEXT: cset w0, ne
278 %res = call i1 @llvm.vector.reduce.smin.i1.nxv2i1(<vscale x 2 x i1> %vec)
282 define i1 @reduce_smin_nxv1i1(<vscale x 1 x i1> %vec) {
283 ; CHECK-LABEL: reduce_smin_nxv1i1:
285 ; CHECK-NEXT: ptrue p1.d
286 ; CHECK-NEXT: punpklo p1.h, p1.b
287 ; CHECK-NEXT: ptest p1, p0.b
288 ; CHECK-NEXT: cset w0, ne
290 %res = call i1 @llvm.vector.reduce.smin.i1.nxv1i1(<vscale x 1 x i1> %vec)
296 define i1 @reduce_umax_nxv16i1(<vscale x 16 x i1> %vec) {
297 ; CHECK-LABEL: reduce_umax_nxv16i1:
299 ; CHECK-NEXT: ptest p0, p0.b
300 ; CHECK-NEXT: cset w0, ne
302 %res = call i1 @llvm.vector.reduce.umax.i1.nxv16i1(<vscale x 16 x i1> %vec)
306 define i1 @reduce_umax_nxv8i1(<vscale x 8 x i1> %vec) {
307 ; CHECK-LABEL: reduce_umax_nxv8i1:
309 ; CHECK-NEXT: ptrue p1.h
310 ; CHECK-NEXT: ptest p1, p0.b
311 ; CHECK-NEXT: cset w0, ne
313 %res = call i1 @llvm.vector.reduce.umax.i1.nxv8i1(<vscale x 8 x i1> %vec)
317 define i1 @reduce_umax_nxv4i1(<vscale x 4 x i1> %vec) {
318 ; CHECK-LABEL: reduce_umax_nxv4i1:
320 ; CHECK-NEXT: ptrue p1.s
321 ; CHECK-NEXT: ptest p1, p0.b
322 ; CHECK-NEXT: cset w0, ne
324 %res = call i1 @llvm.vector.reduce.umax.i1.nxv4i1(<vscale x 4 x i1> %vec)
328 define i1 @reduce_umax_nxv2i1(<vscale x 2 x i1> %vec) {
329 ; CHECK-LABEL: reduce_umax_nxv2i1:
331 ; CHECK-NEXT: ptrue p1.d
332 ; CHECK-NEXT: ptest p1, p0.b
333 ; CHECK-NEXT: cset w0, ne
335 %res = call i1 @llvm.vector.reduce.umax.i1.nxv2i1(<vscale x 2 x i1> %vec)
339 define i1 @reduce_umax_nxv1i1(<vscale x 1 x i1> %vec) {
340 ; CHECK-LABEL: reduce_umax_nxv1i1:
342 ; CHECK-NEXT: ptrue p1.d
343 ; CHECK-NEXT: punpklo p1.h, p1.b
344 ; CHECK-NEXT: ptest p1, p0.b
345 ; CHECK-NEXT: cset w0, ne
347 %res = call i1 @llvm.vector.reduce.umax.i1.nxv1i1(<vscale x 1 x i1> %vec)
353 define i1 @reduce_umin_nxv16i1(<vscale x 16 x i1> %vec) {
354 ; CHECK-LABEL: reduce_umin_nxv16i1:
356 ; CHECK-NEXT: ptrue p1.b
357 ; CHECK-NEXT: nots p0.b, p1/z, p0.b
358 ; CHECK-NEXT: cset w0, eq
360 %res = call i1 @llvm.vector.reduce.umin.i1.nxv16i1(<vscale x 16 x i1> %vec)
364 define i1 @reduce_umin_nxv8i1(<vscale x 8 x i1> %vec) {
365 ; CHECK-LABEL: reduce_umin_nxv8i1:
367 ; CHECK-NEXT: ptrue p1.h
368 ; CHECK-NEXT: nots p0.b, p1/z, p0.b
369 ; CHECK-NEXT: cset w0, eq
371 %res = call i1 @llvm.vector.reduce.umin.i1.nxv8i1(<vscale x 8 x i1> %vec)
375 define i1 @reduce_umin_nxv4i1(<vscale x 4 x i1> %vec) {
376 ; CHECK-LABEL: reduce_umin_nxv4i1:
378 ; CHECK-NEXT: ptrue p1.s
379 ; CHECK-NEXT: nots p0.b, p1/z, p0.b
380 ; CHECK-NEXT: cset w0, eq
382 %res = call i1 @llvm.vector.reduce.umin.i1.nxv4i1(<vscale x 4 x i1> %vec)
386 define i1 @reduce_umin_nxv1i1(<vscale x 1 x i1> %vec) {
387 ; CHECK-LABEL: reduce_umin_nxv1i1:
389 ; CHECK-NEXT: ptrue p1.d
390 ; CHECK-NEXT: punpklo p2.h, p1.b
391 ; CHECK-NEXT: eor p0.b, p1/z, p0.b, p2.b
392 ; CHECK-NEXT: ptest p2, p0.b
393 ; CHECK-NEXT: cset w0, eq
395 %res = call i1 @llvm.vector.reduce.umin.i1.nxv1i1(<vscale x 1 x i1> %vec)
399 define i1 @reduce_umin_nxv2i1(<vscale x 2 x i1> %vec) {
400 ; CHECK-LABEL: reduce_umin_nxv2i1:
402 ; CHECK-NEXT: ptrue p1.d
403 ; CHECK-NEXT: nots p0.b, p1/z, p0.b
404 ; CHECK-NEXT: cset w0, eq
406 %res = call i1 @llvm.vector.reduce.umin.i1.nxv2i1(<vscale x 2 x i1> %vec)
410 declare i1 @llvm.vector.reduce.and.i1.nxv16i1(<vscale x 16 x i1> %vec)
411 declare i1 @llvm.vector.reduce.and.i1.nxv8i1(<vscale x 8 x i1> %vec)
412 declare i1 @llvm.vector.reduce.and.i1.nxv4i1(<vscale x 4 x i1> %vec)
413 declare i1 @llvm.vector.reduce.and.i1.nxv2i1(<vscale x 2 x i1> %vec)
414 declare i1 @llvm.vector.reduce.and.i1.nxv1i1(<vscale x 1 x i1> %vec)
416 declare i1 @llvm.vector.reduce.or.i1.nxv16i1(<vscale x 16 x i1> %vec)
417 declare i1 @llvm.vector.reduce.or.i1.nxv8i1(<vscale x 8 x i1> %vec)
418 declare i1 @llvm.vector.reduce.or.i1.nxv4i1(<vscale x 4 x i1> %vec)
419 declare i1 @llvm.vector.reduce.or.i1.nxv2i1(<vscale x 2 x i1> %vec)
420 declare i1 @llvm.vector.reduce.or.i1.nxv1i1(<vscale x 1 x i1> %vec)
422 declare i1 @llvm.vector.reduce.xor.i1.nxv16i1(<vscale x 16 x i1> %vec)
423 declare i1 @llvm.vector.reduce.xor.i1.nxv8i1(<vscale x 8 x i1> %vec)
424 declare i1 @llvm.vector.reduce.xor.i1.nxv4i1(<vscale x 4 x i1> %vec)
425 declare i1 @llvm.vector.reduce.xor.i1.nxv2i1(<vscale x 2 x i1> %vec)
426 declare i1 @llvm.vector.reduce.xor.i1.nxv1i1(<vscale x 1 x i1> %vec)
428 declare i1 @llvm.vector.reduce.smin.i1.nxv16i1(<vscale x 16 x i1> %vec)
429 declare i1 @llvm.vector.reduce.smin.i1.nxv8i1(<vscale x 8 x i1> %vec)
430 declare i1 @llvm.vector.reduce.smin.i1.nxv4i1(<vscale x 4 x i1> %vec)
431 declare i1 @llvm.vector.reduce.smin.i1.nxv2i1(<vscale x 2 x i1> %vec)
432 declare i1 @llvm.vector.reduce.smin.i1.nxv1i1(<vscale x 1 x i1> %vec)
434 declare i1 @llvm.vector.reduce.smax.i1.nxv16i1(<vscale x 16 x i1> %vec)
435 declare i1 @llvm.vector.reduce.smax.i1.nxv8i1(<vscale x 8 x i1> %vec)
436 declare i1 @llvm.vector.reduce.smax.i1.nxv4i1(<vscale x 4 x i1> %vec)
437 declare i1 @llvm.vector.reduce.smax.i1.nxv2i1(<vscale x 2 x i1> %vec)
438 declare i1 @llvm.vector.reduce.smax.i1.nxv1i1(<vscale x 1 x i1> %vec)
440 declare i1 @llvm.vector.reduce.umin.i1.nxv16i1(<vscale x 16 x i1> %vec)
441 declare i1 @llvm.vector.reduce.umin.i1.nxv8i1(<vscale x 8 x i1> %vec)
442 declare i1 @llvm.vector.reduce.umin.i1.nxv4i1(<vscale x 4 x i1> %vec)
443 declare i1 @llvm.vector.reduce.umin.i1.nxv2i1(<vscale x 2 x i1> %vec)
444 declare i1 @llvm.vector.reduce.umin.i1.nxv1i1(<vscale x 1 x i1> %vec)
446 declare i1 @llvm.vector.reduce.umax.i1.nxv16i1(<vscale x 16 x i1> %vec)
447 declare i1 @llvm.vector.reduce.umax.i1.nxv8i1(<vscale x 8 x i1> %vec)
448 declare i1 @llvm.vector.reduce.umax.i1.nxv4i1(<vscale x 4 x i1> %vec)
449 declare i1 @llvm.vector.reduce.umax.i1.nxv2i1(<vscale x 2 x i1> %vec)
450 declare i1 @llvm.vector.reduce.umax.i1.nxv1i1(<vscale x 1 x i1> %vec)