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"
11 define <4 x i8> @insertelement_v4i8(<4 x i8> %op1) {
12 ; CHECK-LABEL: insertelement_v4i8:
14 ; CHECK-NEXT: ptrue p0.h
15 ; CHECK-NEXT: mov w8, #3 // =0x3
16 ; CHECK-NEXT: index z1.h, #0, #1
17 ; CHECK-NEXT: mov z2.h, w8
18 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
19 ; CHECK-NEXT: mov w8, #5 // =0x5
20 ; CHECK-NEXT: cmpeq p0.h, p0/z, z1.h, z2.h
21 ; CHECK-NEXT: mov z0.h, p0/m, w8
22 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
24 %r = insertelement <4 x i8> %op1, i8 5, i64 3
28 define <8 x i8> @insertelement_v8i8(<8 x i8> %op1) {
29 ; CHECK-LABEL: insertelement_v8i8:
31 ; CHECK-NEXT: ptrue p0.b
32 ; CHECK-NEXT: mov w8, #7 // =0x7
33 ; CHECK-NEXT: index z1.b, #0, #1
34 ; CHECK-NEXT: mov z2.b, w8
35 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
36 ; CHECK-NEXT: mov w8, #5 // =0x5
37 ; CHECK-NEXT: cmpeq p0.b, p0/z, z1.b, z2.b
38 ; CHECK-NEXT: mov z0.b, p0/m, w8
39 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
41 %r = insertelement <8 x i8> %op1, i8 5, i64 7
45 define <16 x i8> @insertelement_v16i8(<16 x i8> %op1) {
46 ; CHECK-LABEL: insertelement_v16i8:
48 ; CHECK-NEXT: ptrue p0.b
49 ; CHECK-NEXT: mov w8, #15 // =0xf
50 ; CHECK-NEXT: index z1.b, #0, #1
51 ; CHECK-NEXT: mov z2.b, w8
52 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
53 ; CHECK-NEXT: mov w8, #5 // =0x5
54 ; CHECK-NEXT: cmpeq p0.b, p0/z, z1.b, z2.b
55 ; CHECK-NEXT: mov z0.b, p0/m, w8
56 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
58 %r = insertelement <16 x i8> %op1, i8 5, i64 15
62 define <32 x i8> @insertelement_v32i8(<32 x i8> %op1) {
63 ; CHECK-LABEL: insertelement_v32i8:
65 ; CHECK-NEXT: ptrue p0.b
66 ; CHECK-NEXT: mov w8, #15 // =0xf
67 ; CHECK-NEXT: index z2.b, #0, #1
68 ; CHECK-NEXT: mov z3.b, w8
69 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
70 ; CHECK-NEXT: mov w8, #5 // =0x5
71 ; CHECK-NEXT: cmpeq p0.b, p0/z, z2.b, z3.b
72 ; CHECK-NEXT: mov z1.b, p0/m, w8
73 ; CHECK-NEXT: // kill: def $q1 killed $q1 killed $z1
75 %r = insertelement <32 x i8> %op1, i8 5, i64 31
80 define <2 x i16> @insertelement_v2i16(<2 x i16> %op1) {
81 ; CHECK-LABEL: insertelement_v2i16:
83 ; CHECK-NEXT: ptrue p0.s
84 ; CHECK-NEXT: mov w8, #1 // =0x1
85 ; CHECK-NEXT: index z1.s, #0, #1
86 ; CHECK-NEXT: mov z2.s, w8
87 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
88 ; CHECK-NEXT: mov w8, #5 // =0x5
89 ; CHECK-NEXT: cmpeq p0.s, p0/z, z1.s, z2.s
90 ; CHECK-NEXT: mov z0.s, p0/m, w8
91 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
93 %r = insertelement <2 x i16> %op1, i16 5, i64 1
97 define <4 x i16> @insertelement_v4i16(<4 x i16> %op1) {
98 ; CHECK-LABEL: insertelement_v4i16:
100 ; CHECK-NEXT: ptrue p0.h
101 ; CHECK-NEXT: mov w8, #3 // =0x3
102 ; CHECK-NEXT: index z1.h, #0, #1
103 ; CHECK-NEXT: mov z2.h, w8
104 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
105 ; CHECK-NEXT: mov w8, #5 // =0x5
106 ; CHECK-NEXT: cmpeq p0.h, p0/z, z1.h, z2.h
107 ; CHECK-NEXT: mov z0.h, p0/m, w8
108 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
110 %r = insertelement <4 x i16> %op1, i16 5, i64 3
114 define <8 x i16> @insertelement_v8i16(<8 x i16> %op1) {
115 ; CHECK-LABEL: insertelement_v8i16:
117 ; CHECK-NEXT: ptrue p0.h
118 ; CHECK-NEXT: mov w8, #7 // =0x7
119 ; CHECK-NEXT: index z1.h, #0, #1
120 ; CHECK-NEXT: mov z2.h, w8
121 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
122 ; CHECK-NEXT: mov w8, #5 // =0x5
123 ; CHECK-NEXT: cmpeq p0.h, p0/z, z1.h, z2.h
124 ; CHECK-NEXT: mov z0.h, p0/m, w8
125 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
127 %r = insertelement <8 x i16> %op1, i16 5, i64 7
131 define <16 x i16> @insertelement_v16i16(<16 x i16> %op1) {
132 ; CHECK-LABEL: insertelement_v16i16:
134 ; CHECK-NEXT: ptrue p0.h
135 ; CHECK-NEXT: mov w8, #7 // =0x7
136 ; CHECK-NEXT: index z2.h, #0, #1
137 ; CHECK-NEXT: mov z3.h, w8
138 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
139 ; CHECK-NEXT: mov w8, #5 // =0x5
140 ; CHECK-NEXT: cmpeq p0.h, p0/z, z2.h, z3.h
141 ; CHECK-NEXT: mov z1.h, p0/m, w8
142 ; CHECK-NEXT: // kill: def $q1 killed $q1 killed $z1
144 %r = insertelement <16 x i16> %op1, i16 5, i64 15
149 define <2 x i32> @insertelement_v2i32(<2 x i32> %op1) {
150 ; CHECK-LABEL: insertelement_v2i32:
152 ; CHECK-NEXT: ptrue p0.s
153 ; CHECK-NEXT: mov w8, #1 // =0x1
154 ; CHECK-NEXT: index z1.s, #0, #1
155 ; CHECK-NEXT: mov z2.s, w8
156 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
157 ; CHECK-NEXT: mov w8, #5 // =0x5
158 ; CHECK-NEXT: cmpeq p0.s, p0/z, z1.s, z2.s
159 ; CHECK-NEXT: mov z0.s, p0/m, w8
160 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
162 %r = insertelement <2 x i32> %op1, i32 5, i64 1
166 define <4 x i32> @insertelement_v4i32(<4 x i32> %op1) {
167 ; CHECK-LABEL: insertelement_v4i32:
169 ; CHECK-NEXT: ptrue p0.s
170 ; CHECK-NEXT: mov w8, #3 // =0x3
171 ; CHECK-NEXT: index z1.s, #0, #1
172 ; CHECK-NEXT: mov z2.s, w8
173 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
174 ; CHECK-NEXT: mov w8, #5 // =0x5
175 ; CHECK-NEXT: cmpeq p0.s, p0/z, z1.s, z2.s
176 ; CHECK-NEXT: mov z0.s, p0/m, w8
177 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
179 %r = insertelement <4 x i32> %op1, i32 5, i64 3
183 define <8 x i32> @insertelement_v8i32(ptr %a) {
184 ; CHECK-LABEL: insertelement_v8i32:
186 ; CHECK-NEXT: ptrue p0.s
187 ; CHECK-NEXT: mov w8, #3 // =0x3
188 ; CHECK-NEXT: index z0.s, #0, #1
189 ; CHECK-NEXT: mov z1.s, w8
190 ; CHECK-NEXT: mov w8, #5 // =0x5
191 ; CHECK-NEXT: cmpeq p0.s, p0/z, z0.s, z1.s
192 ; CHECK-NEXT: ldp q0, q1, [x0]
193 ; CHECK-NEXT: mov z1.s, p0/m, w8
194 ; CHECK-NEXT: // kill: def $q1 killed $q1 killed $z1
196 %op1 = load <8 x i32>, ptr %a
197 %r = insertelement <8 x i32> %op1, i32 5, i64 7
202 define <1 x i64> @insertelement_v1i64(<1 x i64> %op1) {
203 ; CHECK-LABEL: insertelement_v1i64:
205 ; CHECK-NEXT: mov z0.d, #5 // =0x5
206 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
208 %r = insertelement <1 x i64> %op1, i64 5, i64 0
212 define <2 x i64> @insertelement_v2i64(<2 x i64> %op1) {
213 ; CHECK-LABEL: insertelement_v2i64:
215 ; CHECK-NEXT: ptrue p0.d
216 ; CHECK-NEXT: mov w8, #1 // =0x1
217 ; CHECK-NEXT: index z1.d, #0, #1
218 ; CHECK-NEXT: mov z2.d, x8
219 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
220 ; CHECK-NEXT: mov w8, #5 // =0x5
221 ; CHECK-NEXT: cmpeq p0.d, p0/z, z1.d, z2.d
222 ; CHECK-NEXT: mov z0.d, p0/m, x8
223 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
225 %r = insertelement <2 x i64> %op1, i64 5, i64 1
229 define <4 x i64> @insertelement_v4i64(ptr %a) {
230 ; CHECK-LABEL: insertelement_v4i64:
232 ; CHECK-NEXT: ptrue p0.d
233 ; CHECK-NEXT: mov w8, #1 // =0x1
234 ; CHECK-NEXT: index z0.d, #0, #1
235 ; CHECK-NEXT: mov z1.d, x8
236 ; CHECK-NEXT: mov w8, #5 // =0x5
237 ; CHECK-NEXT: cmpeq p0.d, p0/z, z0.d, z1.d
238 ; CHECK-NEXT: ldp q0, q1, [x0]
239 ; CHECK-NEXT: mov z1.d, p0/m, x8
240 ; CHECK-NEXT: // kill: def $q1 killed $q1 killed $z1
242 %op1 = load <4 x i64>, ptr %a
243 %r = insertelement <4 x i64> %op1, i64 5, i64 3
248 define <2 x half> @insertelement_v2f16(<2 x half> %op1) {
249 ; CHECK-LABEL: insertelement_v2f16:
251 ; CHECK-NEXT: sub sp, sp, #16
252 ; CHECK-NEXT: .cfi_def_cfa_offset 16
253 ; CHECK-NEXT: fmov h1, #5.00000000
254 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
255 ; CHECK-NEXT: str h0, [sp, #8]
256 ; CHECK-NEXT: str h1, [sp, #10]
257 ; CHECK-NEXT: ldr d0, [sp, #8]
258 ; CHECK-NEXT: add sp, sp, #16
260 %r = insertelement <2 x half> %op1, half 5.0, i64 1
264 define <4 x half> @insertelement_v4f16(<4 x half> %op1) {
265 ; CHECK-LABEL: insertelement_v4f16:
267 ; CHECK-NEXT: ptrue p0.h
268 ; CHECK-NEXT: mov w8, #3 // =0x3
269 ; CHECK-NEXT: index z1.h, #0, #1
270 ; CHECK-NEXT: mov z2.h, w8
271 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
272 ; CHECK-NEXT: cmpeq p0.h, p0/z, z1.h, z2.h
273 ; CHECK-NEXT: fmov h1, #5.00000000
274 ; CHECK-NEXT: mov z0.h, p0/m, h1
275 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
277 %r = insertelement <4 x half> %op1, half 5.0, i64 3
281 define <8 x half> @insertelement_v8f16(<8 x half> %op1) {
282 ; CHECK-LABEL: insertelement_v8f16:
284 ; CHECK-NEXT: ptrue p0.h
285 ; CHECK-NEXT: mov w8, #7 // =0x7
286 ; CHECK-NEXT: index z1.h, #0, #1
287 ; CHECK-NEXT: mov z2.h, w8
288 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
289 ; CHECK-NEXT: cmpeq p0.h, p0/z, z1.h, z2.h
290 ; CHECK-NEXT: fmov h1, #5.00000000
291 ; CHECK-NEXT: mov z0.h, p0/m, h1
292 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
294 %r = insertelement <8 x half> %op1, half 5.0, i64 7
298 define <16 x half> @insertelement_v16f16(ptr %a) {
299 ; CHECK-LABEL: insertelement_v16f16:
301 ; CHECK-NEXT: ptrue p0.h
302 ; CHECK-NEXT: mov w8, #7 // =0x7
303 ; CHECK-NEXT: index z0.h, #0, #1
304 ; CHECK-NEXT: mov z1.h, w8
305 ; CHECK-NEXT: fmov h2, #5.00000000
306 ; CHECK-NEXT: cmpeq p0.h, p0/z, z0.h, z1.h
307 ; CHECK-NEXT: ldp q0, q1, [x0]
308 ; CHECK-NEXT: mov z1.h, p0/m, h2
309 ; CHECK-NEXT: // kill: def $q1 killed $q1 killed $z1
311 %op1 = load <16 x half>, ptr %a
312 %r = insertelement <16 x half> %op1, half 5.0, i64 15
317 define <2 x float> @insertelement_v2f32(<2 x float> %op1) {
318 ; CHECK-LABEL: insertelement_v2f32:
320 ; CHECK-NEXT: ptrue p0.s
321 ; CHECK-NEXT: mov w8, #1 // =0x1
322 ; CHECK-NEXT: index z1.s, #0, #1
323 ; CHECK-NEXT: mov z2.s, w8
324 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
325 ; CHECK-NEXT: cmpeq p0.s, p0/z, z1.s, z2.s
326 ; CHECK-NEXT: fmov s1, #5.00000000
327 ; CHECK-NEXT: mov z0.s, p0/m, s1
328 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
330 %r = insertelement <2 x float> %op1, float 5.0, i64 1
334 define <4 x float> @insertelement_v4f32(<4 x float> %op1) {
335 ; CHECK-LABEL: insertelement_v4f32:
337 ; CHECK-NEXT: ptrue p0.s
338 ; CHECK-NEXT: mov w8, #3 // =0x3
339 ; CHECK-NEXT: index z1.s, #0, #1
340 ; CHECK-NEXT: mov z2.s, w8
341 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
342 ; CHECK-NEXT: cmpeq p0.s, p0/z, z1.s, z2.s
343 ; CHECK-NEXT: fmov s1, #5.00000000
344 ; CHECK-NEXT: mov z0.s, p0/m, s1
345 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
347 %r = insertelement <4 x float> %op1, float 5.0, i64 3
351 define <8 x float> @insertelement_v8f32(ptr %a) {
352 ; CHECK-LABEL: insertelement_v8f32:
354 ; CHECK-NEXT: ptrue p0.s
355 ; CHECK-NEXT: mov w8, #3 // =0x3
356 ; CHECK-NEXT: index z0.s, #0, #1
357 ; CHECK-NEXT: mov z1.s, w8
358 ; CHECK-NEXT: fmov s2, #5.00000000
359 ; CHECK-NEXT: cmpeq p0.s, p0/z, z0.s, z1.s
360 ; CHECK-NEXT: ldp q0, q1, [x0]
361 ; CHECK-NEXT: mov z1.s, p0/m, s2
362 ; CHECK-NEXT: // kill: def $q1 killed $q1 killed $z1
364 %op1 = load <8 x float>, ptr %a
365 %r = insertelement <8 x float> %op1, float 5.0, i64 7
370 define <1 x double> @insertelement_v1f64(<1 x double> %op1) {
371 ; CHECK-LABEL: insertelement_v1f64:
373 ; CHECK-NEXT: fmov d0, #5.00000000
375 %r = insertelement <1 x double> %op1, double 5.0, i64 0
379 define <2 x double> @insertelement_v2f64(<2 x double> %op1) {
380 ; CHECK-LABEL: insertelement_v2f64:
382 ; CHECK-NEXT: ptrue p0.d
383 ; CHECK-NEXT: mov w8, #1 // =0x1
384 ; CHECK-NEXT: index z1.d, #0, #1
385 ; CHECK-NEXT: mov z2.d, x8
386 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
387 ; CHECK-NEXT: cmpeq p0.d, p0/z, z1.d, z2.d
388 ; CHECK-NEXT: fmov d1, #5.00000000
389 ; CHECK-NEXT: mov z0.d, p0/m, d1
390 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
392 %r = insertelement <2 x double> %op1, double 5.0, i64 1
396 define <4 x double> @insertelement_v4f64(ptr %a) {
397 ; CHECK-LABEL: insertelement_v4f64:
399 ; CHECK-NEXT: ptrue p0.d
400 ; CHECK-NEXT: mov w8, #1 // =0x1
401 ; CHECK-NEXT: index z0.d, #0, #1
402 ; CHECK-NEXT: mov z1.d, x8
403 ; CHECK-NEXT: fmov d2, #5.00000000
404 ; CHECK-NEXT: cmpeq p0.d, p0/z, z0.d, z1.d
405 ; CHECK-NEXT: ldp q0, q1, [x0]
406 ; CHECK-NEXT: mov z1.d, p0/m, d2
407 ; CHECK-NEXT: // kill: def $q1 killed $q1 killed $z1
409 %op1 = load <4 x double>, ptr %a
410 %r = insertelement <4 x double> %op1, double 5.0, i64 3