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 %allones.ins = insertelement <vscale x 16 x i1> poison, i1 1, i32 0
60 %allones = shufflevector <vscale x 16 x i1> %allones.ins, <vscale x 16 x i1> poison, <vscale x 16 x i32> zeroinitializer
61 %t = call <vscale x 16 x i1> @llvm.vector.insert.nxv16i1.nxv4i1(<vscale x 16 x i1> %allones, <vscale x 4 x i1> %in, i64 0)
62 %res = call i1 @llvm.vector.reduce.and.nxv16i1(<vscale x 16 x i1> %t)
66 define i1 @reduce_and_insert_subvec_into_poison(<vscale x 4 x i1> %in) {
67 ; CHECK-LABEL: reduce_and_insert_subvec_into_poison:
69 ; CHECK-NEXT: ptrue p1.s
70 ; CHECK-NEXT: nots p0.b, p1/z, p0.b
71 ; CHECK-NEXT: cset w0, eq
73 %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)
74 %res = call i1 @llvm.vector.reduce.and.nxv16i1(<vscale x 16 x i1> %t)
78 define i1 @reduce_and_insert_subvec_into_var(<vscale x 4 x i1> %in, <vscale x 16 x i1> %vec) {
79 ; CHECK-LABEL: reduce_and_insert_subvec_into_var:
81 ; CHECK-NEXT: punpklo p3.h, p1.b
82 ; CHECK-NEXT: punpkhi p1.h, p1.b
83 ; CHECK-NEXT: ptrue p2.b
84 ; CHECK-NEXT: punpkhi p3.h, p3.b
85 ; CHECK-NEXT: uzp1 p0.h, p0.h, p3.h
86 ; CHECK-NEXT: uzp1 p0.b, p0.b, p1.b
87 ; CHECK-NEXT: nots p0.b, p2/z, p0.b
88 ; CHECK-NEXT: cset w0, eq
90 %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)
91 %res = call i1 @llvm.vector.reduce.and.nxv16i1(<vscale x 16 x i1> %t)
95 declare i1 @llvm.vector.reduce.and.nxv16i1(<vscale x 16 x i1>)
96 declare i1 @llvm.vector.reduce.or.nxv16i1(<vscale x 16 x i1>)
97 declare <vscale x 16 x i1> @llvm.vector.insert.nxv16i1.nxv4i1(<vscale x 16 x i1>, <vscale x 4 x i1>, i64)