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
4 target triple = "aarch64-unknown-linux-gnu"
8 define <4 x i1> @extract_subvector_v8i1(<8 x i1> %op) {
9 ; CHECK-LABEL: extract_subvector_v8i1:
11 ; CHECK-NEXT: sub sp, sp, #16
12 ; CHECK-NEXT: .cfi_def_cfa_offset 16
13 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
14 ; CHECK-NEXT: mov z1.b, z0.b[7]
15 ; CHECK-NEXT: mov z2.b, z0.b[6]
16 ; CHECK-NEXT: mov z3.b, z0.b[5]
17 ; CHECK-NEXT: mov z0.b, z0.b[4]
18 ; CHECK-NEXT: fmov w8, s1
19 ; CHECK-NEXT: fmov w9, s2
20 ; CHECK-NEXT: strh w8, [sp, #14]
21 ; CHECK-NEXT: fmov w8, s3
22 ; CHECK-NEXT: strh w9, [sp, #12]
23 ; CHECK-NEXT: fmov w9, s0
24 ; CHECK-NEXT: strh w8, [sp, #10]
25 ; CHECK-NEXT: strh w9, [sp, #8]
26 ; CHECK-NEXT: ldr d0, [sp, #8]
27 ; CHECK-NEXT: add sp, sp, #16
29 %ret = call <4 x i1> @llvm.vector.extract.v4i1.v8i1(<8 x i1> %op, i64 4)
35 define <4 x i8> @extract_subvector_v8i8(<8 x i8> %op) {
36 ; CHECK-LABEL: extract_subvector_v8i8:
38 ; CHECK-NEXT: sub sp, sp, #16
39 ; CHECK-NEXT: .cfi_def_cfa_offset 16
40 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
41 ; CHECK-NEXT: mov z1.b, z0.b[7]
42 ; CHECK-NEXT: mov z2.b, z0.b[6]
43 ; CHECK-NEXT: mov z3.b, z0.b[5]
44 ; CHECK-NEXT: mov z0.b, z0.b[4]
45 ; CHECK-NEXT: fmov w8, s1
46 ; CHECK-NEXT: fmov w9, s2
47 ; CHECK-NEXT: strh w8, [sp, #14]
48 ; CHECK-NEXT: fmov w8, s3
49 ; CHECK-NEXT: strh w9, [sp, #12]
50 ; CHECK-NEXT: fmov w9, s0
51 ; CHECK-NEXT: strh w8, [sp, #10]
52 ; CHECK-NEXT: strh w9, [sp, #8]
53 ; CHECK-NEXT: ldr d0, [sp, #8]
54 ; CHECK-NEXT: add sp, sp, #16
56 %ret = call <4 x i8> @llvm.vector.extract.v4i8.v8i8(<8 x i8> %op, i64 4)
60 define <8 x i8> @extract_subvector_v16i8(<16 x i8> %op) {
61 ; CHECK-LABEL: extract_subvector_v16i8:
63 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
64 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
65 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
67 %ret = call <8 x i8> @llvm.vector.extract.v8i8.v16i8(<16 x i8> %op, i64 8)
71 define void @extract_subvector_v32i8(ptr %a, ptr %b) {
72 ; CHECK-LABEL: extract_subvector_v32i8:
74 ; CHECK-NEXT: ldr q0, [x0, #16]
75 ; CHECK-NEXT: str q0, [x1]
77 %op = load <32 x i8>, ptr %a
78 %ret = call <16 x i8> @llvm.vector.extract.v16i8.v32i8(<32 x i8> %op, i64 16)
79 store <16 x i8> %ret, ptr %b
85 define <2 x i16> @extract_subvector_v4i16(<4 x i16> %op) {
86 ; CHECK-LABEL: extract_subvector_v4i16:
88 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
89 ; CHECK-NEXT: uunpklo z0.s, z0.h
90 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
91 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
93 %ret = call <2 x i16> @llvm.vector.extract.v2i16.v4i16(<4 x i16> %op, i64 2)
97 define <4 x i16> @extract_subvector_v8i16(<8 x i16> %op) {
98 ; CHECK-LABEL: extract_subvector_v8i16:
100 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
101 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
102 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
104 %ret = call <4 x i16> @llvm.vector.extract.v4i16.v8i16(<8 x i16> %op, i64 4)
108 define void @extract_subvector_v16i16(ptr %a, ptr %b) {
109 ; CHECK-LABEL: extract_subvector_v16i16:
111 ; CHECK-NEXT: ldr q0, [x0, #16]
112 ; CHECK-NEXT: str q0, [x1]
114 %op = load <16 x i16>, ptr %a
115 %ret = call <8 x i16> @llvm.vector.extract.v8i16.v16i16(<16 x i16> %op, i64 8)
116 store <8 x i16> %ret, ptr %b
122 define <1 x i32> @extract_subvector_v2i32(<2 x i32> %op) {
123 ; CHECK-LABEL: extract_subvector_v2i32:
125 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
126 ; CHECK-NEXT: mov z0.s, z0.s[1]
127 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
129 %ret = call <1 x i32> @llvm.vector.extract.v1i32.v2i32(<2 x i32> %op, i64 1)
133 define <2 x i32> @extract_subvector_v4i32(<4 x i32> %op) {
134 ; CHECK-LABEL: extract_subvector_v4i32:
136 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
137 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
138 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
140 %ret = call <2 x i32> @llvm.vector.extract.v2i32.v4i32(<4 x i32> %op, i64 2)
144 define void @extract_subvector_v8i32(ptr %a, ptr %b) {
145 ; CHECK-LABEL: extract_subvector_v8i32:
147 ; CHECK-NEXT: ldr q0, [x0, #16]
148 ; CHECK-NEXT: str q0, [x1]
150 %op = load <8 x i32>, ptr %a
151 %ret = call <4 x i32> @llvm.vector.extract.v4i32.v8i32(<8 x i32> %op, i64 4)
152 store <4 x i32> %ret, ptr %b
158 define <1 x i64> @extract_subvector_v2i64(<2 x i64> %op) {
159 ; CHECK-LABEL: extract_subvector_v2i64:
161 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
162 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
163 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
165 %ret = call <1 x i64> @llvm.vector.extract.v1i64.v2i64(<2 x i64> %op, i64 1)
169 define void @extract_subvector_v4i64(ptr %a, ptr %b) {
170 ; CHECK-LABEL: extract_subvector_v4i64:
172 ; CHECK-NEXT: ldr q0, [x0, #16]
173 ; CHECK-NEXT: str q0, [x1]
175 %op = load <4 x i64>, ptr %a
176 %ret = call <2 x i64> @llvm.vector.extract.v2i64.v4i64(<4 x i64> %op, i64 2)
177 store <2 x i64> %ret, ptr %b
183 define <2 x half> @extract_subvector_v4f16(<4 x half> %op) {
184 ; CHECK-LABEL: extract_subvector_v4f16:
186 ; CHECK-NEXT: sub sp, sp, #16
187 ; CHECK-NEXT: .cfi_def_cfa_offset 16
188 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
189 ; CHECK-NEXT: mov z1.h, z0.h[3]
190 ; CHECK-NEXT: mov z0.h, z0.h[2]
191 ; CHECK-NEXT: str h1, [sp, #10]
192 ; CHECK-NEXT: str h0, [sp, #8]
193 ; CHECK-NEXT: ldr d0, [sp, #8]
194 ; CHECK-NEXT: add sp, sp, #16
196 %ret = call <2 x half> @llvm.vector.extract.v2f16.v4f16(<4 x half> %op, i64 2)
200 define <4 x half> @extract_subvector_v8f16(<8 x half> %op) {
201 ; CHECK-LABEL: extract_subvector_v8f16:
203 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
204 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
205 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
207 %ret = call <4 x half> @llvm.vector.extract.v4f16.v8f16(<8 x half> %op, i64 4)
211 define void @extract_subvector_v16f16(ptr %a, ptr %b) {
212 ; CHECK-LABEL: extract_subvector_v16f16:
214 ; CHECK-NEXT: ldr q0, [x0, #16]
215 ; CHECK-NEXT: str q0, [x1]
217 %op = load <16 x half>, ptr %a
218 %ret = call <8 x half> @llvm.vector.extract.v8f16.v16f16(<16 x half> %op, i64 8)
219 store <8 x half> %ret, ptr %b
225 define <1 x float> @extract_subvector_v2f32(<2 x float> %op) {
226 ; CHECK-LABEL: extract_subvector_v2f32:
228 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
229 ; CHECK-NEXT: mov z0.s, z0.s[1]
230 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
232 %ret = call <1 x float> @llvm.vector.extract.v1f32.v2f32(<2 x float> %op, i64 1)
236 define <2 x float> @extract_subvector_v4f32(<4 x float> %op) {
237 ; CHECK-LABEL: extract_subvector_v4f32:
239 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
240 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
241 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
243 %ret = call <2 x float> @llvm.vector.extract.v2f32.v4f32(<4 x float> %op, i64 2)
247 define void @extract_subvector_v8f32(ptr %a, ptr %b) {
248 ; CHECK-LABEL: extract_subvector_v8f32:
250 ; CHECK-NEXT: ldr q0, [x0, #16]
251 ; CHECK-NEXT: str q0, [x1]
253 %op = load <8 x float>, ptr %a
254 %ret = call <4 x float> @llvm.vector.extract.v4f32.v8f32(<8 x float> %op, i64 4)
255 store <4 x float> %ret, ptr %b
261 define <1 x double> @extract_subvector_v2f64(<2 x double> %op) {
262 ; CHECK-LABEL: extract_subvector_v2f64:
264 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
265 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #8
266 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
268 %ret = call <1 x double> @llvm.vector.extract.v1f64.v2f64(<2 x double> %op, i64 1)
269 ret <1 x double> %ret
272 define void @extract_subvector_v4f64(ptr %a, ptr %b) {
273 ; CHECK-LABEL: extract_subvector_v4f64:
275 ; CHECK-NEXT: ldr q0, [x0, #16]
276 ; CHECK-NEXT: str q0, [x1]
278 %op = load <4 x double>, ptr %a
279 %ret = call <2 x double> @llvm.vector.extract.v2f64.v4f64(<4 x double> %op, i64 2)
280 store <2 x double> %ret, ptr %b
284 declare <4 x i1> @llvm.vector.extract.v4i1.v8i1(<8 x i1>, i64)
286 declare <4 x i8> @llvm.vector.extract.v4i8.v8i8(<8 x i8>, i64)
287 declare <8 x i8> @llvm.vector.extract.v8i8.v16i8(<16 x i8>, i64)
288 declare <16 x i8> @llvm.vector.extract.v16i8.v32i8(<32 x i8>, i64)
289 declare <32 x i8> @llvm.vector.extract.v32i8.v64i8(<64 x i8>, i64)
291 declare <2 x i16> @llvm.vector.extract.v2i16.v4i16(<4 x i16>, i64)
292 declare <4 x i16> @llvm.vector.extract.v4i16.v8i16(<8 x i16>, i64)
293 declare <8 x i16> @llvm.vector.extract.v8i16.v16i16(<16 x i16>, i64)
294 declare <16 x i16> @llvm.vector.extract.v16i16.v32i16(<32 x i16>, i64)
296 declare <1 x i32> @llvm.vector.extract.v1i32.v2i32(<2 x i32>, i64)
297 declare <2 x i32> @llvm.vector.extract.v2i32.v4i32(<4 x i32>, i64)
298 declare <4 x i32> @llvm.vector.extract.v4i32.v8i32(<8 x i32>, i64)
299 declare <8 x i32> @llvm.vector.extract.v8i32.v16i32(<16 x i32>, i64)
301 declare <1 x i64> @llvm.vector.extract.v1i64.v2i64(<2 x i64>, i64)
302 declare <2 x i64> @llvm.vector.extract.v2i64.v4i64(<4 x i64>, i64)
303 declare <4 x i64> @llvm.vector.extract.v4i64.v8i64(<8 x i64>, i64)
305 declare <2 x half> @llvm.vector.extract.v2f16.v4f16(<4 x half>, i64)
306 declare <4 x half> @llvm.vector.extract.v4f16.v8f16(<8 x half>, i64)
307 declare <8 x half> @llvm.vector.extract.v8f16.v16f16(<16 x half>, i64)
308 declare <16 x half> @llvm.vector.extract.v16f16.v32f16(<32 x half>, i64)
310 declare <1 x float> @llvm.vector.extract.v1f32.v2f32(<2 x float>, i64)
311 declare <2 x float> @llvm.vector.extract.v2f32.v4f32(<4 x float>, i64)
312 declare <4 x float> @llvm.vector.extract.v4f32.v8f32(<8 x float>, i64)
313 declare <8 x float> @llvm.vector.extract.v8f32.v16f32(<16 x float>, i64)
315 declare <1 x double> @llvm.vector.extract.v1f64.v2f64(<2 x double>, i64)
316 declare <2 x double> @llvm.vector.extract.v2f64.v4f64(<4 x double>, i64)
317 declare <4 x double> @llvm.vector.extract.v4f64.v8f64(<8 x double>, i64)