Debian Codegraph @

src/qd8-f16-qc8w-igemm/gen/qd8-f16-qc8w-igemm-8x8c4-minmax-neondotfp16arith.c

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/qs8-igemm/c4-neondot.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2020 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 #include <assert.h>
11
12 #include <arm_neon.h>
13
14 #include "xnnpack/igemm.h"
15 #include "xnnpack/math.h"
16
17
18 void xnn_qd8_f16_qc8w_igemm_minmax_ukernel_8x8c4__neondotfp16arith(
19 size_t mr,
20 size_t nc,
21 size_t kc,
22 size_t ks,
23 const int8_t** restrict a,
24 const void* restrict w,
25 xnn_float16* restrict c,
26 size_t cm_stride,
27 size_t cn_stride,
28 size_t a_offset,
29 const int8_t* zero,
30 const int8_t* zero_data,
31 const union xnn_f16_minmax_params params[restrict XNN_MIN_ELEMENTS(1)],
32 const struct xnn_qd8_quantization_params quantization_params[restrict XNN_MIN_ELEMENTS(1)]) XNN_OOB_READS
33 {
34 assert(mr != 0);
35 assert(mr <= 8);
36 assert(nc != 0);
37 assert(kc != 0);
38 assert(ks != 0);
39 assert(ks % (8 * sizeof(void*)) == 0);
40 assert(a_offset % sizeof(int8_t) == 0);
41 assert(a != NULL);
42 assert(w != NULL);
43 assert(c != NULL);
44
45 kc = round_up_po2(kc, 4 * sizeof(int8_t));
46 uint16_t* c0 = (uint16_t*) c;
47 uint16_t* c1 = (uint16_t*) ((uintptr_t) c0 + cm_stride);
48 if XNN_UNPREDICTABLE(mr < 2) {
49 c1 = c0;
50 }
51 uint16_t* c2 = (uint16_t*) ((uintptr_t) c1 + cm_stride);
52 if XNN_UNPREDICTABLE(mr <= 2) {
53 c2 = c1;
54 }
55 uint16_t* c3 = (uint16_t*) ((uintptr_t) c2 + cm_stride);
56 if XNN_UNPREDICTABLE(mr < 4) {
57 c3 = c2;
58 }
59 uint16_t* c4 = (uint16_t*) ((uintptr_t) c3 + cm_stride);
60 if XNN_UNPREDICTABLE(mr <= 4) {
61 c4 = c3;
62 }
63 uint16_t* c5 = (uint16_t*) ((uintptr_t) c4 + cm_stride);
64 if XNN_UNPREDICTABLE(mr < 6) {
65 c5 = c4;
66 }
67 uint16_t* c6 = (uint16_t*) ((uintptr_t) c5 + cm_stride);
68 if XNN_UNPREDICTABLE(mr <= 6) {
69 c6 = c5;
70 }
71 uint16_t* c7 = (uint16_t*) ((uintptr_t) c6 + cm_stride);
72 if XNN_UNPREDICTABLE(mr != 8) {
73 c7 = c6;
74 }
75
76 do {
77 const int32x4_t vinput_zero_point = vld1q_dup_s32(&quantization_params->zero_point);
78 const int32x4_t vksum0123 = vld1q_s32(w); w = (const int32_t*) w + 4;
79 int32x4_t vacc0x0123 = vmulq_s32(vksum0123, vinput_zero_point);
80 const int32x4_t vksum4567 = vld1q_s32(w); w = (const int32_t*) w + 4;
81 int32x4_t vacc0x4567 = vmulq_s32(vksum4567, vinput_zero_point);
82 int32x4_t vacc1x0123 = vacc0x0123;
83 int32x4_t vacc1x4567 = vacc0x4567;
84 int32x4_t vacc2x0123 = vacc0x0123;
85 int32x4_t vacc2x4567 = vacc0x4567;
86 int32x4_t vacc3x0123 = vacc0x0123;
87 int32x4_t vacc3x4567 = vacc0x4567;
88 int32x4_t vacc4x0123 = vacc0x0123;
89 int32x4_t vacc4x4567 = vacc0x4567;
90 int32x4_t vacc5x0123 = vacc0x0123;
91 int32x4_t vacc5x4567 = vacc0x4567;
92 int32x4_t vacc6x0123 = vacc0x0123;
93 int32x4_t vacc6x4567 = vacc0x4567;
94 int32x4_t vacc7x0123 = vacc0x0123;
95 int32x4_t vacc7x4567 = vacc0x4567;
96
97 size_t p = ks;
98 do {
99 const int8_t* restrict a0 = a[0];
100 if XNN_UNPREDICTABLE(a0 != zero) {
101 a0 = (const int8_t*) ((uintptr_t) a0 + a_offset);
102 } else {
103 a0 = zero_data;
104 }
105 const int8_t* restrict a1 = a[1];
106 if XNN_UNPREDICTABLE(a1 != zero) {
107 a1 = (const int8_t*) ((uintptr_t) a1 + a_offset);
108 } else {
109 a1 = zero_data;
110 }
111 const int8_t* restrict a2 = a[2];
112 if XNN_UNPREDICTABLE(a2 != zero) {
113 a2 = (const int8_t*) ((uintptr_t) a2 + a_offset);
114 } else {
115 a2 = zero_data;
116 }
117 const int8_t* restrict a3 = a[3];
118 if XNN_UNPREDICTABLE(a3 != zero) {
119 a3 = (const int8_t*) ((uintptr_t) a3 + a_offset);
120 } else {
121 a3 = zero_data;
122 }
123 const int8_t* restrict a4 = a[4];
124 if XNN_UNPREDICTABLE(a4 != zero) {
125 a4 = (const int8_t*) ((uintptr_t) a4 + a_offset);
126 } else {
127 a4 = zero_data;
128 }
129 const int8_t* restrict a5 = a[5];
130 if XNN_UNPREDICTABLE(a5 != zero) {
131 a5 = (const int8_t*) ((uintptr_t) a5 + a_offset);
132 } else {
133 a5 = zero_data;
134 }
135 const int8_t* restrict a6 = a[6];
136 if XNN_UNPREDICTABLE(a6 != zero) {
137 a6 = (const int8_t*) ((uintptr_t) a6 + a_offset);
138 } else {
139 a6 = zero_data;
140 }
141 const int8_t* restrict a7 = a[7];
142 if XNN_UNPREDICTABLE(a7 != zero) {
143 a7 = (const int8_t*) ((uintptr_t) a7 + a_offset);
144 } else {
145 a7 = zero_data;
146 }
147 a += 8;
148
149 // Inner accumulation loop along the 8 columns.
150 size_t k = kc;
151 // 2x partial unrolled loop to load 8 bytes at a time.
152 while (k >= 8 * sizeof(int8_t)) {
153 // Load a 8x8 block of activations.
154 const int8x8_t va0x01234567 = vld1_s8(a0); a0 += 8;
155 const int8x8_t va1x01234567 = vld1_s8(a1); a1 += 8;
156 const int8x8_t va2x01234567 = vld1_s8(a2); a2 += 8;
157 const int8x8_t va3x01234567 = vld1_s8(a3); a3 += 8;
158 const int8x8_t va4x01234567 = vld1_s8(a4); a4 += 8;
159 const int8x8_t va5x01234567 = vld1_s8(a5); a5 += 8;
160 const int8x8_t va6x01234567 = vld1_s8(a6); a6 += 8;
161 const int8x8_t va7x01234567 = vld1_s8(a7); a7 += 8;
162
163 // Load a 8x8 block of weights.
164 const int8x16_t vb0123x0123 = vld1q_s8(w); w = (const int8_t*) w + 16;
165 const int8x16_t vb0123x4567 = vld1q_s8(w); w = (const int8_t*) w + 16;
166 const int8x16_t vb4567x0123 = vld1q_s8(w); w = (const int8_t*) w + 16;
167 const int8x16_t vb4567x4567 = vld1q_s8(w); w = (const int8_t*) w + 16;
168
169 // Multiply-accumulate: 8x8 * 8x8 --> 8x8.
170 vacc0x0123 = vdotq_lane_s32(vacc0x0123, vb0123x0123, va0x01234567, 0);
171 vacc0x4567 = vdotq_lane_s32(vacc0x4567, vb0123x4567, va0x01234567, 0);
172 vacc1x0123 = vdotq_lane_s32(vacc1x0123, vb0123x0123, va1x01234567, 0);
173 vacc1x4567 = vdotq_lane_s32(vacc1x4567, vb0123x4567, va1x01234567, 0);
174 vacc2x0123 = vdotq_lane_s32(vacc2x0123, vb0123x0123, va2x01234567, 0);
175 vacc2x4567 = vdotq_lane_s32(vacc2x4567, vb0123x4567, va2x01234567, 0);
176 vacc3x0123 = vdotq_lane_s32(vacc3x0123, vb0123x0123, va3x01234567, 0);
177 vacc3x4567 = vdotq_lane_s32(vacc3x4567, vb0123x4567, va3x01234567, 0);
178 vacc4x0123 = vdotq_lane_s32(vacc4x0123, vb0123x0123, va4x01234567, 0);
179 vacc4x4567 = vdotq_lane_s32(vacc4x4567, vb0123x4567, va4x01234567, 0);
180 vacc5x0123 = vdotq_lane_s32(vacc5x0123, vb0123x0123, va5x01234567, 0);
181 vacc5x4567 = vdotq_lane_s32(vacc5x4567, vb0123x4567, va5x01234567, 0);
182 vacc6x0123 = vdotq_lane_s32(vacc6x0123, vb0123x0123, va6x01234567, 0);
183 vacc6x4567 = vdotq_lane_s32(vacc6x4567, vb0123x4567, va6x01234567, 0);
184 vacc7x0123 = vdotq_lane_s32(vacc7x0123, vb0123x0123, va7x01234567, 0);
185 vacc7x4567 = vdotq_lane_s32(vacc7x4567, vb0123x4567, va7x01234567, 0);
186 vacc0x0123 = vdotq_lane_s32(vacc0x0123, vb4567x0123, va0x01234567, 1);
187 vacc0x4567 = vdotq_lane_s32(vacc0x4567, vb4567x4567, va0x01234567, 1);
188 vacc1x0123 = vdotq_lane_s32(vacc1x0123, vb4567x0123, va1x01234567, 1);
189 vacc1x4567 = vdotq_lane_s32(vacc1x4567, vb4567x4567, va1x01234567, 1);
190 vacc2x0123 = vdotq_lane_s32(vacc2x0123, vb4567x0123, va2x01234567, 1);
191 vacc2x4567 = vdotq_lane_s32(vacc2x4567, vb4567x4567, va2x01234567, 1);
192 vacc3x0123 = vdotq_lane_s32(vacc3x0123, vb4567x0123, va3x01234567, 1);
193 vacc3x4567 = vdotq_lane_s32(vacc3x4567, vb4567x4567, va3x01234567, 1);
194 vacc4x0123 = vdotq_lane_s32(vacc4x0123, vb4567x0123, va4x01234567, 1);
195 vacc4x4567 = vdotq_lane_s32(vacc4x4567, vb4567x4567, va4x01234567, 1);
196 vacc5x0123 = vdotq_lane_s32(vacc5x0123, vb4567x0123, va5x01234567, 1);
197 vacc5x4567 = vdotq_lane_s32(vacc5x4567, vb4567x4567, va5x01234567, 1);
198 vacc6x0123 = vdotq_lane_s32(vacc6x0123, vb4567x0123, va6x01234567, 1);
199 vacc6x4567 = vdotq_lane_s32(vacc6x4567, vb4567x4567, va6x01234567, 1);
200 vacc7x0123 = vdotq_lane_s32(vacc7x0123, vb4567x0123, va7x01234567, 1);
201 vacc7x4567 = vdotq_lane_s32(vacc7x4567, vb4567x4567, va7x01234567, 1);
202
203 k -= 8 * sizeof(int8_t);
204 }
205 // Handle up to 4 final positions of `k`
206 if XNN_UNLIKELY(k != 0) {
207 // Load a 8x4 block of activations.
208 const int8x8_t va0x01234567 = vld1_s8(a0);
209 const int8x8_t va1x01234567 = vld1_s8(a1);
210 const int8x8_t va2x01234567 = vld1_s8(a2);
211 const int8x8_t va3x01234567 = vld1_s8(a3);
212 const int8x8_t va4x01234567 = vld1_s8(a4);
213 const int8x8_t va5x01234567 = vld1_s8(a5);
214 const int8x8_t va6x01234567 = vld1_s8(a6);
215 const int8x8_t va7x01234567 = vld1_s8(a7);
216
217 // Load a 4x8 block of weights.
218 const int8x16_t vb0123x0123 = vld1q_s8(w); w = (const int8_t*) w + 16;
219 const int8x16_t vb0123x4567 = vld1q_s8(w); w = (const int8_t*) w + 16;
220
221 // Multiply-accumulate: 8x4 * 4x8 --> 8x8.
222 vacc0x0123 = vdotq_lane_s32(vacc0x0123, vb0123x0123, va0x01234567, 0);
223 vacc0x4567 = vdotq_lane_s32(vacc0x4567, vb0123x4567, va0x01234567, 0);
224 vacc1x0123 = vdotq_lane_s32(vacc1x0123, vb0123x0123, va1x01234567, 0);
225 vacc1x4567 = vdotq_lane_s32(vacc1x4567, vb0123x4567, va1x01234567, 0);
226 vacc2x0123 = vdotq_lane_s32(vacc2x0123, vb0123x0123, va2x01234567, 0);
227 vacc2x4567 = vdotq_lane_s32(vacc2x4567, vb0123x4567, va2x01234567, 0);
228 vacc3x0123 = vdotq_lane_s32(vacc3x0123, vb0123x0123, va3x01234567, 0);
229 vacc3x4567 = vdotq_lane_s32(vacc3x4567, vb0123x4567, va3x01234567, 0);
230 vacc4x0123 = vdotq_lane_s32(vacc4x0123, vb0123x0123, va4x01234567, 0);
231 vacc4x4567 = vdotq_lane_s32(vacc4x4567, vb0123x4567, va4x01234567, 0);
232 vacc5x0123 = vdotq_lane_s32(vacc5x0123, vb0123x0123, va5x01234567, 0);
233 vacc5x4567 = vdotq_lane_s32(vacc5x4567, vb0123x4567, va5x01234567, 0);
234 vacc6x0123 = vdotq_lane_s32(vacc6x0123, vb0123x0123, va6x01234567, 0);
235 vacc6x4567 = vdotq_lane_s32(vacc6x4567, vb0123x4567, va6x01234567, 0);
236 vacc7x0123 = vdotq_lane_s32(vacc7x0123, vb0123x0123, va7x01234567, 0);
237 vacc7x4567 = vdotq_lane_s32(vacc7x4567, vb0123x4567, va7x01234567, 0);
238 }
239 p -= 8 * sizeof(void*);
240 } while (p != 0);
241
242 float32x4_t vout0x0123 = vcvtq_f32_s32(vacc0x0123);
243 float32x4_t vout0x4567 = vcvtq_f32_s32(vacc0x4567);
244 float32x4_t vout1x0123 = vcvtq_f32_s32(vacc1x0123);
245 float32x4_t vout1x4567 = vcvtq_f32_s32(vacc1x4567);
246 float32x4_t vout2x0123 = vcvtq_f32_s32(vacc2x0123);
247 float32x4_t vout2x4567 = vcvtq_f32_s32(vacc2x4567);
248 float32x4_t vout3x0123 = vcvtq_f32_s32(vacc3x0123);
249 float32x4_t vout3x4567 = vcvtq_f32_s32(vacc3x4567);
250 float32x4_t vout4x0123 = vcvtq_f32_s32(vacc4x0123);
251 float32x4_t vout4x4567 = vcvtq_f32_s32(vacc4x4567);
252 float32x4_t vout5x0123 = vcvtq_f32_s32(vacc5x0123);
253 float32x4_t vout5x4567 = vcvtq_f32_s32(vacc5x4567);
254 float32x4_t vout6x0123 = vcvtq_f32_s32(vacc6x0123);
255 float32x4_t vout6x4567 = vcvtq_f32_s32(vacc6x4567);
256 float32x4_t vout7x0123 = vcvtq_f32_s32(vacc7x0123);
257 float32x4_t vout7x4567 = vcvtq_f32_s32(vacc7x4567);
258 const float32x4_t vinput_scale = vld1q_dup_f32(&quantization_params->inv_scale);
259 vout0x0123 = vmulq_f32(vout0x0123, vinput_scale);
260 vout0x4567 = vmulq_f32(vout0x4567, vinput_scale);
261 vout1x0123 = vmulq_f32(vout1x0123, vinput_scale);
262 vout1x4567 = vmulq_f32(vout1x4567, vinput_scale);
263 vout2x0123 = vmulq_f32(vout2x0123, vinput_scale);
264 vout2x4567 = vmulq_f32(vout2x4567, vinput_scale);
265 vout3x0123 = vmulq_f32(vout3x0123, vinput_scale);
266 vout3x4567 = vmulq_f32(vout3x4567, vinput_scale);
267 vout4x0123 = vmulq_f32(vout4x0123, vinput_scale);
268 vout4x4567 = vmulq_f32(vout4x4567, vinput_scale);
269 vout5x0123 = vmulq_f32(vout5x0123, vinput_scale);
270 vout5x4567 = vmulq_f32(vout5x4567, vinput_scale);
271 vout6x0123 = vmulq_f32(vout6x0123, vinput_scale);
272 vout6x4567 = vmulq_f32(vout6x4567, vinput_scale);
273 vout7x0123 = vmulq_f32(vout7x0123, vinput_scale);
274 vout7x4567 = vmulq_f32(vout7x4567, vinput_scale);
275
276 const float32x4_t vfilter_output_scale0123 = vld1q_f32(w); w = (const float*) w + 4;
277 const float32x4_t vfilter_output_scale4567 = vld1q_f32(w); w = (const float*) w + 4;
278
279 const float32x4_t vbias0123 = vld1q_f32(w); w = (const float*) w + 4;
280 #if XNN_ARCH_ARM64
281 vout0x0123 = vfmaq_f32(vbias0123, vout0x0123, vfilter_output_scale0123);
282 vout1x0123 = vfmaq_f32(vbias0123, vout1x0123, vfilter_output_scale0123);
283 vout2x0123 = vfmaq_f32(vbias0123, vout2x0123, vfilter_output_scale0123);
284 vout3x0123 = vfmaq_f32(vbias0123, vout3x0123, vfilter_output_scale0123);
285 vout4x0123 = vfmaq_f32(vbias0123, vout4x0123, vfilter_output_scale0123);
286 vout5x0123 = vfmaq_f32(vbias0123, vout5x0123, vfilter_output_scale0123);
287 vout6x0123 = vfmaq_f32(vbias0123, vout6x0123, vfilter_output_scale0123);
288 vout7x0123 = vfmaq_f32(vbias0123, vout7x0123, vfilter_output_scale0123);
289 #else
290 vout0x0123 = vmlaq_f32(vbias0123, vout0x0123, vfilter_output_scale0123);
291 vout1x0123 = vmlaq_f32(vbias0123, vout1x0123, vfilter_output_scale0123);
292 vout2x0123 = vmlaq_f32(vbias0123, vout2x0123, vfilter_output_scale0123);
293 vout3x0123 = vmlaq_f32(vbias0123, vout3x0123, vfilter_output_scale0123);
294 vout4x0123 = vmlaq_f32(vbias0123, vout4x0123, vfilter_output_scale0123);
295 vout5x0123 = vmlaq_f32(vbias0123, vout5x0123, vfilter_output_scale0123);
296 vout6x0123 = vmlaq_f32(vbias0123, vout6x0123, vfilter_output_scale0123);
297 vout7x0123 = vmlaq_f32(vbias0123, vout7x0123, vfilter_output_scale0123);
298 #endif
299 const float32x4_t vbias4567 = vld1q_f32(w); w = (const float*) w + 4;
300 #if XNN_ARCH_ARM64
301 vout0x4567 = vfmaq_f32(vbias4567, vout0x4567, vfilter_output_scale4567);
302 vout1x4567 = vfmaq_f32(vbias4567, vout1x4567, vfilter_output_scale4567);
303 vout2x4567 = vfmaq_f32(vbias4567, vout2x4567, vfilter_output_scale4567);
304 vout3x4567 = vfmaq_f32(vbias4567, vout3x4567, vfilter_output_scale4567);
305 vout4x4567 = vfmaq_f32(vbias4567, vout4x4567, vfilter_output_scale4567);
306 vout5x4567 = vfmaq_f32(vbias4567, vout5x4567, vfilter_output_scale4567);
307 vout6x4567 = vfmaq_f32(vbias4567, vout6x4567, vfilter_output_scale4567);
308 vout7x4567 = vfmaq_f32(vbias4567, vout7x4567, vfilter_output_scale4567);
309 #else
310 vout0x4567 = vmlaq_f32(vbias4567, vout0x4567, vfilter_output_scale4567);
311 vout1x4567 = vmlaq_f32(vbias4567, vout1x4567, vfilter_output_scale4567);
312 vout2x4567 = vmlaq_f32(vbias4567, vout2x4567, vfilter_output_scale4567);
313 vout3x4567 = vmlaq_f32(vbias4567, vout3x4567, vfilter_output_scale4567);
314 vout4x4567 = vmlaq_f32(vbias4567, vout4x4567, vfilter_output_scale4567);
315 vout5x4567 = vmlaq_f32(vbias4567, vout5x4567, vfilter_output_scale4567);
316 vout6x4567 = vmlaq_f32(vbias4567, vout6x4567, vfilter_output_scale4567);
317 vout7x4567 = vmlaq_f32(vbias4567, vout7x4567, vfilter_output_scale4567);
318 #endif
319
320 float16x8_t vfp16out0x01234567 = vcombine_f16(vcvt_f16_f32(vout0x0123), vcvt_f16_f32(vout0x4567));
321 float16x8_t vfp16out1x01234567 = vcombine_f16(vcvt_f16_f32(vout1x0123), vcvt_f16_f32(vout1x4567));
322 float16x8_t vfp16out2x01234567 = vcombine_f16(vcvt_f16_f32(vout2x0123), vcvt_f16_f32(vout2x4567));
323 float16x8_t vfp16out3x01234567 = vcombine_f16(vcvt_f16_f32(vout3x0123), vcvt_f16_f32(vout3x4567));
324 float16x8_t vfp16out4x01234567 = vcombine_f16(vcvt_f16_f32(vout4x0123), vcvt_f16_f32(vout4x4567));
325 float16x8_t vfp16out5x01234567 = vcombine_f16(vcvt_f16_f32(vout5x0123), vcvt_f16_f32(vout5x4567));
326 float16x8_t vfp16out6x01234567 = vcombine_f16(vcvt_f16_f32(vout6x0123), vcvt_f16_f32(vout6x4567));
327 float16x8_t vfp16out7x01234567 = vcombine_f16(vcvt_f16_f32(vout7x0123), vcvt_f16_f32(vout7x4567));
328
329 const float16x8_t voutput_min = vreinterpretq_f16_u16(vld1q_dup_u16((const uint16_t*) &params->scalar.min));
330 vfp16out0x01234567 = vmaxq_f16(vfp16out0x01234567, voutput_min);
331 vfp16out1x01234567 = vmaxq_f16(vfp16out1x01234567, voutput_min);
332 vfp16out2x01234567 = vmaxq_f16(vfp16out2x01234567, voutput_min);
333 vfp16out3x01234567 = vmaxq_f16(vfp16out3x01234567, voutput_min);
334 vfp16out4x01234567 = vmaxq_f16(vfp16out4x01234567, voutput_min);
335 vfp16out5x01234567 = vmaxq_f16(vfp16out5x01234567, voutput_min);
336 vfp16out6x01234567 = vmaxq_f16(vfp16out6x01234567, voutput_min);
337 vfp16out7x01234567 = vmaxq_f16(vfp16out7x01234567, voutput_min);
338 const float16x8_t voutput_max = vreinterpretq_f16_u16(vld1q_dup_u16((const uint16_t*) &params->scalar.max));
339 vfp16out0x01234567 = vminq_f16(vfp16out0x01234567, voutput_max);
340 vfp16out1x01234567 = vminq_f16(vfp16out1x01234567, voutput_max);
341 vfp16out2x01234567 = vminq_f16(vfp16out2x01234567, voutput_max);
342 vfp16out3x01234567 = vminq_f16(vfp16out3x01234567, voutput_max);
343 vfp16out4x01234567 = vminq_f16(vfp16out4x01234567, voutput_max);
344 vfp16out5x01234567 = vminq_f16(vfp16out5x01234567, voutput_max);
345 vfp16out6x01234567 = vminq_f16(vfp16out6x01234567, voutput_max);
346 vfp16out7x01234567 = vminq_f16(vfp16out7x01234567, voutput_max);
347 if XNN_LIKELY(nc >= 8) {
348 vst1q_u16(c7, vreinterpretq_u16_f16(vfp16out7x01234567));
349 vst1q_u16(c6, vreinterpretq_u16_f16(vfp16out6x01234567));
350 vst1q_u16(c5, vreinterpretq_u16_f16(vfp16out5x01234567));
351 vst1q_u16(c4, vreinterpretq_u16_f16(vfp16out4x01234567));
352 vst1q_u16(c3, vreinterpretq_u16_f16(vfp16out3x01234567));
353 vst1q_u16(c2, vreinterpretq_u16_f16(vfp16out2x01234567));
354 vst1q_u16(c1, vreinterpretq_u16_f16(vfp16out1x01234567));
355 vst1q_u16(c0, vreinterpretq_u16_f16(vfp16out0x01234567));
356
357 a = (const int8_t**restrict) ((uintptr_t) a - ks);
358
359 c0 = (uint16_t*) ((uintptr_t) c0 + cn_stride);
360 c1 = (uint16_t*) ((uintptr_t) c1 + cn_stride);
361 c2 = (uint16_t*) ((uintptr_t) c2 + cn_stride);
362 c3 = (uint16_t*) ((uintptr_t) c3 + cn_stride);
363 c4 = (uint16_t*) ((uintptr_t) c4 + cn_stride);
364 c5 = (uint16_t*) ((uintptr_t) c5 + cn_stride);
365 c6 = (uint16_t*) ((uintptr_t) c6 + cn_stride);
366 c7 = (uint16_t*) ((uintptr_t) c7 + cn_stride);
367
368 nc -= 8;
369 } else {
370 float16x4_t vfp16out7x0123 = vget_low_f16(vfp16out7x01234567);
371 float16x4_t vfp16out6x0123 = vget_low_f16(vfp16out6x01234567);
372 float16x4_t vfp16out5x0123 = vget_low_f16(vfp16out5x01234567);
373 float16x4_t vfp16out4x0123 = vget_low_f16(vfp16out4x01234567);
374 float16x4_t vfp16out3x0123 = vget_low_f16(vfp16out3x01234567);
375 float16x4_t vfp16out2x0123 = vget_low_f16(vfp16out2x01234567);
376 float16x4_t vfp16out1x0123 = vget_low_f16(vfp16out1x01234567);
377 float16x4_t vfp16out0x0123 = vget_low_f16(vfp16out0x01234567);
378 if (nc & 4) {
379 vst1_u16(c7, vreinterpret_u16_f16(vfp16out7x0123)); c7 += 4;
380 vst1_u16(c6, vreinterpret_u16_f16(vfp16out6x0123)); c6 += 4;
381 vst1_u16(c5, vreinterpret_u16_f16(vfp16out5x0123)); c5 += 4;
382 vst1_u16(c4, vreinterpret_u16_f16(vfp16out4x0123)); c4 += 4;
383 vst1_u16(c3, vreinterpret_u16_f16(vfp16out3x0123)); c3 += 4;
384 vst1_u16(c2, vreinterpret_u16_f16(vfp16out2x0123)); c2 += 4;
385 vst1_u16(c1, vreinterpret_u16_f16(vfp16out1x0123)); c1 += 4;
386 vst1_u16(c0, vreinterpret_u16_f16(vfp16out0x0123)); c0 += 4;
387 vfp16out7x0123 = vget_high_f16(vfp16out7x01234567);
388 vfp16out6x0123 = vget_high_f16(vfp16out6x01234567);
389 vfp16out5x0123 = vget_high_f16(vfp16out5x01234567);
390 vfp16out4x0123 = vget_high_f16(vfp16out4x01234567);
391 vfp16out3x0123 = vget_high_f16(vfp16out3x01234567);
392 vfp16out2x0123 = vget_high_f16(vfp16out2x01234567);
393 vfp16out1x0123 = vget_high_f16(vfp16out1x01234567);
394 vfp16out0x0123 = vget_high_f16(vfp16out0x01234567);
395 }
396 if (nc & 2) {
397 vst1_lane_u32((void*) c7, vreinterpret_u32_f16(vfp16out7x0123), 0); c7 += 2;
398 vst1_lane_u32((void*) c6, vreinterpret_u32_f16(vfp16out6x0123), 0); c6 += 2;
399 vst1_lane_u32((void*) c5, vreinterpret_u32_f16(vfp16out5x0123), 0); c5 += 2;
400 vst1_lane_u32((void*) c4, vreinterpret_u32_f16(vfp16out4x0123), 0); c4 += 2;
401 vst1_lane_u32((void*) c3, vreinterpret_u32_f16(vfp16out3x0123), 0); c3 += 2;
402 vst1_lane_u32((void*) c2, vreinterpret_u32_f16(vfp16out2x0123), 0); c2 += 2;
403 vst1_lane_u32((void*) c1, vreinterpret_u32_f16(vfp16out1x0123), 0); c1 += 2;
404 vst1_lane_u32((void*) c0, vreinterpret_u32_f16(vfp16out0x0123), 0); c0 += 2;
405 vfp16out7x0123 = vext_f16(vfp16out7x0123, vfp16out7x0123, 2);
406 vfp16out6x0123 = vext_f16(vfp16out6x0123, vfp16out6x0123, 2);
407 vfp16out5x0123 = vext_f16(vfp16out5x0123, vfp16out5x0123, 2);
408 vfp16out4x0123 = vext_f16(vfp16out4x0123, vfp16out4x0123, 2);
409 vfp16out3x0123 = vext_f16(vfp16out3x0123, vfp16out3x0123, 2);
410 vfp16out2x0123 = vext_f16(vfp16out2x0123, vfp16out2x0123, 2);
411 vfp16out1x0123 = vext_f16(vfp16out1x0123, vfp16out1x0123, 2);
412 vfp16out0x0123 = vext_f16(vfp16out0x0123, vfp16out0x0123, 2);
413 }
414 if (nc & 1) {
415 vst1_lane_u16(c7, vreinterpret_u16_f16(vfp16out7x0123), 0);
416 vst1_lane_u16(c6, vreinterpret_u16_f16(vfp16out6x0123), 0);
417 vst1_lane_u16(c5, vreinterpret_u16_f16(vfp16out5x0123), 0);
418 vst1_lane_u16(c4, vreinterpret_u16_f16(vfp16out4x0123), 0);
419 vst1_lane_u16(c3, vreinterpret_u16_f16(vfp16out3x0123), 0);
420 vst1_lane_u16(c2, vreinterpret_u16_f16(vfp16out2x0123), 0);
421 vst1_lane_u16(c1, vreinterpret_u16_f16(vfp16out1x0123), 0);
422 vst1_lane_u16(c0, vreinterpret_u16_f16(vfp16out0x0123), 0);
423 }
424 nc = 0;
425 }
426 } while (nc != 0);
427 }