1 // Auto-generated file. Do not edit!
2 // Template: src/bf16-gemm/c2-neonbf16-bfdot-lane-ld128.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2022 Google LLC
6 //
7 // This source code is licensed under the BSD-style license found in the
8 // LICENSE file in the root directory of this source tree.
9
10
11 #include <assert.h>
12
13 #include <arm_neon.h>
14
15 #include <xnnpack/gemm.h>
16
17
xnn_bf16_gemm_minmax_ukernel_4x8c2__neonbf16_bfdot_lane_ld128(size_t mr,size_t nc,size_t kc,const void * restrict a,size_t a_stride,const void * restrict w_ptr,void * restrict c,size_t cm_stride,size_t cn_stride,const union xnn_bf16_minmax_params params[restrict XNN_MIN_ELEMENTS (1)])18 void xnn_bf16_gemm_minmax_ukernel_4x8c2__neonbf16_bfdot_lane_ld128(
19 size_t mr,
20 size_t nc,
21 size_t kc,
22 const void* restrict a,
23 size_t a_stride,
24 const void* restrict w_ptr,
25 void* restrict c,
26 size_t cm_stride,
27 size_t cn_stride,
28 const union xnn_bf16_minmax_params params[restrict XNN_MIN_ELEMENTS(1)])
29 {
30 assert(mr != 0);
31 assert(mr <= 4);
32 assert(nc != 0);
33 assert(kc != 0);
34 assert(kc % sizeof(bfloat16_t) == 0);
35 assert(a != NULL);
36 assert(w_ptr != NULL);
37 assert(c != NULL);
38
39 const bfloat16_t* a0 = (const bfloat16_t*) a;
40 bfloat16_t* c0 = (bfloat16_t*) c;
41 const bfloat16_t* a1 = (const bfloat16_t*) ((uintptr_t) a0 + a_stride);
42 bfloat16_t* c1 = (bfloat16_t*) ((uintptr_t) c0 + cm_stride);
43 if XNN_UNPREDICTABLE(mr < 2) {
44 a1 = a0;
45 c1 = c0;
46 }
47 const bfloat16_t* a2 = (const bfloat16_t*) ((uintptr_t) a1 + a_stride);
48 bfloat16_t* c2 = (bfloat16_t*) ((uintptr_t) c1 + cm_stride);
49 if XNN_UNPREDICTABLE(mr <= 2) {
50 a2 = a1;
51 c2 = c1;
52 }
53 const bfloat16_t* a3 = (const bfloat16_t*) ((uintptr_t) a2 + a_stride);
54 bfloat16_t* c3 = (bfloat16_t*) ((uintptr_t) c2 + cm_stride);
55 if XNN_UNPREDICTABLE(mr != 4) {
56 a3 = a2;
57 c3 = c2;
58 }
59
60 const bfloat16_t* w = (const bfloat16_t*) w_ptr;
61 do {
62 float32x4_t vacc0x0123 = vcvt_f32_bf16(vld1_bf16(w)); w += 4;
63 float32x4_t vacc0x4567 = vcvt_f32_bf16(vld1_bf16(w)); w += 4;
64 float32x4_t vacc1x0123 = vacc0x0123;
65 float32x4_t vacc1x4567 = vacc0x4567;
66 float32x4_t vacc2x0123 = vacc0x0123;
67 float32x4_t vacc2x4567 = vacc0x4567;
68 float32x4_t vacc3x0123 = vacc0x0123;
69 float32x4_t vacc3x4567 = vacc0x4567;
70
71 size_t k = kc;
72 for (; k >= 8 * sizeof(bfloat16_t); k -= 8 * sizeof(bfloat16_t)) {
73 const bfloat16x8_t va0 = vld1q_bf16(a0); a0 += 8;
74 const bfloat16x8_t va1 = vld1q_bf16(a1); a1 += 8;
75 const bfloat16x8_t va2 = vld1q_bf16(a2); a2 += 8;
76 const bfloat16x8_t va3 = vld1q_bf16(a3); a3 += 8;
77
78 const bfloat16x8_t vb0123c01 = vld1q_bf16(w); w += 8;
79 const bfloat16x8_t vb4567c01 = vld1q_bf16(w); w += 8;
80
81 vacc0x0123 = vbfdotq_laneq_f32(vacc0x0123, vb0123c01, va0, 0);
82 vacc1x0123 = vbfdotq_laneq_f32(vacc1x0123, vb0123c01, va1, 0);
83 vacc2x0123 = vbfdotq_laneq_f32(vacc2x0123, vb0123c01, va2, 0);
84 vacc3x0123 = vbfdotq_laneq_f32(vacc3x0123, vb0123c01, va3, 0);
85 vacc0x4567 = vbfdotq_laneq_f32(vacc0x4567, vb4567c01, va0, 0);
86 vacc1x4567 = vbfdotq_laneq_f32(vacc1x4567, vb4567c01, va1, 0);
87 vacc2x4567 = vbfdotq_laneq_f32(vacc2x4567, vb4567c01, va2, 0);
88 vacc3x4567 = vbfdotq_laneq_f32(vacc3x4567, vb4567c01, va3, 0);
89 const bfloat16x8_t vb0123c23 = vld1q_bf16(w); w += 8;
90 const bfloat16x8_t vb4567c23 = vld1q_bf16(w); w += 8;
91
92 vacc0x0123 = vbfdotq_laneq_f32(vacc0x0123, vb0123c23, va0, 1);
93 vacc1x0123 = vbfdotq_laneq_f32(vacc1x0123, vb0123c23, va1, 1);
94 vacc2x0123 = vbfdotq_laneq_f32(vacc2x0123, vb0123c23, va2, 1);
95 vacc3x0123 = vbfdotq_laneq_f32(vacc3x0123, vb0123c23, va3, 1);
96 vacc0x4567 = vbfdotq_laneq_f32(vacc0x4567, vb4567c23, va0, 1);
97 vacc1x4567 = vbfdotq_laneq_f32(vacc1x4567, vb4567c23, va1, 1);
98 vacc2x4567 = vbfdotq_laneq_f32(vacc2x4567, vb4567c23, va2, 1);
99 vacc3x4567 = vbfdotq_laneq_f32(vacc3x4567, vb4567c23, va3, 1);
100 const bfloat16x8_t vb0123c45 = vld1q_bf16(w); w += 8;
101 const bfloat16x8_t vb4567c45 = vld1q_bf16(w); w += 8;
102
103 vacc0x0123 = vbfdotq_laneq_f32(vacc0x0123, vb0123c45, va0, 2);
104 vacc1x0123 = vbfdotq_laneq_f32(vacc1x0123, vb0123c45, va1, 2);
105 vacc2x0123 = vbfdotq_laneq_f32(vacc2x0123, vb0123c45, va2, 2);
106 vacc3x0123 = vbfdotq_laneq_f32(vacc3x0123, vb0123c45, va3, 2);
107 vacc0x4567 = vbfdotq_laneq_f32(vacc0x4567, vb4567c45, va0, 2);
108 vacc1x4567 = vbfdotq_laneq_f32(vacc1x4567, vb4567c45, va1, 2);
109 vacc2x4567 = vbfdotq_laneq_f32(vacc2x4567, vb4567c45, va2, 2);
110 vacc3x4567 = vbfdotq_laneq_f32(vacc3x4567, vb4567c45, va3, 2);
111 const bfloat16x8_t vb0123c67 = vld1q_bf16(w); w += 8;
112 const bfloat16x8_t vb4567c67 = vld1q_bf16(w); w += 8;
113
114 vacc0x0123 = vbfdotq_laneq_f32(vacc0x0123, vb0123c67, va0, 3);
115 vacc1x0123 = vbfdotq_laneq_f32(vacc1x0123, vb0123c67, va1, 3);
116 vacc2x0123 = vbfdotq_laneq_f32(vacc2x0123, vb0123c67, va2, 3);
117 vacc3x0123 = vbfdotq_laneq_f32(vacc3x0123, vb0123c67, va3, 3);
118 vacc0x4567 = vbfdotq_laneq_f32(vacc0x4567, vb4567c67, va0, 3);
119 vacc1x4567 = vbfdotq_laneq_f32(vacc1x4567, vb4567c67, va1, 3);
120 vacc2x4567 = vbfdotq_laneq_f32(vacc2x4567, vb4567c67, va2, 3);
121 vacc3x4567 = vbfdotq_laneq_f32(vacc3x4567, vb4567c67, va3, 3);
122 }
123 if XNN_UNLIKELY(k != 0) {
124 const bfloat16x8_t va0 = vld1q_bf16(a0); a0 = (const bfloat16_t*) ((uintptr_t) a0 + k);
125 const bfloat16x8_t va1 = vld1q_bf16(a1); a1 = (const bfloat16_t*) ((uintptr_t) a1 + k);
126 const bfloat16x8_t va2 = vld1q_bf16(a2); a2 = (const bfloat16_t*) ((uintptr_t) a2 + k);
127 const bfloat16x8_t va3 = vld1q_bf16(a3); a3 = (const bfloat16_t*) ((uintptr_t) a3 + k);
128
129 const bfloat16x8_t vb0123c01 = vld1q_bf16(w); w += 8;
130 const bfloat16x8_t vb4567c01 = vld1q_bf16(w); w += 8;
131
132 const uint32x4_t va0c01 = vdupq_lane_u32(vreinterpret_u32_bf16(vget_low_bf16(va0)), 0);
133 const uint32x4_t va1c01 = vdupq_lane_u32(vreinterpret_u32_bf16(vget_low_bf16(va1)), 0);
134 const uint32x4_t va2c01 = vdupq_lane_u32(vreinterpret_u32_bf16(vget_low_bf16(va2)), 0);
135 const uint32x4_t va3c01 = vdupq_lane_u32(vreinterpret_u32_bf16(vget_low_bf16(va3)), 0);
136
137 const uint32x4_t vm0123c01 = vreinterpretq_u32_u16(vceqq_u16(vreinterpretq_u16_bf16(vb0123c01), vmovq_n_u16(0)));
138 const uint32x4_t vm4567c01 = vreinterpretq_u32_u16(vceqq_u16(vreinterpretq_u16_bf16(vb4567c01), vmovq_n_u16(0)));
139
140 const uint32x4_t va0x0123c01 = vbicq_u32(va0c01, vm0123c01);
141 vacc0x0123 = vbfdotq_f32(vacc0x0123, vb0123c01, vreinterpretq_bf16_u32(va0x0123c01));
142 const uint32x4_t va1x0123c01 = vbicq_u32(va1c01, vm0123c01);
143 vacc1x0123 = vbfdotq_f32(vacc1x0123, vb0123c01, vreinterpretq_bf16_u32(va1x0123c01));
144 const uint32x4_t va2x0123c01 = vbicq_u32(va2c01, vm0123c01);
145 vacc2x0123 = vbfdotq_f32(vacc2x0123, vb0123c01, vreinterpretq_bf16_u32(va2x0123c01));
146 const uint32x4_t va3x0123c01 = vbicq_u32(va3c01, vm0123c01);
147 vacc3x0123 = vbfdotq_f32(vacc3x0123, vb0123c01, vreinterpretq_bf16_u32(va3x0123c01));
148 const uint32x4_t va0x4567c01 = vbicq_u32(va0c01, vm4567c01);
149 vacc0x4567 = vbfdotq_f32(vacc0x4567, vb4567c01, vreinterpretq_bf16_u32(va0x4567c01));
150 const uint32x4_t va1x4567c01 = vbicq_u32(va1c01, vm4567c01);
151 vacc1x4567 = vbfdotq_f32(vacc1x4567, vb4567c01, vreinterpretq_bf16_u32(va1x4567c01));
152 const uint32x4_t va2x4567c01 = vbicq_u32(va2c01, vm4567c01);
153 vacc2x4567 = vbfdotq_f32(vacc2x4567, vb4567c01, vreinterpretq_bf16_u32(va2x4567c01));
154 const uint32x4_t va3x4567c01 = vbicq_u32(va3c01, vm4567c01);
155 vacc3x4567 = vbfdotq_f32(vacc3x4567, vb4567c01, vreinterpretq_bf16_u32(va3x4567c01));
156
157 if (k > 2 * sizeof(bfloat16_t)) {
158 const bfloat16x8_t vb0123c23 = vld1q_bf16(w); w += 8;
159 const bfloat16x8_t vb4567c23 = vld1q_bf16(w); w += 8;
160
161 const uint32x4_t va0c23 = vdupq_lane_u32(vreinterpret_u32_bf16(vget_low_bf16(va0)), 1);
162 const uint32x4_t va1c23 = vdupq_lane_u32(vreinterpret_u32_bf16(vget_low_bf16(va1)), 1);
163 const uint32x4_t va2c23 = vdupq_lane_u32(vreinterpret_u32_bf16(vget_low_bf16(va2)), 1);
164 const uint32x4_t va3c23 = vdupq_lane_u32(vreinterpret_u32_bf16(vget_low_bf16(va3)), 1);
165
166 const uint32x4_t vm0123c23 = vreinterpretq_u32_u16(vceqq_u16(vreinterpretq_u16_bf16(vb0123c23), vmovq_n_u16(0)));
167 const uint32x4_t vm4567c23 = vreinterpretq_u32_u16(vceqq_u16(vreinterpretq_u16_bf16(vb4567c23), vmovq_n_u16(0)));
168
169 const uint32x4_t va0x0123c23 = vbicq_u32(va0c23, vm0123c23);
170 vacc0x0123 = vbfdotq_f32(vacc0x0123, vb0123c23, vreinterpretq_bf16_u32(va0x0123c23));
171 const uint32x4_t va1x0123c23 = vbicq_u32(va1c23, vm0123c23);
172 vacc1x0123 = vbfdotq_f32(vacc1x0123, vb0123c23, vreinterpretq_bf16_u32(va1x0123c23));
173 const uint32x4_t va2x0123c23 = vbicq_u32(va2c23, vm0123c23);
174 vacc2x0123 = vbfdotq_f32(vacc2x0123, vb0123c23, vreinterpretq_bf16_u32(va2x0123c23));
175 const uint32x4_t va3x0123c23 = vbicq_u32(va3c23, vm0123c23);
176 vacc3x0123 = vbfdotq_f32(vacc3x0123, vb0123c23, vreinterpretq_bf16_u32(va3x0123c23));
177 const uint32x4_t va0x4567c23 = vbicq_u32(va0c23, vm4567c23);
178 vacc0x4567 = vbfdotq_f32(vacc0x4567, vb4567c23, vreinterpretq_bf16_u32(va0x4567c23));
179 const uint32x4_t va1x4567c23 = vbicq_u32(va1c23, vm4567c23);
180 vacc1x4567 = vbfdotq_f32(vacc1x4567, vb4567c23, vreinterpretq_bf16_u32(va1x4567c23));
181 const uint32x4_t va2x4567c23 = vbicq_u32(va2c23, vm4567c23);
182 vacc2x4567 = vbfdotq_f32(vacc2x4567, vb4567c23, vreinterpretq_bf16_u32(va2x4567c23));
183 const uint32x4_t va3x4567c23 = vbicq_u32(va3c23, vm4567c23);
184 vacc3x4567 = vbfdotq_f32(vacc3x4567, vb4567c23, vreinterpretq_bf16_u32(va3x4567c23));
185
186 if (k > 4 * sizeof(bfloat16_t)) {
187 const bfloat16x8_t vb0123c45 = vld1q_bf16(w); w += 8;
188 const bfloat16x8_t vb4567c45 = vld1q_bf16(w); w += 8;
189
190 const uint32x4_t va0c45 = vdupq_lane_u32(vreinterpret_u32_bf16(vget_high_bf16(va0)), 0);
191 const uint32x4_t va1c45 = vdupq_lane_u32(vreinterpret_u32_bf16(vget_high_bf16(va1)), 0);
192 const uint32x4_t va2c45 = vdupq_lane_u32(vreinterpret_u32_bf16(vget_high_bf16(va2)), 0);
193 const uint32x4_t va3c45 = vdupq_lane_u32(vreinterpret_u32_bf16(vget_high_bf16(va3)), 0);
194
195 const uint32x4_t vm0123c45 = vreinterpretq_u32_u16(vceqq_u16(vreinterpretq_u16_bf16(vb0123c45), vmovq_n_u16(0)));
196 const uint32x4_t vm4567c45 = vreinterpretq_u32_u16(vceqq_u16(vreinterpretq_u16_bf16(vb4567c45), vmovq_n_u16(0)));
197
198 const uint32x4_t va0x0123c45 = vbicq_u32(va0c45, vm0123c45);
199 vacc0x0123 = vbfdotq_f32(vacc0x0123, vb0123c45, vreinterpretq_bf16_u32(va0x0123c45));
200 const uint32x4_t va1x0123c45 = vbicq_u32(va1c45, vm0123c45);
201 vacc1x0123 = vbfdotq_f32(vacc1x0123, vb0123c45, vreinterpretq_bf16_u32(va1x0123c45));
202 const uint32x4_t va2x0123c45 = vbicq_u32(va2c45, vm0123c45);
203 vacc2x0123 = vbfdotq_f32(vacc2x0123, vb0123c45, vreinterpretq_bf16_u32(va2x0123c45));
204 const uint32x4_t va3x0123c45 = vbicq_u32(va3c45, vm0123c45);
205 vacc3x0123 = vbfdotq_f32(vacc3x0123, vb0123c45, vreinterpretq_bf16_u32(va3x0123c45));
206 const uint32x4_t va0x4567c45 = vbicq_u32(va0c45, vm4567c45);
207 vacc0x4567 = vbfdotq_f32(vacc0x4567, vb4567c45, vreinterpretq_bf16_u32(va0x4567c45));
208 const uint32x4_t va1x4567c45 = vbicq_u32(va1c45, vm4567c45);
209 vacc1x4567 = vbfdotq_f32(vacc1x4567, vb4567c45, vreinterpretq_bf16_u32(va1x4567c45));
210 const uint32x4_t va2x4567c45 = vbicq_u32(va2c45, vm4567c45);
211 vacc2x4567 = vbfdotq_f32(vacc2x4567, vb4567c45, vreinterpretq_bf16_u32(va2x4567c45));
212 const uint32x4_t va3x4567c45 = vbicq_u32(va3c45, vm4567c45);
213 vacc3x4567 = vbfdotq_f32(vacc3x4567, vb4567c45, vreinterpretq_bf16_u32(va3x4567c45));
214
215 if (k > 6 * sizeof(bfloat16_t)) {
216 const bfloat16x8_t vb0123c67 = vld1q_bf16(w); w += 8;
217 const bfloat16x8_t vb4567c67 = vld1q_bf16(w); w += 8;
218
219 const uint32x4_t va0c67 = vdupq_lane_u32(vreinterpret_u32_bf16(vget_high_bf16(va0)), 1);
220 const uint32x4_t va1c67 = vdupq_lane_u32(vreinterpret_u32_bf16(vget_high_bf16(va1)), 1);
221 const uint32x4_t va2c67 = vdupq_lane_u32(vreinterpret_u32_bf16(vget_high_bf16(va2)), 1);
222 const uint32x4_t va3c67 = vdupq_lane_u32(vreinterpret_u32_bf16(vget_high_bf16(va3)), 1);
223
224 const uint32x4_t vm0123c67 = vreinterpretq_u32_u16(vceqq_u16(vreinterpretq_u16_bf16(vb0123c67), vmovq_n_u16(0)));
225 const uint32x4_t vm4567c67 = vreinterpretq_u32_u16(vceqq_u16(vreinterpretq_u16_bf16(vb4567c67), vmovq_n_u16(0)));
226
227 const uint32x4_t va0x0123c67 = vbicq_u32(va0c67, vm0123c67);
228 vacc0x0123 = vbfdotq_f32(vacc0x0123, vb0123c67, vreinterpretq_bf16_u32(va0x0123c67));
229 const uint32x4_t va1x0123c67 = vbicq_u32(va1c67, vm0123c67);
230 vacc1x0123 = vbfdotq_f32(vacc1x0123, vb0123c67, vreinterpretq_bf16_u32(va1x0123c67));
231 const uint32x4_t va2x0123c67 = vbicq_u32(va2c67, vm0123c67);
232 vacc2x0123 = vbfdotq_f32(vacc2x0123, vb0123c67, vreinterpretq_bf16_u32(va2x0123c67));
233 const uint32x4_t va3x0123c67 = vbicq_u32(va3c67, vm0123c67);
234 vacc3x0123 = vbfdotq_f32(vacc3x0123, vb0123c67, vreinterpretq_bf16_u32(va3x0123c67));
235 const uint32x4_t va0x4567c67 = vbicq_u32(va0c67, vm4567c67);
236 vacc0x4567 = vbfdotq_f32(vacc0x4567, vb4567c67, vreinterpretq_bf16_u32(va0x4567c67));
237 const uint32x4_t va1x4567c67 = vbicq_u32(va1c67, vm4567c67);
238 vacc1x4567 = vbfdotq_f32(vacc1x4567, vb4567c67, vreinterpretq_bf16_u32(va1x4567c67));
239 const uint32x4_t va2x4567c67 = vbicq_u32(va2c67, vm4567c67);
240 vacc2x4567 = vbfdotq_f32(vacc2x4567, vb4567c67, vreinterpretq_bf16_u32(va2x4567c67));
241 const uint32x4_t va3x4567c67 = vbicq_u32(va3c67, vm4567c67);
242 vacc3x4567 = vbfdotq_f32(vacc3x4567, vb4567c67, vreinterpretq_bf16_u32(va3x4567c67));
243 }
244 }
245 }
246 }
247
248 const float32x4_t vmax = vld1q_dup_f32(¶ms->scalar.max);
249 vacc0x0123 = vminq_f32(vacc0x0123, vmax);
250 vacc1x0123 = vminq_f32(vacc1x0123, vmax);
251 vacc2x0123 = vminq_f32(vacc2x0123, vmax);
252 vacc3x0123 = vminq_f32(vacc3x0123, vmax);
253 vacc0x4567 = vminq_f32(vacc0x4567, vmax);
254 vacc1x4567 = vminq_f32(vacc1x4567, vmax);
255 vacc2x4567 = vminq_f32(vacc2x4567, vmax);
256 vacc3x4567 = vminq_f32(vacc3x4567, vmax);
257
258 const float32x4_t vmin = vld1q_dup_f32(¶ms->scalar.min);
259 vacc0x0123 = vmaxq_f32(vacc0x0123, vmin);
260 vacc1x0123 = vmaxq_f32(vacc1x0123, vmin);
261 vacc2x0123 = vmaxq_f32(vacc2x0123, vmin);
262 vacc3x0123 = vmaxq_f32(vacc3x0123, vmin);
263 vacc0x4567 = vmaxq_f32(vacc0x4567, vmin);
264 vacc1x4567 = vmaxq_f32(vacc1x4567, vmin);
265 vacc2x4567 = vmaxq_f32(vacc2x4567, vmin);
266 vacc3x4567 = vmaxq_f32(vacc3x4567, vmin);
267
268 bfloat16x4_t vout0x0123 = vcvt_bf16_f32(vacc0x0123);
269 bfloat16x4_t vout1x0123 = vcvt_bf16_f32(vacc1x0123);
270 bfloat16x4_t vout2x0123 = vcvt_bf16_f32(vacc2x0123);
271 bfloat16x4_t vout3x0123 = vcvt_bf16_f32(vacc3x0123);
272 bfloat16x4_t vout0x4567 = vcvt_bf16_f32(vacc0x4567);
273 bfloat16x4_t vout1x4567 = vcvt_bf16_f32(vacc1x4567);
274 bfloat16x4_t vout2x4567 = vcvt_bf16_f32(vacc2x4567);
275 bfloat16x4_t vout3x4567 = vcvt_bf16_f32(vacc3x4567);
276
277 if XNN_LIKELY(nc >= 8) {
278 vst1_bf16(c0, vout0x0123);
279 vst1_bf16(c0 + 4, vout0x4567);
280 c0 = (bfloat16_t*) ((uintptr_t) c0 + cn_stride);
281 vst1_bf16(c1, vout1x0123);
282 vst1_bf16(c1 + 4, vout1x4567);
283 c1 = (bfloat16_t*) ((uintptr_t) c1 + cn_stride);
284 vst1_bf16(c2, vout2x0123);
285 vst1_bf16(c2 + 4, vout2x4567);
286 c2 = (bfloat16_t*) ((uintptr_t) c2 + cn_stride);
287 vst1_bf16(c3, vout3x0123);
288 vst1_bf16(c3 + 4, vout3x4567);
289 c3 = (bfloat16_t*) ((uintptr_t) c3 + cn_stride);
290
291 a0 = (const bfloat16_t*) ((uintptr_t) a0 - kc);
292 a1 = (const bfloat16_t*) ((uintptr_t) a1 - kc);
293 a2 = (const bfloat16_t*) ((uintptr_t) a2 - kc);
294 a3 = (const bfloat16_t*) ((uintptr_t) a3 - kc);
295
296 nc -= 8;
297 } else {
298 if (nc & 4) {
299 vst1_bf16(c0, vout0x0123); c0 += 4;
300 vst1_bf16(c1, vout1x0123); c1 += 4;
301 vst1_bf16(c2, vout2x0123); c2 += 4;
302 vst1_bf16(c3, vout3x0123); c3 += 4;
303
304 vout0x0123 = vout0x4567;
305 vout1x0123 = vout1x4567;
306 vout2x0123 = vout2x4567;
307 vout3x0123 = vout3x4567;
308 }
309 if (nc & 2) {
310 vst1_lane_u32((void*) c0, vreinterpret_u32_bf16(vout0x0123), 0); c0 += 2;
311 vst1_lane_u32((void*) c1, vreinterpret_u32_bf16(vout1x0123), 0); c1 += 2;
312 vst1_lane_u32((void*) c2, vreinterpret_u32_bf16(vout2x0123), 0); c2 += 2;
313 vst1_lane_u32((void*) c3, vreinterpret_u32_bf16(vout3x0123), 0); c3 += 2;
314
315 vout0x0123 = vreinterpret_bf16_u16(vext_u16(vreinterpret_u16_bf16(vout0x0123), vreinterpret_u16_bf16(vout0x0123), 2));
316 vout1x0123 = vreinterpret_bf16_u16(vext_u16(vreinterpret_u16_bf16(vout1x0123), vreinterpret_u16_bf16(vout1x0123), 2));
317 vout2x0123 = vreinterpret_bf16_u16(vext_u16(vreinterpret_u16_bf16(vout2x0123), vreinterpret_u16_bf16(vout2x0123), 2));
318 vout3x0123 = vreinterpret_bf16_u16(vext_u16(vreinterpret_u16_bf16(vout3x0123), vreinterpret_u16_bf16(vout3x0123), 2));
319 }
320 if (nc & 1) {
321 vst1_lane_bf16(c0, vout0x0123, 0);
322 vst1_lane_bf16(c1, vout1x0123, 0);
323 vst1_lane_bf16(c2, vout2x0123, 0);
324 vst1_lane_bf16(c3, vout3x0123, 0);
325 }
326
327 nc = 0;
328 }
329 } while (nc != 0);
330 }
331