1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
4 define <vscale x 2 x i64> @and_d(<vscale x 2 x i64> %a, <vscale x 2 x i64> %b) {
7 ; CHECK-NEXT: and z0.d, z0.d, z1.d
9 %res = and <vscale x 2 x i64> %a, %b
10 ret <vscale x 2 x i64> %res
13 define <vscale x 4 x i32> @and_s(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {
16 ; CHECK-NEXT: and z0.d, z0.d, z1.d
18 %res = and <vscale x 4 x i32> %a, %b
19 ret <vscale x 4 x i32> %res
22 define <vscale x 8 x i16> @and_h(<vscale x 8 x i16> %a, <vscale x 8 x i16> %b) {
25 ; CHECK-NEXT: and z0.d, z0.d, z1.d
27 %res = and <vscale x 8 x i16> %a, %b
28 ret <vscale x 8 x i16> %res
31 define <vscale x 16 x i8> @and_b(<vscale x 16 x i8> %a, <vscale x 16 x i8> %b) {
34 ; CHECK-NEXT: and z0.d, z0.d, z1.d
36 %res = and <vscale x 16 x i8> %a, %b
37 ret <vscale x 16 x i8> %res
40 define <vscale x 16 x i8> @and_b_zero(<vscale x 16 x i8> %a) {
41 ; CHECK-LABEL: and_b_zero:
43 ; CHECK-NEXT: mov z0.b, #0 // =0x0
45 %res = and <vscale x 16 x i8> %a, zeroinitializer
46 ret <vscale x 16 x i8> %res
49 define <vscale x 1 x i1> @and_pred_q(<vscale x 1 x i1> %a, <vscale x 1 x i1> %b) {
50 ; CHECK-LABEL: and_pred_q:
52 ; CHECK-NEXT: and p0.b, p0/z, p0.b, p1.b
54 %res = and <vscale x 1 x i1> %a, %b
55 ret <vscale x 1 x i1> %res
58 define <vscale x 2 x i1> @and_pred_d(<vscale x 2 x i1> %a, <vscale x 2 x i1> %b) {
59 ; CHECK-LABEL: and_pred_d:
61 ; CHECK-NEXT: and p0.b, p0/z, p0.b, p1.b
63 %res = and <vscale x 2 x i1> %a, %b
64 ret <vscale x 2 x i1> %res
67 define <vscale x 4 x i1> @and_pred_s(<vscale x 4 x i1> %a, <vscale x 4 x i1> %b) {
68 ; CHECK-LABEL: and_pred_s:
70 ; CHECK-NEXT: and p0.b, p0/z, p0.b, p1.b
72 %res = and <vscale x 4 x i1> %a, %b
73 ret <vscale x 4 x i1> %res
76 define <vscale x 8 x i1> @and_pred_h(<vscale x 8 x i1> %a, <vscale x 8 x i1> %b) {
77 ; CHECK-LABEL: and_pred_h:
79 ; CHECK-NEXT: and p0.b, p0/z, p0.b, p1.b
81 %res = and <vscale x 8 x i1> %a, %b
82 ret <vscale x 8 x i1> %res
85 define <vscale x 16 x i1> @and_pred_b(<vscale x 16 x i1> %a, <vscale x 16 x i1> %b) {
86 ; CHECK-LABEL: and_pred_b:
88 ; CHECK-NEXT: and p0.b, p0/z, p0.b, p1.b
90 %res = and <vscale x 16 x i1> %a, %b
91 ret <vscale x 16 x i1> %res
94 define <vscale x 2 x i64> @bic_d(<vscale x 2 x i64> %a, <vscale x 2 x i64> %b) {
97 ; CHECK-NEXT: bic z0.d, z0.d, z1.d
99 %allones = shufflevector <vscale x 2 x i64> insertelement(<vscale x 2 x i64> undef, i64 -1, i32 0), <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer
100 %not_b = xor <vscale x 2 x i64> %b, %allones
101 %res = and <vscale x 2 x i64> %a, %not_b
102 ret <vscale x 2 x i64> %res
105 define <vscale x 4 x i32> @bic_s(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {
106 ; CHECK-LABEL: bic_s:
108 ; CHECK-NEXT: bic z0.d, z0.d, z1.d
110 %allones = shufflevector <vscale x 4 x i32> insertelement(<vscale x 4 x i32> undef, i32 -1, i32 0), <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
111 %not_b = xor <vscale x 4 x i32> %b, %allones
112 %res = and <vscale x 4 x i32> %a, %not_b
113 ret <vscale x 4 x i32> %res
116 define <vscale x 8 x i16> @bic_h(<vscale x 8 x i16> %a, <vscale x 8 x i16> %b) {
117 ; CHECK-LABEL: bic_h:
119 ; CHECK-NEXT: bic z0.d, z0.d, z1.d
121 %allones = shufflevector <vscale x 8 x i16> insertelement(<vscale x 8 x i16> undef, i16 -1, i32 0), <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer
122 %not_b = xor <vscale x 8 x i16> %b, %allones
123 %res = and <vscale x 8 x i16> %a, %not_b
124 ret <vscale x 8 x i16> %res
127 define <vscale x 16 x i8> @bic_b(<vscale x 16 x i8> %a, <vscale x 16 x i8> %b) {
128 ; CHECK-LABEL: bic_b:
130 ; CHECK-NEXT: bic z0.d, z0.d, z1.d
132 %allones = shufflevector <vscale x 16 x i8> insertelement(<vscale x 16 x i8> undef, i8 -1, i32 0), <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer
133 %not_b = xor <vscale x 16 x i8> %b, %allones
134 %res = and <vscale x 16 x i8> %a, %not_b
135 ret <vscale x 16 x i8> %res
138 define <vscale x 1 x i1> @bic_pred_q(<vscale x 1 x i1> %a, <vscale x 1 x i1> %b) {
139 ; CHECK-LABEL: bic_pred_q:
141 ; CHECK-NEXT: bic p0.b, p0/z, p0.b, p1.b
143 %allones = shufflevector <vscale x 1 x i1> insertelement(<vscale x 1 x i1> undef, i1 true, i32 0), <vscale x 1 x i1> undef, <vscale x 1 x i32> zeroinitializer
144 %not_b = xor <vscale x 1 x i1> %b, %allones
145 %res = and <vscale x 1 x i1> %a, %not_b
146 ret <vscale x 1 x i1> %res
149 define <vscale x 2 x i1> @bic_pred_d(<vscale x 2 x i1> %a, <vscale x 2 x i1> %b) {
150 ; CHECK-LABEL: bic_pred_d:
152 ; CHECK-NEXT: bic p0.b, p0/z, p0.b, p1.b
154 %allones = shufflevector <vscale x 2 x i1> insertelement(<vscale x 2 x i1> undef, i1 true, i32 0), <vscale x 2 x i1> undef, <vscale x 2 x i32> zeroinitializer
155 %not_b = xor <vscale x 2 x i1> %b, %allones
156 %res = and <vscale x 2 x i1> %a, %not_b
157 ret <vscale x 2 x i1> %res
160 define <vscale x 4 x i1> @bic_pred_s(<vscale x 4 x i1> %a, <vscale x 4 x i1> %b) {
161 ; CHECK-LABEL: bic_pred_s:
163 ; CHECK-NEXT: bic p0.b, p0/z, p0.b, p1.b
165 %allones = shufflevector <vscale x 4 x i1> insertelement(<vscale x 4 x i1> undef, i1 true, i32 0), <vscale x 4 x i1> undef, <vscale x 4 x i32> zeroinitializer
166 %not_b = xor <vscale x 4 x i1> %b, %allones
167 %res = and <vscale x 4 x i1> %a, %not_b
168 ret <vscale x 4 x i1> %res
171 define <vscale x 8 x i1> @bic_pred_h(<vscale x 8 x i1> %a, <vscale x 8 x i1> %b) {
172 ; CHECK-LABEL: bic_pred_h:
174 ; CHECK-NEXT: bic p0.b, p0/z, p0.b, p1.b
176 %allones = shufflevector <vscale x 8 x i1> insertelement(<vscale x 8 x i1> undef, i1 true, i32 0), <vscale x 8 x i1> undef, <vscale x 8 x i32> zeroinitializer
177 %not_b = xor <vscale x 8 x i1> %b, %allones
178 %res = and <vscale x 8 x i1> %a, %not_b
179 ret <vscale x 8 x i1> %res
182 define <vscale x 16 x i1> @bic_pred_b(<vscale x 16 x i1> %a, <vscale x 16 x i1> %b) {
183 ; CHECK-LABEL: bic_pred_b:
185 ; CHECK-NEXT: bic p0.b, p0/z, p0.b, p1.b
187 %allones = shufflevector <vscale x 16 x i1> insertelement(<vscale x 16 x i1> undef, i1 true, i32 0), <vscale x 16 x i1> undef, <vscale x 16 x i32> zeroinitializer
188 %not_b = xor <vscale x 16 x i1> %b, %allones
189 %res = and <vscale x 16 x i1> %a, %not_b
190 ret <vscale x 16 x i1> %res
193 define <vscale x 2 x i64> @or_d(<vscale x 2 x i64> %a, <vscale x 2 x i64> %b) {
196 ; CHECK-NEXT: orr z0.d, z0.d, z1.d
198 %res = or <vscale x 2 x i64> %a, %b
199 ret <vscale x 2 x i64> %res
202 define <vscale x 4 x i32> @or_s(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {
205 ; CHECK-NEXT: orr z0.d, z0.d, z1.d
207 %res = or <vscale x 4 x i32> %a, %b
208 ret <vscale x 4 x i32> %res
211 define <vscale x 8 x i16> @or_h(<vscale x 8 x i16> %a, <vscale x 8 x i16> %b) {
214 ; CHECK-NEXT: orr z0.d, z0.d, z1.d
216 %res = or <vscale x 8 x i16> %a, %b
217 ret <vscale x 8 x i16> %res
220 define <vscale x 16 x i8> @or_b(<vscale x 16 x i8> %a, <vscale x 16 x i8> %b) {
223 ; CHECK-NEXT: orr z0.d, z0.d, z1.d
225 %res = or <vscale x 16 x i8> %a, %b
226 ret <vscale x 16 x i8> %res
229 define <vscale x 16 x i8> @or_b_zero(<vscale x 16 x i8> %a) {
230 ; CHECK-LABEL: or_b_zero:
233 %res = or <vscale x 16 x i8> %a, zeroinitializer
234 ret <vscale x 16 x i8> %res
237 define <vscale x 1 x i1> @or_pred_q(<vscale x 1 x i1> %a, <vscale x 1 x i1> %b) {
238 ; CHECK-LABEL: or_pred_q:
240 ; CHECK-NEXT: sel p0.b, p0, p0.b, p1.b
242 %res = or <vscale x 1 x i1> %a, %b
243 ret <vscale x 1 x i1> %res
246 define <vscale x 2 x i1> @or_pred_d(<vscale x 2 x i1> %a, <vscale x 2 x i1> %b) {
247 ; CHECK-LABEL: or_pred_d:
249 ; CHECK-NEXT: sel p0.b, p0, p0.b, p1.b
251 %res = or <vscale x 2 x i1> %a, %b
252 ret <vscale x 2 x i1> %res
255 define <vscale x 4 x i1> @or_pred_s(<vscale x 4 x i1> %a, <vscale x 4 x i1> %b) {
256 ; CHECK-LABEL: or_pred_s:
258 ; CHECK-NEXT: sel p0.b, p0, p0.b, p1.b
260 %res = or <vscale x 4 x i1> %a, %b
261 ret <vscale x 4 x i1> %res
264 define <vscale x 8 x i1> @or_pred_h(<vscale x 8 x i1> %a, <vscale x 8 x i1> %b) {
265 ; CHECK-LABEL: or_pred_h:
267 ; CHECK-NEXT: sel p0.b, p0, p0.b, p1.b
269 %res = or <vscale x 8 x i1> %a, %b
270 ret <vscale x 8 x i1> %res
273 define <vscale x 16 x i1> @or_pred_b(<vscale x 16 x i1> %a, <vscale x 16 x i1> %b) {
274 ; CHECK-LABEL: or_pred_b:
276 ; CHECK-NEXT: sel p0.b, p0, p0.b, p1.b
278 %res = or <vscale x 16 x i1> %a, %b
279 ret <vscale x 16 x i1> %res
282 define <vscale x 2 x i64> @xor_d(<vscale x 2 x i64> %a, <vscale x 2 x i64> %b) {
283 ; CHECK-LABEL: xor_d:
285 ; CHECK-NEXT: eor z0.d, z0.d, z1.d
287 %res = xor <vscale x 2 x i64> %a, %b
288 ret <vscale x 2 x i64> %res
291 define <vscale x 4 x i32> @xor_s(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {
292 ; CHECK-LABEL: xor_s:
294 ; CHECK-NEXT: eor z0.d, z0.d, z1.d
296 %res = xor <vscale x 4 x i32> %a, %b
297 ret <vscale x 4 x i32> %res
300 define <vscale x 8 x i16> @xor_h(<vscale x 8 x i16> %a, <vscale x 8 x i16> %b) {
301 ; CHECK-LABEL: xor_h:
303 ; CHECK-NEXT: eor z0.d, z0.d, z1.d
305 %res = xor <vscale x 8 x i16> %a, %b
306 ret <vscale x 8 x i16> %res
309 define <vscale x 16 x i8> @xor_b(<vscale x 16 x i8> %a, <vscale x 16 x i8> %b) {
310 ; CHECK-LABEL: xor_b:
312 ; CHECK-NEXT: eor z0.d, z0.d, z1.d
314 %res = xor <vscale x 16 x i8> %a, %b
315 ret <vscale x 16 x i8> %res
318 define <vscale x 16 x i8> @xor_b_zero(<vscale x 16 x i8> %a) {
319 ; CHECK-LABEL: xor_b_zero:
322 %res = xor <vscale x 16 x i8> %a, zeroinitializer
323 ret <vscale x 16 x i8> %res
326 define <vscale x 1 x i1> @xor_pred_q(<vscale x 1 x i1> %a, <vscale x 1 x i1> %b) {
327 ; CHECK-LABEL: xor_pred_q:
329 ; CHECK-NEXT: ptrue p2.d
330 ; CHECK-NEXT: eor p0.b, p2/z, p0.b, p1.b
332 %res = xor <vscale x 1 x i1> %a, %b
333 ret <vscale x 1 x i1> %res
336 define <vscale x 2 x i1> @xor_pred_d(<vscale x 2 x i1> %a, <vscale x 2 x i1> %b) {
337 ; CHECK-LABEL: xor_pred_d:
339 ; CHECK-NEXT: ptrue p2.d
340 ; CHECK-NEXT: eor p0.b, p2/z, p0.b, p1.b
342 %res = xor <vscale x 2 x i1> %a, %b
343 ret <vscale x 2 x i1> %res
346 define <vscale x 4 x i1> @xor_pred_s(<vscale x 4 x i1> %a, <vscale x 4 x i1> %b) {
347 ; CHECK-LABEL: xor_pred_s:
349 ; CHECK-NEXT: ptrue p2.s
350 ; CHECK-NEXT: eor p0.b, p2/z, p0.b, p1.b
352 %res = xor <vscale x 4 x i1> %a, %b
353 ret <vscale x 4 x i1> %res
356 define <vscale x 8 x i1> @xor_pred_h(<vscale x 8 x i1> %a, <vscale x 8 x i1> %b) {
357 ; CHECK-LABEL: xor_pred_h:
359 ; CHECK-NEXT: ptrue p2.h
360 ; CHECK-NEXT: eor p0.b, p2/z, p0.b, p1.b
362 %res = xor <vscale x 8 x i1> %a, %b
363 ret <vscale x 8 x i1> %res
366 define <vscale x 16 x i1> @xor_pred_b(<vscale x 16 x i1> %a, <vscale x 16 x i1> %b) {
367 ; CHECK-LABEL: xor_pred_b:
369 ; CHECK-NEXT: ptrue p2.b
370 ; CHECK-NEXT: eor p0.b, p2/z, p0.b, p1.b
372 %res = xor <vscale x 16 x i1> %a, %b
373 ret <vscale x 16 x i1> %res