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
6 target triple = "aarch64-unknown-linux-gnu"
8 define void @add_v4i8(ptr %a, ptr %b) {
9 ; CHECK-LABEL: add_v4i8:
11 ; CHECK-NEXT: ptrue p0.h, vl4
12 ; CHECK-NEXT: ld1b { z0.h }, p0/z, [x0]
13 ; CHECK-NEXT: ld1b { z1.h }, p0/z, [x1]
14 ; CHECK-NEXT: add z0.h, z0.h, z1.h
15 ; CHECK-NEXT: st1b { z0.h }, p0, [x0]
17 %op1 = load <4 x i8>, ptr %a
18 %op2 = load <4 x i8>, ptr %b
19 %res = add <4 x i8> %op1, %op2
20 store <4 x i8> %res, ptr %a
24 define void @add_v8i8(ptr %a, ptr %b) {
25 ; CHECK-LABEL: add_v8i8:
27 ; CHECK-NEXT: ldr d0, [x0]
28 ; CHECK-NEXT: ldr d1, [x1]
29 ; CHECK-NEXT: add z0.b, z0.b, z1.b
30 ; CHECK-NEXT: str d0, [x0]
32 %op1 = load <8 x i8>, ptr %a
33 %op2 = load <8 x i8>, ptr %b
34 %res = add <8 x i8> %op1, %op2
35 store <8 x i8> %res, ptr %a
39 define void @add_v16i8(ptr %a, ptr %b) {
40 ; CHECK-LABEL: add_v16i8:
42 ; CHECK-NEXT: ldr q0, [x0]
43 ; CHECK-NEXT: ldr q1, [x1]
44 ; CHECK-NEXT: add z0.b, z0.b, z1.b
45 ; CHECK-NEXT: str q0, [x0]
47 %op1 = load <16 x i8>, ptr %a
48 %op2 = load <16 x i8>, ptr %b
49 %res = add <16 x i8> %op1, %op2
50 store <16 x i8> %res, ptr %a
54 define void @add_v32i8(ptr %a, ptr %b) {
55 ; CHECK-LABEL: add_v32i8:
57 ; CHECK-NEXT: ldp q0, q3, [x1]
58 ; CHECK-NEXT: ldp q1, q2, [x0]
59 ; CHECK-NEXT: add z0.b, z1.b, z0.b
60 ; CHECK-NEXT: add z1.b, z2.b, z3.b
61 ; CHECK-NEXT: stp q0, q1, [x0]
63 %op1 = load <32 x i8>, ptr %a
64 %op2 = load <32 x i8>, ptr %b
65 %res = add <32 x i8> %op1, %op2
66 store <32 x i8> %res, ptr %a
70 define void @add_v2i16(ptr %a, ptr %b, ptr %c) {
71 ; CHECK-LABEL: add_v2i16:
73 ; CHECK-NEXT: sub sp, sp, #16
74 ; CHECK-NEXT: .cfi_def_cfa_offset 16
75 ; CHECK-NEXT: ldrh w8, [x0, #2]
76 ; CHECK-NEXT: ptrue p0.s, vl2
77 ; CHECK-NEXT: str w8, [sp, #4]
78 ; CHECK-NEXT: ldrh w8, [x0]
79 ; CHECK-NEXT: str w8, [sp]
80 ; CHECK-NEXT: ldrh w8, [x1, #2]
81 ; CHECK-NEXT: str w8, [sp, #12]
82 ; CHECK-NEXT: ldrh w8, [x1]
83 ; CHECK-NEXT: str w8, [sp, #8]
84 ; CHECK-NEXT: ldp d0, d1, [sp]
85 ; CHECK-NEXT: add z0.s, z0.s, z1.s
86 ; CHECK-NEXT: st1h { z0.s }, p0, [x0]
87 ; CHECK-NEXT: add sp, sp, #16
89 %op1 = load <2 x i16>, ptr %a
90 %op2 = load <2 x i16>, ptr %b
91 %res = add <2 x i16> %op1, %op2
92 store <2 x i16> %res, ptr %a
96 define void @add_v4i16(ptr %a, ptr %b, ptr %c) {
97 ; CHECK-LABEL: add_v4i16:
99 ; CHECK-NEXT: ldr d0, [x0]
100 ; CHECK-NEXT: ldr d1, [x1]
101 ; CHECK-NEXT: add z0.h, z0.h, z1.h
102 ; CHECK-NEXT: str d0, [x0]
104 %op1 = load <4 x i16>, ptr %a
105 %op2 = load <4 x i16>, ptr %b
106 %res = add <4 x i16> %op1, %op2
107 store <4 x i16> %res, ptr %a
111 define void @add_v8i16(ptr %a, ptr %b, ptr %c) {
112 ; CHECK-LABEL: add_v8i16:
114 ; CHECK-NEXT: ldr q0, [x0]
115 ; CHECK-NEXT: ldr q1, [x1]
116 ; CHECK-NEXT: add z0.h, z0.h, z1.h
117 ; CHECK-NEXT: str q0, [x0]
119 %op1 = load <8 x i16>, ptr %a
120 %op2 = load <8 x i16>, ptr %b
121 %res = add <8 x i16> %op1, %op2
122 store <8 x i16> %res, ptr %a
126 define void @add_v16i16(ptr %a, ptr %b, ptr %c) {
127 ; CHECK-LABEL: add_v16i16:
129 ; CHECK-NEXT: ldp q0, q3, [x1]
130 ; CHECK-NEXT: ldp q1, q2, [x0]
131 ; CHECK-NEXT: add z0.h, z1.h, z0.h
132 ; CHECK-NEXT: add z1.h, z2.h, z3.h
133 ; CHECK-NEXT: stp q0, q1, [x0]
135 %op1 = load <16 x i16>, ptr %a
136 %op2 = load <16 x i16>, ptr %b
137 %res = add <16 x i16> %op1, %op2
138 store <16 x i16> %res, ptr %a
142 define void @abs_v2i32(ptr %a) {
143 ; CHECK-LABEL: abs_v2i32:
145 ; CHECK-NEXT: ptrue p0.s, vl2
146 ; CHECK-NEXT: ldr d0, [x0]
147 ; CHECK-NEXT: abs z0.s, p0/m, z0.s
148 ; CHECK-NEXT: str d0, [x0]
150 %op1 = load <2 x i32>, ptr %a
151 %res = call <2 x i32> @llvm.abs.v2i32(<2 x i32> %op1, i1 false)
152 store <2 x i32> %res, ptr %a
156 define void @abs_v4i32(ptr %a) {
157 ; CHECK-LABEL: abs_v4i32:
159 ; CHECK-NEXT: ptrue p0.s, vl4
160 ; CHECK-NEXT: ldr q0, [x0]
161 ; CHECK-NEXT: abs z0.s, p0/m, z0.s
162 ; CHECK-NEXT: str q0, [x0]
164 %op1 = load <4 x i32>, ptr %a
165 %res = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %op1, i1 false)
166 store <4 x i32> %res, ptr %a
170 define void @abs_v8i32(ptr %a) {
171 ; CHECK-LABEL: abs_v8i32:
173 ; CHECK-NEXT: ptrue p0.s, vl4
174 ; CHECK-NEXT: ldp q0, q1, [x0]
175 ; CHECK-NEXT: abs z0.s, p0/m, z0.s
176 ; CHECK-NEXT: abs z1.s, p0/m, z1.s
177 ; CHECK-NEXT: stp q0, q1, [x0]
179 %op1 = load <8 x i32>, ptr %a
180 %res = call <8 x i32> @llvm.abs.v8i32(<8 x i32> %op1, i1 false)
181 store <8 x i32> %res, ptr %a
185 define void @abs_v2i64(ptr %a) {
186 ; CHECK-LABEL: abs_v2i64:
188 ; CHECK-NEXT: ptrue p0.d, vl2
189 ; CHECK-NEXT: ldr q0, [x0]
190 ; CHECK-NEXT: abs z0.d, p0/m, z0.d
191 ; CHECK-NEXT: str q0, [x0]
193 %op1 = load <2 x i64>, ptr %a
194 %res = call <2 x i64> @llvm.abs.v2i64(<2 x i64> %op1, i1 false)
195 store <2 x i64> %res, ptr %a
199 define void @abs_v4i64(ptr %a) {
200 ; CHECK-LABEL: abs_v4i64:
202 ; CHECK-NEXT: ptrue p0.d, vl2
203 ; CHECK-NEXT: ldp q0, q1, [x0]
204 ; CHECK-NEXT: abs z0.d, p0/m, z0.d
205 ; CHECK-NEXT: abs z1.d, p0/m, z1.d
206 ; CHECK-NEXT: stp q0, q1, [x0]
208 %op1 = load <4 x i64>, ptr %a
209 %res = call <4 x i64> @llvm.abs.v4i64(<4 x i64> %op1, i1 false)
210 store <4 x i64> %res, ptr %a
214 define void @fadd_v2f16(ptr %a, ptr %b) {
215 ; CHECK-LABEL: fadd_v2f16:
217 ; CHECK-NEXT: ptrue p0.h, vl4
218 ; CHECK-NEXT: ldr s0, [x0]
219 ; CHECK-NEXT: ldr s1, [x1]
220 ; CHECK-NEXT: fadd z0.h, p0/m, z0.h, z1.h
221 ; CHECK-NEXT: fmov w8, s0
222 ; CHECK-NEXT: str w8, [x0]
224 %op1 = load <2 x half>, ptr %a
225 %op2 = load <2 x half>, ptr %b
226 %res = fadd <2 x half> %op1, %op2
227 store <2 x half> %res, ptr %a
231 define void @fadd_v4f16(ptr %a, ptr %b) {
232 ; CHECK-LABEL: fadd_v4f16:
234 ; CHECK-NEXT: ptrue p0.h, vl4
235 ; CHECK-NEXT: ldr d0, [x0]
236 ; CHECK-NEXT: ldr d1, [x1]
237 ; CHECK-NEXT: fadd z0.h, p0/m, z0.h, z1.h
238 ; CHECK-NEXT: str d0, [x0]
240 %op1 = load <4 x half>, ptr %a
241 %op2 = load <4 x half>, ptr %b
242 %res = fadd <4 x half> %op1, %op2
243 store <4 x half> %res, ptr %a
247 define void @fadd_v8f16(ptr %a, ptr %b) {
248 ; CHECK-LABEL: fadd_v8f16:
250 ; CHECK-NEXT: ptrue p0.h, vl8
251 ; CHECK-NEXT: ldr q0, [x0]
252 ; CHECK-NEXT: ldr q1, [x1]
253 ; CHECK-NEXT: fadd z0.h, p0/m, z0.h, z1.h
254 ; CHECK-NEXT: str q0, [x0]
256 %op1 = load <8 x half>, ptr %a
257 %op2 = load <8 x half>, ptr %b
258 %res = fadd <8 x half> %op1, %op2
259 store <8 x half> %res, ptr %a
263 define void @fadd_v16f16(ptr %a, ptr %b) {
264 ; CHECK-LABEL: fadd_v16f16:
266 ; CHECK-NEXT: ptrue p0.h, vl8
267 ; CHECK-NEXT: ldp q0, q3, [x1]
268 ; CHECK-NEXT: ldp q1, q2, [x0]
269 ; CHECK-NEXT: fadd z0.h, p0/m, z0.h, z1.h
270 ; CHECK-NEXT: movprfx z1, z2
271 ; CHECK-NEXT: fadd z1.h, p0/m, z1.h, z3.h
272 ; CHECK-NEXT: stp q0, q1, [x0]
274 %op1 = load <16 x half>, ptr %a
275 %op2 = load <16 x half>, ptr %b
276 %res = fadd <16 x half> %op1, %op2
277 store <16 x half> %res, ptr %a
281 define void @fadd_v2f32(ptr %a, ptr %b) {
282 ; CHECK-LABEL: fadd_v2f32:
284 ; CHECK-NEXT: ptrue p0.s, vl2
285 ; CHECK-NEXT: ldr d0, [x0]
286 ; CHECK-NEXT: ldr d1, [x1]
287 ; CHECK-NEXT: fadd z0.s, p0/m, z0.s, z1.s
288 ; CHECK-NEXT: str d0, [x0]
290 %op1 = load <2 x float>, ptr %a
291 %op2 = load <2 x float>, ptr %b
292 %res = fadd <2 x float> %op1, %op2
293 store <2 x float> %res, ptr %a
297 define void @fadd_v4f32(ptr %a, ptr %b) {
298 ; CHECK-LABEL: fadd_v4f32:
300 ; CHECK-NEXT: ptrue p0.s, vl4
301 ; CHECK-NEXT: ldr q0, [x0]
302 ; CHECK-NEXT: ldr q1, [x1]
303 ; CHECK-NEXT: fadd z0.s, p0/m, z0.s, z1.s
304 ; CHECK-NEXT: str q0, [x0]
306 %op1 = load <4 x float>, ptr %a
307 %op2 = load <4 x float>, ptr %b
308 %res = fadd <4 x float> %op1, %op2
309 store <4 x float> %res, ptr %a
313 define void @fadd_v8f32(ptr %a, ptr %b) {
314 ; CHECK-LABEL: fadd_v8f32:
316 ; CHECK-NEXT: ptrue p0.s, vl4
317 ; CHECK-NEXT: ldp q0, q3, [x1]
318 ; CHECK-NEXT: ldp q1, q2, [x0]
319 ; CHECK-NEXT: fadd z0.s, p0/m, z0.s, z1.s
320 ; CHECK-NEXT: movprfx z1, z2
321 ; CHECK-NEXT: fadd z1.s, p0/m, z1.s, z3.s
322 ; CHECK-NEXT: stp q0, q1, [x0]
324 %op1 = load <8 x float>, ptr %a
325 %op2 = load <8 x float>, ptr %b
326 %res = fadd <8 x float> %op1, %op2
327 store <8 x float> %res, ptr %a
331 define void @fadd_v2f64(ptr %a, ptr %b) {
332 ; CHECK-LABEL: fadd_v2f64:
334 ; CHECK-NEXT: ptrue p0.d, vl2
335 ; CHECK-NEXT: ldr q0, [x0]
336 ; CHECK-NEXT: ldr q1, [x1]
337 ; CHECK-NEXT: fadd z0.d, p0/m, z0.d, z1.d
338 ; CHECK-NEXT: str q0, [x0]
340 %op1 = load <2 x double>, ptr %a
341 %op2 = load <2 x double>, ptr %b
342 %res = fadd <2 x double> %op1, %op2
343 store <2 x double> %res, ptr %a
347 define void @fadd_v4f64(ptr %a, ptr %b) {
348 ; CHECK-LABEL: fadd_v4f64:
350 ; CHECK-NEXT: ptrue p0.d, vl2
351 ; CHECK-NEXT: ldp q0, q3, [x1]
352 ; CHECK-NEXT: ldp q1, q2, [x0]
353 ; CHECK-NEXT: fadd z0.d, p0/m, z0.d, z1.d
354 ; CHECK-NEXT: movprfx z1, z2
355 ; CHECK-NEXT: fadd z1.d, p0/m, z1.d, z3.d
356 ; CHECK-NEXT: stp q0, q1, [x0]
358 %op1 = load <4 x double>, ptr %a
359 %op2 = load <4 x double>, ptr %b
360 %res = fadd <4 x double> %op1, %op2
361 store <4 x double> %res, ptr %a
365 declare <2 x i32> @llvm.abs.v2i32(<2 x i32>, i1)
366 declare <4 x i32> @llvm.abs.v4i32(<4 x i32>, i1)
367 declare <8 x i32> @llvm.abs.v8i32(<8 x i32>, i1)
368 declare <2 x i64> @llvm.abs.v2i64(<2 x i64>, i1)
369 declare <4 x i64> @llvm.abs.v4i64(<4 x i64>, i1)