1; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
2
3;
4; PFIRST
5;
6
7define <vscale x 16 x i1> @pfirst_b8(<vscale x 16 x i1> %pg, <vscale x 16 x i1> %a) {
8; CHECK-LABEL: pfirst_b8:
9; CHECK: pfirst p1.b, p0, p1.b
10; CHECK-NEXT: mov p0.b, p1.b
11; CHECK-NEXT: ret
12  %out = call <vscale x 16 x i1> @llvm.aarch64.sve.pfirst.nxv16i1(<vscale x 16 x i1> %pg,
13                                                                  <vscale x 16 x i1> %a)
14  ret <vscale x 16 x i1> %out
15}
16
17;
18; PNEXT
19;
20
21define <vscale x 16 x i1> @pnext_b8(<vscale x 16 x i1> %pg, <vscale x 16 x i1> %a) {
22; CHECK-LABEL: pnext_b8:
23; CHECK: pnext p1.b, p0, p1.b
24; CHECK-NEXT: mov p0.b, p1.b
25; CHECK-NEXT: ret
26  %out = call <vscale x 16 x i1> @llvm.aarch64.sve.pnext.nxv16i1(<vscale x 16 x i1> %pg,
27                                                                 <vscale x 16 x i1> %a)
28  ret <vscale x 16 x i1> %out
29}
30
31define <vscale x 8 x i1> @pnext_b16(<vscale x 8 x i1> %pg, <vscale x 8 x i1> %a) {
32; CHECK-LABEL: pnext_b16:
33; CHECK: pnext p1.h, p0, p1.h
34; CHECK-NEXT: mov p0.b, p1.b
35; CHECK-NEXT: ret
36  %out = call <vscale x 8 x i1> @llvm.aarch64.sve.pnext.nxv8i1(<vscale x 8 x i1> %pg,
37                                                               <vscale x 8 x i1> %a)
38  ret <vscale x 8 x i1> %out
39}
40
41define <vscale x 4 x i1> @pnext_b32(<vscale x 4 x i1> %pg, <vscale x 4 x i1> %a) {
42; CHECK-LABEL: pnext_b32:
43; CHECK: pnext p1.s, p0, p1.s
44; CHECK-NEXT: mov p0.b, p1.b
45; CHECK-NEXT: ret
46  %out = call <vscale x 4 x i1> @llvm.aarch64.sve.pnext.nxv4i1(<vscale x 4 x i1> %pg,
47                                                               <vscale x 4 x i1> %a)
48  ret <vscale x 4 x i1> %out
49}
50
51define <vscale x 2 x i1> @pnext_b64(<vscale x 2 x i1> %pg, <vscale x 2 x i1> %a) {
52; CHECK-LABEL: pnext_b64:
53; CHECK: pnext p1.d, p0, p1.d
54; CHECK-NEXT: mov p0.b, p1.b
55; CHECK-NEXT: ret
56  %out = call <vscale x 2 x i1> @llvm.aarch64.sve.pnext.nxv2i1(<vscale x 2 x i1> %pg,
57                                                               <vscale x 2 x i1> %a)
58  ret <vscale x 2 x i1> %out
59}
60
61;
62; PUNPKHI
63;
64
65define <vscale x 8 x i1> @punpkhi_b16(<vscale x 16 x i1> %a) {
66; CHECK-LABEL: punpkhi_b16
67; CHECK: punpkhi p0.h, p0.b
68; CHECK-NEXT: ret
69  %res = call <vscale x 8 x i1> @llvm.aarch64.sve.punpkhi.nxv8i1(<vscale x 16 x i1> %a)
70  ret <vscale x 8 x i1> %res
71}
72
73define <vscale x 4 x i1> @punpkhi_b8(<vscale x 8 x i1> %a) {
74; CHECK-LABEL: punpkhi_b8
75; CHECK: punpkhi p0.h, p0.b
76; CHECK-NEXT: ret
77  %res = call <vscale x 4 x i1> @llvm.aarch64.sve.punpkhi.nxv4i1(<vscale x 8 x i1> %a)
78  ret <vscale x 4 x i1> %res
79}
80
81define <vscale x 2 x i1> @punpkhi_b4(<vscale x 4 x i1> %a) {
82; CHECK-LABEL: punpkhi_b4
83; CHECK: punpkhi p0.h, p0.b
84; CHECK-NEXT: ret
85  %res = call <vscale x 2 x i1> @llvm.aarch64.sve.punpkhi.nxv2i1(<vscale x 4 x i1> %a)
86  ret <vscale x 2 x i1> %res
87}
88
89;
90; PUNPKLO
91;
92
93define <vscale x 8 x i1> @punpklo_b16(<vscale x 16 x i1> %a) {
94; CHECK-LABEL: punpklo_b16
95; CHECK: punpklo p0.h, p0.b
96; CHECK-NEXT: ret
97  %res = call <vscale x 8 x i1> @llvm.aarch64.sve.punpklo.nxv8i1(<vscale x 16 x i1> %a)
98  ret <vscale x 8 x i1> %res
99}
100
101define <vscale x 4 x i1> @punpklo_b8(<vscale x 8 x i1> %a) {
102; CHECK-LABEL: punpklo_b8
103; CHECK: punpklo p0.h, p0.b
104; CHECK-NEXT: ret
105  %res = call <vscale x 4 x i1> @llvm.aarch64.sve.punpklo.nxv4i1(<vscale x 8 x i1> %a)
106  ret <vscale x 4 x i1> %res
107}
108
109define <vscale x 2 x i1> @punpklo_b4(<vscale x 4 x i1> %a) {
110; CHECK-LABEL: punpklo_b4
111; CHECK: punpklo p0.h, p0.b
112; CHECK-NEXT: ret
113  %res = call <vscale x 2 x i1> @llvm.aarch64.sve.punpklo.nxv2i1(<vscale x 4 x i1> %a)
114  ret <vscale x 2 x i1> %res
115}
116
117declare <vscale x 16 x i1> @llvm.aarch64.sve.pfirst.nxv16i1(<vscale x 16 x i1>, <vscale x 16 x i1>)
118
119declare <vscale x 16 x i1> @llvm.aarch64.sve.pnext.nxv16i1(<vscale x 16 x i1>, <vscale x 16 x i1>)
120declare <vscale x 8 x i1> @llvm.aarch64.sve.pnext.nxv8i1(<vscale x 8 x i1>, <vscale x 8 x i1>)
121declare <vscale x 4 x i1> @llvm.aarch64.sve.pnext.nxv4i1(<vscale x 4 x i1>, <vscale x 4 x i1>)
122declare <vscale x 2 x i1> @llvm.aarch64.sve.pnext.nxv2i1(<vscale x 2 x i1>, <vscale x 2 x i1>)
123
124declare <vscale x 8 x i1> @llvm.aarch64.sve.punpkhi.nxv8i1(<vscale x 16 x i1>)
125declare <vscale x 4 x i1> @llvm.aarch64.sve.punpkhi.nxv4i1(<vscale x 8 x i1>)
126declare <vscale x 2 x i1> @llvm.aarch64.sve.punpkhi.nxv2i1(<vscale x 4 x i1>)
127
128declare <vscale x 8 x i1> @llvm.aarch64.sve.punpklo.nxv8i1(<vscale x 16 x i1>)
129declare <vscale x 4 x i1> @llvm.aarch64.sve.punpklo.nxv4i1(<vscale x 8 x i1>)
130declare <vscale x 2 x i1> @llvm.aarch64.sve.punpklo.nxv2i1(<vscale x 4 x i1>)
131