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: not p0.b, p1/z, p0.b
11 ; CHECK-NEXT: ptest p1, p0.b
12 ; CHECK-NEXT: cset w0, eq
14 %res = call i1 @llvm.vector.reduce.and.i1.nxv16i1(<vscale x 16 x i1> %vec)
18 define i1 @reduce_and_nxv8i1(<vscale x 8 x i1> %vec) {
19 ; CHECK-LABEL: reduce_and_nxv8i1:
21 ; CHECK-NEXT: ptrue p1.h
22 ; CHECK-NEXT: not p0.b, p1/z, p0.b
23 ; CHECK-NEXT: ptest p1, p0.b
24 ; CHECK-NEXT: cset w0, eq
26 %res = call i1 @llvm.vector.reduce.and.i1.nxv8i1(<vscale x 8 x i1> %vec)
30 define i1 @reduce_and_nxv4i1(<vscale x 4 x i1> %vec) {
31 ; CHECK-LABEL: reduce_and_nxv4i1:
33 ; CHECK-NEXT: ptrue p1.s
34 ; CHECK-NEXT: not p0.b, p1/z, p0.b
35 ; CHECK-NEXT: ptest p1, p0.b
36 ; CHECK-NEXT: cset w0, eq
38 %res = call i1 @llvm.vector.reduce.and.i1.nxv4i1(<vscale x 4 x i1> %vec)
42 define i1 @reduce_and_nxv2i1(<vscale x 2 x i1> %vec) {
43 ; CHECK-LABEL: reduce_and_nxv2i1:
45 ; CHECK-NEXT: ptrue p1.d
46 ; CHECK-NEXT: not p0.b, p1/z, p0.b
47 ; CHECK-NEXT: ptest p1, p0.b
48 ; CHECK-NEXT: cset w0, eq
50 %res = call i1 @llvm.vector.reduce.and.i1.nxv2i1(<vscale x 2 x i1> %vec)
56 define i1 @reduce_or_nxv16i1(<vscale x 16 x i1> %vec) {
57 ; CHECK-LABEL: reduce_or_nxv16i1:
59 ; CHECK-NEXT: ptrue p1.b
60 ; CHECK-NEXT: ptest p1, p0.b
61 ; CHECK-NEXT: cset w0, ne
63 %res = call i1 @llvm.vector.reduce.or.i1.nxv16i1(<vscale x 16 x i1> %vec)
67 define i1 @reduce_or_nxv8i1(<vscale x 8 x i1> %vec) {
68 ; CHECK-LABEL: reduce_or_nxv8i1:
70 ; CHECK-NEXT: ptrue p1.h
71 ; CHECK-NEXT: ptest p1, p0.b
72 ; CHECK-NEXT: cset w0, ne
74 %res = call i1 @llvm.vector.reduce.or.i1.nxv8i1(<vscale x 8 x i1> %vec)
78 define i1 @reduce_or_nxv4i1(<vscale x 4 x i1> %vec) {
79 ; CHECK-LABEL: reduce_or_nxv4i1:
81 ; CHECK-NEXT: ptrue p1.s
82 ; CHECK-NEXT: ptest p1, p0.b
83 ; CHECK-NEXT: cset w0, ne
85 %res = call i1 @llvm.vector.reduce.or.i1.nxv4i1(<vscale x 4 x i1> %vec)
89 define i1 @reduce_or_nxv2i1(<vscale x 2 x i1> %vec) {
90 ; CHECK-LABEL: reduce_or_nxv2i1:
92 ; CHECK-NEXT: ptrue p1.d
93 ; CHECK-NEXT: ptest p1, p0.b
94 ; CHECK-NEXT: cset w0, ne
96 %res = call i1 @llvm.vector.reduce.or.i1.nxv2i1(<vscale x 2 x i1> %vec)
102 define i1 @reduce_xor_nxv16i1(<vscale x 16 x i1> %vec) {
103 ; CHECK-LABEL: reduce_xor_nxv16i1:
105 ; CHECK-NEXT: ptrue p1.b
106 ; CHECK-NEXT: cntp x8, p1, p0.b
107 ; CHECK-NEXT: and w0, w8, #0x1
109 %res = call i1 @llvm.vector.reduce.xor.i1.nxv16i1(<vscale x 16 x i1> %vec)
113 define i1 @reduce_xor_nxv8i1(<vscale x 8 x i1> %vec) {
114 ; CHECK-LABEL: reduce_xor_nxv8i1:
116 ; CHECK-NEXT: ptrue p1.h
117 ; CHECK-NEXT: cntp x8, p1, p0.h
118 ; CHECK-NEXT: and w0, w8, #0x1
120 %res = call i1 @llvm.vector.reduce.xor.i1.nxv8i1(<vscale x 8 x i1> %vec)
124 define i1 @reduce_xor_nxv4i1(<vscale x 4 x i1> %vec) {
125 ; CHECK-LABEL: reduce_xor_nxv4i1:
127 ; CHECK-NEXT: ptrue p1.s
128 ; CHECK-NEXT: cntp x8, p1, p0.s
129 ; CHECK-NEXT: and w0, w8, #0x1
131 %res = call i1 @llvm.vector.reduce.xor.i1.nxv4i1(<vscale x 4 x i1> %vec)
135 define i1 @reduce_xor_nxv2i1(<vscale x 2 x i1> %vec) {
136 ; CHECK-LABEL: reduce_xor_nxv2i1:
138 ; CHECK-NEXT: ptrue p1.d
139 ; CHECK-NEXT: cntp x8, p1, p0.d
140 ; CHECK-NEXT: and w0, w8, #0x1
142 %res = call i1 @llvm.vector.reduce.xor.i1.nxv2i1(<vscale x 2 x i1> %vec)
148 define i1 @reduce_smax_nxv16i1(<vscale x 16 x i1> %vec) {
149 ; CHECK-LABEL: reduce_smax_nxv16i1:
151 ; CHECK-NEXT: ptrue p1.b
152 ; CHECK-NEXT: not p0.b, p1/z, p0.b
153 ; CHECK-NEXT: ptest p1, p0.b
154 ; CHECK-NEXT: cset w0, eq
156 %res = call i1 @llvm.vector.reduce.smax.i1.nxv16i1(<vscale x 16 x i1> %vec)
160 define i1 @reduce_smax_nxv8i1(<vscale x 8 x i1> %vec) {
161 ; CHECK-LABEL: reduce_smax_nxv8i1:
163 ; CHECK-NEXT: ptrue p1.h
164 ; CHECK-NEXT: not p0.b, p1/z, p0.b
165 ; CHECK-NEXT: ptest p1, p0.b
166 ; CHECK-NEXT: cset w0, eq
168 %res = call i1 @llvm.vector.reduce.smax.i1.nxv8i1(<vscale x 8 x i1> %vec)
172 define i1 @reduce_smax_nxv4i1(<vscale x 4 x i1> %vec) {
173 ; CHECK-LABEL: reduce_smax_nxv4i1:
175 ; CHECK-NEXT: ptrue p1.s
176 ; CHECK-NEXT: not p0.b, p1/z, p0.b
177 ; CHECK-NEXT: ptest p1, p0.b
178 ; CHECK-NEXT: cset w0, eq
180 %res = call i1 @llvm.vector.reduce.smax.i1.nxv4i1(<vscale x 4 x i1> %vec)
184 define i1 @reduce_smax_nxv2i1(<vscale x 2 x i1> %vec) {
185 ; CHECK-LABEL: reduce_smax_nxv2i1:
187 ; CHECK-NEXT: ptrue p1.d
188 ; CHECK-NEXT: not p0.b, p1/z, p0.b
189 ; CHECK-NEXT: ptest p1, p0.b
190 ; CHECK-NEXT: cset w0, eq
192 %res = call i1 @llvm.vector.reduce.smax.i1.nxv2i1(<vscale x 2 x i1> %vec)
198 define i1 @reduce_smin_nxv16i1(<vscale x 16 x i1> %vec) {
199 ; CHECK-LABEL: reduce_smin_nxv16i1:
201 ; CHECK-NEXT: ptrue p1.b
202 ; CHECK-NEXT: ptest p1, p0.b
203 ; CHECK-NEXT: cset w0, ne
205 %res = call i1 @llvm.vector.reduce.smin.i1.nxv16i1(<vscale x 16 x i1> %vec)
209 define i1 @reduce_smin_nxv8i1(<vscale x 8 x i1> %vec) {
210 ; CHECK-LABEL: reduce_smin_nxv8i1:
212 ; CHECK-NEXT: ptrue p1.h
213 ; CHECK-NEXT: ptest p1, p0.b
214 ; CHECK-NEXT: cset w0, ne
216 %res = call i1 @llvm.vector.reduce.smin.i1.nxv8i1(<vscale x 8 x i1> %vec)
220 define i1 @reduce_smin_nxv4i1(<vscale x 4 x i1> %vec) {
221 ; CHECK-LABEL: reduce_smin_nxv4i1:
223 ; CHECK-NEXT: ptrue p1.s
224 ; CHECK-NEXT: ptest p1, p0.b
225 ; CHECK-NEXT: cset w0, ne
227 %res = call i1 @llvm.vector.reduce.smin.i1.nxv4i1(<vscale x 4 x i1> %vec)
231 define i1 @reduce_smin_nxv2i1(<vscale x 2 x i1> %vec) {
232 ; CHECK-LABEL: reduce_smin_nxv2i1:
234 ; CHECK-NEXT: ptrue p1.d
235 ; CHECK-NEXT: ptest p1, p0.b
236 ; CHECK-NEXT: cset w0, ne
238 %res = call i1 @llvm.vector.reduce.smin.i1.nxv2i1(<vscale x 2 x i1> %vec)
244 define i1 @reduce_umax_nxv16i1(<vscale x 16 x i1> %vec) {
245 ; CHECK-LABEL: reduce_umax_nxv16i1:
247 ; CHECK-NEXT: ptrue p1.b
248 ; CHECK-NEXT: ptest p1, p0.b
249 ; CHECK-NEXT: cset w0, ne
251 %res = call i1 @llvm.vector.reduce.umax.i1.nxv16i1(<vscale x 16 x i1> %vec)
255 define i1 @reduce_umax_nxv8i1(<vscale x 8 x i1> %vec) {
256 ; CHECK-LABEL: reduce_umax_nxv8i1:
258 ; CHECK-NEXT: ptrue p1.h
259 ; CHECK-NEXT: ptest p1, p0.b
260 ; CHECK-NEXT: cset w0, ne
262 %res = call i1 @llvm.vector.reduce.umax.i1.nxv8i1(<vscale x 8 x i1> %vec)
266 define i1 @reduce_umax_nxv4i1(<vscale x 4 x i1> %vec) {
267 ; CHECK-LABEL: reduce_umax_nxv4i1:
269 ; CHECK-NEXT: ptrue p1.s
270 ; CHECK-NEXT: ptest p1, p0.b
271 ; CHECK-NEXT: cset w0, ne
273 %res = call i1 @llvm.vector.reduce.umax.i1.nxv4i1(<vscale x 4 x i1> %vec)
277 define i1 @reduce_umax_nxv2i1(<vscale x 2 x i1> %vec) {
278 ; CHECK-LABEL: reduce_umax_nxv2i1:
280 ; CHECK-NEXT: ptrue p1.d
281 ; CHECK-NEXT: ptest p1, p0.b
282 ; CHECK-NEXT: cset w0, ne
284 %res = call i1 @llvm.vector.reduce.umax.i1.nxv2i1(<vscale x 2 x i1> %vec)
290 define i1 @reduce_umin_nxv16i1(<vscale x 16 x i1> %vec) {
291 ; CHECK-LABEL: reduce_umin_nxv16i1:
293 ; CHECK-NEXT: ptrue p1.b
294 ; CHECK-NEXT: not p0.b, p1/z, p0.b
295 ; CHECK-NEXT: ptest p1, p0.b
296 ; CHECK-NEXT: cset w0, eq
298 %res = call i1 @llvm.vector.reduce.umin.i1.nxv16i1(<vscale x 16 x i1> %vec)
302 define i1 @reduce_umin_nxv8i1(<vscale x 8 x i1> %vec) {
303 ; CHECK-LABEL: reduce_umin_nxv8i1:
305 ; CHECK-NEXT: ptrue p1.h
306 ; CHECK-NEXT: not p0.b, p1/z, p0.b
307 ; CHECK-NEXT: ptest p1, p0.b
308 ; CHECK-NEXT: cset w0, eq
310 %res = call i1 @llvm.vector.reduce.umin.i1.nxv8i1(<vscale x 8 x i1> %vec)
314 define i1 @reduce_umin_nxv4i1(<vscale x 4 x i1> %vec) {
315 ; CHECK-LABEL: reduce_umin_nxv4i1:
317 ; CHECK-NEXT: ptrue p1.s
318 ; CHECK-NEXT: not p0.b, p1/z, p0.b
319 ; CHECK-NEXT: ptest p1, p0.b
320 ; CHECK-NEXT: cset w0, eq
322 %res = call i1 @llvm.vector.reduce.umin.i1.nxv4i1(<vscale x 4 x i1> %vec)
326 define i1 @reduce_umin_nxv2i1(<vscale x 2 x i1> %vec) {
327 ; CHECK-LABEL: reduce_umin_nxv2i1:
329 ; CHECK-NEXT: ptrue p1.d
330 ; CHECK-NEXT: not p0.b, p1/z, p0.b
331 ; CHECK-NEXT: ptest p1, p0.b
332 ; CHECK-NEXT: cset w0, eq
334 %res = call i1 @llvm.vector.reduce.umin.i1.nxv2i1(<vscale x 2 x i1> %vec)
338 declare i1 @llvm.vector.reduce.and.i1.nxv16i1(<vscale x 16 x i1> %vec)
339 declare i1 @llvm.vector.reduce.and.i1.nxv8i1(<vscale x 8 x i1> %vec)
340 declare i1 @llvm.vector.reduce.and.i1.nxv4i1(<vscale x 4 x i1> %vec)
341 declare i1 @llvm.vector.reduce.and.i1.nxv2i1(<vscale x 2 x i1> %vec)
343 declare i1 @llvm.vector.reduce.or.i1.nxv16i1(<vscale x 16 x i1> %vec)
344 declare i1 @llvm.vector.reduce.or.i1.nxv8i1(<vscale x 8 x i1> %vec)
345 declare i1 @llvm.vector.reduce.or.i1.nxv4i1(<vscale x 4 x i1> %vec)
346 declare i1 @llvm.vector.reduce.or.i1.nxv2i1(<vscale x 2 x i1> %vec)
348 declare i1 @llvm.vector.reduce.xor.i1.nxv16i1(<vscale x 16 x i1> %vec)
349 declare i1 @llvm.vector.reduce.xor.i1.nxv8i1(<vscale x 8 x i1> %vec)
350 declare i1 @llvm.vector.reduce.xor.i1.nxv4i1(<vscale x 4 x i1> %vec)
351 declare i1 @llvm.vector.reduce.xor.i1.nxv2i1(<vscale x 2 x i1> %vec)
353 declare i1 @llvm.vector.reduce.smin.i1.nxv16i1(<vscale x 16 x i1> %vec)
354 declare i1 @llvm.vector.reduce.smin.i1.nxv8i1(<vscale x 8 x i1> %vec)
355 declare i1 @llvm.vector.reduce.smin.i1.nxv4i1(<vscale x 4 x i1> %vec)
356 declare i1 @llvm.vector.reduce.smin.i1.nxv2i1(<vscale x 2 x i1> %vec)
358 declare i1 @llvm.vector.reduce.smax.i1.nxv16i1(<vscale x 16 x i1> %vec)
359 declare i1 @llvm.vector.reduce.smax.i1.nxv8i1(<vscale x 8 x i1> %vec)
360 declare i1 @llvm.vector.reduce.smax.i1.nxv4i1(<vscale x 4 x i1> %vec)
361 declare i1 @llvm.vector.reduce.smax.i1.nxv2i1(<vscale x 2 x i1> %vec)
363 declare i1 @llvm.vector.reduce.umin.i1.nxv16i1(<vscale x 16 x i1> %vec)
364 declare i1 @llvm.vector.reduce.umin.i1.nxv8i1(<vscale x 8 x i1> %vec)
365 declare i1 @llvm.vector.reduce.umin.i1.nxv4i1(<vscale x 4 x i1> %vec)
366 declare i1 @llvm.vector.reduce.umin.i1.nxv2i1(<vscale x 2 x i1> %vec)
368 declare i1 @llvm.vector.reduce.umax.i1.nxv16i1(<vscale x 16 x i1> %vec)
369 declare i1 @llvm.vector.reduce.umax.i1.nxv8i1(<vscale x 8 x i1> %vec)
370 declare i1 @llvm.vector.reduce.umax.i1.nxv4i1(<vscale x 4 x i1> %vec)
371 declare i1 @llvm.vector.reduce.umax.i1.nxv2i1(<vscale x 2 x i1> %vec)