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
5 ; Test we can code generater patterns of the form:
6 ; fixed_length_vector = ISD::EXTRACT_SUBVECTOR scalable_vector, 0
7 ; scalable_vector = ISD::INSERT_SUBVECTOR scalable_vector, fixed_length_vector, 0
9 ; NOTE: Currently shufflevector does not support scalable vectors so it cannot
10 ; be used to model the above operations. Instead these tests rely on knowing
11 ; how fixed length operation are lowered to scalable ones, with multiple blocks
12 ; ensuring insert/extract sequences are not folded away.
14 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
15 target triple = "aarch64-unknown-linux-gnu"
18 define void @subvector_v4i8(ptr %in, ptr %out) {
19 ; CHECK-LABEL: subvector_v4i8:
20 ; CHECK: // %bb.0: // %bb1
21 ; CHECK-NEXT: ptrue p0.h, vl4
22 ; CHECK-NEXT: ld1b { z0.h }, p0/z, [x0]
23 ; CHECK-NEXT: st1b { z0.h }, p0, [x1]
25 %a = load <4 x i8>, ptr %in
29 store <4 x i8> %a, ptr %out
33 define void @subvector_v8i8(ptr %in, ptr %out) {
34 ; CHECK-LABEL: subvector_v8i8:
35 ; CHECK: // %bb.0: // %bb1
36 ; CHECK-NEXT: ldr d0, [x0]
37 ; CHECK-NEXT: str d0, [x1]
39 %a = load <8 x i8>, ptr %in
43 store <8 x i8> %a, ptr %out
47 define void @subvector_v16i8(ptr %in, ptr %out) {
48 ; CHECK-LABEL: subvector_v16i8:
49 ; CHECK: // %bb.0: // %bb1
50 ; CHECK-NEXT: ldr q0, [x0]
51 ; CHECK-NEXT: str q0, [x1]
53 %a = load <16 x i8>, ptr %in
57 store <16 x i8> %a, ptr %out
61 define void @subvector_v32i8(ptr %in, ptr %out) {
62 ; CHECK-LABEL: subvector_v32i8:
63 ; CHECK: // %bb.0: // %bb1
64 ; CHECK-NEXT: ldp q0, q1, [x0]
65 ; CHECK-NEXT: stp q0, q1, [x1]
67 %a = load <32 x i8>, ptr %in
71 store <32 x i8> %a, ptr %out
76 define void @subvector_v2i16(ptr %in, ptr %out) {
77 ; CHECK-LABEL: subvector_v2i16:
78 ; CHECK: // %bb.0: // %bb1
79 ; CHECK-NEXT: sub sp, sp, #16
80 ; CHECK-NEXT: .cfi_def_cfa_offset 16
81 ; CHECK-NEXT: ldrh w8, [x0, #2]
82 ; CHECK-NEXT: ptrue p0.s, vl2
83 ; CHECK-NEXT: str w8, [sp, #12]
84 ; CHECK-NEXT: ldrh w8, [x0]
85 ; CHECK-NEXT: str w8, [sp, #8]
86 ; CHECK-NEXT: ldr d0, [sp, #8]
87 ; CHECK-NEXT: st1h { z0.s }, p0, [x1]
88 ; CHECK-NEXT: add sp, sp, #16
90 %a = load <2 x i16>, ptr %in
94 store <2 x i16> %a, ptr %out
98 define void @subvector_v4i16(ptr %in, ptr %out) {
99 ; CHECK-LABEL: subvector_v4i16:
100 ; CHECK: // %bb.0: // %bb1
101 ; CHECK-NEXT: ldr d0, [x0]
102 ; CHECK-NEXT: str d0, [x1]
104 %a = load <4 x i16>, ptr %in
108 store <4 x i16> %a, ptr %out
112 define void @subvector_v8i16(ptr %in, ptr %out) {
113 ; CHECK-LABEL: subvector_v8i16:
114 ; CHECK: // %bb.0: // %bb1
115 ; CHECK-NEXT: ldr q0, [x0]
116 ; CHECK-NEXT: str q0, [x1]
118 %a = load <8 x i16>, ptr %in
122 store <8 x i16> %a, ptr %out
126 define void @subvector_v16i16(ptr %in, ptr %out) {
127 ; CHECK-LABEL: subvector_v16i16:
128 ; CHECK: // %bb.0: // %bb1
129 ; CHECK-NEXT: ldp q0, q1, [x0]
130 ; CHECK-NEXT: stp q0, q1, [x1]
132 %a = load <16 x i16>, ptr %in
136 store <16 x i16> %a, ptr %out
141 define void @subvector_v2i32(ptr %in, ptr %out) {
142 ; CHECK-LABEL: subvector_v2i32:
143 ; CHECK: // %bb.0: // %bb1
144 ; CHECK-NEXT: ldr d0, [x0]
145 ; CHECK-NEXT: str d0, [x1]
147 %a = load <2 x i32>, ptr %in
151 store <2 x i32> %a, ptr %out
155 define void @subvector_v4i32(ptr %in, ptr %out) {
156 ; CHECK-LABEL: subvector_v4i32:
157 ; CHECK: // %bb.0: // %bb1
158 ; CHECK-NEXT: ldr q0, [x0]
159 ; CHECK-NEXT: str q0, [x1]
161 %a = load <4 x i32>, ptr %in
165 store <4 x i32> %a, ptr %out
169 define void @subvector_v8i32(ptr %in, ptr %out) {
170 ; CHECK-LABEL: subvector_v8i32:
171 ; CHECK: // %bb.0: // %bb1
172 ; CHECK-NEXT: ldp q0, q1, [x0]
173 ; CHECK-NEXT: stp q0, q1, [x1]
175 %a = load <8 x i32>, ptr %in
179 store <8 x i32> %a, ptr %out
184 define void @subvector_v2i64(ptr %in, ptr %out) {
185 ; CHECK-LABEL: subvector_v2i64:
186 ; CHECK: // %bb.0: // %bb1
187 ; CHECK-NEXT: ldr q0, [x0]
188 ; CHECK-NEXT: str q0, [x1]
190 %a = load <2 x i64>, ptr %in
194 store <2 x i64> %a, ptr %out
198 define void @subvector_v4i64(ptr %in, ptr %out) {
199 ; CHECK-LABEL: subvector_v4i64:
200 ; CHECK: // %bb.0: // %bb1
201 ; CHECK-NEXT: ldp q0, q1, [x0]
202 ; CHECK-NEXT: stp q0, q1, [x1]
204 %a = load <4 x i64>, ptr %in
208 store <4 x i64> %a, ptr %out
213 define void @subvector_v2f16(ptr %in, ptr %out) {
214 ; CHECK-LABEL: subvector_v2f16:
215 ; CHECK: // %bb.0: // %bb1
216 ; CHECK-NEXT: ldr w8, [x0]
217 ; CHECK-NEXT: str w8, [x1]
219 %a = load <2 x half>, ptr %in
223 store <2 x half> %a, ptr %out
227 define void @subvector_v4f16(ptr %in, ptr %out) {
228 ; CHECK-LABEL: subvector_v4f16:
229 ; CHECK: // %bb.0: // %bb1
230 ; CHECK-NEXT: ldr d0, [x0]
231 ; CHECK-NEXT: str d0, [x1]
233 %a = load <4 x half>, ptr %in
237 store <4 x half> %a, ptr %out
241 define void @subvector_v8f16(ptr %in, ptr %out) {
242 ; CHECK-LABEL: subvector_v8f16:
243 ; CHECK: // %bb.0: // %bb1
244 ; CHECK-NEXT: ldr q0, [x0]
245 ; CHECK-NEXT: str q0, [x1]
247 %a = load <8 x half>, ptr %in
251 store <8 x half> %a, ptr %out
255 define void @subvector_v16f16(ptr %in, ptr %out) {
256 ; CHECK-LABEL: subvector_v16f16:
257 ; CHECK: // %bb.0: // %bb1
258 ; CHECK-NEXT: ldp q0, q1, [x0]
259 ; CHECK-NEXT: stp q0, q1, [x1]
261 %a = load <16 x half>, ptr %in
265 store <16 x half> %a, ptr %out
270 define void @subvector_v2f32(ptr %in, ptr %out) {
271 ; CHECK-LABEL: subvector_v2f32:
272 ; CHECK: // %bb.0: // %bb1
273 ; CHECK-NEXT: ldr d0, [x0]
274 ; CHECK-NEXT: str d0, [x1]
276 %a = load <2 x float>, ptr %in
280 store <2 x float> %a, ptr %out
284 define void @subvector_v4f32(ptr %in, ptr %out) {
285 ; CHECK-LABEL: subvector_v4f32:
286 ; CHECK: // %bb.0: // %bb1
287 ; CHECK-NEXT: ldr q0, [x0]
288 ; CHECK-NEXT: str q0, [x1]
290 %a = load <4 x float>, ptr %in
294 store <4 x float> %a, ptr %out
298 define void @subvector_v8f32(ptr %in, ptr %out) {
299 ; CHECK-LABEL: subvector_v8f32:
300 ; CHECK: // %bb.0: // %bb1
301 ; CHECK-NEXT: ldp q0, q1, [x0]
302 ; CHECK-NEXT: stp q0, q1, [x1]
304 %a = load <8 x float>,ptr %in
308 store <8 x float> %a, ptr %out
313 define void @subvector_v2f64(ptr %in, ptr %out) {
314 ; CHECK-LABEL: subvector_v2f64:
315 ; CHECK: // %bb.0: // %bb1
316 ; CHECK-NEXT: ldr q0, [x0]
317 ; CHECK-NEXT: str q0, [x1]
319 %a = load <2 x double>, ptr %in
323 store <2 x double> %a, ptr %out
327 define void @subvector_v4f64(ptr %in, ptr %out) {
328 ; CHECK-LABEL: subvector_v4f64:
329 ; CHECK: // %bb.0: // %bb1
330 ; CHECK-NEXT: ldp q0, q1, [x0]
331 ; CHECK-NEXT: stp q0, q1, [x1]
333 %a = load <4 x double>, ptr %in
337 store <4 x double> %a, ptr %out