1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s | FileCheck %s
4 target triple = "aarch64-unknown-linux-gnu"
8 define i64 @cntp_add_all_active_nxv16i1(i64 %x, <vscale x 16 x i1> %pg) #0 {
9 ; CHECK-LABEL: cntp_add_all_active_nxv16i1:
11 ; CHECK-NEXT: incp x0, p0.b
13 %1 = tail call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 31)
14 %2 = tail call i64 @llvm.aarch64.sve.cntp.nxv16i1(<vscale x 16 x i1> %1, <vscale x 16 x i1> %pg)
19 define i64 @cntp_add_all_active_nxv8i1(i64 %x, <vscale x 8 x i1> %pg) #0 {
20 ; CHECK-LABEL: cntp_add_all_active_nxv8i1:
22 ; CHECK-NEXT: incp x0, p0.h
24 %1 = tail call <vscale x 8 x i1> @llvm.aarch64.sve.ptrue.nxv8i1(i32 31)
25 %2 = tail call i64 @llvm.aarch64.sve.cntp.nxv8i1(<vscale x 8 x i1> %1, <vscale x 8 x i1> %pg)
30 define i64 @cntp_add_all_active_nxv4i1(i64 %x, <vscale x 4 x i1> %pg) #0 {
31 ; CHECK-LABEL: cntp_add_all_active_nxv4i1:
33 ; CHECK-NEXT: incp x0, p0.s
35 %1 = tail call <vscale x 4 x i1> @llvm.aarch64.sve.ptrue.nxv4i1(i32 31)
36 %2 = tail call i64 @llvm.aarch64.sve.cntp.nxv4i1(<vscale x 4 x i1> %1, <vscale x 4 x i1> %pg)
41 define i64 @cntp_add_all_active_nxv2i1(i64 %x, <vscale x 2 x i1> %pg) #0 {
42 ; CHECK-LABEL: cntp_add_all_active_nxv2i1:
44 ; CHECK-NEXT: incp x0, p0.d
46 %1 = tail call <vscale x 2 x i1> @llvm.aarch64.sve.ptrue.nxv2i1(i32 31)
47 %2 = tail call i64 @llvm.aarch64.sve.cntp.nxv2i1(<vscale x 2 x i1> %1, <vscale x 2 x i1> %pg)
52 define i64 @cntp_add_all_active_nxv8i1_via_cast(i64 %x, <vscale x 8 x i1> %pg) #0 {
53 ; CHECK-LABEL: cntp_add_all_active_nxv8i1_via_cast:
55 ; CHECK-NEXT: incp x0, p0.h
57 %1 = tail call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 31)
58 %2 = tail call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %1)
59 %3 = tail call i64 @llvm.aarch64.sve.cntp.nxv8i1(<vscale x 8 x i1> %2, <vscale x 8 x i1> %pg)
64 define i64 @cntp_add_all_active_nxv2i1_multiuse(i64 %x, <vscale x 2 x i1> %pg) #0 {
65 ; CHECK-LABEL: cntp_add_all_active_nxv2i1_multiuse:
67 ; CHECK-NEXT: ptrue p1.d
68 ; CHECK-NEXT: cntp x8, p1, p0.d
69 ; CHECK-NEXT: add x9, x8, x0
70 ; CHECK-NEXT: madd x0, x8, x0, x9
72 %1 = tail call <vscale x 2 x i1> @llvm.aarch64.sve.ptrue.nxv2i1(i32 31)
73 %2 = tail call i64 @llvm.aarch64.sve.cntp.nxv2i1(<vscale x 2 x i1> %1, <vscale x 2 x i1> %pg)
76 %res = add i64 %add, %mul
80 define i64 @cntp_add_same_active_nxv16i1(i64 %x, <vscale x 16 x i1> %pg) #0 {
81 ; CHECK-LABEL: cntp_add_same_active_nxv16i1:
83 ; CHECK-NEXT: incp x0, p0.b
85 %1 = tail call i64 @llvm.aarch64.sve.cntp.nxv16i1(<vscale x 16 x i1> %pg, <vscale x 16 x i1> %pg)
90 define i64 @cntp_add_same_active_nxv8i1(i64 %x, <vscale x 8 x i1> %pg) #0 {
91 ; CHECK-LABEL: cntp_add_same_active_nxv8i1:
93 ; CHECK-NEXT: incp x0, p0.h
95 %1 = tail call i64 @llvm.aarch64.sve.cntp.nxv8i1(<vscale x 8 x i1> %pg, <vscale x 8 x i1> %pg)
100 define i64 @cntp_add_same_active_nxv4i1(i64 %x, <vscale x 4 x i1> %pg) #0 {
101 ; CHECK-LABEL: cntp_add_same_active_nxv4i1:
103 ; CHECK-NEXT: incp x0, p0.s
105 %1 = tail call i64 @llvm.aarch64.sve.cntp.nxv4i1(<vscale x 4 x i1> %pg, <vscale x 4 x i1> %pg)
106 %add = add i64 %1, %x
110 define i64 @cntp_add_same_active_nxv2i1(i64 %x, <vscale x 2 x i1> %pg) #0 {
111 ; CHECK-LABEL: cntp_add_same_active_nxv2i1:
113 ; CHECK-NEXT: incp x0, p0.d
115 %1 = tail call i64 @llvm.aarch64.sve.cntp.nxv2i1(<vscale x 2 x i1> %pg, <vscale x 2 x i1> %pg)
116 %add = add i64 %1, %x
120 define i64 @cntp_add_same_active_nxv2i1_multiuse(i64 %x, <vscale x 2 x i1> %pg) #0 {
121 ; CHECK-LABEL: cntp_add_same_active_nxv2i1_multiuse:
123 ; CHECK-NEXT: cntp x8, p0, p0.d
124 ; CHECK-NEXT: add x9, x8, x0
125 ; CHECK-NEXT: madd x0, x8, x0, x9
127 %1 = tail call i64 @llvm.aarch64.sve.cntp.nxv2i1(<vscale x 2 x i1> %pg, <vscale x 2 x i1> %pg)
128 %add = add i64 %1, %x
129 %mul = mul i64 %1, %x
130 %res = add i64 %add, %mul
136 define i64 @cntp_sub_all_active_nxv16i1(i64 %x, <vscale x 16 x i1> %pg) #0 {
137 ; CHECK-LABEL: cntp_sub_all_active_nxv16i1:
139 ; CHECK-NEXT: decp x0, p0.b
141 %1 = tail call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 31)
142 %2 = tail call i64 @llvm.aarch64.sve.cntp.nxv16i1(<vscale x 16 x i1> %1, <vscale x 16 x i1> %pg)
143 %sub = sub i64 %x, %2
147 define i64 @cntp_sub_all_active_nxv8i1(i64 %x, <vscale x 8 x i1> %pg) #0 {
148 ; CHECK-LABEL: cntp_sub_all_active_nxv8i1:
150 ; CHECK-NEXT: decp x0, p0.h
152 %1 = tail call <vscale x 8 x i1> @llvm.aarch64.sve.ptrue.nxv8i1(i32 31)
153 %2 = tail call i64 @llvm.aarch64.sve.cntp.nxv8i1(<vscale x 8 x i1> %1, <vscale x 8 x i1> %pg)
154 %sub = sub i64 %x, %2
158 define i64 @cntp_sub_all_active_nxv4i1(i64 %x, <vscale x 4 x i1> %pg) #0 {
159 ; CHECK-LABEL: cntp_sub_all_active_nxv4i1:
161 ; CHECK-NEXT: decp x0, p0.s
163 %1 = tail call <vscale x 4 x i1> @llvm.aarch64.sve.ptrue.nxv4i1(i32 31)
164 %2 = tail call i64 @llvm.aarch64.sve.cntp.nxv4i1(<vscale x 4 x i1> %1, <vscale x 4 x i1> %pg)
165 %sub = sub i64 %x, %2
169 define i64 @cntp_sub_all_active_nxv2i1(i64 %x, <vscale x 2 x i1> %pg) #0 {
170 ; CHECK-LABEL: cntp_sub_all_active_nxv2i1:
172 ; CHECK-NEXT: decp x0, p0.d
174 %1 = tail call <vscale x 2 x i1> @llvm.aarch64.sve.ptrue.nxv2i1(i32 31)
175 %2 = tail call i64 @llvm.aarch64.sve.cntp.nxv2i1(<vscale x 2 x i1> %1, <vscale x 2 x i1> %pg)
176 %sub = sub i64 %x, %2
180 define i64 @cntp_sub_all_active_nxv8i1_via_cast(i64 %x, <vscale x 8 x i1> %pg) #0 {
181 ; CHECK-LABEL: cntp_sub_all_active_nxv8i1_via_cast:
183 ; CHECK-NEXT: decp x0, p0.h
185 %1 = tail call <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32 31)
186 %2 = tail call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %1)
187 %3 = tail call i64 @llvm.aarch64.sve.cntp.nxv8i1(<vscale x 8 x i1> %2, <vscale x 8 x i1> %pg)
188 %sub = sub i64 %x, %3
192 define i64 @cntp_sub_all_active_nxv2i1_multiuse(i64 %x, <vscale x 2 x i1> %pg) #0 {
193 ; CHECK-LABEL: cntp_sub_all_active_nxv2i1_multiuse:
195 ; CHECK-NEXT: ptrue p1.d
196 ; CHECK-NEXT: cntp x8, p1, p0.d
197 ; CHECK-NEXT: sub x9, x8, x0
198 ; CHECK-NEXT: madd x0, x8, x0, x9
200 %1 = tail call <vscale x 2 x i1> @llvm.aarch64.sve.ptrue.nxv2i1(i32 31)
201 %2 = tail call i64 @llvm.aarch64.sve.cntp.nxv2i1(<vscale x 2 x i1> %1, <vscale x 2 x i1> %pg)
202 %sub = sub i64 %2, %x
203 %mul = mul i64 %2, %x
204 %res = add i64 %sub, %mul
208 define i64 @cntp_sub_same_active_nxv16i1(i64 %x, <vscale x 16 x i1> %pg) #0 {
209 ; CHECK-LABEL: cntp_sub_same_active_nxv16i1:
211 ; CHECK-NEXT: decp x0, p0.b
213 %1 = tail call i64 @llvm.aarch64.sve.cntp.nxv16i1(<vscale x 16 x i1> %pg, <vscale x 16 x i1> %pg)
214 %sub = sub i64 %x, %1
218 define i64 @cntp_sub_same_active_nxv8i1(i64 %x, <vscale x 8 x i1> %pg) #0 {
219 ; CHECK-LABEL: cntp_sub_same_active_nxv8i1:
221 ; CHECK-NEXT: decp x0, p0.h
223 %1 = tail call i64 @llvm.aarch64.sve.cntp.nxv8i1(<vscale x 8 x i1> %pg, <vscale x 8 x i1> %pg)
224 %sub = sub i64 %x, %1
228 define i64 @cntp_sub_same_active_nxv4i1(i64 %x, <vscale x 4 x i1> %pg) #0 {
229 ; CHECK-LABEL: cntp_sub_same_active_nxv4i1:
231 ; CHECK-NEXT: decp x0, p0.s
233 %1 = tail call i64 @llvm.aarch64.sve.cntp.nxv4i1(<vscale x 4 x i1> %pg, <vscale x 4 x i1> %pg)
234 %sub = sub i64 %x, %1
238 define i64 @cntp_sub_same_active_nxv2i1(i64 %x, <vscale x 2 x i1> %pg) #0 {
239 ; CHECK-LABEL: cntp_sub_same_active_nxv2i1:
241 ; CHECK-NEXT: decp x0, p0.d
243 %1 = tail call i64 @llvm.aarch64.sve.cntp.nxv2i1(<vscale x 2 x i1> %pg, <vscale x 2 x i1> %pg)
244 %sub = sub i64 %x, %1
248 define i64 @cntp_sub_same_active_nxv2i1_multiuse(i64 %x, <vscale x 2 x i1> %pg) #0 {
249 ; CHECK-LABEL: cntp_sub_same_active_nxv2i1_multiuse:
251 ; CHECK-NEXT: cntp x8, p0, p0.d
252 ; CHECK-NEXT: sub x9, x8, x0
253 ; CHECK-NEXT: madd x0, x8, x0, x9
255 %1 = tail call i64 @llvm.aarch64.sve.cntp.nxv2i1(<vscale x 2 x i1> %pg, <vscale x 2 x i1> %pg)
256 %sub = sub i64 %1, %x
257 %mul = mul i64 %1, %x
258 %res = add i64 %sub, %mul
262 declare <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1>)
263 declare <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1>)
264 declare <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1>)
266 declare <vscale x 16 x i1> @llvm.aarch64.sve.ptrue.nxv16i1(i32)
267 declare <vscale x 8 x i1> @llvm.aarch64.sve.ptrue.nxv8i1(i32)
268 declare <vscale x 4 x i1> @llvm.aarch64.sve.ptrue.nxv4i1(i32)
269 declare <vscale x 2 x i1> @llvm.aarch64.sve.ptrue.nxv2i1(i32)
271 declare i64 @llvm.aarch64.sve.cntp.nxv16i1(<vscale x 16 x i1>, <vscale x 16 x i1>)
272 declare i64 @llvm.aarch64.sve.cntp.nxv8i1(<vscale x 8 x i1>, <vscale x 8 x i1>)
273 declare i64 @llvm.aarch64.sve.cntp.nxv4i1(<vscale x 4 x i1>, <vscale x 4 x i1>)
274 declare i64 @llvm.aarch64.sve.cntp.nxv2i1(<vscale x 2 x i1>, <vscale x 2 x i1>)
276 attributes #0 = { "target-features"="+sve" }