xref: /aosp_15_r20/external/XNNPACK/src/qs8-dwconv/gen/up8x25-minmax-rndnu-neon-mul8-ld64.c (revision 4bdc94577ba0e567308109d787f7fec7b531ce36)
1 // Auto-generated file. Do not edit!
2 //   Template: src/qs8-dwconv/unipass-neon-mul8.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/dwconv.h>
15 
16 
xnn_qs8_dwconv_minmax_rndnu_ukernel_up8x25__neon_mul8_ld64(size_t channels,size_t output_width,const int8_t ** input,const void * weights,int8_t * output,size_t input_stride,size_t output_increment,size_t input_offset,const int8_t * zero,const union xnn_qs8_conv_minmax_params params[restrict XNN_MIN_ELEMENTS (1)])17 void xnn_qs8_dwconv_minmax_rndnu_ukernel_up8x25__neon_mul8_ld64(
18     size_t channels,
19     size_t output_width,
20     const int8_t** input,
21     const void* weights,
22     int8_t* output,
23     size_t input_stride,
24     size_t output_increment,
25     size_t input_offset,
26     const int8_t* zero,
27     const union xnn_qs8_conv_minmax_params params[restrict XNN_MIN_ELEMENTS(1)]) XNN_OOB_READS
28 {
29   assert(channels != 0);
30   assert(output_width != 0);
31 
32   const int32x4_t vright_pre_shift = vld1q_dup_s32(&params->rndnu_neon.right_pre_shift);
33   const int32x4_t vmultiplier = vld1q_dup_s32(&params->rndnu_neon.multiplier);
34   const int32x4_t vright_post_shift = vld1q_dup_s32(&params->rndnu_neon.right_post_shift);
35   const int16x8_t voutput_zero_point = vld1q_dup_s16(&params->rndnu_neon.output_zero_point);
36   const int8x8_t voutput_min = vld1_dup_s8(&params->rndnu_neon.output_min);
37   const int8x8_t voutput_max = vld1_dup_s8(&params->rndnu_neon.output_max);
38   do {
39     const int8_t* i0 = input[0];
40     assert(i0 != NULL);
41     if XNN_UNPREDICTABLE(i0 != zero) {
42       i0 = (const int8_t*) ((uintptr_t) i0 + input_offset);
43     }
44     const int8_t* i1 = input[1];
45     assert(i1 != NULL);
46     if XNN_UNPREDICTABLE(i1 != zero) {
47       i1 = (const int8_t*) ((uintptr_t) i1 + input_offset);
48     }
49     const int8_t* i2 = input[2];
50     assert(i2 != NULL);
51     if XNN_UNPREDICTABLE(i2 != zero) {
52       i2 = (const int8_t*) ((uintptr_t) i2 + input_offset);
53     }
54     const int8_t* i3 = input[3];
55     assert(i3 != NULL);
56     if XNN_UNPREDICTABLE(i3 != zero) {
57       i3 = (const int8_t*) ((uintptr_t) i3 + input_offset);
58     }
59     const int8_t* i4 = input[4];
60     assert(i4 != NULL);
61     if XNN_UNPREDICTABLE(i4 != zero) {
62       i4 = (const int8_t*) ((uintptr_t) i4 + input_offset);
63     }
64     const int8_t* i5 = input[5];
65     assert(i5 != NULL);
66     if XNN_UNPREDICTABLE(i5 != zero) {
67       i5 = (const int8_t*) ((uintptr_t) i5 + input_offset);
68     }
69     const int8_t* i6 = input[6];
70     assert(i6 != NULL);
71     if XNN_UNPREDICTABLE(i6 != zero) {
72       i6 = (const int8_t*) ((uintptr_t) i6 + input_offset);
73     }
74     const int8_t* i7 = input[7];
75     assert(i7 != NULL);
76     if XNN_UNPREDICTABLE(i7 != zero) {
77       i7 = (const int8_t*) ((uintptr_t) i7 + input_offset);
78     }
79     const int8_t* i8 = input[8];
80     assert(i8 != NULL);
81     if XNN_UNPREDICTABLE(i8 != zero) {
82       i8 = (const int8_t*) ((uintptr_t) i8 + input_offset);
83     }
84     const int8_t* i9 = input[9];
85     assert(i9 != NULL);
86     if XNN_UNPREDICTABLE(i9 != zero) {
87       i9 = (const int8_t*) ((uintptr_t) i9 + input_offset);
88     }
89     const int8_t* i10 = input[10];
90     assert(i10 != NULL);
91     if XNN_UNPREDICTABLE(i10 != zero) {
92       i10 = (const int8_t*) ((uintptr_t) i10 + input_offset);
93     }
94     const int8_t* i11 = input[11];
95     assert(i11 != NULL);
96     if XNN_UNPREDICTABLE(i11 != zero) {
97       i11 = (const int8_t*) ((uintptr_t) i11 + input_offset);
98     }
99     const int8_t* i12 = input[12];
100     assert(i12 != NULL);
101     if XNN_UNPREDICTABLE(i12 != zero) {
102       i12 = (const int8_t*) ((uintptr_t) i12 + input_offset);
103     }
104     const int8_t* i13 = input[13];
105     assert(i13 != NULL);
106     if XNN_UNPREDICTABLE(i13 != zero) {
107       i13 = (const int8_t*) ((uintptr_t) i13 + input_offset);
108     }
109     const int8_t* i14 = input[14];
110     assert(i14 != NULL);
111     if XNN_UNPREDICTABLE(i14 != zero) {
112       i14 = (const int8_t*) ((uintptr_t) i14 + input_offset);
113     }
114     const int8_t* i15 = input[15];
115     assert(i15 != NULL);
116     if XNN_UNPREDICTABLE(i15 != zero) {
117       i15 = (const int8_t*) ((uintptr_t) i15 + input_offset);
118     }
119     const int8_t* i16 = input[16];
120     assert(i16 != NULL);
121     if XNN_UNPREDICTABLE(i16 != zero) {
122       i16 = (const int8_t*) ((uintptr_t) i16 + input_offset);
123     }
124     const int8_t* i17 = input[17];
125     assert(i17 != NULL);
126     if XNN_UNPREDICTABLE(i17 != zero) {
127       i17 = (const int8_t*) ((uintptr_t) i17 + input_offset);
128     }
129     const int8_t* i18 = input[18];
130     assert(i18 != NULL);
131     if XNN_UNPREDICTABLE(i18 != zero) {
132       i18 = (const int8_t*) ((uintptr_t) i18 + input_offset);
133     }
134     const int8_t* i19 = input[19];
135     assert(i19 != NULL);
136     if XNN_UNPREDICTABLE(i19 != zero) {
137       i19 = (const int8_t*) ((uintptr_t) i19 + input_offset);
138     }
139     const int8_t* i20 = input[20];
140     assert(i20 != NULL);
141     if XNN_UNPREDICTABLE(i20 != zero) {
142       i20 = (const int8_t*) ((uintptr_t) i20 + input_offset);
143     }
144     const int8_t* i21 = input[21];
145     assert(i21 != NULL);
146     if XNN_UNPREDICTABLE(i21 != zero) {
147       i21 = (const int8_t*) ((uintptr_t) i21 + input_offset);
148     }
149     const int8_t* i22 = input[22];
150     assert(i22 != NULL);
151     if XNN_UNPREDICTABLE(i22 != zero) {
152       i22 = (const int8_t*) ((uintptr_t) i22 + input_offset);
153     }
154     const int8_t* i23 = input[23];
155     assert(i23 != NULL);
156     if XNN_UNPREDICTABLE(i23 != zero) {
157       i23 = (const int8_t*) ((uintptr_t) i23 + input_offset);
158     }
159     const int8_t* i24 = input[24];
160     assert(i24 != NULL);
161     if XNN_UNPREDICTABLE(i24 != zero) {
162       i24 = (const int8_t*) ((uintptr_t) i24 + input_offset);
163     }
164     input = (const int8_t**) ((uintptr_t) input + input_stride);
165 
166     size_t c = channels;
167     const void* w = weights;
168     for (; c >= 8; c -= 8) {
169       int32x4_t vacc0123 = vld1q_s32(w); w = (const void*) ((const int32_t*) w + 4);
170       int32x4_t vacc4567 = vld1q_s32(w); w = (const void*) ((const int32_t*) w + 4);
171 
172       const int8x8_t vi0x01234567 = vld1_s8(i0); i0 += 8;
173       const int8x8_t vk0x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
174 
175       int16x8_t vprod01234567 = vmull_s8(vi0x01234567, vk0x01234567);
176 
177       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
178       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
179       const int8x8_t vi1x01234567 = vld1_s8(i1); i1 += 8;
180       const int8x8_t vk1x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
181 
182       vprod01234567 = vmull_s8(vi1x01234567, vk1x01234567);
183 
184       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
185       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
186       const int8x8_t vi2x01234567 = vld1_s8(i2); i2 += 8;
187       const int8x8_t vk2x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
188 
189       vprod01234567 = vmull_s8(vi2x01234567, vk2x01234567);
190 
191       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
192       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
193       const int8x8_t vi3x01234567 = vld1_s8(i3); i3 += 8;
194       const int8x8_t vk3x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
195 
196       vprod01234567 = vmull_s8(vi3x01234567, vk3x01234567);
197 
198       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
199       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
200       const int8x8_t vi4x01234567 = vld1_s8(i4); i4 += 8;
201       const int8x8_t vk4x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
202 
203       vprod01234567 = vmull_s8(vi4x01234567, vk4x01234567);
204 
205       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
206       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
207       const int8x8_t vi5x01234567 = vld1_s8(i5); i5 += 8;
208       const int8x8_t vk5x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
209 
210       vprod01234567 = vmull_s8(vi5x01234567, vk5x01234567);
211 
212       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
213       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
214       const int8x8_t vi6x01234567 = vld1_s8(i6); i6 += 8;
215       const int8x8_t vk6x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
216 
217       vprod01234567 = vmull_s8(vi6x01234567, vk6x01234567);
218 
219       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
220       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
221       const int8x8_t vi7x01234567 = vld1_s8(i7); i7 += 8;
222       const int8x8_t vk7x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
223 
224       vprod01234567 = vmull_s8(vi7x01234567, vk7x01234567);
225 
226       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
227       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
228       const int8x8_t vi8x01234567 = vld1_s8(i8); i8 += 8;
229       const int8x8_t vk8x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
230 
231       vprod01234567 = vmull_s8(vi8x01234567, vk8x01234567);
232 
233       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
234       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
235       const int8x8_t vi9x01234567 = vld1_s8(i9); i9 += 8;
236       const int8x8_t vk9x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
237 
238       vprod01234567 = vmull_s8(vi9x01234567, vk9x01234567);
239 
240       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
241       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
242       const int8x8_t vi10x01234567 = vld1_s8(i10); i10 += 8;
243       const int8x8_t vk10x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
244 
245       vprod01234567 = vmull_s8(vi10x01234567, vk10x01234567);
246 
247       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
248       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
249       const int8x8_t vi11x01234567 = vld1_s8(i11); i11 += 8;
250       const int8x8_t vk11x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
251 
252       vprod01234567 = vmull_s8(vi11x01234567, vk11x01234567);
253 
254       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
255       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
256       const int8x8_t vi12x01234567 = vld1_s8(i12); i12 += 8;
257       const int8x8_t vk12x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
258 
259       vprod01234567 = vmull_s8(vi12x01234567, vk12x01234567);
260 
261       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
262       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
263       const int8x8_t vi13x01234567 = vld1_s8(i13); i13 += 8;
264       const int8x8_t vk13x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
265 
266       vprod01234567 = vmull_s8(vi13x01234567, vk13x01234567);
267 
268       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
269       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
270       const int8x8_t vi14x01234567 = vld1_s8(i14); i14 += 8;
271       const int8x8_t vk14x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
272 
273       vprod01234567 = vmull_s8(vi14x01234567, vk14x01234567);
274 
275       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
276       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
277       const int8x8_t vi15x01234567 = vld1_s8(i15); i15 += 8;
278       const int8x8_t vk15x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
279 
280       vprod01234567 = vmull_s8(vi15x01234567, vk15x01234567);
281 
282       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
283       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
284       const int8x8_t vi16x01234567 = vld1_s8(i16); i16 += 8;
285       const int8x8_t vk16x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
286 
287       vprod01234567 = vmull_s8(vi16x01234567, vk16x01234567);
288 
289       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
290       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
291       const int8x8_t vi17x01234567 = vld1_s8(i17); i17 += 8;
292       const int8x8_t vk17x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
293 
294       vprod01234567 = vmull_s8(vi17x01234567, vk17x01234567);
295 
296       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
297       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
298       const int8x8_t vi18x01234567 = vld1_s8(i18); i18 += 8;
299       const int8x8_t vk18x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
300 
301       vprod01234567 = vmull_s8(vi18x01234567, vk18x01234567);
302 
303       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
304       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
305       const int8x8_t vi19x01234567 = vld1_s8(i19); i19 += 8;
306       const int8x8_t vk19x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
307 
308       vprod01234567 = vmull_s8(vi19x01234567, vk19x01234567);
309 
310       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
311       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
312       const int8x8_t vi20x01234567 = vld1_s8(i20); i20 += 8;
313       const int8x8_t vk20x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
314 
315       vprod01234567 = vmull_s8(vi20x01234567, vk20x01234567);
316 
317       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
318       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
319       const int8x8_t vi21x01234567 = vld1_s8(i21); i21 += 8;
320       const int8x8_t vk21x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
321 
322       vprod01234567 = vmull_s8(vi21x01234567, vk21x01234567);
323 
324       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
325       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
326       const int8x8_t vi22x01234567 = vld1_s8(i22); i22 += 8;
327       const int8x8_t vk22x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
328 
329       vprod01234567 = vmull_s8(vi22x01234567, vk22x01234567);
330 
331       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
332       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
333       const int8x8_t vi23x01234567 = vld1_s8(i23); i23 += 8;
334       const int8x8_t vk23x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
335 
336       vprod01234567 = vmull_s8(vi23x01234567, vk23x01234567);
337 
338       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
339       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
340       const int8x8_t vi24x01234567 = vld1_s8(i24); i24 += 8;
341       const int8x8_t vk24x01234567 = vld1_s8(w); w = (const void*) ((const int8_t*) w + 8);
342 
343       vprod01234567 = vmull_s8(vi24x01234567, vk24x01234567);
344 
345       vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
346       vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
347 
348       vacc0123 = vqshlq_s32(vacc0123, vright_pre_shift);
349       vacc4567 = vqshlq_s32(vacc4567, vright_pre_shift);
350 
351       vacc0123 = vqdmulhq_s32(vacc0123, vmultiplier);
352       vacc4567 = vqdmulhq_s32(vacc4567, vmultiplier);
353 
354       vacc0123 = vrshlq_s32(vacc0123, vright_post_shift);
355       vacc4567 = vrshlq_s32(vacc4567, vright_post_shift);
356 
357 #if XNN_ARCH_ARM64
358       int16x8_t vacc01234567 = vqmovn_high_s32(vqmovn_s32(vacc0123), vacc4567);
359 
360       vacc01234567 = vqaddq_s16(vacc01234567, voutput_zero_point);
361 
362       int8x8_t vout01234567 = vqmovn_s16(vacc01234567);
363 #else  // !XNN_ARCH_ARM64
364       int16x8_t vacc01234567 = vcombine_s16(vqmovn_s32(vacc0123), vqmovn_s32(vacc4567));
365 
366       vacc01234567 = vqaddq_s16(vacc01234567, voutput_zero_point);
367 
368       int8x8_t vout01234567 = vqmovn_s16(vacc01234567);
369 #endif  // !XNN_ARCH_ARM64
370 
371       vout01234567 = vmax_s8(vout01234567, voutput_min);
372 
373       vout01234567 = vmin_s8(vout01234567, voutput_max);
374 
375       vst1_s8(output, vout01234567); output += 8;
376     }
377     if XNN_UNLIKELY(c != 0) {
378       {
379         int32x4_t vacc0123 = vld1q_s32(w); w = (const void*) ((const int32_t*) w + 4);
380         int32x4_t vacc4567 = vld1q_s32(w); w = (const void*) ((const int32_t*) w + 4);
381 
382         const int8x8_t vi0x01234567 = vld1_s8(i0);
383         const int8x8_t vk0x01234567 = vld1_s8(w);
384 
385         int16x8_t vprod01234567 = vmull_s8(vi0x01234567, vk0x01234567);
386 
387         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
388         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
389         const int8x8_t vi1x01234567 = vld1_s8(i1);
390         const int8x8_t vk1x01234567 = vld1_s8((const void*) ((const int8_t*) w + 8));
391 
392         vprod01234567 = vmull_s8(vi1x01234567, vk1x01234567);
393 
394         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
395         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
396         const int8x8_t vi2x01234567 = vld1_s8(i2);
397         const int8x8_t vk2x01234567 = vld1_s8((const void*) ((const int8_t*) w + 16));
398 
399         vprod01234567 = vmull_s8(vi2x01234567, vk2x01234567);
400 
401         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
402         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
403         const int8x8_t vi3x01234567 = vld1_s8(i3);
404         const int8x8_t vk3x01234567 = vld1_s8((const void*) ((const int8_t*) w + 24));
405 
406         vprod01234567 = vmull_s8(vi3x01234567, vk3x01234567);
407 
408         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
409         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
410         const int8x8_t vi4x01234567 = vld1_s8(i4);
411         const int8x8_t vk4x01234567 = vld1_s8((const void*) ((const int8_t*) w + 32));
412 
413         vprod01234567 = vmull_s8(vi4x01234567, vk4x01234567);
414 
415         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
416         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
417         const int8x8_t vi5x01234567 = vld1_s8(i5);
418         const int8x8_t vk5x01234567 = vld1_s8((const void*) ((const int8_t*) w + 40));
419 
420         vprod01234567 = vmull_s8(vi5x01234567, vk5x01234567);
421 
422         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
423         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
424         const int8x8_t vi6x01234567 = vld1_s8(i6);
425         const int8x8_t vk6x01234567 = vld1_s8((const void*) ((const int8_t*) w + 48));
426 
427         vprod01234567 = vmull_s8(vi6x01234567, vk6x01234567);
428 
429         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
430         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
431         const int8x8_t vi7x01234567 = vld1_s8(i7);
432         const int8x8_t vk7x01234567 = vld1_s8((const void*) ((const int8_t*) w + 56));
433 
434         vprod01234567 = vmull_s8(vi7x01234567, vk7x01234567);
435 
436         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
437         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
438         const int8x8_t vi8x01234567 = vld1_s8(i8);
439         const int8x8_t vk8x01234567 = vld1_s8((const void*) ((const int8_t*) w + 64));
440 
441         vprod01234567 = vmull_s8(vi8x01234567, vk8x01234567);
442 
443         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
444         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
445         const int8x8_t vi9x01234567 = vld1_s8(i9);
446         const int8x8_t vk9x01234567 = vld1_s8((const void*) ((const int8_t*) w + 72));
447 
448         vprod01234567 = vmull_s8(vi9x01234567, vk9x01234567);
449 
450         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
451         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
452         const int8x8_t vi10x01234567 = vld1_s8(i10);
453         const int8x8_t vk10x01234567 = vld1_s8((const void*) ((const int8_t*) w + 80));
454 
455         vprod01234567 = vmull_s8(vi10x01234567, vk10x01234567);
456 
457         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
458         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
459         const int8x8_t vi11x01234567 = vld1_s8(i11);
460         const int8x8_t vk11x01234567 = vld1_s8((const void*) ((const int8_t*) w + 88));
461 
462         vprod01234567 = vmull_s8(vi11x01234567, vk11x01234567);
463 
464         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
465         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
466         const int8x8_t vi12x01234567 = vld1_s8(i12);
467         const int8x8_t vk12x01234567 = vld1_s8((const void*) ((const int8_t*) w + 96));
468 
469         vprod01234567 = vmull_s8(vi12x01234567, vk12x01234567);
470 
471         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
472         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
473         const int8x8_t vi13x01234567 = vld1_s8(i13);
474         const int8x8_t vk13x01234567 = vld1_s8((const void*) ((const int8_t*) w + 104));
475 
476         vprod01234567 = vmull_s8(vi13x01234567, vk13x01234567);
477 
478         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
479         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
480         const int8x8_t vi14x01234567 = vld1_s8(i14);
481         const int8x8_t vk14x01234567 = vld1_s8((const void*) ((const int8_t*) w + 112));
482 
483         vprod01234567 = vmull_s8(vi14x01234567, vk14x01234567);
484 
485         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
486         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
487         const int8x8_t vi15x01234567 = vld1_s8(i15);
488         const int8x8_t vk15x01234567 = vld1_s8((const void*) ((const int8_t*) w + 120));
489 
490         vprod01234567 = vmull_s8(vi15x01234567, vk15x01234567);
491 
492         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
493         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
494         const int8x8_t vi16x01234567 = vld1_s8(i16);
495         const int8x8_t vk16x01234567 = vld1_s8((const void*) ((const int8_t*) w + 128));
496 
497         vprod01234567 = vmull_s8(vi16x01234567, vk16x01234567);
498 
499         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
500         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
501         const int8x8_t vi17x01234567 = vld1_s8(i17);
502         const int8x8_t vk17x01234567 = vld1_s8((const void*) ((const int8_t*) w + 136));
503 
504         vprod01234567 = vmull_s8(vi17x01234567, vk17x01234567);
505 
506         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
507         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
508         const int8x8_t vi18x01234567 = vld1_s8(i18);
509         const int8x8_t vk18x01234567 = vld1_s8((const void*) ((const int8_t*) w + 144));
510 
511         vprod01234567 = vmull_s8(vi18x01234567, vk18x01234567);
512 
513         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
514         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
515         const int8x8_t vi19x01234567 = vld1_s8(i19);
516         const int8x8_t vk19x01234567 = vld1_s8((const void*) ((const int8_t*) w + 152));
517 
518         vprod01234567 = vmull_s8(vi19x01234567, vk19x01234567);
519 
520         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
521         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
522         const int8x8_t vi20x01234567 = vld1_s8(i20);
523         const int8x8_t vk20x01234567 = vld1_s8((const void*) ((const int8_t*) w + 160));
524 
525         vprod01234567 = vmull_s8(vi20x01234567, vk20x01234567);
526 
527         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
528         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
529         const int8x8_t vi21x01234567 = vld1_s8(i21);
530         const int8x8_t vk21x01234567 = vld1_s8((const void*) ((const int8_t*) w + 168));
531 
532         vprod01234567 = vmull_s8(vi21x01234567, vk21x01234567);
533 
534         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
535         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
536         const int8x8_t vi22x01234567 = vld1_s8(i22);
537         const int8x8_t vk22x01234567 = vld1_s8((const void*) ((const int8_t*) w + 176));
538 
539         vprod01234567 = vmull_s8(vi22x01234567, vk22x01234567);
540 
541         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
542         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
543         const int8x8_t vi23x01234567 = vld1_s8(i23);
544         const int8x8_t vk23x01234567 = vld1_s8((const void*) ((const int8_t*) w + 184));
545 
546         vprod01234567 = vmull_s8(vi23x01234567, vk23x01234567);
547 
548         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
549         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
550         const int8x8_t vi24x01234567 = vld1_s8(i24);
551         const int8x8_t vk24x01234567 = vld1_s8((const void*) ((const int8_t*) w + 192));
552 
553         vprod01234567 = vmull_s8(vi24x01234567, vk24x01234567);
554 
555         vacc0123 = vaddw_s16(vacc0123, vget_low_s16(vprod01234567));
556         vacc4567 = vaddw_s16(vacc4567, vget_high_s16(vprod01234567));
557 
558         vacc0123 = vqshlq_s32(vacc0123, vright_pre_shift);
559         vacc4567 = vqshlq_s32(vacc4567, vright_pre_shift);
560 
561         vacc0123 = vqdmulhq_s32(vacc0123, vmultiplier);
562         vacc4567 = vqdmulhq_s32(vacc4567, vmultiplier);
563 
564         vacc0123 = vrshlq_s32(vacc0123, vright_post_shift);
565         vacc4567 = vrshlq_s32(vacc4567, vright_post_shift);
566 
567 #if XNN_ARCH_ARM64
568         int16x8_t vacc01234567 = vqmovn_high_s32(vqmovn_s32(vacc0123), vacc4567);
569 #else
570         int16x8_t vacc01234567 = vcombine_s16(vqmovn_s32(vacc0123), vqmovn_s32(vacc4567));
571 #endif
572         vacc01234567 = vqaddq_s16(vacc01234567, voutput_zero_point);
573 
574         int8x8_t vout01234567 = vqmovn_s16(vacc01234567);
575         vout01234567 = vmax_s8(vout01234567, voutput_min);
576         vout01234567 = vmin_s8(vout01234567, voutput_max);
577 
578         if (c & 4) {
579           vst1_lane_u32((void*) output, vreinterpret_u32_s8(vout01234567), 0); output += 4;
580           vout01234567 = vext_s8(vout01234567, vout01234567, 4);
581         }
582         if (c & 2) {
583           vst1_lane_u16((void*) output, vreinterpret_u16_s8(vout01234567), 0); output += 2;
584           vout01234567 = vext_s8(vout01234567, vout01234567, 2);
585         }
586         if (c & 1) {
587           vst1_lane_s8(output, vout01234567, 0); output += 1;
588         }
589       }
590     }
591 
592     output = (int8_t*) ((uintptr_t) output + output_increment);
593   } while (--output_width != 0);
594 }
595