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"
9 define <4 x i1> @extract_subvector_v8i1(<8 x i1> %op) {
10 ; CHECK-LABEL: extract_subvector_v8i1:
12 ; CHECK-NEXT: sub sp, sp, #16
13 ; CHECK-NEXT: .cfi_def_cfa_offset 16
14 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
15 ; CHECK-NEXT: mov z1.b, z0.b[7]
16 ; CHECK-NEXT: mov z2.b, z0.b[6]
17 ; CHECK-NEXT: mov z3.b, z0.b[5]
18 ; CHECK-NEXT: mov z0.b, z0.b[4]
19 ; CHECK-NEXT: fmov w8, s1
20 ; CHECK-NEXT: fmov w9, s2
21 ; CHECK-NEXT: strh w8, [sp, #14]
22 ; CHECK-NEXT: fmov w8, s3
23 ; CHECK-NEXT: strh w9, [sp, #12]
24 ; CHECK-NEXT: fmov w9, s0
25 ; CHECK-NEXT: strh w8, [sp, #10]
26 ; CHECK-NEXT: strh w9, [sp, #8]
27 ; CHECK-NEXT: ldr d0, [sp, #8]
28 ; CHECK-NEXT: add sp, sp, #16
30 %ret = call <4 x i1> @llvm.vector.extract.v4i1.v8i1(<8 x i1> %op, i64 4)
36 define <4 x i8> @extract_subvector_v8i8(<8 x i8> %op) {
37 ; CHECK-LABEL: extract_subvector_v8i8:
39 ; CHECK-NEXT: sub sp, sp, #16
40 ; CHECK-NEXT: .cfi_def_cfa_offset 16
41 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
42 ; CHECK-NEXT: mov z1.b, z0.b[7]
43 ; CHECK-NEXT: mov z2.b, z0.b[6]
44 ; CHECK-NEXT: mov z3.b, z0.b[5]
45 ; CHECK-NEXT: mov z0.b, z0.b[4]
46 ; CHECK-NEXT: fmov w8, s1
47 ; CHECK-NEXT: fmov w9, s2
48 ; CHECK-NEXT: strh w8, [sp, #14]
49 ; CHECK-NEXT: fmov w8, s3
50 ; CHECK-NEXT: strh w9, [sp, #12]
51 ; CHECK-NEXT: fmov w9, s0
52 ; CHECK-NEXT: strh w8, [sp, #10]
53 ; CHECK-NEXT: strh w9, [sp, #8]
54 ; CHECK-NEXT: ldr d0, [sp, #8]
55 ; CHECK-NEXT: add sp, sp, #16
57 %ret = call <4 x i8> @llvm.vector.extract.v4i8.v8i8(<8 x i8> %op, i64 4)
61 define <8 x i8> @extract_subvector_v16i8(<16 x i8> %op) {
62 ; CHECK-LABEL: extract_subvector_v16i8:
64 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
65 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
66 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
68 %ret = call <8 x i8> @llvm.vector.extract.v8i8.v16i8(<16 x i8> %op, i64 8)
72 define void @extract_subvector_v32i8(ptr %a, ptr %b) {
73 ; CHECK-LABEL: extract_subvector_v32i8:
75 ; CHECK-NEXT: ldr q0, [x0, #16]
76 ; CHECK-NEXT: str q0, [x1]
78 %op = load <32 x i8>, ptr %a
79 %ret = call <16 x i8> @llvm.vector.extract.v16i8.v32i8(<32 x i8> %op, i64 16)
80 store <16 x i8> %ret, ptr %b
86 define <2 x i16> @extract_subvector_v4i16(<4 x i16> %op) {
87 ; CHECK-LABEL: extract_subvector_v4i16:
89 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
90 ; CHECK-NEXT: uunpklo z0.s, z0.h
91 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
92 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
94 %ret = call <2 x i16> @llvm.vector.extract.v2i16.v4i16(<4 x i16> %op, i64 2)
98 define <4 x i16> @extract_subvector_v8i16(<8 x i16> %op) {
99 ; CHECK-LABEL: extract_subvector_v8i16:
101 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
102 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
103 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
105 %ret = call <4 x i16> @llvm.vector.extract.v4i16.v8i16(<8 x i16> %op, i64 4)
109 define void @extract_subvector_v16i16(ptr %a, ptr %b) {
110 ; CHECK-LABEL: extract_subvector_v16i16:
112 ; CHECK-NEXT: ldr q0, [x0, #16]
113 ; CHECK-NEXT: str q0, [x1]
115 %op = load <16 x i16>, ptr %a
116 %ret = call <8 x i16> @llvm.vector.extract.v8i16.v16i16(<16 x i16> %op, i64 8)
117 store <8 x i16> %ret, ptr %b
123 define <1 x i32> @extract_subvector_v2i32(<2 x i32> %op) {
124 ; CHECK-LABEL: extract_subvector_v2i32:
126 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
127 ; CHECK-NEXT: mov z0.s, z0.s[1]
128 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
130 %ret = call <1 x i32> @llvm.vector.extract.v1i32.v2i32(<2 x i32> %op, i64 1)
134 define <2 x i32> @extract_subvector_v4i32(<4 x i32> %op) {
135 ; CHECK-LABEL: extract_subvector_v4i32:
137 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
138 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
139 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
141 %ret = call <2 x i32> @llvm.vector.extract.v2i32.v4i32(<4 x i32> %op, i64 2)
145 define void @extract_subvector_v8i32(ptr %a, ptr %b) {
146 ; CHECK-LABEL: extract_subvector_v8i32:
148 ; CHECK-NEXT: ldr q0, [x0, #16]
149 ; CHECK-NEXT: str q0, [x1]
151 %op = load <8 x i32>, ptr %a
152 %ret = call <4 x i32> @llvm.vector.extract.v4i32.v8i32(<8 x i32> %op, i64 4)
153 store <4 x i32> %ret, ptr %b
159 define <1 x i64> @extract_subvector_v2i64(<2 x i64> %op) {
160 ; CHECK-LABEL: extract_subvector_v2i64:
162 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
163 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
164 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
166 %ret = call <1 x i64> @llvm.vector.extract.v1i64.v2i64(<2 x i64> %op, i64 1)
170 define void @extract_subvector_v4i64(ptr %a, ptr %b) {
171 ; CHECK-LABEL: extract_subvector_v4i64:
173 ; CHECK-NEXT: ldr q0, [x0, #16]
174 ; CHECK-NEXT: str q0, [x1]
176 %op = load <4 x i64>, ptr %a
177 %ret = call <2 x i64> @llvm.vector.extract.v2i64.v4i64(<4 x i64> %op, i64 2)
178 store <2 x i64> %ret, ptr %b
184 define <2 x half> @extract_subvector_v4f16(<4 x half> %op) {
185 ; CHECK-LABEL: extract_subvector_v4f16:
187 ; CHECK-NEXT: sub sp, sp, #16
188 ; CHECK-NEXT: .cfi_def_cfa_offset 16
189 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
190 ; CHECK-NEXT: mov z1.h, z0.h[3]
191 ; CHECK-NEXT: mov z0.h, z0.h[2]
192 ; CHECK-NEXT: str h1, [sp, #10]
193 ; CHECK-NEXT: str h0, [sp, #8]
194 ; CHECK-NEXT: ldr d0, [sp, #8]
195 ; CHECK-NEXT: add sp, sp, #16
197 %ret = call <2 x half> @llvm.vector.extract.v2f16.v4f16(<4 x half> %op, i64 2)
201 define <4 x half> @extract_subvector_v8f16(<8 x half> %op) {
202 ; CHECK-LABEL: extract_subvector_v8f16:
204 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
205 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
206 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
208 %ret = call <4 x half> @llvm.vector.extract.v4f16.v8f16(<8 x half> %op, i64 4)
212 define void @extract_subvector_v16f16(ptr %a, ptr %b) {
213 ; CHECK-LABEL: extract_subvector_v16f16:
215 ; CHECK-NEXT: ldr q0, [x0, #16]
216 ; CHECK-NEXT: str q0, [x1]
218 %op = load <16 x half>, ptr %a
219 %ret = call <8 x half> @llvm.vector.extract.v8f16.v16f16(<16 x half> %op, i64 8)
220 store <8 x half> %ret, ptr %b
226 define <1 x float> @extract_subvector_v2f32(<2 x float> %op) {
227 ; CHECK-LABEL: extract_subvector_v2f32:
229 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
230 ; CHECK-NEXT: mov z0.s, z0.s[1]
231 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
233 %ret = call <1 x float> @llvm.vector.extract.v1f32.v2f32(<2 x float> %op, i64 1)
237 define <2 x float> @extract_subvector_v4f32(<4 x float> %op) {
238 ; CHECK-LABEL: extract_subvector_v4f32:
240 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
241 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
242 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
244 %ret = call <2 x float> @llvm.vector.extract.v2f32.v4f32(<4 x float> %op, i64 2)
248 define void @extract_subvector_v8f32(ptr %a, ptr %b) {
249 ; CHECK-LABEL: extract_subvector_v8f32:
251 ; CHECK-NEXT: ldr q0, [x0, #16]
252 ; CHECK-NEXT: str q0, [x1]
254 %op = load <8 x float>, ptr %a
255 %ret = call <4 x float> @llvm.vector.extract.v4f32.v8f32(<8 x float> %op, i64 4)
256 store <4 x float> %ret, ptr %b
262 define <1 x double> @extract_subvector_v2f64(<2 x double> %op) {
263 ; CHECK-LABEL: extract_subvector_v2f64:
265 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
266 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
267 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
269 %ret = call <1 x double> @llvm.vector.extract.v1f64.v2f64(<2 x double> %op, i64 1)
270 ret <1 x double> %ret
273 define void @extract_subvector_v4f64(ptr %a, ptr %b) {
274 ; CHECK-LABEL: extract_subvector_v4f64:
276 ; CHECK-NEXT: ldr q0, [x0, #16]
277 ; CHECK-NEXT: str q0, [x1]
279 %op = load <4 x double>, ptr %a
280 %ret = call <2 x double> @llvm.vector.extract.v2f64.v4f64(<4 x double> %op, i64 2)
281 store <2 x double> %ret, ptr %b
285 declare <4 x i1> @llvm.vector.extract.v4i1.v8i1(<8 x i1>, i64)
287 declare <4 x i8> @llvm.vector.extract.v4i8.v8i8(<8 x i8>, i64)
288 declare <8 x i8> @llvm.vector.extract.v8i8.v16i8(<16 x i8>, i64)
289 declare <16 x i8> @llvm.vector.extract.v16i8.v32i8(<32 x i8>, i64)
290 declare <32 x i8> @llvm.vector.extract.v32i8.v64i8(<64 x i8>, i64)
292 declare <2 x i16> @llvm.vector.extract.v2i16.v4i16(<4 x i16>, i64)
293 declare <4 x i16> @llvm.vector.extract.v4i16.v8i16(<8 x i16>, i64)
294 declare <8 x i16> @llvm.vector.extract.v8i16.v16i16(<16 x i16>, i64)
295 declare <16 x i16> @llvm.vector.extract.v16i16.v32i16(<32 x i16>, i64)
297 declare <1 x i32> @llvm.vector.extract.v1i32.v2i32(<2 x i32>, i64)
298 declare <2 x i32> @llvm.vector.extract.v2i32.v4i32(<4 x i32>, i64)
299 declare <4 x i32> @llvm.vector.extract.v4i32.v8i32(<8 x i32>, i64)
300 declare <8 x i32> @llvm.vector.extract.v8i32.v16i32(<16 x i32>, i64)
302 declare <1 x i64> @llvm.vector.extract.v1i64.v2i64(<2 x i64>, i64)
303 declare <2 x i64> @llvm.vector.extract.v2i64.v4i64(<4 x i64>, i64)
304 declare <4 x i64> @llvm.vector.extract.v4i64.v8i64(<8 x i64>, i64)
306 declare <2 x half> @llvm.vector.extract.v2f16.v4f16(<4 x half>, i64)
307 declare <4 x half> @llvm.vector.extract.v4f16.v8f16(<8 x half>, i64)
308 declare <8 x half> @llvm.vector.extract.v8f16.v16f16(<16 x half>, i64)
309 declare <16 x half> @llvm.vector.extract.v16f16.v32f16(<32 x half>, i64)
311 declare <1 x float> @llvm.vector.extract.v1f32.v2f32(<2 x float>, i64)
312 declare <2 x float> @llvm.vector.extract.v2f32.v4f32(<4 x float>, i64)
313 declare <4 x float> @llvm.vector.extract.v4f32.v8f32(<8 x float>, i64)
314 declare <8 x float> @llvm.vector.extract.v8f32.v16f32(<16 x float>, i64)
316 declare <1 x double> @llvm.vector.extract.v1f64.v2f64(<2 x double>, i64)
317 declare <2 x double> @llvm.vector.extract.v2f64.v4f64(<4 x double>, i64)
318 declare <4 x double> @llvm.vector.extract.v4f64.v8f64(<8 x double>, i64)