1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=thumbv8.1m.main-none-none-eabi -mattr=+mve -verify-machineinstrs %s -o - | FileCheck %s
4 define arm_aapcs_vfpcc <4 x i32> @cmpeqz_v4i1(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c) {
5 ; CHECK-LABEL: cmpeqz_v4i1:
6 ; CHECK: @ %bb.0: @ %entry
7 ; CHECK-NEXT: vpt.i32 eq, q1, zr
8 ; CHECK-NEXT: vcmpt.i32 ne, q2, zr
9 ; CHECK-NEXT: vmrs r0, p0
10 ; CHECK-NEXT: vpt.i32 eq, q0, zr
11 ; CHECK-NEXT: vcmpt.i32 eq, q2, zr
12 ; CHECK-NEXT: vmrs r1, p0
13 ; CHECK-NEXT: orrs r0, r1
14 ; CHECK-NEXT: vmsr p0, r0
15 ; CHECK-NEXT: vpsel q0, q0, q1
18 %c1 = icmp eq <4 x i32> %a, zeroinitializer
19 %c2 = icmp eq <4 x i32> %b, zeroinitializer
20 %c3 = icmp eq <4 x i32> %c, zeroinitializer
21 %c4 = select <4 x i1> %c3, <4 x i1> %c1, <4 x i1> %c2
22 %s = select <4 x i1> %c4, <4 x i32> %a, <4 x i32> %b
26 define arm_aapcs_vfpcc <8 x i16> @cmpeqz_v8i1(<8 x i16> %a, <8 x i16> %b, <8 x i16> %c) {
27 ; CHECK-LABEL: cmpeqz_v8i1:
28 ; CHECK: @ %bb.0: @ %entry
29 ; CHECK-NEXT: vpt.i16 eq, q1, zr
30 ; CHECK-NEXT: vcmpt.i16 ne, q2, zr
31 ; CHECK-NEXT: vmrs r0, p0
32 ; CHECK-NEXT: vpt.i16 eq, q0, zr
33 ; CHECK-NEXT: vcmpt.i16 eq, q2, zr
34 ; CHECK-NEXT: vmrs r1, p0
35 ; CHECK-NEXT: orrs r0, r1
36 ; CHECK-NEXT: vmsr p0, r0
37 ; CHECK-NEXT: vpsel q0, q0, q1
40 %c1 = icmp eq <8 x i16> %a, zeroinitializer
41 %c2 = icmp eq <8 x i16> %b, zeroinitializer
42 %c3 = icmp eq <8 x i16> %c, zeroinitializer
43 %c4 = select <8 x i1> %c3, <8 x i1> %c1, <8 x i1> %c2
44 %s = select <8 x i1> %c4, <8 x i16> %a, <8 x i16> %b
48 define arm_aapcs_vfpcc <16 x i8> @cmpeqz_v16i1(<16 x i8> %a, <16 x i8> %b, <16 x i8> %c) {
49 ; CHECK-LABEL: cmpeqz_v16i1:
50 ; CHECK: @ %bb.0: @ %entry
51 ; CHECK-NEXT: vpt.i8 eq, q1, zr
52 ; CHECK-NEXT: vcmpt.i8 ne, q2, zr
53 ; CHECK-NEXT: vmrs r0, p0
54 ; CHECK-NEXT: vpt.i8 eq, q0, zr
55 ; CHECK-NEXT: vcmpt.i8 eq, q2, zr
56 ; CHECK-NEXT: vmrs r1, p0
57 ; CHECK-NEXT: orrs r0, r1
58 ; CHECK-NEXT: vmsr p0, r0
59 ; CHECK-NEXT: vpsel q0, q0, q1
62 %c1 = icmp eq <16 x i8> %a, zeroinitializer
63 %c2 = icmp eq <16 x i8> %b, zeroinitializer
64 %c3 = icmp eq <16 x i8> %c, zeroinitializer
65 %c4 = select <16 x i1> %c3, <16 x i1> %c1, <16 x i1> %c2
66 %s = select <16 x i1> %c4, <16 x i8> %a, <16 x i8> %b
70 define arm_aapcs_vfpcc <2 x i64> @cmpeqz_v2i1(<2 x i64> %a, <2 x i64> %b, <2 x i64> %c) {
71 ; CHECK-LABEL: cmpeqz_v2i1:
72 ; CHECK: @ %bb.0: @ %entry
73 ; CHECK-NEXT: vmov r0, r1, d4
74 ; CHECK-NEXT: orrs r0, r1
75 ; CHECK-NEXT: vmov r1, r2, d0
76 ; CHECK-NEXT: orrs r1, r2
77 ; CHECK-NEXT: vmov r2, r3, d2
78 ; CHECK-NEXT: cset r1, eq
79 ; CHECK-NEXT: orrs r2, r3
80 ; CHECK-NEXT: cset r2, eq
81 ; CHECK-NEXT: cmp r0, #0
82 ; CHECK-NEXT: csel r0, r1, r2, eq
83 ; CHECK-NEXT: movs r1, #0
84 ; CHECK-NEXT: rsbs r0, r0, #0
85 ; CHECK-NEXT: bfi r1, r0, #0, #8
86 ; CHECK-NEXT: vmov r0, r2, d5
87 ; CHECK-NEXT: orr.w r12, r0, r2
88 ; CHECK-NEXT: vmov r2, r3, d1
89 ; CHECK-NEXT: orrs r2, r3
90 ; CHECK-NEXT: vmov r3, r0, d3
91 ; CHECK-NEXT: cset r2, eq
92 ; CHECK-NEXT: orrs r0, r3
93 ; CHECK-NEXT: cset r0, eq
94 ; CHECK-NEXT: cmp.w r12, #0
95 ; CHECK-NEXT: csel r0, r2, r0, eq
96 ; CHECK-NEXT: rsbs r0, r0, #0
97 ; CHECK-NEXT: bfi r1, r0, #8, #8
98 ; CHECK-NEXT: vmsr p0, r1
99 ; CHECK-NEXT: vpsel q0, q0, q1
102 %c1 = icmp eq <2 x i64> %a, zeroinitializer
103 %c2 = icmp eq <2 x i64> %b, zeroinitializer
104 %c3 = icmp eq <2 x i64> %c, zeroinitializer
105 %c4 = select <2 x i1> %c3, <2 x i1> %c1, <2 x i1> %c2
106 %s = select <2 x i1> %c4, <2 x i64> %a, <2 x i64> %b
110 define arm_aapcs_vfpcc <4 x i32> @cmpnez_v4i1(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c) {
111 ; CHECK-LABEL: cmpnez_v4i1:
112 ; CHECK: @ %bb.0: @ %entry
113 ; CHECK-NEXT: vpt.i32 ne, q1, zr
114 ; CHECK-NEXT: vcmpt.i32 eq, q2, zr
115 ; CHECK-NEXT: vmrs r0, p0
116 ; CHECK-NEXT: vpt.i32 ne, q0, zr
117 ; CHECK-NEXT: vcmpt.i32 ne, q2, zr
118 ; CHECK-NEXT: vmrs r1, p0
119 ; CHECK-NEXT: orrs r0, r1
120 ; CHECK-NEXT: vmsr p0, r0
121 ; CHECK-NEXT: vpsel q0, q0, q1
124 %c1 = icmp ne <4 x i32> %a, zeroinitializer
125 %c2 = icmp ne <4 x i32> %b, zeroinitializer
126 %c3 = icmp ne <4 x i32> %c, zeroinitializer
127 %c4 = select <4 x i1> %c3, <4 x i1> %c1, <4 x i1> %c2
128 %s = select <4 x i1> %c4, <4 x i32> %a, <4 x i32> %b
132 define arm_aapcs_vfpcc <8 x i16> @cmpnez_v8i1(<8 x i16> %a, <8 x i16> %b, <8 x i16> %c) {
133 ; CHECK-LABEL: cmpnez_v8i1:
134 ; CHECK: @ %bb.0: @ %entry
135 ; CHECK-NEXT: vpt.i16 ne, q1, zr
136 ; CHECK-NEXT: vcmpt.i16 eq, q2, zr
137 ; CHECK-NEXT: vmrs r0, p0
138 ; CHECK-NEXT: vpt.i16 ne, q0, zr
139 ; CHECK-NEXT: vcmpt.i16 ne, q2, zr
140 ; CHECK-NEXT: vmrs r1, p0
141 ; CHECK-NEXT: orrs r0, r1
142 ; CHECK-NEXT: vmsr p0, r0
143 ; CHECK-NEXT: vpsel q0, q0, q1
146 %c1 = icmp ne <8 x i16> %a, zeroinitializer
147 %c2 = icmp ne <8 x i16> %b, zeroinitializer
148 %c3 = icmp ne <8 x i16> %c, zeroinitializer
149 %c4 = select <8 x i1> %c3, <8 x i1> %c1, <8 x i1> %c2
150 %s = select <8 x i1> %c4, <8 x i16> %a, <8 x i16> %b
154 define arm_aapcs_vfpcc <16 x i8> @cmpnez_v16i1(<16 x i8> %a, <16 x i8> %b, <16 x i8> %c) {
155 ; CHECK-LABEL: cmpnez_v16i1:
156 ; CHECK: @ %bb.0: @ %entry
157 ; CHECK-NEXT: vpt.i8 ne, q1, zr
158 ; CHECK-NEXT: vcmpt.i8 eq, q2, zr
159 ; CHECK-NEXT: vmrs r0, p0
160 ; CHECK-NEXT: vpt.i8 ne, q0, zr
161 ; CHECK-NEXT: vcmpt.i8 ne, q2, zr
162 ; CHECK-NEXT: vmrs r1, p0
163 ; CHECK-NEXT: orrs r0, r1
164 ; CHECK-NEXT: vmsr p0, r0
165 ; CHECK-NEXT: vpsel q0, q0, q1
168 %c1 = icmp ne <16 x i8> %a, zeroinitializer
169 %c2 = icmp ne <16 x i8> %b, zeroinitializer
170 %c3 = icmp ne <16 x i8> %c, zeroinitializer
171 %c4 = select <16 x i1> %c3, <16 x i1> %c1, <16 x i1> %c2
172 %s = select <16 x i1> %c4, <16 x i8> %a, <16 x i8> %b
176 define arm_aapcs_vfpcc <2 x i64> @cmpnez_v2i1(<2 x i64> %a, <2 x i64> %b, <2 x i64> %c) {
177 ; CHECK-LABEL: cmpnez_v2i1:
178 ; CHECK: @ %bb.0: @ %entry
179 ; CHECK-NEXT: vmov r0, r1, d4
180 ; CHECK-NEXT: orrs r0, r1
181 ; CHECK-NEXT: vmov r1, r2, d0
182 ; CHECK-NEXT: orrs r1, r2
183 ; CHECK-NEXT: vmov r2, r3, d2
184 ; CHECK-NEXT: cset r1, ne
185 ; CHECK-NEXT: orrs r2, r3
186 ; CHECK-NEXT: cset r2, ne
187 ; CHECK-NEXT: cmp r0, #0
188 ; CHECK-NEXT: csel r0, r1, r2, ne
189 ; CHECK-NEXT: movs r1, #0
190 ; CHECK-NEXT: rsbs r0, r0, #0
191 ; CHECK-NEXT: bfi r1, r0, #0, #8
192 ; CHECK-NEXT: vmov r0, r2, d5
193 ; CHECK-NEXT: orr.w r12, r0, r2
194 ; CHECK-NEXT: vmov r2, r3, d1
195 ; CHECK-NEXT: orrs r2, r3
196 ; CHECK-NEXT: vmov r3, r0, d3
197 ; CHECK-NEXT: cset r2, ne
198 ; CHECK-NEXT: orrs r0, r3
199 ; CHECK-NEXT: cset r0, ne
200 ; CHECK-NEXT: cmp.w r12, #0
201 ; CHECK-NEXT: csel r0, r2, r0, ne
202 ; CHECK-NEXT: rsbs r0, r0, #0
203 ; CHECK-NEXT: bfi r1, r0, #8, #8
204 ; CHECK-NEXT: vmsr p0, r1
205 ; CHECK-NEXT: vpsel q0, q0, q1
208 %c1 = icmp ne <2 x i64> %a, zeroinitializer
209 %c2 = icmp ne <2 x i64> %b, zeroinitializer
210 %c3 = icmp ne <2 x i64> %c, zeroinitializer
211 %c4 = select <2 x i1> %c3, <2 x i1> %c1, <2 x i1> %c2
212 %s = select <2 x i1> %c4, <2 x i64> %a, <2 x i64> %b
218 define arm_aapcs_vfpcc <4 x i32> @cmpsltz_v4i1(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c) {
219 ; CHECK-LABEL: cmpsltz_v4i1:
220 ; CHECK: @ %bb.0: @ %entry
221 ; CHECK-NEXT: vpt.s32 lt, q1, zr
222 ; CHECK-NEXT: vcmpt.s32 ge, q2, zr
223 ; CHECK-NEXT: vmrs r0, p0
224 ; CHECK-NEXT: vpt.s32 lt, q0, zr
225 ; CHECK-NEXT: vcmpt.s32 lt, q2, zr
226 ; CHECK-NEXT: vmrs r1, p0
227 ; CHECK-NEXT: orrs r0, r1
228 ; CHECK-NEXT: vmsr p0, r0
229 ; CHECK-NEXT: vpsel q0, q0, q1
232 %c1 = icmp slt <4 x i32> %a, zeroinitializer
233 %c2 = icmp slt <4 x i32> %b, zeroinitializer
234 %c3 = icmp slt <4 x i32> %c, zeroinitializer
235 %c4 = select <4 x i1> %c3, <4 x i1> %c1, <4 x i1> %c2
236 %s = select <4 x i1> %c4, <4 x i32> %a, <4 x i32> %b
240 define arm_aapcs_vfpcc <8 x i16> @cmpsltz_v8i1(<8 x i16> %a, <8 x i16> %b, <8 x i16> %c) {
241 ; CHECK-LABEL: cmpsltz_v8i1:
242 ; CHECK: @ %bb.0: @ %entry
243 ; CHECK-NEXT: vpt.s16 lt, q1, zr
244 ; CHECK-NEXT: vcmpt.s16 ge, q2, zr
245 ; CHECK-NEXT: vmrs r0, p0
246 ; CHECK-NEXT: vpt.s16 lt, q0, zr
247 ; CHECK-NEXT: vcmpt.s16 lt, q2, zr
248 ; CHECK-NEXT: vmrs r1, p0
249 ; CHECK-NEXT: orrs r0, r1
250 ; CHECK-NEXT: vmsr p0, r0
251 ; CHECK-NEXT: vpsel q0, q0, q1
254 %c1 = icmp slt <8 x i16> %a, zeroinitializer
255 %c2 = icmp slt <8 x i16> %b, zeroinitializer
256 %c3 = icmp slt <8 x i16> %c, zeroinitializer
257 %c4 = select <8 x i1> %c3, <8 x i1> %c1, <8 x i1> %c2
258 %s = select <8 x i1> %c4, <8 x i16> %a, <8 x i16> %b
262 define arm_aapcs_vfpcc <16 x i8> @cmpsltz_v16i1(<16 x i8> %a, <16 x i8> %b, <16 x i8> %c) {
263 ; CHECK-LABEL: cmpsltz_v16i1:
264 ; CHECK: @ %bb.0: @ %entry
265 ; CHECK-NEXT: vpt.s8 lt, q1, zr
266 ; CHECK-NEXT: vcmpt.s8 ge, q2, zr
267 ; CHECK-NEXT: vmrs r0, p0
268 ; CHECK-NEXT: vpt.s8 lt, q0, zr
269 ; CHECK-NEXT: vcmpt.s8 lt, q2, zr
270 ; CHECK-NEXT: vmrs r1, p0
271 ; CHECK-NEXT: orrs r0, r1
272 ; CHECK-NEXT: vmsr p0, r0
273 ; CHECK-NEXT: vpsel q0, q0, q1
276 %c1 = icmp slt <16 x i8> %a, zeroinitializer
277 %c2 = icmp slt <16 x i8> %b, zeroinitializer
278 %c3 = icmp slt <16 x i8> %c, zeroinitializer
279 %c4 = select <16 x i1> %c3, <16 x i1> %c1, <16 x i1> %c2
280 %s = select <16 x i1> %c4, <16 x i8> %a, <16 x i8> %b
284 define arm_aapcs_vfpcc <2 x i64> @cmpsltz_v2i1(<2 x i64> %a, <2 x i64> %b, <2 x i64> %c) {
285 ; CHECK-LABEL: cmpsltz_v2i1:
286 ; CHECK: @ %bb.0: @ %entry
287 ; CHECK-NEXT: vmov r0, s9
288 ; CHECK-NEXT: movs r3, #0
289 ; CHECK-NEXT: vmov r1, s1
290 ; CHECK-NEXT: vmov r2, s5
291 ; CHECK-NEXT: cmp.w r3, r0, lsr #31
292 ; CHECK-NEXT: csel r0, r1, r2, ne
293 ; CHECK-NEXT: vmov r1, s11
294 ; CHECK-NEXT: asr.w r12, r0, #31
295 ; CHECK-NEXT: vmov r2, s3
296 ; CHECK-NEXT: vmov r0, s7
297 ; CHECK-NEXT: cmp.w r3, r1, lsr #31
298 ; CHECK-NEXT: bfi r3, r12, #0, #8
299 ; CHECK-NEXT: csel r0, r2, r0, ne
300 ; CHECK-NEXT: asrs r0, r0, #31
301 ; CHECK-NEXT: bfi r3, r0, #8, #8
302 ; CHECK-NEXT: vmsr p0, r3
303 ; CHECK-NEXT: vpsel q0, q0, q1
306 %c1 = icmp slt <2 x i64> %a, zeroinitializer
307 %c2 = icmp slt <2 x i64> %b, zeroinitializer
308 %c3 = icmp slt <2 x i64> %c, zeroinitializer
309 %c4 = select <2 x i1> %c3, <2 x i1> %c1, <2 x i1> %c2
310 %s = select <2 x i1> %c4, <2 x i64> %a, <2 x i64> %b
316 define arm_aapcs_vfpcc <4 x i32> @cmpeqz_v4i1_i1(<4 x i32> %a, <4 x i32> %b, i32 %c) {
317 ; CHECK-LABEL: cmpeqz_v4i1_i1:
318 ; CHECK: @ %bb.0: @ %entry
319 ; CHECK-NEXT: cbz r0, .LBB12_2
320 ; CHECK-NEXT: @ %bb.1: @ %select.false
321 ; CHECK-NEXT: vcmp.i32 eq, q1, zr
322 ; CHECK-NEXT: vpsel q0, q0, q1
324 ; CHECK-NEXT: .LBB12_2:
325 ; CHECK-NEXT: vcmp.i32 eq, q0, zr
326 ; CHECK-NEXT: vpsel q0, q0, q1
329 %c1 = icmp eq <4 x i32> %a, zeroinitializer
330 %c2 = icmp eq <4 x i32> %b, zeroinitializer
331 %c3 = icmp eq i32 %c, 0
332 %c4 = select i1 %c3, <4 x i1> %c1, <4 x i1> %c2
333 %s = select <4 x i1> %c4, <4 x i32> %a, <4 x i32> %b
337 define arm_aapcs_vfpcc <8 x i16> @cmpeqz_v8i1_i1(<8 x i16> %a, <8 x i16> %b, i16 %c) {
338 ; CHECK-LABEL: cmpeqz_v8i1_i1:
339 ; CHECK: @ %bb.0: @ %entry
340 ; CHECK-NEXT: lsls r0, r0, #16
341 ; CHECK-NEXT: beq .LBB13_2
342 ; CHECK-NEXT: @ %bb.1: @ %select.false
343 ; CHECK-NEXT: vcmp.i16 eq, q1, zr
344 ; CHECK-NEXT: vpsel q0, q0, q1
346 ; CHECK-NEXT: .LBB13_2:
347 ; CHECK-NEXT: vcmp.i16 eq, q0, zr
348 ; CHECK-NEXT: vpsel q0, q0, q1
351 %c1 = icmp eq <8 x i16> %a, zeroinitializer
352 %c2 = icmp eq <8 x i16> %b, zeroinitializer
353 %c3 = icmp eq i16 %c, 0
354 %c4 = select i1 %c3, <8 x i1> %c1, <8 x i1> %c2
355 %s = select <8 x i1> %c4, <8 x i16> %a, <8 x i16> %b
359 define arm_aapcs_vfpcc <16 x i8> @cmpeqz_v16i1_i1(<16 x i8> %a, <16 x i8> %b, i8 %c) {
360 ; CHECK-LABEL: cmpeqz_v16i1_i1:
361 ; CHECK: @ %bb.0: @ %entry
362 ; CHECK-NEXT: lsls r0, r0, #24
363 ; CHECK-NEXT: beq .LBB14_2
364 ; CHECK-NEXT: @ %bb.1: @ %select.false
365 ; CHECK-NEXT: vcmp.i8 eq, q1, zr
366 ; CHECK-NEXT: vpsel q0, q0, q1
368 ; CHECK-NEXT: .LBB14_2:
369 ; CHECK-NEXT: vcmp.i8 eq, q0, zr
370 ; CHECK-NEXT: vpsel q0, q0, q1
373 %c1 = icmp eq <16 x i8> %a, zeroinitializer
374 %c2 = icmp eq <16 x i8> %b, zeroinitializer
375 %c3 = icmp eq i8 %c, 0
376 %c4 = select i1 %c3, <16 x i1> %c1, <16 x i1> %c2
377 %s = select <16 x i1> %c4, <16 x i8> %a, <16 x i8> %b
381 define arm_aapcs_vfpcc <2 x i64> @cmpeqz_v2i1_i1(<2 x i64> %a, <2 x i64> %b, i64 %c) {
382 ; CHECK-LABEL: cmpeqz_v2i1_i1:
383 ; CHECK: @ %bb.0: @ %entry
384 ; CHECK-NEXT: .save {r4, lr}
385 ; CHECK-NEXT: push {r4, lr}
386 ; CHECK-NEXT: orr.w r3, r0, r1
387 ; CHECK-NEXT: vmov r0, r1, d2
388 ; CHECK-NEXT: orrs r0, r1
389 ; CHECK-NEXT: vmov r1, r2, d3
390 ; CHECK-NEXT: csetm r12, eq
391 ; CHECK-NEXT: movs r0, #0
392 ; CHECK-NEXT: orrs r1, r2
393 ; CHECK-NEXT: vmov r1, r2, d0
394 ; CHECK-NEXT: csetm r4, eq
395 ; CHECK-NEXT: orrs r1, r2
396 ; CHECK-NEXT: vmov r1, r2, d1
397 ; CHECK-NEXT: csetm lr, eq
398 ; CHECK-NEXT: orrs r1, r2
399 ; CHECK-NEXT: csetm r1, eq
400 ; CHECK-NEXT: cbz r3, .LBB15_2
401 ; CHECK-NEXT: @ %bb.1: @ %select.false
402 ; CHECK-NEXT: bfi r0, r12, #0, #8
403 ; CHECK-NEXT: bfi r0, r4, #8, #8
404 ; CHECK-NEXT: b .LBB15_3
405 ; CHECK-NEXT: .LBB15_2:
406 ; CHECK-NEXT: bfi r0, lr, #0, #8
407 ; CHECK-NEXT: bfi r0, r1, #8, #8
408 ; CHECK-NEXT: .LBB15_3: @ %select.end
409 ; CHECK-NEXT: vmsr p0, r0
410 ; CHECK-NEXT: vpsel q0, q0, q1
411 ; CHECK-NEXT: pop {r4, pc}
413 %c1 = icmp eq <2 x i64> %a, zeroinitializer
414 %c2 = icmp eq <2 x i64> %b, zeroinitializer
415 %c3 = icmp eq i64 %c, zeroinitializer
416 %c4 = select i1 %c3, <2 x i1> %c1, <2 x i1> %c2
417 %s = select <2 x i1> %c4, <2 x i64> %a, <2 x i64> %b