1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64 -mattr=+sve < %s | FileCheck %s
8 define i1 @reduce_or_insert_subvec_into_zero(<vscale x 4 x i1> %in) {
9 ; CHECK-LABEL: reduce_or_insert_subvec_into_zero:
11 ; CHECK-NEXT: ptrue p1.s
12 ; CHECK-NEXT: ptest p1, p0.b
13 ; CHECK-NEXT: cset w0, ne
15 %t = call <vscale x 16 x i1> @llvm.vector.insert.nxv16i1.nxv4i1(<vscale x 16 x i1> zeroinitializer, <vscale x 4 x i1> %in, i64 0)
16 %res = call i1 @llvm.vector.reduce.or.nxv16i1(<vscale x 16 x i1> %t)
20 define i1 @reduce_or_insert_subvec_into_poison(<vscale x 4 x i1> %in) {
21 ; CHECK-LABEL: reduce_or_insert_subvec_into_poison:
23 ; CHECK-NEXT: ptrue p1.s
24 ; CHECK-NEXT: ptest p1, p0.b
25 ; CHECK-NEXT: cset w0, ne
27 %t = call <vscale x 16 x i1> @llvm.vector.insert.nxv16i1.nxv4i1(<vscale x 16 x i1> poison, <vscale x 4 x i1> %in, i64 0)
28 %res = call i1 @llvm.vector.reduce.or.nxv16i1(<vscale x 16 x i1> %t)
32 define i1 @reduce_or_insert_subvec_into_nonzero(<vscale x 4 x i1> %in, <vscale x 16 x i1> %vec) {
33 ; CHECK-LABEL: reduce_or_insert_subvec_into_nonzero:
35 ; CHECK-NEXT: punpklo p2.h, p1.b
36 ; CHECK-NEXT: punpkhi p1.h, p1.b
37 ; CHECK-NEXT: punpkhi p2.h, p2.b
38 ; CHECK-NEXT: uzp1 p0.h, p0.h, p2.h
39 ; CHECK-NEXT: uzp1 p0.b, p0.b, p1.b
40 ; CHECK-NEXT: ptest p0, p0.b
41 ; CHECK-NEXT: cset w0, ne
43 %t = call <vscale x 16 x i1> @llvm.vector.insert.nxv16i1.nxv4i1(<vscale x 16 x i1> %vec, <vscale x 4 x i1> %in, i64 0)
44 %res = call i1 @llvm.vector.reduce.or.nxv16i1(<vscale x 16 x i1> %t)
52 define i1 @reduce_and_insert_subvec_into_ones(<vscale x 4 x i1> %in) {
53 ; CHECK-LABEL: reduce_and_insert_subvec_into_ones:
55 ; CHECK-NEXT: ptrue p1.s
56 ; CHECK-NEXT: nots p0.b, p1/z, p0.b
57 ; CHECK-NEXT: cset w0, eq
59 %t = call <vscale x 16 x i1> @llvm.vector.insert.nxv16i1.nxv4i1(<vscale x 16 x i1> splat(i1 true), <vscale x 4 x i1> %in, i64 0)
60 %res = call i1 @llvm.vector.reduce.and.nxv16i1(<vscale x 16 x i1> %t)
64 define i1 @reduce_and_insert_subvec_into_poison(<vscale x 4 x i1> %in) {
65 ; CHECK-LABEL: reduce_and_insert_subvec_into_poison:
67 ; CHECK-NEXT: ptrue p1.s
68 ; CHECK-NEXT: nots p0.b, p1/z, p0.b
69 ; CHECK-NEXT: cset w0, eq
71 %t = call <vscale x 16 x i1> @llvm.vector.insert.nxv16i1.nxv4i1(<vscale x 16 x i1> poison, <vscale x 4 x i1> %in, i64 0)
72 %res = call i1 @llvm.vector.reduce.and.nxv16i1(<vscale x 16 x i1> %t)
76 define i1 @reduce_and_insert_subvec_into_var(<vscale x 4 x i1> %in, <vscale x 16 x i1> %vec) {
77 ; CHECK-LABEL: reduce_and_insert_subvec_into_var:
79 ; CHECK-NEXT: punpklo p3.h, p1.b
80 ; CHECK-NEXT: punpkhi p1.h, p1.b
81 ; CHECK-NEXT: punpkhi p3.h, p3.b
82 ; CHECK-NEXT: ptrue p2.b
83 ; CHECK-NEXT: uzp1 p0.h, p0.h, p3.h
84 ; CHECK-NEXT: uzp1 p0.b, p0.b, p1.b
85 ; CHECK-NEXT: nots p0.b, p2/z, p0.b
86 ; CHECK-NEXT: cset w0, eq
88 %t = call <vscale x 16 x i1> @llvm.vector.insert.nxv16i1.nxv4i1(<vscale x 16 x i1> %vec, <vscale x 4 x i1> %in, i64 0)
89 %res = call i1 @llvm.vector.reduce.and.nxv16i1(<vscale x 16 x i1> %t)
93 declare i1 @llvm.vector.reduce.and.nxv16i1(<vscale x 16 x i1>)
94 declare i1 @llvm.vector.reduce.or.nxv16i1(<vscale x 16 x i1>)
95 declare <vscale x 16 x i1> @llvm.vector.insert.nxv16i1.nxv4i1(<vscale x 16 x i1>, <vscale x 4 x i1>, i64)