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"
6 define <vscale x 8 x i8> @zext.add.8xi8(<vscale x 8 x i8> %a, <vscale x 8 x i1> %v) #0 {
7 ; CHECK-LABEL: zext.add.8xi8:
9 ; CHECK-NEXT: mov z1.h, #1 // =0x1
10 ; CHECK-NEXT: add z0.h, p0/m, z0.h, z1.h
12 %extend = zext <vscale x 8 x i1> %v to <vscale x 8 x i8>
13 %result = add <vscale x 8 x i8> %a, %extend
14 ret <vscale x 8 x i8> %result
17 define <vscale x 4 x i16> @zext.add.4xi16(<vscale x 4 x i16> %a, <vscale x 4 x i1> %v) #0 {
18 ; CHECK-LABEL: zext.add.4xi16:
20 ; CHECK-NEXT: mov z1.s, #1 // =0x1
21 ; CHECK-NEXT: add z0.s, p0/m, z0.s, z1.s
23 %extend = zext <vscale x 4 x i1> %v to <vscale x 4 x i16>
24 %result = add <vscale x 4 x i16> %a, %extend
25 ret <vscale x 4 x i16> %result
28 define <vscale x 2 x i32> @zext.add.2xi32(<vscale x 2 x i32> %a, <vscale x 2 x i1> %v) #0 {
29 ; CHECK-LABEL: zext.add.2xi32:
31 ; CHECK-NEXT: mov z1.d, #1 // =0x1
32 ; CHECK-NEXT: add z0.d, p0/m, z0.d, z1.d
34 %extend = zext <vscale x 2 x i1> %v to <vscale x 2 x i32>
35 %result = add <vscale x 2 x i32> %a, %extend
36 ret <vscale x 2 x i32> %result
39 define <vscale x 16 x i8> @zext.add.16xi8(<vscale x 16 x i8> %a, <vscale x 16 x i1> %v) #0 {
40 ; CHECK-LABEL: zext.add.16xi8:
42 ; CHECK-NEXT: mov z1.b, #1 // =0x1
43 ; CHECK-NEXT: add z0.b, p0/m, z0.b, z1.b
45 %extend = zext <vscale x 16 x i1> %v to <vscale x 16 x i8>
46 %result = add <vscale x 16 x i8> %a, %extend
47 ret <vscale x 16 x i8> %result
50 define <vscale x 8 x i16> @zext.add.8xi16(<vscale x 8 x i16> %a, <vscale x 8 x i1> %v) #0 {
51 ; CHECK-LABEL: zext.add.8xi16:
53 ; CHECK-NEXT: mov z1.h, #1 // =0x1
54 ; CHECK-NEXT: add z0.h, p0/m, z0.h, z1.h
56 %extend = zext <vscale x 8 x i1> %v to <vscale x 8 x i16>
57 %result = add <vscale x 8 x i16> %a, %extend
58 ret <vscale x 8 x i16> %result
61 define <vscale x 4 x i32> @zext.add.4xi32(<vscale x 4 x i32> %a, <vscale x 4 x i1> %v) #0 {
62 ; CHECK-LABEL: zext.add.4xi32:
64 ; CHECK-NEXT: mov z1.s, #1 // =0x1
65 ; CHECK-NEXT: add z0.s, p0/m, z0.s, z1.s
67 %extend = zext <vscale x 4 x i1> %v to <vscale x 4 x i32>
68 %result = add <vscale x 4 x i32> %a, %extend
69 ret <vscale x 4 x i32> %result
72 define <vscale x 2 x i64> @zext.add.2xi64(<vscale x 2 x i64> %a, <vscale x 2 x i1> %v) #0 {
73 ; CHECK-LABEL: zext.add.2xi64:
75 ; CHECK-NEXT: mov z1.d, #1 // =0x1
76 ; CHECK-NEXT: add z0.d, p0/m, z0.d, z1.d
78 %extend = zext <vscale x 2 x i1> %v to <vscale x 2 x i64>
79 %result = add <vscale x 2 x i64> %a, %extend
80 ret <vscale x 2 x i64> %result
83 define <vscale x 8 x i32> @zext.add.8xi32(<vscale x 8 x i32> %a, <vscale x 8 x i1> %v) #0 {
84 ; CHECK-LABEL: zext.add.8xi32:
86 ; CHECK-NEXT: punpkhi p1.h, p0.b
87 ; CHECK-NEXT: mov z2.s, #1 // =0x1
88 ; CHECK-NEXT: punpklo p0.h, p0.b
89 ; CHECK-NEXT: add z1.s, p1/m, z1.s, z2.s
90 ; CHECK-NEXT: add z0.s, p0/m, z0.s, z2.s
92 %extend = zext <vscale x 8 x i1> %v to <vscale x 8 x i32>
93 %result = add <vscale x 8 x i32> %a, %extend
94 ret <vscale x 8 x i32> %result
97 define <vscale x 16 x i32> @zext.add.16xi32(<vscale x 16 x i32> %a, <vscale x 16 x i1> %v) #0 {
98 ; CHECK-LABEL: zext.add.16xi32:
100 ; CHECK-NEXT: punpkhi p1.h, p0.b
101 ; CHECK-NEXT: mov z4.s, #1 // =0x1
102 ; CHECK-NEXT: punpklo p0.h, p0.b
103 ; CHECK-NEXT: punpkhi p2.h, p1.b
104 ; CHECK-NEXT: punpklo p1.h, p1.b
105 ; CHECK-NEXT: punpklo p3.h, p0.b
106 ; CHECK-NEXT: punpkhi p0.h, p0.b
107 ; CHECK-NEXT: add z3.s, p2/m, z3.s, z4.s
108 ; CHECK-NEXT: add z2.s, p1/m, z2.s, z4.s
109 ; CHECK-NEXT: add z0.s, p3/m, z0.s, z4.s
110 ; CHECK-NEXT: add z1.s, p0/m, z1.s, z4.s
112 %extend = zext <vscale x 16 x i1> %v to <vscale x 16 x i32>
113 %result = add <vscale x 16 x i32> %a, %extend
114 ret <vscale x 16 x i32> %result
117 define <vscale x 8 x i8> @zext.sub.8xi8(<vscale x 8 x i8> %a, <vscale x 8 x i1> %v) #0 {
118 ; CHECK-LABEL: zext.sub.8xi8:
120 ; CHECK-NEXT: mov z1.h, #-1 // =0xffffffffffffffff
121 ; CHECK-NEXT: add z0.h, p0/m, z0.h, z1.h
123 %extend = zext <vscale x 8 x i1> %v to <vscale x 8 x i8>
124 %result = sub <vscale x 8 x i8> %a, %extend
125 ret <vscale x 8 x i8> %result
128 define <vscale x 4 x i16> @zext.sub.4xi16(<vscale x 4 x i16> %a, <vscale x 4 x i1> %v) #0 {
129 ; CHECK-LABEL: zext.sub.4xi16:
131 ; CHECK-NEXT: mov z1.s, #-1 // =0xffffffffffffffff
132 ; CHECK-NEXT: add z0.s, p0/m, z0.s, z1.s
134 %extend = zext <vscale x 4 x i1> %v to <vscale x 4 x i16>
135 %result = sub <vscale x 4 x i16> %a, %extend
136 ret <vscale x 4 x i16> %result
139 define <vscale x 2 x i32> @zext.sub.2xi32(<vscale x 2 x i32> %a, <vscale x 2 x i1> %v) #0 {
140 ; CHECK-LABEL: zext.sub.2xi32:
142 ; CHECK-NEXT: mov z1.d, #-1 // =0xffffffffffffffff
143 ; CHECK-NEXT: add z0.d, p0/m, z0.d, z1.d
145 %extend = zext <vscale x 2 x i1> %v to <vscale x 2 x i32>
146 %result = sub <vscale x 2 x i32> %a, %extend
147 ret <vscale x 2 x i32> %result
150 define <vscale x 16 x i8> @zext.sub.16xi8(<vscale x 16 x i8> %a, <vscale x 16 x i1> %v) #0 {
151 ; CHECK-LABEL: zext.sub.16xi8:
153 ; CHECK-NEXT: mov z1.b, #-1 // =0xffffffffffffffff
154 ; CHECK-NEXT: add z0.b, p0/m, z0.b, z1.b
156 %extend = zext <vscale x 16 x i1> %v to <vscale x 16 x i8>
157 %result = sub <vscale x 16 x i8> %a, %extend
158 ret <vscale x 16 x i8> %result
161 define <vscale x 8 x i16> @zext.sub.8xi16(<vscale x 8 x i16> %a, <vscale x 8 x i1> %v) #0 {
162 ; CHECK-LABEL: zext.sub.8xi16:
164 ; CHECK-NEXT: mov z1.h, #-1 // =0xffffffffffffffff
165 ; CHECK-NEXT: add z0.h, p0/m, z0.h, z1.h
167 %extend = zext <vscale x 8 x i1> %v to <vscale x 8 x i16>
168 %result = sub <vscale x 8 x i16> %a, %extend
169 ret <vscale x 8 x i16> %result
172 define <vscale x 4 x i32> @zext.sub.4xi32(<vscale x 4 x i32> %a, <vscale x 4 x i1> %v) #0 {
173 ; CHECK-LABEL: zext.sub.4xi32:
175 ; CHECK-NEXT: mov z1.s, #-1 // =0xffffffffffffffff
176 ; CHECK-NEXT: add z0.s, p0/m, z0.s, z1.s
178 %extend = zext <vscale x 4 x i1> %v to <vscale x 4 x i32>
179 %result = sub <vscale x 4 x i32> %a, %extend
180 ret <vscale x 4 x i32> %result
183 define <vscale x 2 x i64> @zext.sub.2xi64(<vscale x 2 x i64> %a, <vscale x 2 x i1> %v) #0 {
184 ; CHECK-LABEL: zext.sub.2xi64:
186 ; CHECK-NEXT: mov z1.d, #-1 // =0xffffffffffffffff
187 ; CHECK-NEXT: add z0.d, p0/m, z0.d, z1.d
189 %extend = zext <vscale x 2 x i1> %v to <vscale x 2 x i64>
190 %result = sub <vscale x 2 x i64> %a, %extend
191 ret <vscale x 2 x i64> %result
194 define <vscale x 8 x i32> @zext.sub.8xi32(<vscale x 8 x i32> %a, <vscale x 8 x i1> %v) #0 {
195 ; CHECK-LABEL: zext.sub.8xi32:
197 ; CHECK-NEXT: punpklo p1.h, p0.b
198 ; CHECK-NEXT: mov z2.s, #-1 // =0xffffffffffffffff
199 ; CHECK-NEXT: punpkhi p0.h, p0.b
200 ; CHECK-NEXT: add z0.s, p1/m, z0.s, z2.s
201 ; CHECK-NEXT: add z1.s, p0/m, z1.s, z2.s
203 %extend = zext <vscale x 8 x i1> %v to <vscale x 8 x i32>
204 %result = sub <vscale x 8 x i32> %a, %extend
205 ret <vscale x 8 x i32> %result
208 define <vscale x 16 x i32> @zext.sub.16xi32(<vscale x 16 x i32> %a, <vscale x 16 x i1> %v) #0 {
209 ; CHECK-LABEL: zext.sub.16xi32:
211 ; CHECK-NEXT: punpklo p1.h, p0.b
212 ; CHECK-NEXT: mov z4.s, #-1 // =0xffffffffffffffff
213 ; CHECK-NEXT: punpkhi p0.h, p0.b
214 ; CHECK-NEXT: punpklo p2.h, p1.b
215 ; CHECK-NEXT: punpkhi p1.h, p1.b
216 ; CHECK-NEXT: punpklo p3.h, p0.b
217 ; CHECK-NEXT: punpkhi p0.h, p0.b
218 ; CHECK-NEXT: add z0.s, p2/m, z0.s, z4.s
219 ; CHECK-NEXT: add z1.s, p1/m, z1.s, z4.s
220 ; CHECK-NEXT: add z2.s, p3/m, z2.s, z4.s
221 ; CHECK-NEXT: add z3.s, p0/m, z3.s, z4.s
223 %extend = zext <vscale x 16 x i1> %v to <vscale x 16 x i32>
224 %result = sub <vscale x 16 x i32> %a, %extend
225 ret <vscale x 16 x i32> %result
228 define <vscale x 8 x i8> @sext.add.8xi8(<vscale x 8 x i8> %a, <vscale x 8 x i1> %v) #0 {
229 ; CHECK-LABEL: sext.add.8xi8:
231 ; CHECK-NEXT: mov z1.h, #-1 // =0xffffffffffffffff
232 ; CHECK-NEXT: add z0.h, p0/m, z0.h, z1.h
234 %extend = sext <vscale x 8 x i1> %v to <vscale x 8 x i8>
235 %result = add <vscale x 8 x i8> %a, %extend
236 ret <vscale x 8 x i8> %result
239 define <vscale x 4 x i16> @sext.add.4xi16(<vscale x 4 x i16> %a, <vscale x 4 x i1> %v) #0 {
240 ; CHECK-LABEL: sext.add.4xi16:
242 ; CHECK-NEXT: mov z1.s, #-1 // =0xffffffffffffffff
243 ; CHECK-NEXT: add z0.s, p0/m, z0.s, z1.s
245 %extend = sext <vscale x 4 x i1> %v to <vscale x 4 x i16>
246 %result = add <vscale x 4 x i16> %a, %extend
247 ret <vscale x 4 x i16> %result
250 define <vscale x 2 x i32> @sext.add.2xi32(<vscale x 2 x i32> %a, <vscale x 2 x i1> %v) #0 {
251 ; CHECK-LABEL: sext.add.2xi32:
253 ; CHECK-NEXT: mov z1.d, #-1 // =0xffffffffffffffff
254 ; CHECK-NEXT: add z0.d, p0/m, z0.d, z1.d
256 %extend = sext <vscale x 2 x i1> %v to <vscale x 2 x i32>
257 %result = add <vscale x 2 x i32> %a, %extend
258 ret <vscale x 2 x i32> %result
261 define <vscale x 16 x i8> @sext.add.16xi8(<vscale x 16 x i8> %a, <vscale x 16 x i1> %v) #0 {
262 ; CHECK-LABEL: sext.add.16xi8:
264 ; CHECK-NEXT: mov z1.b, #-1 // =0xffffffffffffffff
265 ; CHECK-NEXT: add z0.b, p0/m, z0.b, z1.b
267 %extend = sext <vscale x 16 x i1> %v to <vscale x 16 x i8>
268 %result = add <vscale x 16 x i8> %a, %extend
269 ret <vscale x 16 x i8> %result
272 define <vscale x 8 x i16> @sext.add.8xi16(<vscale x 8 x i16> %a, <vscale x 8 x i1> %v) #0 {
273 ; CHECK-LABEL: sext.add.8xi16:
275 ; CHECK-NEXT: mov z1.h, #-1 // =0xffffffffffffffff
276 ; CHECK-NEXT: add z0.h, p0/m, z0.h, z1.h
278 %extend = sext <vscale x 8 x i1> %v to <vscale x 8 x i16>
279 %result = add <vscale x 8 x i16> %a, %extend
280 ret <vscale x 8 x i16> %result
283 define <vscale x 4 x i32> @sext.add.4xi32(<vscale x 4 x i32> %a, <vscale x 4 x i1> %v) #0 {
284 ; CHECK-LABEL: sext.add.4xi32:
286 ; CHECK-NEXT: mov z1.s, #-1 // =0xffffffffffffffff
287 ; CHECK-NEXT: add z0.s, p0/m, z0.s, z1.s
289 %extend = sext <vscale x 4 x i1> %v to <vscale x 4 x i32>
290 %result = add <vscale x 4 x i32> %a, %extend
291 ret <vscale x 4 x i32> %result
294 define <vscale x 2 x i64> @sext.add.2xi64(<vscale x 2 x i64> %a, <vscale x 2 x i1> %v) #0 {
295 ; CHECK-LABEL: sext.add.2xi64:
297 ; CHECK-NEXT: mov z1.d, #-1 // =0xffffffffffffffff
298 ; CHECK-NEXT: add z0.d, p0/m, z0.d, z1.d
300 %extend = sext <vscale x 2 x i1> %v to <vscale x 2 x i64>
301 %result = add <vscale x 2 x i64> %a, %extend
302 ret <vscale x 2 x i64> %result
305 define <vscale x 8 x i32> @sext.add.8xi32(<vscale x 8 x i32> %a, <vscale x 8 x i1> %v) #0 {
306 ; CHECK-LABEL: sext.add.8xi32:
308 ; CHECK-NEXT: punpkhi p1.h, p0.b
309 ; CHECK-NEXT: mov z2.s, #-1 // =0xffffffffffffffff
310 ; CHECK-NEXT: punpklo p0.h, p0.b
311 ; CHECK-NEXT: add z1.s, p1/m, z1.s, z2.s
312 ; CHECK-NEXT: add z0.s, p0/m, z0.s, z2.s
314 %extend = sext <vscale x 8 x i1> %v to <vscale x 8 x i32>
315 %result = add <vscale x 8 x i32> %a, %extend
316 ret <vscale x 8 x i32> %result
319 define <vscale x 16 x i32> @sext.add.16xi32(<vscale x 16 x i32> %a, <vscale x 16 x i1> %v) #0 {
320 ; CHECK-LABEL: sext.add.16xi32:
322 ; CHECK-NEXT: punpkhi p1.h, p0.b
323 ; CHECK-NEXT: mov z4.s, #-1 // =0xffffffffffffffff
324 ; CHECK-NEXT: punpklo p0.h, p0.b
325 ; CHECK-NEXT: punpkhi p2.h, p1.b
326 ; CHECK-NEXT: punpklo p1.h, p1.b
327 ; CHECK-NEXT: punpklo p3.h, p0.b
328 ; CHECK-NEXT: punpkhi p0.h, p0.b
329 ; CHECK-NEXT: add z3.s, p2/m, z3.s, z4.s
330 ; CHECK-NEXT: add z2.s, p1/m, z2.s, z4.s
331 ; CHECK-NEXT: add z0.s, p3/m, z0.s, z4.s
332 ; CHECK-NEXT: add z1.s, p0/m, z1.s, z4.s
334 %extend = sext <vscale x 16 x i1> %v to <vscale x 16 x i32>
335 %result = add <vscale x 16 x i32> %a, %extend
336 ret <vscale x 16 x i32> %result
339 define <vscale x 8 x i8> @sext.sub.8xi8(<vscale x 8 x i8> %a, <vscale x 8 x i1> %v) #0 {
340 ; CHECK-LABEL: sext.sub.8xi8:
342 ; CHECK-NEXT: mov z1.h, #-1 // =0xffffffffffffffff
343 ; CHECK-NEXT: sub z0.h, p0/m, z0.h, z1.h
345 %extend = sext <vscale x 8 x i1> %v to <vscale x 8 x i8>
346 %result = sub <vscale x 8 x i8> %a, %extend
347 ret <vscale x 8 x i8> %result
350 define <vscale x 4 x i16> @sext.sub.4xi16(<vscale x 4 x i16> %a, <vscale x 4 x i1> %v) #0 {
351 ; CHECK-LABEL: sext.sub.4xi16:
353 ; CHECK-NEXT: mov z1.s, #-1 // =0xffffffffffffffff
354 ; CHECK-NEXT: sub z0.s, p0/m, z0.s, z1.s
356 %extend = sext <vscale x 4 x i1> %v to <vscale x 4 x i16>
357 %result = sub <vscale x 4 x i16> %a, %extend
358 ret <vscale x 4 x i16> %result
361 define <vscale x 2 x i32> @sext.sub.2xi32(<vscale x 2 x i32> %a, <vscale x 2 x i1> %v) #0 {
362 ; CHECK-LABEL: sext.sub.2xi32:
364 ; CHECK-NEXT: mov z1.d, #-1 // =0xffffffffffffffff
365 ; CHECK-NEXT: sub z0.d, p0/m, z0.d, z1.d
367 %extend = sext <vscale x 2 x i1> %v to <vscale x 2 x i32>
368 %result = sub <vscale x 2 x i32> %a, %extend
369 ret <vscale x 2 x i32> %result
372 define <vscale x 16 x i8> @sext.sub.16xi8(<vscale x 16 x i8> %a, <vscale x 16 x i1> %v) #0 {
373 ; CHECK-LABEL: sext.sub.16xi8:
375 ; CHECK-NEXT: mov z1.b, #-1 // =0xffffffffffffffff
376 ; CHECK-NEXT: sub z0.b, p0/m, z0.b, z1.b
378 %extend = sext <vscale x 16 x i1> %v to <vscale x 16 x i8>
379 %result = sub <vscale x 16 x i8> %a, %extend
380 ret <vscale x 16 x i8> %result
383 define <vscale x 8 x i16> @sext.sub.8xi16(<vscale x 8 x i16> %a, <vscale x 8 x i1> %v) #0 {
384 ; CHECK-LABEL: sext.sub.8xi16:
386 ; CHECK-NEXT: mov z1.h, #-1 // =0xffffffffffffffff
387 ; CHECK-NEXT: sub z0.h, p0/m, z0.h, z1.h
389 %extend = sext <vscale x 8 x i1> %v to <vscale x 8 x i16>
390 %result = sub <vscale x 8 x i16> %a, %extend
391 ret <vscale x 8 x i16> %result
394 define <vscale x 4 x i32> @sext.sub.4xi32(<vscale x 4 x i32> %a, <vscale x 4 x i1> %v) #0 {
395 ; CHECK-LABEL: sext.sub.4xi32:
397 ; CHECK-NEXT: mov z1.s, #-1 // =0xffffffffffffffff
398 ; CHECK-NEXT: sub z0.s, p0/m, z0.s, z1.s
400 %extend = sext <vscale x 4 x i1> %v to <vscale x 4 x i32>
401 %result = sub <vscale x 4 x i32> %a, %extend
402 ret <vscale x 4 x i32> %result
405 define <vscale x 2 x i64> @sext.sub.2xi64(<vscale x 2 x i64> %a, <vscale x 2 x i1> %v) #0 {
406 ; CHECK-LABEL: sext.sub.2xi64:
408 ; CHECK-NEXT: mov z1.d, #-1 // =0xffffffffffffffff
409 ; CHECK-NEXT: sub z0.d, p0/m, z0.d, z1.d
411 %extend = sext <vscale x 2 x i1> %v to <vscale x 2 x i64>
412 %result = sub <vscale x 2 x i64> %a, %extend
413 ret <vscale x 2 x i64> %result
416 define <vscale x 8 x i32> @sext.sub.8xi32(<vscale x 8 x i32> %a, <vscale x 8 x i1> %v) #0 {
417 ; CHECK-LABEL: sext.sub.8xi32:
419 ; CHECK-NEXT: punpkhi p1.h, p0.b
420 ; CHECK-NEXT: mov z2.s, #-1 // =0xffffffffffffffff
421 ; CHECK-NEXT: punpklo p0.h, p0.b
422 ; CHECK-NEXT: sub z1.s, p1/m, z1.s, z2.s
423 ; CHECK-NEXT: sub z0.s, p0/m, z0.s, z2.s
425 %extend = sext <vscale x 8 x i1> %v to <vscale x 8 x i32>
426 %result = sub <vscale x 8 x i32> %a, %extend
427 ret <vscale x 8 x i32> %result
430 define <vscale x 16 x i32> @sext.sub.16xi32(<vscale x 16 x i32> %a, <vscale x 16 x i1> %v) #0 {
431 ; CHECK-LABEL: sext.sub.16xi32:
433 ; CHECK-NEXT: punpkhi p1.h, p0.b
434 ; CHECK-NEXT: mov z4.s, #-1 // =0xffffffffffffffff
435 ; CHECK-NEXT: punpklo p0.h, p0.b
436 ; CHECK-NEXT: punpkhi p2.h, p1.b
437 ; CHECK-NEXT: punpklo p1.h, p1.b
438 ; CHECK-NEXT: punpklo p3.h, p0.b
439 ; CHECK-NEXT: punpkhi p0.h, p0.b
440 ; CHECK-NEXT: sub z3.s, p2/m, z3.s, z4.s
441 ; CHECK-NEXT: sub z2.s, p1/m, z2.s, z4.s
442 ; CHECK-NEXT: sub z0.s, p3/m, z0.s, z4.s
443 ; CHECK-NEXT: sub z1.s, p0/m, z1.s, z4.s
445 %extend = sext <vscale x 16 x i1> %v to <vscale x 16 x i32>
446 %result = sub <vscale x 16 x i32> %a, %extend
447 ret <vscale x 16 x i32> %result
450 attributes #0 = { "target-features"="+sve" }