1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=arm64-eabi -mcpu=generic -aarch64-neon-syntax=apple -mattr="+fullfp16" | FileCheck %s
4 define void @test0f(float* nocapture %x, float %a) #0 {
6 ; CHECK: // %bb.0: // %entry
7 ; CHECK-NEXT: movi.2d v1, #0000000000000000
8 ; CHECK-NEXT: // kill: def $s0 killed $s0 def $q0
9 ; CHECK-NEXT: mov.s v1[0], v0[0]
10 ; CHECK-NEXT: str q1, [x0]
13 %0 = insertelement <4 x float> <float undef, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00>, float %a, i32 0
14 %1 = bitcast float* %x to <4 x float>*
15 store <4 x float> %0, <4 x float>* %1, align 16
19 define void @test1f(float* nocapture %x, float %a) #0 {
20 ; CHECK-LABEL: test1f:
21 ; CHECK: // %bb.0: // %entry
22 ; CHECK-NEXT: fmov.4s v1, #1.00000000
23 ; CHECK-NEXT: // kill: def $s0 killed $s0 def $q0
24 ; CHECK-NEXT: mov.s v1[0], v0[0]
25 ; CHECK-NEXT: str q1, [x0]
28 %0 = insertelement <4 x float> <float undef, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, float %a, i32 0
29 %1 = bitcast float* %x to <4 x float>*
30 store <4 x float> %0, <4 x float>* %1, align 16
34 define <16 x i8> @test_insert_v16i8_insert_1(i8 %a) {
35 ; CHECK-LABEL: test_insert_v16i8_insert_1:
37 ; CHECK-NEXT: movi.2d v0, #0000000000000000
38 ; CHECK-NEXT: mov.b v0[14], w0
40 %v.0 = insertelement <16 x i8> zeroinitializer, i8 %a, i32 14
44 define <16 x i8> @test_insert_v16i8_insert_2(i8 %a) {
45 ; CHECK-LABEL: test_insert_v16i8_insert_2:
47 ; CHECK-NEXT: movi.2d v0, #0000000000000000
48 ; CHECK-NEXT: mov.b v0[1], w0
49 ; CHECK-NEXT: mov.b v0[2], w0
51 %v.0 = insertelement <16 x i8> zeroinitializer, i8 %a, i32 2
52 %v.1 = insertelement <16 x i8> %v.0, i8 %a, i32 1
56 define <16 x i8> @test_insert_v16i8_insert_2_undef_base(i8 %a) {
57 ; CHECK-LABEL: test_insert_v16i8_insert_2_undef_base:
59 ; CHECK-NEXT: dup.16b v0, w0
60 ; CHECK-NEXT: mov.b v0[5], wzr
61 ; CHECK-NEXT: mov.b v0[9], wzr
63 %v.0 = insertelement <16 x i8> <i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 0, i8 undef, i8 undef, i8 undef, i8 0, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef> , i8 %a, i32 0
64 %v.1 = insertelement <16 x i8> %v.0, i8 %a, i32 1
65 %v.2 = insertelement <16 x i8> %v.1, i8 %a, i32 2
66 %v.3 = insertelement <16 x i8> %v.2, i8 %a, i32 3
67 %v.4 = insertelement <16 x i8> %v.3, i8 %a, i32 4
68 %v.6 = insertelement <16 x i8> %v.4, i8 %a, i32 6
69 %v.7 = insertelement <16 x i8> %v.6, i8 %a, i32 7
70 %v.8 = insertelement <16 x i8> %v.7, i8 %a, i32 8
71 %v.10 = insertelement <16 x i8> %v.7, i8 %a, i32 10
72 %v.11 = insertelement <16 x i8> %v.10, i8 %a, i32 11
73 %v.12 = insertelement <16 x i8> %v.11, i8 %a, i32 12
74 %v.13 = insertelement <16 x i8> %v.12, i8 %a, i32 13
75 %v.14 = insertelement <16 x i8> %v.13, i8 %a, i32 14
76 %v.15 = insertelement <16 x i8> %v.14, i8 %a, i32 15
80 define <16 x i8> @test_insert_v16i8_insert_2_undef_base_different_valeus(i8 %a, i8 %b) {
81 ; CHECK-LABEL: test_insert_v16i8_insert_2_undef_base_different_valeus:
83 ; CHECK-NEXT: dup.16b v0, w0
84 ; CHECK-NEXT: mov.b v0[2], w1
85 ; CHECK-NEXT: mov.b v0[5], wzr
86 ; CHECK-NEXT: mov.b v0[7], w1
87 ; CHECK-NEXT: mov.b v0[9], wzr
88 ; CHECK-NEXT: mov.b v0[12], w1
89 ; CHECK-NEXT: mov.b v0[15], w1
91 %v.0 = insertelement <16 x i8> <i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 0, i8 undef, i8 undef, i8 undef, i8 0, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef> , i8 %a, i32 0
92 %v.1 = insertelement <16 x i8> %v.0, i8 %a, i32 1
93 %v.2 = insertelement <16 x i8> %v.1, i8 %b, i32 2
94 %v.3 = insertelement <16 x i8> %v.2, i8 %a, i32 3
95 %v.4 = insertelement <16 x i8> %v.3, i8 %a, i32 4
96 %v.6 = insertelement <16 x i8> %v.4, i8 %a, i32 6
97 %v.7 = insertelement <16 x i8> %v.6, i8 %b, i32 7
98 %v.8 = insertelement <16 x i8> %v.7, i8 %a, i32 8
99 %v.10 = insertelement <16 x i8> %v.7, i8 %a, i32 10
100 %v.11 = insertelement <16 x i8> %v.10, i8 %a, i32 11
101 %v.12 = insertelement <16 x i8> %v.11, i8 %b, i32 12
102 %v.13 = insertelement <16 x i8> %v.12, i8 %a, i32 13
103 %v.14 = insertelement <16 x i8> %v.13, i8 %a, i32 14
104 %v.15 = insertelement <16 x i8> %v.14, i8 %b, i32 15
108 define <8 x half> @test_insert_v8f16_insert_1(half %a) {
109 ; CHECK-LABEL: test_insert_v8f16_insert_1:
111 ; CHECK-NEXT: // kill: def $h0 killed $h0 def $q0
112 ; CHECK-NEXT: dup.8h v0, v0[0]
113 ; CHECK-NEXT: mov.h v0[7], wzr
115 %v.0 = insertelement <8 x half> <half undef, half undef, half undef, half undef, half undef, half undef, half undef, half 0.0>, half %a, i32 0
116 %v.1 = insertelement <8 x half> %v.0, half %a, i32 1
117 %v.2 = insertelement <8 x half> %v.1, half %a, i32 2
118 %v.3 = insertelement <8 x half> %v.2, half %a, i32 3
119 %v.4 = insertelement <8 x half> %v.3, half %a, i32 4
120 %v.5 = insertelement <8 x half> %v.4, half %a, i32 5
121 %v.6 = insertelement <8 x half> %v.5, half %a, i32 6
126 define <8 x half> @test_insert_v8f16_insert_2(half %a) {
127 ; CHECK-LABEL: test_insert_v8f16_insert_2:
129 ; CHECK-NEXT: movi.2d v1, #0000000000000000
130 ; CHECK-NEXT: // kill: def $h0 killed $h0 def $q0
131 ; CHECK-NEXT: mov.h v1[1], v0[0]
132 ; CHECK-NEXT: mov.h v1[2], v0[0]
133 ; CHECK-NEXT: mov.16b v0, v1
135 %v.0 = insertelement <8 x half> zeroinitializer, half %a, i32 2
136 %v.1 = insertelement <8 x half> %v.0, half %a, i32 1
140 define <8 x i16> @test_insert_v8i16_insert_2(i16 %a) {
141 ; CHECK-LABEL: test_insert_v8i16_insert_2:
143 ; CHECK-NEXT: dup.8h v0, w0
144 ; CHECK-NEXT: mov.h v0[3], wzr
145 ; CHECK-NEXT: mov.h v0[7], wzr
147 %v.0 = insertelement <8 x i16> <i16 undef, i16 undef, i16 undef, i16 0, i16 undef, i16 undef, i16 undef, i16 0>, i16 %a, i32 0
148 %v.1 = insertelement <8 x i16> %v.0, i16 %a, i32 1
149 %v.2 = insertelement <8 x i16> %v.1, i16 %a, i32 2
150 %v.3 = insertelement <8 x i16> %v.2, i16 %a, i32 4
151 %v.4 = insertelement <8 x i16> %v.3, i16 %a, i32 5
152 %v.5 = insertelement <8 x i16> %v.4, i16 %a, i32 6
156 define <8 x i16> @test_insert_v8i16_insert_3(i16 %a) {
157 ; CHECK-LABEL: test_insert_v8i16_insert_3:
159 ; CHECK-NEXT: dup.8h v0, w0
160 ; CHECK-NEXT: mov.h v0[1], wzr
161 ; CHECK-NEXT: mov.h v0[3], wzr
162 ; CHECK-NEXT: mov.h v0[7], wzr
164 %v.0 = insertelement <8 x i16> <i16 undef, i16 0, i16 undef, i16 0, i16 undef, i16 undef, i16 undef, i16 0>, i16 %a, i32 0
165 %v.2 = insertelement <8 x i16> %v.0, i16 %a, i32 2
166 %v.3 = insertelement <8 x i16> %v.2, i16 %a, i32 4
167 %v.4 = insertelement <8 x i16> %v.3, i16 %a, i32 5
168 %v.5 = insertelement <8 x i16> %v.4, i16 %a, i32 6
172 define <8 x i16> @test_insert_v8i16_insert_4(i16 %a) {
173 ; CHECK-LABEL: test_insert_v8i16_insert_4:
175 ; CHECK-NEXT: movi.2d v0, #0000000000000000
176 ; CHECK-NEXT: mov.h v0[0], w0
177 ; CHECK-NEXT: mov.h v0[2], w0
178 ; CHECK-NEXT: mov.h v0[4], w0
179 ; CHECK-NEXT: mov.h v0[5], w0
181 %v.0 = insertelement <8 x i16> <i16 undef, i16 0, i16 undef, i16 0, i16 undef, i16 undef, i16 0, i16 0>, i16 %a, i32 0
182 %v.2 = insertelement <8 x i16> %v.0, i16 %a, i32 2
183 %v.3 = insertelement <8 x i16> %v.2, i16 %a, i32 4
184 %v.4 = insertelement <8 x i16> %v.3, i16 %a, i32 5
188 define <8 x i16> @test_insert_v8i16_insert_5(i16 %a) {
189 ; CHECK-LABEL: test_insert_v8i16_insert_5:
191 ; CHECK-NEXT: movi.2d v0, #0000000000000000
192 ; CHECK-NEXT: mov.h v0[0], w0
193 ; CHECK-NEXT: mov.h v0[4], w0
194 ; CHECK-NEXT: mov.h v0[5], w0
196 %v.0 = insertelement <8 x i16> <i16 undef, i16 0, i16 0, i16 0, i16 undef, i16 undef, i16 0, i16 0>, i16 %a, i32 0
197 %v.3 = insertelement <8 x i16> %v.0, i16 %a, i32 4
198 %v.4 = insertelement <8 x i16> %v.3, i16 %a, i32 5
202 define <2 x float> @test_insert_v2f32_undef_zero_vector(float %a) {
203 ; CHECK-LABEL: test_insert_v2f32_undef_zero_vector:
205 ; CHECK-NEXT: movi d1, #0000000000000000
206 ; CHECK-NEXT: // kill: def $s0 killed $s0 def $q0
207 ; CHECK-NEXT: mov.s v1[1], v0[0]
208 ; CHECK-NEXT: fmov d0, d1
210 %v.0 = insertelement <2 x float> <float 0.000000e+00, float undef>, float %a, i32 1
214 define <4 x float> @test_insert_3_f32_undef_zero_vector(float %a) {
215 ; CHECK-LABEL: test_insert_3_f32_undef_zero_vector:
217 ; CHECK-NEXT: // kill: def $s0 killed $s0 def $q0
218 ; CHECK-NEXT: dup.4s v0, v0[0]
219 ; CHECK-NEXT: mov.s v0[3], wzr
221 %v.0 = insertelement <4 x float> <float undef, float undef, float undef, float 0.000000e+00>, float %a, i32 0
222 %v.1 = insertelement <4 x float> %v.0, float %a, i32 1
223 %v.2 = insertelement <4 x float> %v.1, float %a, i32 2
227 define <4 x float> @test_insert_3_f32_undef(float %a) {
228 ; CHECK-LABEL: test_insert_3_f32_undef:
230 ; CHECK-NEXT: // kill: def $s0 killed $s0 def $q0
231 ; CHECK-NEXT: dup.4s v0, v0[0]
233 %v.0 = insertelement <4 x float> <float undef, float undef, float undef, float undef>, float %a, i32 0
234 %v.1 = insertelement <4 x float> %v.0, float %a, i32 1
235 %v.2 = insertelement <4 x float> %v.1, float %a, i32 2
239 define <4 x float> @test_insert_2_f32_undef_zero(float %a) {
240 ; CHECK-LABEL: test_insert_2_f32_undef_zero:
242 ; CHECK-NEXT: movi.2d v1, #0000000000000000
243 ; CHECK-NEXT: // kill: def $s0 killed $s0 def $q0
244 ; CHECK-NEXT: mov.s v1[0], v0[0]
245 ; CHECK-NEXT: mov.s v1[2], v0[0]
246 ; CHECK-NEXT: mov.16b v0, v1
248 %v.0 = insertelement <4 x float> <float undef, float 0.000000e+00, float undef, float 0.000000e+00>, float %a, i32 0
249 %v.1 = insertelement <4 x float> %v.0, float %a, i32 2
253 define <2 x double> @test_insert_v2f64_undef_insert1(double %a) {
254 ; CHECK-LABEL: test_insert_v2f64_undef_insert1:
256 ; CHECK-NEXT: movi.2d v1, #0000000000000000
257 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
258 ; CHECK-NEXT: mov.d v1[0], v0[0]
259 ; CHECK-NEXT: mov.16b v0, v1
261 %v.0 = insertelement <2 x double > <double undef, double 0.000000e+00>, double %a, i32 0
262 ret <2 x double> %v.0
265 define <4 x float> @test_insert_2_f32_var(float %a, <4 x float> %b) {
266 ; CHECK-LABEL: test_insert_2_f32_var:
268 ; CHECK-NEXT: // kill: def $s0 killed $s0 def $q0
269 ; CHECK-NEXT: mov.s v1[0], v0[0]
270 ; CHECK-NEXT: mov.s v1[2], v0[0]
271 ; CHECK-NEXT: mov.16b v0, v1
273 %v.0 = insertelement <4 x float> %b, float %a, i32 0
274 %v.1 = insertelement <4 x float> %v.0, float %a, i32 2
278 define <8 x i16> @test_insert_v8i16_i16_zero(<8 x i16> %a) {
279 ; CHECK-LABEL: test_insert_v8i16_i16_zero:
281 ; CHECK-NEXT: mov.h v0[5], wzr
283 %v.0 = insertelement <8 x i16> %a, i16 0, i32 5
287 ; TODO: This should jsut be a mov.s v0[3], wzr
288 define <4 x half> @test_insert_v4f16_f16_zero(<4 x half> %a) {
289 ; CHECK-LABEL: test_insert_v4f16_f16_zero:
291 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
292 ; CHECK-NEXT: mov.h v0[0], wzr
293 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
295 %v.0 = insertelement <4 x half> %a, half 0.000000e+00, i32 0
299 define <8 x half> @test_insert_v8f16_f16_zero(<8 x half> %a) {
300 ; CHECK-LABEL: test_insert_v8f16_f16_zero:
302 ; CHECK-NEXT: mov.h v0[6], wzr
304 %v.0 = insertelement <8 x half> %a, half 0.000000e+00, i32 6
308 define <2 x float> @test_insert_v2f32_f32_zero(<2 x float> %a) {
309 ; CHECK-LABEL: test_insert_v2f32_f32_zero:
311 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
312 ; CHECK-NEXT: mov.s v0[0], wzr
313 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
315 %v.0 = insertelement <2 x float> %a, float 0.000000e+00, i32 0
319 define <4 x float> @test_insert_v4f32_f32_zero(<4 x float> %a) {
320 ; CHECK-LABEL: test_insert_v4f32_f32_zero:
322 ; CHECK-NEXT: mov.s v0[3], wzr
324 %v.0 = insertelement <4 x float> %a, float 0.000000e+00, i32 3
328 define <2 x double> @test_insert_v2f64_f64_zero(<2 x double> %a) {
329 ; CHECK-LABEL: test_insert_v2f64_f64_zero:
331 ; CHECK-NEXT: mov.d v0[1], xzr
333 %v.0 = insertelement <2 x double> %a, double 0.000000e+00, i32 1
334 ret <2 x double> %v.0