1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s | FileCheck %s
4 target triple = "aarch64-unknown-linux-gnu"
6 ; SCALABLE INSERTED INTO SCALABLE TESTS
8 define <vscale x 8 x i8> @vec_scalable_subvec_scalable_idx_zero_i8(<vscale x 8 x i8>* %a, <vscale x 4 x i8>* %b) #0 {
9 ; CHECK-LABEL: vec_scalable_subvec_scalable_idx_zero_i8:
11 ; CHECK-NEXT: ptrue p0.h
12 ; CHECK-NEXT: ld1b { z0.h }, p0/z, [x0]
13 ; CHECK-NEXT: ptrue p0.s
14 ; CHECK-NEXT: ld1b { z1.s }, p0/z, [x1]
15 ; CHECK-NEXT: uunpkhi z0.s, z0.h
16 ; CHECK-NEXT: uzp1 z0.h, z1.h, z0.h
18 %vec = load <vscale x 8 x i8>, <vscale x 8 x i8>* %a
19 %subvec = load <vscale x 4 x i8>, <vscale x 4 x i8>* %b
20 %ins = call <vscale x 8 x i8> @llvm.experimental.vector.insert.nxv8i8.nxv4i8(<vscale x 8 x i8> %vec, <vscale x 4 x i8> %subvec, i64 0)
21 ret <vscale x 8 x i8> %ins
24 define <vscale x 8 x i8> @vec_scalable_subvec_scalable_idx_nonzero_i8(<vscale x 8 x i8>* %a, <vscale x 4 x i8>* %b) #0 {
25 ; CHECK-LABEL: vec_scalable_subvec_scalable_idx_nonzero_i8:
27 ; CHECK-NEXT: ptrue p0.h
28 ; CHECK-NEXT: ld1b { z0.h }, p0/z, [x0]
29 ; CHECK-NEXT: ptrue p0.s
30 ; CHECK-NEXT: ld1b { z1.s }, p0/z, [x1]
31 ; CHECK-NEXT: uunpklo z0.s, z0.h
32 ; CHECK-NEXT: uzp1 z0.h, z0.h, z1.h
34 %vec = load <vscale x 8 x i8>, <vscale x 8 x i8>* %a
35 %subvec = load <vscale x 4 x i8>, <vscale x 4 x i8>* %b
36 %ins = call <vscale x 8 x i8> @llvm.experimental.vector.insert.nxv8i8.nxv4i8(<vscale x 8 x i8> %vec, <vscale x 4 x i8> %subvec, i64 4)
37 ret <vscale x 8 x i8> %ins
40 define <vscale x 4 x i16> @vec_scalable_subvec_scalable_idx_zero_i16(<vscale x 4 x i16>* %a, <vscale x 2 x i16>* %b) #0 {
41 ; CHECK-LABEL: vec_scalable_subvec_scalable_idx_zero_i16:
43 ; CHECK-NEXT: ptrue p0.s
44 ; CHECK-NEXT: ld1h { z0.s }, p0/z, [x0]
45 ; CHECK-NEXT: ptrue p0.d
46 ; CHECK-NEXT: ld1h { z1.d }, p0/z, [x1]
47 ; CHECK-NEXT: uunpkhi z0.d, z0.s
48 ; CHECK-NEXT: uzp1 z0.s, z1.s, z0.s
50 %vec = load <vscale x 4 x i16>, <vscale x 4 x i16>* %a
51 %subvec = load <vscale x 2 x i16>, <vscale x 2 x i16>* %b
52 %ins = call <vscale x 4 x i16> @llvm.experimental.vector.insert.nxv4i16.nxv2i16(<vscale x 4 x i16> %vec, <vscale x 2 x i16> %subvec, i64 0)
53 ret <vscale x 4 x i16> %ins
56 define <vscale x 4 x i16> @vec_scalable_subvec_scalable_idx_nonzero_i16(<vscale x 4 x i16>* %a, <vscale x 2 x i16>* %b) #0 {
57 ; CHECK-LABEL: vec_scalable_subvec_scalable_idx_nonzero_i16:
59 ; CHECK-NEXT: ptrue p0.s
60 ; CHECK-NEXT: ld1h { z0.s }, p0/z, [x0]
61 ; CHECK-NEXT: ptrue p0.d
62 ; CHECK-NEXT: ld1h { z1.d }, p0/z, [x1]
63 ; CHECK-NEXT: uunpklo z0.d, z0.s
64 ; CHECK-NEXT: uzp1 z0.s, z0.s, z1.s
66 %vec = load <vscale x 4 x i16>, <vscale x 4 x i16>* %a
67 %subvec = load <vscale x 2 x i16>, <vscale x 2 x i16>* %b
68 %ins = call <vscale x 4 x i16> @llvm.experimental.vector.insert.nxv4i16.nxv2i16(<vscale x 4 x i16> %vec, <vscale x 2 x i16> %subvec, i64 2)
69 ret <vscale x 4 x i16> %ins
72 ; FIXED INSERTED INTO SCALABLE TESTS
74 define <vscale x 8 x i8> @vec_scalable_subvec_fixed_idx_zero_i8(<vscale x 8 x i8>* %a, <8 x i8>* %b) #0 {
75 ; CHECK-LABEL: vec_scalable_subvec_fixed_idx_zero_i8:
77 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
78 ; CHECK-NEXT: addvl sp, sp, #-1
79 ; CHECK-NEXT: ptrue p0.h
80 ; CHECK-NEXT: ld1b { z0.h }, p0/z, [x0]
81 ; CHECK-NEXT: ldr d1, [x1]
82 ; CHECK-NEXT: st1h { z0.h }, p0, [sp]
83 ; CHECK-NEXT: ushll v0.8h, v1.8b, #0
84 ; CHECK-NEXT: str q0, [sp]
85 ; CHECK-NEXT: ld1h { z0.h }, p0/z, [sp]
86 ; CHECK-NEXT: addvl sp, sp, #1
87 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
89 %vec = load <vscale x 8 x i8>, <vscale x 8 x i8>* %a
90 %subvec = load <8 x i8>, <8 x i8>* %b
91 %ins = call <vscale x 8 x i8> @llvm.experimental.vector.insert.nxv8i8.v8i8(<vscale x 8 x i8> %vec, <8 x i8> %subvec, i64 0)
92 ret <vscale x 8 x i8> %ins
95 define <vscale x 8 x i8> @vec_scalable_subvec_fixed_idx_nonzero_i8(<vscale x 8 x i8>* %a, <8 x i8>* %b) #0 {
96 ; CHECK-LABEL: vec_scalable_subvec_fixed_idx_nonzero_i8:
98 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
99 ; CHECK-NEXT: addvl sp, sp, #-1
100 ; CHECK-NEXT: ptrue p0.h
101 ; CHECK-NEXT: ld1b { z0.h }, p0/z, [x0]
102 ; CHECK-NEXT: ldr d1, [x1]
103 ; CHECK-NEXT: cnth x9
104 ; CHECK-NEXT: sub x9, x9, #8
105 ; CHECK-NEXT: mov w8, #8
106 ; CHECK-NEXT: cmp x9, #8
107 ; CHECK-NEXT: csel x8, x9, x8, lo
108 ; CHECK-NEXT: lsl x8, x8, #1
109 ; CHECK-NEXT: st1h { z0.h }, p0, [sp]
110 ; CHECK-NEXT: ushll v0.8h, v1.8b, #0
111 ; CHECK-NEXT: mov x9, sp
112 ; CHECK-NEXT: str q0, [x9, x8]
113 ; CHECK-NEXT: ld1h { z0.h }, p0/z, [sp]
114 ; CHECK-NEXT: addvl sp, sp, #1
115 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
117 %vec = load <vscale x 8 x i8>, <vscale x 8 x i8>* %a
118 %subvec = load <8 x i8>, <8 x i8>* %b
119 %ins = call <vscale x 8 x i8> @llvm.experimental.vector.insert.nxv8i8.v8i8(<vscale x 8 x i8> %vec, <8 x i8> %subvec, i64 8)
120 ret <vscale x 8 x i8> %ins
123 define <vscale x 4 x i16> @vec_scalable_subvec_fixed_idx_zero_i16(<vscale x 4 x i16>* %a, <4 x i16>* %b) #0 {
124 ; CHECK-LABEL: vec_scalable_subvec_fixed_idx_zero_i16:
126 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
127 ; CHECK-NEXT: addvl sp, sp, #-1
128 ; CHECK-NEXT: ptrue p0.s
129 ; CHECK-NEXT: ld1h { z0.s }, p0/z, [x0]
130 ; CHECK-NEXT: ldr d1, [x1]
131 ; CHECK-NEXT: st1w { z0.s }, p0, [sp]
132 ; CHECK-NEXT: ushll v0.4s, v1.4h, #0
133 ; CHECK-NEXT: str q0, [sp]
134 ; CHECK-NEXT: ld1w { z0.s }, p0/z, [sp]
135 ; CHECK-NEXT: addvl sp, sp, #1
136 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
138 %vec = load <vscale x 4 x i16>, <vscale x 4 x i16>* %a
139 %subvec = load <4 x i16>, <4 x i16>* %b
140 %ins = call <vscale x 4 x i16> @llvm.experimental.vector.insert.nxv4i16.v4i16(<vscale x 4 x i16> %vec, <4 x i16> %subvec, i64 0)
141 ret <vscale x 4 x i16> %ins
144 define <vscale x 4 x i16> @vec_scalable_subvec_fixed_idx_nonzero_i16(<vscale x 4 x i16>* %a, <4 x i16>* %b) #0 {
145 ; CHECK-LABEL: vec_scalable_subvec_fixed_idx_nonzero_i16:
147 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
148 ; CHECK-NEXT: addvl sp, sp, #-1
149 ; CHECK-NEXT: ptrue p0.s
150 ; CHECK-NEXT: ld1h { z0.s }, p0/z, [x0]
151 ; CHECK-NEXT: ldr d1, [x1]
152 ; CHECK-NEXT: cntw x9
153 ; CHECK-NEXT: sub x9, x9, #4
154 ; CHECK-NEXT: mov w8, #4
155 ; CHECK-NEXT: cmp x9, #4
156 ; CHECK-NEXT: csel x8, x9, x8, lo
157 ; CHECK-NEXT: lsl x8, x8, #2
158 ; CHECK-NEXT: st1w { z0.s }, p0, [sp]
159 ; CHECK-NEXT: ushll v0.4s, v1.4h, #0
160 ; CHECK-NEXT: mov x9, sp
161 ; CHECK-NEXT: str q0, [x9, x8]
162 ; CHECK-NEXT: ld1w { z0.s }, p0/z, [sp]
163 ; CHECK-NEXT: addvl sp, sp, #1
164 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
166 %vec = load <vscale x 4 x i16>, <vscale x 4 x i16>* %a
167 %subvec = load <4 x i16>, <4 x i16>* %b
168 %ins = call <vscale x 4 x i16> @llvm.experimental.vector.insert.nxv4i16.v4i16(<vscale x 4 x i16> %vec, <4 x i16> %subvec, i64 4)
169 ret <vscale x 4 x i16> %ins
172 define <vscale x 2 x i32> @vec_scalable_subvec_fixed_idx_zero_i32(<vscale x 2 x i32>* %a, <2 x i32>* %b) #0 {
173 ; CHECK-LABEL: vec_scalable_subvec_fixed_idx_zero_i32:
175 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
176 ; CHECK-NEXT: addvl sp, sp, #-1
177 ; CHECK-NEXT: ptrue p0.d
178 ; CHECK-NEXT: ld1w { z0.d }, p0/z, [x0]
179 ; CHECK-NEXT: ldr d1, [x1]
180 ; CHECK-NEXT: st1d { z0.d }, p0, [sp]
181 ; CHECK-NEXT: ushll v0.2d, v1.2s, #0
182 ; CHECK-NEXT: str q0, [sp]
183 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [sp]
184 ; CHECK-NEXT: addvl sp, sp, #1
185 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
187 %vec = load <vscale x 2 x i32>, <vscale x 2 x i32>* %a
188 %subvec = load <2 x i32>, <2 x i32>* %b
189 %ins = call <vscale x 2 x i32> @llvm.experimental.vector.insert.nxv2i32.v2i32(<vscale x 2 x i32> %vec, <2 x i32> %subvec, i64 0)
190 ret <vscale x 2 x i32> %ins
193 define <vscale x 2 x i32> @vec_scalable_subvec_fixed_idx_nonzero_i32(<vscale x 2 x i32>* %a, <2 x i32>* %b) #0 {
194 ; CHECK-LABEL: vec_scalable_subvec_fixed_idx_nonzero_i32:
196 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
197 ; CHECK-NEXT: addvl sp, sp, #-1
198 ; CHECK-NEXT: ptrue p0.d
199 ; CHECK-NEXT: ld1w { z0.d }, p0/z, [x0]
200 ; CHECK-NEXT: ldr d1, [x1]
201 ; CHECK-NEXT: cntd x9
202 ; CHECK-NEXT: sub x9, x9, #2
203 ; CHECK-NEXT: mov w8, #2
204 ; CHECK-NEXT: cmp x9, #2
205 ; CHECK-NEXT: csel x8, x9, x8, lo
206 ; CHECK-NEXT: lsl x8, x8, #3
207 ; CHECK-NEXT: st1d { z0.d }, p0, [sp]
208 ; CHECK-NEXT: ushll v0.2d, v1.2s, #0
209 ; CHECK-NEXT: mov x9, sp
210 ; CHECK-NEXT: str q0, [x9, x8]
211 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [sp]
212 ; CHECK-NEXT: addvl sp, sp, #1
213 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
215 %vec = load <vscale x 2 x i32>, <vscale x 2 x i32>* %a
216 %subvec = load <2 x i32>, <2 x i32>* %b
217 %ins = call <vscale x 2 x i32> @llvm.experimental.vector.insert.nxv2i32.v2i32(<vscale x 2 x i32> %vec, <2 x i32> %subvec, i64 2)
218 ret <vscale x 2 x i32> %ins
221 define <vscale x 2 x i32> @vec_scalable_subvec_fixed_idx_nonzero_large_i32(<vscale x 2 x i32>* %a, <8 x i32>* %b) #1 {
222 ; CHECK-LABEL: vec_scalable_subvec_fixed_idx_nonzero_large_i32:
224 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
225 ; CHECK-NEXT: addvl sp, sp, #-1
226 ; CHECK-NEXT: ptrue p0.d
227 ; CHECK-NEXT: ptrue p1.s, vl8
228 ; CHECK-NEXT: ld1w { z0.d }, p0/z, [x0]
229 ; CHECK-NEXT: ld1w { z1.s }, p1/z, [x1]
230 ; CHECK-NEXT: cntd x8
231 ; CHECK-NEXT: subs x8, x8, #8
232 ; CHECK-NEXT: csel x8, xzr, x8, lo
233 ; CHECK-NEXT: mov w9, #8
234 ; CHECK-NEXT: cmp x8, #8
235 ; CHECK-NEXT: ptrue p1.d, vl8
236 ; CHECK-NEXT: csel x8, x8, x9, lo
237 ; CHECK-NEXT: st1d { z0.d }, p0, [sp]
238 ; CHECK-NEXT: uunpklo z0.d, z1.s
239 ; CHECK-NEXT: mov x9, sp
240 ; CHECK-NEXT: st1d { z0.d }, p1, [x9, x8, lsl #3]
241 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [sp]
242 ; CHECK-NEXT: addvl sp, sp, #1
243 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
245 %vec = load <vscale x 2 x i32>, <vscale x 2 x i32>* %a
246 %subvec = load <8 x i32>, <8 x i32>* %b
247 %ins = call <vscale x 2 x i32> @llvm.experimental.vector.insert.nxv2i32.v8i32(<vscale x 2 x i32> %vec, <8 x i32> %subvec, i64 8)
248 ret <vscale x 2 x i32> %ins
251 declare <vscale x 8 x i8> @llvm.experimental.vector.insert.nxv8i8.nxv4i8(<vscale x 8 x i8>, <vscale x 4 x i8>, i64)
252 declare <vscale x 4 x i16> @llvm.experimental.vector.insert.nxv4i16.nxv2i16(<vscale x 4 x i16>, <vscale x 2 x i16>, i64)
254 declare <vscale x 8 x i8> @llvm.experimental.vector.insert.nxv8i8.v8i8(<vscale x 8 x i8>, <8 x i8>, i64)
255 declare <vscale x 4 x i16> @llvm.experimental.vector.insert.nxv4i16.v4i16(<vscale x 4 x i16>, <4 x i16>, i64)
256 declare <vscale x 2 x i32> @llvm.experimental.vector.insert.nxv2i32.v2i32(<vscale x 2 x i32>, <2 x i32>, i64)
258 declare <vscale x 2 x i32> @llvm.experimental.vector.insert.nxv2i32.v8i32(<vscale x 2 x i32>, <8 x i32>, i64)
260 attributes #0 = { nounwind "target-features"="+sve" }
261 attributes #1 = { nounwind "target-features"="+sve" vscale_range(4,4) }