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
6 target triple = "aarch64-unknown-linux-gnu"
12 define <4 x i8> @splat_v4i8(i8 %a) {
13 ; CHECK-LABEL: splat_v4i8:
15 ; CHECK-NEXT: mov z0.h, w0
16 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
18 %insert = insertelement <4 x i8> undef, i8 %a, i64 0
19 %splat = shufflevector <4 x i8> %insert, <4 x i8> undef, <4 x i32> zeroinitializer
23 define <8 x i8> @splat_v8i8(i8 %a) {
24 ; CHECK-LABEL: splat_v8i8:
26 ; CHECK-NEXT: mov z0.b, w0
27 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
29 %insert = insertelement <8 x i8> undef, i8 %a, i64 0
30 %splat = shufflevector <8 x i8> %insert, <8 x i8> undef, <8 x i32> zeroinitializer
34 define <16 x i8> @splat_v16i8(i8 %a) {
35 ; CHECK-LABEL: splat_v16i8:
37 ; CHECK-NEXT: mov z0.b, w0
38 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
40 %insert = insertelement <16 x i8> undef, i8 %a, i64 0
41 %splat = shufflevector <16 x i8> %insert, <16 x i8> undef, <16 x i32> zeroinitializer
45 define void @splat_v32i8(i8 %a, ptr %b) {
46 ; CHECK-LABEL: splat_v32i8:
48 ; CHECK-NEXT: mov z0.b, w0
49 ; CHECK-NEXT: stp q0, q0, [x1]
51 %insert = insertelement <32 x i8> undef, i8 %a, i64 0
52 %splat = shufflevector <32 x i8> %insert, <32 x i8> undef, <32 x i32> zeroinitializer
53 store <32 x i8> %splat, ptr %b
57 define <2 x i16> @splat_v2i16(i16 %a) {
58 ; CHECK-LABEL: splat_v2i16:
60 ; CHECK-NEXT: mov z0.s, w0
61 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
63 %insert = insertelement <2 x i16> undef, i16 %a, i64 0
64 %splat = shufflevector <2 x i16> %insert, <2 x i16> undef, <2 x i32> zeroinitializer
68 define <4 x i16> @splat_v4i16(i16 %a) {
69 ; CHECK-LABEL: splat_v4i16:
71 ; CHECK-NEXT: mov z0.h, w0
72 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
74 %insert = insertelement <4 x i16> undef, i16 %a, i64 0
75 %splat = shufflevector <4 x i16> %insert, <4 x i16> undef, <4 x i32> zeroinitializer
79 define <8 x i16> @splat_v8i16(i16 %a) {
80 ; CHECK-LABEL: splat_v8i16:
82 ; CHECK-NEXT: mov z0.h, w0
83 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
85 %insert = insertelement <8 x i16> undef, i16 %a, i64 0
86 %splat = shufflevector <8 x i16> %insert, <8 x i16> undef, <8 x i32> zeroinitializer
90 define void @splat_v16i16(i16 %a, ptr %b) {
91 ; CHECK-LABEL: splat_v16i16:
93 ; CHECK-NEXT: mov z0.h, w0
94 ; CHECK-NEXT: stp q0, q0, [x1]
96 %insert = insertelement <16 x i16> undef, i16 %a, i64 0
97 %splat = shufflevector <16 x i16> %insert, <16 x i16> undef, <16 x i32> zeroinitializer
98 store <16 x i16> %splat, ptr %b
102 define <2 x i32> @splat_v2i32(i32 %a) {
103 ; CHECK-LABEL: splat_v2i32:
105 ; CHECK-NEXT: mov z0.s, w0
106 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
108 %insert = insertelement <2 x i32> undef, i32 %a, i64 0
109 %splat = shufflevector <2 x i32> %insert, <2 x i32> undef, <2 x i32> zeroinitializer
113 define <4 x i32> @splat_v4i32(i32 %a) {
114 ; CHECK-LABEL: splat_v4i32:
116 ; CHECK-NEXT: mov z0.s, w0
117 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
119 %insert = insertelement <4 x i32> undef, i32 %a, i64 0
120 %splat = shufflevector <4 x i32> %insert, <4 x i32> undef, <4 x i32> zeroinitializer
124 define void @splat_v8i32(i32 %a, ptr %b) {
125 ; CHECK-LABEL: splat_v8i32:
127 ; CHECK-NEXT: mov z0.s, w0
128 ; CHECK-NEXT: stp q0, q0, [x1]
130 %insert = insertelement <8 x i32> undef, i32 %a, i64 0
131 %splat = shufflevector <8 x i32> %insert, <8 x i32> undef, <8 x i32> zeroinitializer
132 store <8 x i32> %splat, ptr %b
136 define <1 x i64> @splat_v1i64(i64 %a) {
137 ; CHECK-LABEL: splat_v1i64:
139 ; CHECK-NEXT: mov z0.d, x0
140 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
142 %insert = insertelement <1 x i64> undef, i64 %a, i64 0
143 %splat = shufflevector <1 x i64> %insert, <1 x i64> undef, <1 x i32> zeroinitializer
147 define <2 x i64> @splat_v2i64(i64 %a) {
148 ; CHECK-LABEL: splat_v2i64:
150 ; CHECK-NEXT: mov z0.d, x0
151 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
153 %insert = insertelement <2 x i64> undef, i64 %a, i64 0
154 %splat = shufflevector <2 x i64> %insert, <2 x i64> undef, <2 x i32> zeroinitializer
158 define void @splat_v4i64(i64 %a, ptr %b) {
159 ; CHECK-LABEL: splat_v4i64:
161 ; CHECK-NEXT: mov z0.d, x0
162 ; CHECK-NEXT: stp q0, q0, [x1]
164 %insert = insertelement <4 x i64> undef, i64 %a, i64 0
165 %splat = shufflevector <4 x i64> %insert, <4 x i64> undef, <4 x i32> zeroinitializer
166 store <4 x i64> %splat, ptr %b
171 ; DUP (floating-point)
174 define <2 x half> @splat_v2f16(half %a) {
175 ; CHECK-LABEL: splat_v2f16:
177 ; CHECK-NEXT: // kill: def $h0 killed $h0 def $z0
178 ; CHECK-NEXT: mov z0.h, h0
179 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
181 %insert = insertelement <2 x half> undef, half %a, i64 0
182 %splat = shufflevector <2 x half> %insert, <2 x half> undef, <2 x i32> zeroinitializer
183 ret <2 x half> %splat
186 define <4 x half> @splat_v4f16(half %a) {
187 ; CHECK-LABEL: splat_v4f16:
189 ; CHECK-NEXT: // kill: def $h0 killed $h0 def $z0
190 ; CHECK-NEXT: mov z0.h, h0
191 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
193 %insert = insertelement <4 x half> undef, half %a, i64 0
194 %splat = shufflevector <4 x half> %insert, <4 x half> undef, <4 x i32> zeroinitializer
195 ret <4 x half> %splat
198 define <8 x half> @splat_v8f16(half %a) {
199 ; CHECK-LABEL: splat_v8f16:
201 ; CHECK-NEXT: // kill: def $h0 killed $h0 def $z0
202 ; CHECK-NEXT: mov z0.h, h0
203 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
205 %insert = insertelement <8 x half> undef, half %a, i64 0
206 %splat = shufflevector <8 x half> %insert, <8 x half> undef, <8 x i32> zeroinitializer
207 ret <8 x half> %splat
210 define void @splat_v16f16(half %a, ptr %b) {
211 ; CHECK-LABEL: splat_v16f16:
213 ; CHECK-NEXT: // kill: def $h0 killed $h0 def $z0
214 ; CHECK-NEXT: mov z0.h, h0
215 ; CHECK-NEXT: stp q0, q0, [x0]
217 %insert = insertelement <16 x half> undef, half %a, i64 0
218 %splat = shufflevector <16 x half> %insert, <16 x half> undef, <16 x i32> zeroinitializer
219 store <16 x half> %splat, ptr %b
223 define <2 x float> @splat_v2f32(float %a, <2 x float> %op2) {
224 ; CHECK-LABEL: splat_v2f32:
226 ; CHECK-NEXT: // kill: def $s0 killed $s0 def $z0
227 ; CHECK-NEXT: mov z0.s, s0
228 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
230 %insert = insertelement <2 x float> undef, float %a, i64 0
231 %splat = shufflevector <2 x float> %insert, <2 x float> undef, <2 x i32> zeroinitializer
232 ret <2 x float> %splat
235 define <4 x float> @splat_v4f32(float %a, <4 x float> %op2) {
236 ; CHECK-LABEL: splat_v4f32:
238 ; CHECK-NEXT: // kill: def $s0 killed $s0 def $z0
239 ; CHECK-NEXT: mov z0.s, s0
240 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
242 %insert = insertelement <4 x float> undef, float %a, i64 0
243 %splat = shufflevector <4 x float> %insert, <4 x float> undef, <4 x i32> zeroinitializer
244 ret <4 x float> %splat
247 define void @splat_v8f32(float %a, ptr %b) {
248 ; CHECK-LABEL: splat_v8f32:
250 ; CHECK-NEXT: // kill: def $s0 killed $s0 def $z0
251 ; CHECK-NEXT: mov z0.s, s0
252 ; CHECK-NEXT: stp q0, q0, [x0]
254 %insert = insertelement <8 x float> undef, float %a, i64 0
255 %splat = shufflevector <8 x float> %insert, <8 x float> undef, <8 x i32> zeroinitializer
256 store <8 x float> %splat, ptr %b
260 define <1 x double> @splat_v1f64(double %a, <1 x double> %op2) {
261 ; CHECK-LABEL: splat_v1f64:
264 %insert = insertelement <1 x double> undef, double %a, i64 0
265 %splat = shufflevector <1 x double> %insert, <1 x double> undef, <1 x i32> zeroinitializer
266 ret <1 x double> %splat
269 define <2 x double> @splat_v2f64(double %a, <2 x double> %op2) {
270 ; CHECK-LABEL: splat_v2f64:
272 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
273 ; CHECK-NEXT: mov z0.d, d0
274 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
276 %insert = insertelement <2 x double> undef, double %a, i64 0
277 %splat = shufflevector <2 x double> %insert, <2 x double> undef, <2 x i32> zeroinitializer
278 ret <2 x double> %splat
281 define void @splat_v4f64(double %a, ptr %b) {
282 ; CHECK-LABEL: splat_v4f64:
284 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
285 ; CHECK-NEXT: mov z0.d, d0
286 ; CHECK-NEXT: stp q0, q0, [x0]
288 %insert = insertelement <4 x double> undef, double %a, i64 0
289 %splat = shufflevector <4 x double> %insert, <4 x double> undef, <4 x i32> zeroinitializer
290 store <4 x double> %splat, ptr %b
295 ; DUP (integer immediate)
298 define void @splat_imm_v32i8(ptr %a) {
299 ; CHECK-LABEL: splat_imm_v32i8:
301 ; CHECK-NEXT: mov z0.b, #1 // =0x1
302 ; CHECK-NEXT: stp q0, q0, [x0]
304 %insert = insertelement <32 x i8> undef, i8 1, i64 0
305 %splat = shufflevector <32 x i8> %insert, <32 x i8> undef, <32 x i32> zeroinitializer
306 store <32 x i8> %splat, ptr %a
310 define void @splat_imm_v16i16(ptr %a) {
311 ; CHECK-LABEL: splat_imm_v16i16:
313 ; CHECK-NEXT: mov z0.h, #2 // =0x2
314 ; CHECK-NEXT: stp q0, q0, [x0]
316 %insert = insertelement <16 x i16> undef, i16 2, i64 0
317 %splat = shufflevector <16 x i16> %insert, <16 x i16> undef, <16 x i32> zeroinitializer
318 store <16 x i16> %splat, ptr %a
322 define void @splat_imm_v8i32(ptr %a) {
323 ; CHECK-LABEL: splat_imm_v8i32:
325 ; CHECK-NEXT: mov z0.s, #3 // =0x3
326 ; CHECK-NEXT: stp q0, q0, [x0]
328 %insert = insertelement <8 x i32> undef, i32 3, i64 0
329 %splat = shufflevector <8 x i32> %insert, <8 x i32> undef, <8 x i32> zeroinitializer
330 store <8 x i32> %splat, ptr %a
334 define void @splat_imm_v4i64(ptr %a) {
335 ; CHECK-LABEL: splat_imm_v4i64:
337 ; CHECK-NEXT: mov z0.d, #4 // =0x4
338 ; CHECK-NEXT: stp q0, q0, [x0]
340 %insert = insertelement <4 x i64> undef, i64 4, i64 0
341 %splat = shufflevector <4 x i64> %insert, <4 x i64> undef, <4 x i32> zeroinitializer
342 store <4 x i64> %splat, ptr %a
347 ; DUP (floating-point immediate)
350 define void @splat_imm_v16f16(ptr %a) {
351 ; CHECK-LABEL: splat_imm_v16f16:
353 ; CHECK-NEXT: fmov z0.h, #5.00000000
354 ; CHECK-NEXT: stp q0, q0, [x0]
356 %insert = insertelement <16 x half> undef, half 5.0, i64 0
357 %splat = shufflevector <16 x half> %insert, <16 x half> undef, <16 x i32> zeroinitializer
358 store <16 x half> %splat, ptr %a
362 define void @splat_imm_v8f32(ptr %a) {
363 ; CHECK-LABEL: splat_imm_v8f32:
365 ; CHECK-NEXT: fmov z0.s, #6.00000000
366 ; CHECK-NEXT: stp q0, q0, [x0]
368 %insert = insertelement <8 x float> undef, float 6.0, i64 0
369 %splat = shufflevector <8 x float> %insert, <8 x float> undef, <8 x i32> zeroinitializer
370 store <8 x float> %splat, ptr %a
374 define void @splat_imm_v4f64(ptr %a) {
375 ; CHECK-LABEL: splat_imm_v4f64:
377 ; CHECK-NEXT: fmov z0.d, #7.00000000
378 ; CHECK-NEXT: stp q0, q0, [x0]
380 %insert = insertelement <4 x double> undef, double 7.0, i64 0
381 %splat = shufflevector <4 x double> %insert, <4 x double> undef, <4 x i32> zeroinitializer
382 store <4 x double> %splat, ptr %a