1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mattr=+sve -force-streaming-compatible-sve < %s | FileCheck %s
3 ; RUN: llc -mattr=+sme -force-streaming-compatible-sve < %s | FileCheck %s
5 target triple = "aarch64-unknown-linux-gnu"
11 define <8 x i8> @icmp_eq_v8i8(<8 x i8> %op1, <8 x i8> %op2) {
12 ; CHECK-LABEL: icmp_eq_v8i8:
14 ; CHECK-NEXT: ptrue p0.b, vl8
15 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
16 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
17 ; CHECK-NEXT: cmpeq p0.b, p0/z, z0.b, z1.b
18 ; CHECK-NEXT: mov z0.b, p0/z, #-1 // =0xffffffffffffffff
19 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
21 %cmp = icmp eq <8 x i8> %op1, %op2
22 %sext = sext <8 x i1> %cmp to <8 x i8>
26 define <16 x i8> @icmp_eq_v16i8(<16 x i8> %op1, <16 x i8> %op2) {
27 ; CHECK-LABEL: icmp_eq_v16i8:
29 ; CHECK-NEXT: ptrue p0.b, vl16
30 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
31 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
32 ; CHECK-NEXT: cmpeq p0.b, p0/z, z0.b, z1.b
33 ; CHECK-NEXT: mov z0.b, p0/z, #-1 // =0xffffffffffffffff
34 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
36 %cmp = icmp eq <16 x i8> %op1, %op2
37 %sext = sext <16 x i1> %cmp to <16 x i8>
41 define void @icmp_eq_v32i8(ptr %a, ptr %b) {
42 ; CHECK-LABEL: icmp_eq_v32i8:
44 ; CHECK-NEXT: ptrue p0.b, vl16
45 ; CHECK-NEXT: ldp q0, q3, [x1]
46 ; CHECK-NEXT: ldp q1, q2, [x0]
47 ; CHECK-NEXT: cmpeq p1.b, p0/z, z1.b, z0.b
48 ; CHECK-NEXT: cmpeq p0.b, p0/z, z2.b, z3.b
49 ; CHECK-NEXT: mov z0.b, p1/z, #-1 // =0xffffffffffffffff
50 ; CHECK-NEXT: mov z1.b, p0/z, #-1 // =0xffffffffffffffff
51 ; CHECK-NEXT: stp q0, q1, [x0]
53 %op1 = load <32 x i8>, ptr %a
54 %op2 = load <32 x i8>, ptr %b
55 %cmp = icmp eq <32 x i8> %op1, %op2
56 %sext = sext <32 x i1> %cmp to <32 x i8>
57 store <32 x i8> %sext, ptr %a
61 define <4 x i16> @icmp_eq_v4i16(<4 x i16> %op1, <4 x i16> %op2) {
62 ; CHECK-LABEL: icmp_eq_v4i16:
64 ; CHECK-NEXT: ptrue p0.h, vl4
65 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
66 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
67 ; CHECK-NEXT: cmpeq p0.h, p0/z, z0.h, z1.h
68 ; CHECK-NEXT: mov z0.h, p0/z, #-1 // =0xffffffffffffffff
69 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
71 %cmp = icmp eq <4 x i16> %op1, %op2
72 %sext = sext <4 x i1> %cmp to <4 x i16>
76 define <8 x i16> @icmp_eq_v8i16(<8 x i16> %op1, <8 x i16> %op2) {
77 ; CHECK-LABEL: icmp_eq_v8i16:
79 ; CHECK-NEXT: ptrue p0.h, vl8
80 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
81 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
82 ; CHECK-NEXT: cmpeq p0.h, p0/z, z0.h, z1.h
83 ; CHECK-NEXT: mov z0.h, p0/z, #-1 // =0xffffffffffffffff
84 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
86 %cmp = icmp eq <8 x i16> %op1, %op2
87 %sext = sext <8 x i1> %cmp to <8 x i16>
91 define void @icmp_eq_v16i16(ptr %a, ptr %b) {
92 ; CHECK-LABEL: icmp_eq_v16i16:
94 ; CHECK-NEXT: ptrue p0.h, vl8
95 ; CHECK-NEXT: ldp q0, q3, [x1]
96 ; CHECK-NEXT: ldp q1, q2, [x0]
97 ; CHECK-NEXT: cmpeq p1.h, p0/z, z1.h, z0.h
98 ; CHECK-NEXT: cmpeq p0.h, p0/z, z2.h, z3.h
99 ; CHECK-NEXT: mov z0.h, p1/z, #-1 // =0xffffffffffffffff
100 ; CHECK-NEXT: mov z1.h, p0/z, #-1 // =0xffffffffffffffff
101 ; CHECK-NEXT: stp q0, q1, [x0]
103 %op1 = load <16 x i16>, ptr %a
104 %op2 = load <16 x i16>, ptr %b
105 %cmp = icmp eq <16 x i16> %op1, %op2
106 %sext = sext <16 x i1> %cmp to <16 x i16>
107 store <16 x i16> %sext, ptr %a
111 define <2 x i32> @icmp_eq_v2i32(<2 x i32> %op1, <2 x i32> %op2) {
112 ; CHECK-LABEL: icmp_eq_v2i32:
114 ; CHECK-NEXT: ptrue p0.s, vl2
115 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
116 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
117 ; CHECK-NEXT: cmpeq p0.s, p0/z, z0.s, z1.s
118 ; CHECK-NEXT: mov z0.s, p0/z, #-1 // =0xffffffffffffffff
119 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
121 %cmp = icmp eq <2 x i32> %op1, %op2
122 %sext = sext <2 x i1> %cmp to <2 x i32>
126 define <4 x i32> @icmp_eq_v4i32(<4 x i32> %op1, <4 x i32> %op2) {
127 ; CHECK-LABEL: icmp_eq_v4i32:
129 ; CHECK-NEXT: ptrue p0.s, vl4
130 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
131 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
132 ; CHECK-NEXT: cmpeq p0.s, p0/z, z0.s, z1.s
133 ; CHECK-NEXT: mov z0.s, p0/z, #-1 // =0xffffffffffffffff
134 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
136 %cmp = icmp eq <4 x i32> %op1, %op2
137 %sext = sext <4 x i1> %cmp to <4 x i32>
141 define void @icmp_eq_v8i32(ptr %a, ptr %b) {
142 ; CHECK-LABEL: icmp_eq_v8i32:
144 ; CHECK-NEXT: ptrue p0.s, vl4
145 ; CHECK-NEXT: ldp q0, q3, [x1]
146 ; CHECK-NEXT: ldp q1, q2, [x0]
147 ; CHECK-NEXT: cmpeq p1.s, p0/z, z1.s, z0.s
148 ; CHECK-NEXT: cmpeq p0.s, p0/z, z2.s, z3.s
149 ; CHECK-NEXT: mov z0.s, p1/z, #-1 // =0xffffffffffffffff
150 ; CHECK-NEXT: mov z1.s, p0/z, #-1 // =0xffffffffffffffff
151 ; CHECK-NEXT: stp q0, q1, [x0]
153 %op1 = load <8 x i32>, ptr %a
154 %op2 = load <8 x i32>, ptr %b
155 %cmp = icmp eq <8 x i32> %op1, %op2
156 %sext = sext <8 x i1> %cmp to <8 x i32>
157 store <8 x i32> %sext, ptr %a
161 define <1 x i64> @icmp_eq_v1i64(<1 x i64> %op1, <1 x i64> %op2) {
162 ; CHECK-LABEL: icmp_eq_v1i64:
164 ; CHECK-NEXT: ptrue p0.d, vl1
165 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
166 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
167 ; CHECK-NEXT: cmpeq p0.d, p0/z, z0.d, z1.d
168 ; CHECK-NEXT: mov z0.d, p0/z, #-1 // =0xffffffffffffffff
169 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
171 %cmp = icmp eq <1 x i64> %op1, %op2
172 %sext = sext <1 x i1> %cmp to <1 x i64>
176 define <2 x i64> @icmp_eq_v2i64(<2 x i64> %op1, <2 x i64> %op2) {
177 ; CHECK-LABEL: icmp_eq_v2i64:
179 ; CHECK-NEXT: ptrue p0.d, vl2
180 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
181 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
182 ; CHECK-NEXT: cmpeq p0.d, p0/z, z0.d, z1.d
183 ; CHECK-NEXT: mov z0.d, p0/z, #-1 // =0xffffffffffffffff
184 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
186 %cmp = icmp eq <2 x i64> %op1, %op2
187 %sext = sext <2 x i1> %cmp to <2 x i64>
191 define void @icmp_eq_v4i64(ptr %a, ptr %b) {
192 ; CHECK-LABEL: icmp_eq_v4i64:
194 ; CHECK-NEXT: ptrue p0.d, vl2
195 ; CHECK-NEXT: ldp q0, q3, [x1]
196 ; CHECK-NEXT: ldp q1, q2, [x0]
197 ; CHECK-NEXT: cmpeq p1.d, p0/z, z1.d, z0.d
198 ; CHECK-NEXT: cmpeq p0.d, p0/z, z2.d, z3.d
199 ; CHECK-NEXT: mov z0.d, p1/z, #-1 // =0xffffffffffffffff
200 ; CHECK-NEXT: mov z1.d, p0/z, #-1 // =0xffffffffffffffff
201 ; CHECK-NEXT: stp q0, q1, [x0]
203 %op1 = load <4 x i64>, ptr %a
204 %op2 = load <4 x i64>, ptr %b
205 %cmp = icmp eq <4 x i64> %op1, %op2
206 %sext = sext <4 x i1> %cmp to <4 x i64>
207 store <4 x i64> %sext, ptr %a
215 define void @icmp_ne_v32i8(ptr %a, ptr %b) {
216 ; CHECK-LABEL: icmp_ne_v32i8:
218 ; CHECK-NEXT: ptrue p0.b, vl16
219 ; CHECK-NEXT: ldp q0, q3, [x1]
220 ; CHECK-NEXT: ldp q1, q2, [x0]
221 ; CHECK-NEXT: cmpne p1.b, p0/z, z1.b, z0.b
222 ; CHECK-NEXT: cmpne p0.b, p0/z, z2.b, z3.b
223 ; CHECK-NEXT: mov z0.b, p1/z, #-1 // =0xffffffffffffffff
224 ; CHECK-NEXT: mov z1.b, p0/z, #-1 // =0xffffffffffffffff
225 ; CHECK-NEXT: stp q0, q1, [x0]
227 %op1 = load <32 x i8>, ptr %a
228 %op2 = load <32 x i8>, ptr %b
229 %cmp = icmp ne <32 x i8> %op1, %op2
230 %sext = sext <32 x i1> %cmp to <32 x i8>
231 store <32 x i8> %sext, ptr %a
239 define void @icmp_sge_v8i16(ptr %a, ptr %b) {
240 ; CHECK-LABEL: icmp_sge_v8i16:
242 ; CHECK-NEXT: ptrue p0.h, vl8
243 ; CHECK-NEXT: ldr q0, [x0]
244 ; CHECK-NEXT: ldr q1, [x1]
245 ; CHECK-NEXT: cmpge p0.h, p0/z, z0.h, z1.h
246 ; CHECK-NEXT: mov z0.h, p0/z, #-1 // =0xffffffffffffffff
247 ; CHECK-NEXT: str q0, [x0]
249 %op1 = load <8 x i16>, ptr %a
250 %op2 = load <8 x i16>, ptr %b
251 %cmp = icmp sge <8 x i16> %op1, %op2
252 %sext = sext <8 x i1> %cmp to <8 x i16>
253 store <8 x i16> %sext, ptr %a
261 define void @icmp_sgt_v16i16(ptr %a, ptr %b) {
262 ; CHECK-LABEL: icmp_sgt_v16i16:
264 ; CHECK-NEXT: ptrue p0.h, vl8
265 ; CHECK-NEXT: ldp q0, q3, [x1]
266 ; CHECK-NEXT: ldp q1, q2, [x0]
267 ; CHECK-NEXT: cmpgt p1.h, p0/z, z1.h, z0.h
268 ; CHECK-NEXT: cmpgt p0.h, p0/z, z2.h, z3.h
269 ; CHECK-NEXT: mov z0.h, p1/z, #-1 // =0xffffffffffffffff
270 ; CHECK-NEXT: mov z1.h, p0/z, #-1 // =0xffffffffffffffff
271 ; CHECK-NEXT: stp q0, q1, [x0]
273 %op1 = load <16 x i16>, ptr %a
274 %op2 = load <16 x i16>, ptr %b
275 %cmp = icmp sgt <16 x i16> %op1, %op2
276 %sext = sext <16 x i1> %cmp to <16 x i16>
277 store <16 x i16> %sext, ptr %a
285 define void @icmp_sle_v4i32(ptr %a, ptr %b) {
286 ; CHECK-LABEL: icmp_sle_v4i32:
288 ; CHECK-NEXT: ptrue p0.s, vl4
289 ; CHECK-NEXT: ldr q0, [x0]
290 ; CHECK-NEXT: ldr q1, [x1]
291 ; CHECK-NEXT: cmpge p0.s, p0/z, z1.s, z0.s
292 ; CHECK-NEXT: mov z0.s, p0/z, #-1 // =0xffffffffffffffff
293 ; CHECK-NEXT: str q0, [x0]
295 %op1 = load <4 x i32>, ptr %a
296 %op2 = load <4 x i32>, ptr %b
297 %cmp = icmp sle <4 x i32> %op1, %op2
298 %sext = sext <4 x i1> %cmp to <4 x i32>
299 store <4 x i32> %sext, ptr %a
307 define void @icmp_slt_v8i32(ptr %a, ptr %b) {
308 ; CHECK-LABEL: icmp_slt_v8i32:
310 ; CHECK-NEXT: ptrue p0.s, vl4
311 ; CHECK-NEXT: ldp q0, q3, [x1]
312 ; CHECK-NEXT: ldp q1, q2, [x0]
313 ; CHECK-NEXT: cmpgt p1.s, p0/z, z0.s, z1.s
314 ; CHECK-NEXT: cmpgt p0.s, p0/z, z3.s, z2.s
315 ; CHECK-NEXT: mov z0.s, p1/z, #-1 // =0xffffffffffffffff
316 ; CHECK-NEXT: mov z1.s, p0/z, #-1 // =0xffffffffffffffff
317 ; CHECK-NEXT: stp q0, q1, [x0]
319 %op1 = load <8 x i32>, ptr %a
320 %op2 = load <8 x i32>, ptr %b
321 %cmp = icmp slt <8 x i32> %op1, %op2
322 %sext = sext <8 x i1> %cmp to <8 x i32>
323 store <8 x i32> %sext, ptr %a
331 define void @icmp_uge_v2i64(ptr %a, ptr %b) {
332 ; CHECK-LABEL: icmp_uge_v2i64:
334 ; CHECK-NEXT: ptrue p0.d, vl2
335 ; CHECK-NEXT: ldr q0, [x0]
336 ; CHECK-NEXT: ldr q1, [x1]
337 ; CHECK-NEXT: cmphs p0.d, p0/z, z0.d, z1.d
338 ; CHECK-NEXT: mov z0.d, p0/z, #-1 // =0xffffffffffffffff
339 ; CHECK-NEXT: str q0, [x0]
341 %op1 = load <2 x i64>, ptr %a
342 %op2 = load <2 x i64>, ptr %b
343 %cmp = icmp uge <2 x i64> %op1, %op2
344 %sext = sext <2 x i1> %cmp to <2 x i64>
345 store <2 x i64> %sext, ptr %a
353 define void @icmp_ugt_v2i64(ptr %a, ptr %b) {
354 ; CHECK-LABEL: icmp_ugt_v2i64:
356 ; CHECK-NEXT: ptrue p0.d, vl2
357 ; CHECK-NEXT: ldr q0, [x0]
358 ; CHECK-NEXT: ldr q1, [x1]
359 ; CHECK-NEXT: cmphi p0.d, p0/z, z0.d, z1.d
360 ; CHECK-NEXT: mov z0.d, p0/z, #-1 // =0xffffffffffffffff
361 ; CHECK-NEXT: str q0, [x0]
363 %op1 = load <2 x i64>, ptr %a
364 %op2 = load <2 x i64>, ptr %b
365 %cmp = icmp ugt <2 x i64> %op1, %op2
366 %sext = sext <2 x i1> %cmp to <2 x i64>
367 store <2 x i64> %sext, ptr %a
375 define void @icmp_ule_v2i64(ptr %a, ptr %b) {
376 ; CHECK-LABEL: icmp_ule_v2i64:
378 ; CHECK-NEXT: ptrue p0.d, vl2
379 ; CHECK-NEXT: ldr q0, [x0]
380 ; CHECK-NEXT: ldr q1, [x1]
381 ; CHECK-NEXT: cmphs p0.d, p0/z, z1.d, z0.d
382 ; CHECK-NEXT: mov z0.d, p0/z, #-1 // =0xffffffffffffffff
383 ; CHECK-NEXT: str q0, [x0]
385 %op1 = load <2 x i64>, ptr %a
386 %op2 = load <2 x i64>, ptr %b
387 %cmp = icmp ule <2 x i64> %op1, %op2
388 %sext = sext <2 x i1> %cmp to <2 x i64>
389 store <2 x i64> %sext, ptr %a
397 define void @icmp_ult_v2i64(ptr %a, ptr %b) {
398 ; CHECK-LABEL: icmp_ult_v2i64:
400 ; CHECK-NEXT: ptrue p0.d, vl2
401 ; CHECK-NEXT: ldr q0, [x0]
402 ; CHECK-NEXT: ldr q1, [x1]
403 ; CHECK-NEXT: cmphi p0.d, p0/z, z1.d, z0.d
404 ; CHECK-NEXT: mov z0.d, p0/z, #-1 // =0xffffffffffffffff
405 ; CHECK-NEXT: str q0, [x0]
407 %op1 = load <2 x i64>, ptr %a
408 %op2 = load <2 x i64>, ptr %b
409 %cmp = icmp ult <2 x i64> %op1, %op2
410 %sext = sext <2 x i1> %cmp to <2 x i64>
411 store <2 x i64> %sext, ptr %a