xref: /aosp_15_r20/external/XNNPACK/src/qs8-dwconv/gen/up24x9-minmax-fp32-neonv8-mul16.c (revision 4bdc94577ba0e567308109d787f7fec7b531ce36)
1 // Auto-generated file. Do not edit!
2 //   Template: src/qs8-dwconv/unipass-neon-mul16.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 #include <xnnpack/intrinsics-polyfill.h>
16 
17 
xnn_qs8_dwconv_minmax_fp32_ukernel_up24x9__neonv8_mul16(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)])18 void xnn_qs8_dwconv_minmax_fp32_ukernel_up24x9__neonv8_mul16(
19     size_t channels,
20     size_t output_width,
21     const int8_t** input,
22     const void* weights,
23     int8_t* output,
24     size_t input_stride,
25     size_t output_increment,
26     size_t input_offset,
27     const int8_t* zero,
28     const union xnn_qs8_conv_minmax_params params[restrict XNN_MIN_ELEMENTS(1)]) XNN_OOB_READS
29 {
30   assert(channels != 0);
31   assert(output_width != 0);
32 
33   const float32x4_t vscale = vld1q_dup_f32(&params->fp32_neonv8.scale);
34   const int16x8_t voutput_zero_point = vld1q_dup_s16(&params->fp32_neonv8.output_zero_point);
35   const int8x16_t voutput_min = vld1q_dup_s8(&params->fp32_neonv8.output_min);
36   const int8x16_t voutput_max = vld1q_dup_s8(&params->fp32_neonv8.output_max);
37   do {
38     const int8_t* i0 = input[0];
39     assert(i0 != NULL);
40     if XNN_UNPREDICTABLE(i0 != zero) {
41       i0 = (const int8_t*) ((uintptr_t) i0 + input_offset);
42     }
43     const int8_t* i1 = input[1];
44     assert(i1 != NULL);
45     if XNN_UNPREDICTABLE(i1 != zero) {
46       i1 = (const int8_t*) ((uintptr_t) i1 + input_offset);
47     }
48     const int8_t* i2 = input[2];
49     assert(i2 != NULL);
50     if XNN_UNPREDICTABLE(i2 != zero) {
51       i2 = (const int8_t*) ((uintptr_t) i2 + input_offset);
52     }
53     const int8_t* i3 = input[3];
54     assert(i3 != NULL);
55     if XNN_UNPREDICTABLE(i3 != zero) {
56       i3 = (const int8_t*) ((uintptr_t) i3 + input_offset);
57     }
58     const int8_t* i4 = input[4];
59     assert(i4 != NULL);
60     if XNN_UNPREDICTABLE(i4 != zero) {
61       i4 = (const int8_t*) ((uintptr_t) i4 + input_offset);
62     }
63     const int8_t* i5 = input[5];
64     assert(i5 != NULL);
65     if XNN_UNPREDICTABLE(i5 != zero) {
66       i5 = (const int8_t*) ((uintptr_t) i5 + input_offset);
67     }
68     const int8_t* i6 = input[6];
69     assert(i6 != NULL);
70     if XNN_UNPREDICTABLE(i6 != zero) {
71       i6 = (const int8_t*) ((uintptr_t) i6 + input_offset);
72     }
73     const int8_t* i7 = input[7];
74     assert(i7 != NULL);
75     if XNN_UNPREDICTABLE(i7 != zero) {
76       i7 = (const int8_t*) ((uintptr_t) i7 + input_offset);
77     }
78     const int8_t* i8 = input[8];
79     assert(i8 != NULL);
80     if XNN_UNPREDICTABLE(i8 != zero) {
81       i8 = (const int8_t*) ((uintptr_t) i8 + input_offset);
82     }
83     input = (const int8_t**) ((uintptr_t) input + input_stride);
84 
85     size_t c = channels;
86     const void* w = weights;
87     for (; c >= 24; c -= 24) {
88       int32x4_t vacc0123 = vld1q_s32(w); w = (const void*) ((const int32_t*) w + 4);
89       int32x4_t vacc4567 = vld1q_s32(w); w = (const void*) ((const int32_t*) w + 4);
90       int32x4_t vacc89AB = vld1q_s32(w); w = (const void*) ((const int32_t*) w + 4);
91       int32x4_t vaccCDEF = vld1q_s32(w); w = (const void*) ((const int32_t*) w + 4);
92       int32x4_t vaccGHIJ = vld1q_s32(w); w = (const void*) ((const int32_t*) w + 4);
93       int32x4_t vaccKLMN = vld1q_s32(w); w = (const void*) ((const int32_t*) w + 4);
94 
95 
96       const int16x8_t vi0x01234567 = vmovl_s8(vld1_s8(i0)); i0 += 8;
97       const int16x8_t vk0x01234567 = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
98       const int16x8_t vi0x89ABCDEF = vmovl_s8(vld1_s8(i0)); i0 += 8;
99       const int16x8_t vk0x89ABCDEF = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
100       const int16x8_t vi0xGHIJKLMN = vmovl_s8(vld1_s8(i0)); i0 += 8;
101       const int16x8_t vk0xGHIJKLMN = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
102 
103       vacc0123 = vmlal_s16(vacc0123, vget_low_s16(vi0x01234567), vget_low_s16(vk0x01234567));
104       vacc4567 = vmlal_s16(vacc4567, vget_high_s16(vi0x01234567), vget_high_s16(vk0x01234567));
105       vacc89AB = vmlal_s16(vacc89AB, vget_low_s16(vi0x89ABCDEF), vget_low_s16(vk0x89ABCDEF));
106       vaccCDEF = vmlal_s16(vaccCDEF, vget_high_s16(vi0x89ABCDEF), vget_high_s16(vk0x89ABCDEF));
107       vaccGHIJ = vmlal_s16(vaccGHIJ, vget_low_s16(vi0xGHIJKLMN), vget_low_s16(vk0xGHIJKLMN));
108       vaccKLMN = vmlal_s16(vaccKLMN, vget_high_s16(vi0xGHIJKLMN), vget_high_s16(vk0xGHIJKLMN));
109 
110       const int16x8_t vi1x01234567 = vmovl_s8(vld1_s8(i1)); i1 += 8;
111       const int16x8_t vk1x01234567 = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
112       const int16x8_t vi1x89ABCDEF = vmovl_s8(vld1_s8(i1)); i1 += 8;
113       const int16x8_t vk1x89ABCDEF = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
114       const int16x8_t vi1xGHIJKLMN = vmovl_s8(vld1_s8(i1)); i1 += 8;
115       const int16x8_t vk1xGHIJKLMN = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
116 
117       vacc0123 = vmlal_s16(vacc0123, vget_low_s16(vi1x01234567), vget_low_s16(vk1x01234567));
118       vacc4567 = vmlal_s16(vacc4567, vget_high_s16(vi1x01234567), vget_high_s16(vk1x01234567));
119       vacc89AB = vmlal_s16(vacc89AB, vget_low_s16(vi1x89ABCDEF), vget_low_s16(vk1x89ABCDEF));
120       vaccCDEF = vmlal_s16(vaccCDEF, vget_high_s16(vi1x89ABCDEF), vget_high_s16(vk1x89ABCDEF));
121       vaccGHIJ = vmlal_s16(vaccGHIJ, vget_low_s16(vi1xGHIJKLMN), vget_low_s16(vk1xGHIJKLMN));
122       vaccKLMN = vmlal_s16(vaccKLMN, vget_high_s16(vi1xGHIJKLMN), vget_high_s16(vk1xGHIJKLMN));
123 
124       const int16x8_t vi2x01234567 = vmovl_s8(vld1_s8(i2)); i2 += 8;
125       const int16x8_t vk2x01234567 = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
126       const int16x8_t vi2x89ABCDEF = vmovl_s8(vld1_s8(i2)); i2 += 8;
127       const int16x8_t vk2x89ABCDEF = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
128       const int16x8_t vi2xGHIJKLMN = vmovl_s8(vld1_s8(i2)); i2 += 8;
129       const int16x8_t vk2xGHIJKLMN = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
130 
131       vacc0123 = vmlal_s16(vacc0123, vget_low_s16(vi2x01234567), vget_low_s16(vk2x01234567));
132       vacc4567 = vmlal_s16(vacc4567, vget_high_s16(vi2x01234567), vget_high_s16(vk2x01234567));
133       vacc89AB = vmlal_s16(vacc89AB, vget_low_s16(vi2x89ABCDEF), vget_low_s16(vk2x89ABCDEF));
134       vaccCDEF = vmlal_s16(vaccCDEF, vget_high_s16(vi2x89ABCDEF), vget_high_s16(vk2x89ABCDEF));
135       vaccGHIJ = vmlal_s16(vaccGHIJ, vget_low_s16(vi2xGHIJKLMN), vget_low_s16(vk2xGHIJKLMN));
136       vaccKLMN = vmlal_s16(vaccKLMN, vget_high_s16(vi2xGHIJKLMN), vget_high_s16(vk2xGHIJKLMN));
137 
138       const int16x8_t vi3x01234567 = vmovl_s8(vld1_s8(i3)); i3 += 8;
139       const int16x8_t vk3x01234567 = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
140       const int16x8_t vi3x89ABCDEF = vmovl_s8(vld1_s8(i3)); i3 += 8;
141       const int16x8_t vk3x89ABCDEF = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
142       const int16x8_t vi3xGHIJKLMN = vmovl_s8(vld1_s8(i3)); i3 += 8;
143       const int16x8_t vk3xGHIJKLMN = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
144 
145       vacc0123 = vmlal_s16(vacc0123, vget_low_s16(vi3x01234567), vget_low_s16(vk3x01234567));
146       vacc4567 = vmlal_s16(vacc4567, vget_high_s16(vi3x01234567), vget_high_s16(vk3x01234567));
147       vacc89AB = vmlal_s16(vacc89AB, vget_low_s16(vi3x89ABCDEF), vget_low_s16(vk3x89ABCDEF));
148       vaccCDEF = vmlal_s16(vaccCDEF, vget_high_s16(vi3x89ABCDEF), vget_high_s16(vk3x89ABCDEF));
149       vaccGHIJ = vmlal_s16(vaccGHIJ, vget_low_s16(vi3xGHIJKLMN), vget_low_s16(vk3xGHIJKLMN));
150       vaccKLMN = vmlal_s16(vaccKLMN, vget_high_s16(vi3xGHIJKLMN), vget_high_s16(vk3xGHIJKLMN));
151 
152       const int16x8_t vi4x01234567 = vmovl_s8(vld1_s8(i4)); i4 += 8;
153       const int16x8_t vk4x01234567 = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
154       const int16x8_t vi4x89ABCDEF = vmovl_s8(vld1_s8(i4)); i4 += 8;
155       const int16x8_t vk4x89ABCDEF = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
156       const int16x8_t vi4xGHIJKLMN = vmovl_s8(vld1_s8(i4)); i4 += 8;
157       const int16x8_t vk4xGHIJKLMN = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
158 
159       vacc0123 = vmlal_s16(vacc0123, vget_low_s16(vi4x01234567), vget_low_s16(vk4x01234567));
160       vacc4567 = vmlal_s16(vacc4567, vget_high_s16(vi4x01234567), vget_high_s16(vk4x01234567));
161       vacc89AB = vmlal_s16(vacc89AB, vget_low_s16(vi4x89ABCDEF), vget_low_s16(vk4x89ABCDEF));
162       vaccCDEF = vmlal_s16(vaccCDEF, vget_high_s16(vi4x89ABCDEF), vget_high_s16(vk4x89ABCDEF));
163       vaccGHIJ = vmlal_s16(vaccGHIJ, vget_low_s16(vi4xGHIJKLMN), vget_low_s16(vk4xGHIJKLMN));
164       vaccKLMN = vmlal_s16(vaccKLMN, vget_high_s16(vi4xGHIJKLMN), vget_high_s16(vk4xGHIJKLMN));
165 
166       const int16x8_t vi5x01234567 = vmovl_s8(vld1_s8(i5)); i5 += 8;
167       const int16x8_t vk5x01234567 = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
168       const int16x8_t vi5x89ABCDEF = vmovl_s8(vld1_s8(i5)); i5 += 8;
169       const int16x8_t vk5x89ABCDEF = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
170       const int16x8_t vi5xGHIJKLMN = vmovl_s8(vld1_s8(i5)); i5 += 8;
171       const int16x8_t vk5xGHIJKLMN = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
172 
173       vacc0123 = vmlal_s16(vacc0123, vget_low_s16(vi5x01234567), vget_low_s16(vk5x01234567));
174       vacc4567 = vmlal_s16(vacc4567, vget_high_s16(vi5x01234567), vget_high_s16(vk5x01234567));
175       vacc89AB = vmlal_s16(vacc89AB, vget_low_s16(vi5x89ABCDEF), vget_low_s16(vk5x89ABCDEF));
176       vaccCDEF = vmlal_s16(vaccCDEF, vget_high_s16(vi5x89ABCDEF), vget_high_s16(vk5x89ABCDEF));
177       vaccGHIJ = vmlal_s16(vaccGHIJ, vget_low_s16(vi5xGHIJKLMN), vget_low_s16(vk5xGHIJKLMN));
178       vaccKLMN = vmlal_s16(vaccKLMN, vget_high_s16(vi5xGHIJKLMN), vget_high_s16(vk5xGHIJKLMN));
179 
180       const int16x8_t vi6x01234567 = vmovl_s8(vld1_s8(i6)); i6 += 8;
181       const int16x8_t vk6x01234567 = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
182       const int16x8_t vi6x89ABCDEF = vmovl_s8(vld1_s8(i6)); i6 += 8;
183       const int16x8_t vk6x89ABCDEF = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
184       const int16x8_t vi6xGHIJKLMN = vmovl_s8(vld1_s8(i6)); i6 += 8;
185       const int16x8_t vk6xGHIJKLMN = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
186 
187       vacc0123 = vmlal_s16(vacc0123, vget_low_s16(vi6x01234567), vget_low_s16(vk6x01234567));
188       vacc4567 = vmlal_s16(vacc4567, vget_high_s16(vi6x01234567), vget_high_s16(vk6x01234567));
189       vacc89AB = vmlal_s16(vacc89AB, vget_low_s16(vi6x89ABCDEF), vget_low_s16(vk6x89ABCDEF));
190       vaccCDEF = vmlal_s16(vaccCDEF, vget_high_s16(vi6x89ABCDEF), vget_high_s16(vk6x89ABCDEF));
191       vaccGHIJ = vmlal_s16(vaccGHIJ, vget_low_s16(vi6xGHIJKLMN), vget_low_s16(vk6xGHIJKLMN));
192       vaccKLMN = vmlal_s16(vaccKLMN, vget_high_s16(vi6xGHIJKLMN), vget_high_s16(vk6xGHIJKLMN));
193 
194       const int16x8_t vi7x01234567 = vmovl_s8(vld1_s8(i7)); i7 += 8;
195       const int16x8_t vk7x01234567 = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
196       const int16x8_t vi7x89ABCDEF = vmovl_s8(vld1_s8(i7)); i7 += 8;
197       const int16x8_t vk7x89ABCDEF = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
198       const int16x8_t vi7xGHIJKLMN = vmovl_s8(vld1_s8(i7)); i7 += 8;
199       const int16x8_t vk7xGHIJKLMN = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
200 
201       vacc0123 = vmlal_s16(vacc0123, vget_low_s16(vi7x01234567), vget_low_s16(vk7x01234567));
202       vacc4567 = vmlal_s16(vacc4567, vget_high_s16(vi7x01234567), vget_high_s16(vk7x01234567));
203       vacc89AB = vmlal_s16(vacc89AB, vget_low_s16(vi7x89ABCDEF), vget_low_s16(vk7x89ABCDEF));
204       vaccCDEF = vmlal_s16(vaccCDEF, vget_high_s16(vi7x89ABCDEF), vget_high_s16(vk7x89ABCDEF));
205       vaccGHIJ = vmlal_s16(vaccGHIJ, vget_low_s16(vi7xGHIJKLMN), vget_low_s16(vk7xGHIJKLMN));
206       vaccKLMN = vmlal_s16(vaccKLMN, vget_high_s16(vi7xGHIJKLMN), vget_high_s16(vk7xGHIJKLMN));
207 
208       const int16x8_t vi8x01234567 = vmovl_s8(vld1_s8(i8)); i8 += 8;
209       const int16x8_t vk8x01234567 = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
210       const int16x8_t vi8x89ABCDEF = vmovl_s8(vld1_s8(i8)); i8 += 8;
211       const int16x8_t vk8x89ABCDEF = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
212       const int16x8_t vi8xGHIJKLMN = vmovl_s8(vld1_s8(i8)); i8 += 8;
213       const int16x8_t vk8xGHIJKLMN = vmovl_s8(vld1_s8(w)); w = (const void*) ((const int8_t*) w + 8);
214 
215       vacc0123 = vmlal_s16(vacc0123, vget_low_s16(vi8x01234567), vget_low_s16(vk8x01234567));
216       vacc4567 = vmlal_s16(vacc4567, vget_high_s16(vi8x01234567), vget_high_s16(vk8x01234567));
217       vacc89AB = vmlal_s16(vacc89AB, vget_low_s16(vi8x89ABCDEF), vget_low_s16(vk8x89ABCDEF));
218       vaccCDEF = vmlal_s16(vaccCDEF, vget_high_s16(vi8x89ABCDEF), vget_high_s16(vk8x89ABCDEF));
219       vaccGHIJ = vmlal_s16(vaccGHIJ, vget_low_s16(vi8xGHIJKLMN), vget_low_s16(vk8xGHIJKLMN));
220       vaccKLMN = vmlal_s16(vaccKLMN, vget_high_s16(vi8xGHIJKLMN), vget_high_s16(vk8xGHIJKLMN));
221 
222       float32x4_t vfpacc0123 = vcvtq_f32_s32(vacc0123);
223       float32x4_t vfpacc4567 = vcvtq_f32_s32(vacc4567);
224       float32x4_t vfpacc89AB = vcvtq_f32_s32(vacc89AB);
225       float32x4_t vfpaccCDEF = vcvtq_f32_s32(vaccCDEF);
226       float32x4_t vfpaccGHIJ = vcvtq_f32_s32(vaccGHIJ);
227       float32x4_t vfpaccKLMN = vcvtq_f32_s32(vaccKLMN);
228 
229       vfpacc0123 = vmulq_f32(vfpacc0123, vscale);
230       vfpacc4567 = vmulq_f32(vfpacc4567, vscale);
231       vfpacc89AB = vmulq_f32(vfpacc89AB, vscale);
232       vfpaccCDEF = vmulq_f32(vfpaccCDEF, vscale);
233       vfpaccGHIJ = vmulq_f32(vfpaccGHIJ, vscale);
234       vfpaccKLMN = vmulq_f32(vfpaccKLMN, vscale);
235 
236       vacc0123 = vcvtnq_s32_f32(vfpacc0123);
237       vacc4567 = vcvtnq_s32_f32(vfpacc4567);
238       vacc89AB = vcvtnq_s32_f32(vfpacc89AB);
239       vaccCDEF = vcvtnq_s32_f32(vfpaccCDEF);
240       vaccGHIJ = vcvtnq_s32_f32(vfpaccGHIJ);
241       vaccKLMN = vcvtnq_s32_f32(vfpaccKLMN);
242 
243 #if XNN_ARCH_ARM64
244       int16x8_t vacc01234567 = vqmovn_high_s32(vqmovn_s32(vacc0123), vacc4567);
245       int16x8_t vacc89ABCDEF = vqmovn_high_s32(vqmovn_s32(vacc89AB), vaccCDEF);
246       int16x8_t vaccGHIJKLMN = vqmovn_high_s32(vqmovn_s32(vaccGHIJ), vaccKLMN);
247 
248       vacc01234567 = vqaddq_s16(vacc01234567, voutput_zero_point);
249       vacc89ABCDEF = vqaddq_s16(vacc89ABCDEF, voutput_zero_point);
250       vaccGHIJKLMN = vqaddq_s16(vaccGHIJKLMN, voutput_zero_point);
251 
252       int8x16_t vout0123456789ABCDEF = vqmovn_high_s16(vqmovn_s16(vacc01234567), vacc89ABCDEF);
253       int8x8_t voutGHIJKLMN = vqmovn_s16(vaccGHIJKLMN);
254 #else  // !XNN_ARCH_ARM64
255       int16x8_t vacc01234567 = vcombine_s16(vqmovn_s32(vacc0123), vqmovn_s32(vacc4567));
256       int16x8_t vacc89ABCDEF = vcombine_s16(vqmovn_s32(vacc89AB), vqmovn_s32(vaccCDEF));
257       int16x8_t vaccGHIJKLMN = vcombine_s16(vqmovn_s32(vaccGHIJ), vqmovn_s32(vaccKLMN));
258 
259       vacc01234567 = vqaddq_s16(vacc01234567, voutput_zero_point);
260       vacc89ABCDEF = vqaddq_s16(vacc89ABCDEF, voutput_zero_point);
261       vaccGHIJKLMN = vqaddq_s16(vaccGHIJKLMN, voutput_zero_point);
262 
263       int8x16_t vout0123456789ABCDEF = vcombine_s8(vqmovn_s16(vacc01234567), vqmovn_s16(vacc89ABCDEF));
264       int8x8_t voutGHIJKLMN = vqmovn_s16(vaccGHIJKLMN);
265 #endif  // !XNN_ARCH_ARM64
266 
267       vout0123456789ABCDEF = vmaxq_s8(vout0123456789ABCDEF, voutput_min);
268       voutGHIJKLMN = vmax_s8(voutGHIJKLMN, vget_low_s8(voutput_min));
269 
270       vout0123456789ABCDEF = vminq_s8(vout0123456789ABCDEF, voutput_max);
271       voutGHIJKLMN = vmin_s8(voutGHIJKLMN, vget_low_s8(voutput_max));
272 
273       vst1q_s8(output, vout0123456789ABCDEF); output += 16;
274       vst1_s8(output, voutGHIJKLMN); output += 8;
275     }
276     if XNN_UNLIKELY(c != 0) {
277       const int8_t* k = (const int8_t*) ((const int32_t*) w + 24);
278       do {
279         int32x4_t vacc0123 = vld1q_s32(w); w = (const void*) ((const int32_t*) w + 4);
280         int32x4_t vacc4567 = vld1q_s32(w); w = (const void*) ((const int32_t*) w + 4);
281 
282         const int16x8_t vi0x01234567 = vmovl_s8(vld1_s8(i0)); i0 += 8;
283         const int16x8_t vk0x01234567 = vmovl_s8(vld1_s8(k)); k += 8;
284 
285         vacc0123 = vmlal_s16(vacc0123, vget_low_s16(vi0x01234567), vget_low_s16(vk0x01234567));
286         vacc4567 = vmlal_s16(vacc4567, vget_high_s16(vi0x01234567), vget_high_s16(vk0x01234567));
287         const int16x8_t vi1x01234567 = vmovl_s8(vld1_s8(i1)); i1 += 8;
288         const int16x8_t vk1x01234567 = vmovl_s8(vld1_s8((const void*) (k + 16)));
289 
290         vacc0123 = vmlal_s16(vacc0123, vget_low_s16(vi1x01234567), vget_low_s16(vk1x01234567));
291         vacc4567 = vmlal_s16(vacc4567, vget_high_s16(vi1x01234567), vget_high_s16(vk1x01234567));
292         const int16x8_t vi2x01234567 = vmovl_s8(vld1_s8(i2)); i2 += 8;
293         const int16x8_t vk2x01234567 = vmovl_s8(vld1_s8((const void*) (k + 40)));
294 
295         vacc0123 = vmlal_s16(vacc0123, vget_low_s16(vi2x01234567), vget_low_s16(vk2x01234567));
296         vacc4567 = vmlal_s16(vacc4567, vget_high_s16(vi2x01234567), vget_high_s16(vk2x01234567));
297         const int16x8_t vi3x01234567 = vmovl_s8(vld1_s8(i3)); i3 += 8;
298         const int16x8_t vk3x01234567 = vmovl_s8(vld1_s8((const void*) (k + 64)));
299 
300         vacc0123 = vmlal_s16(vacc0123, vget_low_s16(vi3x01234567), vget_low_s16(vk3x01234567));
301         vacc4567 = vmlal_s16(vacc4567, vget_high_s16(vi3x01234567), vget_high_s16(vk3x01234567));
302         const int16x8_t vi4x01234567 = vmovl_s8(vld1_s8(i4)); i4 += 8;
303         const int16x8_t vk4x01234567 = vmovl_s8(vld1_s8((const void*) (k + 88)));
304 
305         vacc0123 = vmlal_s16(vacc0123, vget_low_s16(vi4x01234567), vget_low_s16(vk4x01234567));
306         vacc4567 = vmlal_s16(vacc4567, vget_high_s16(vi4x01234567), vget_high_s16(vk4x01234567));
307         const int16x8_t vi5x01234567 = vmovl_s8(vld1_s8(i5)); i5 += 8;
308         const int16x8_t vk5x01234567 = vmovl_s8(vld1_s8((const void*) (k + 112)));
309 
310         vacc0123 = vmlal_s16(vacc0123, vget_low_s16(vi5x01234567), vget_low_s16(vk5x01234567));
311         vacc4567 = vmlal_s16(vacc4567, vget_high_s16(vi5x01234567), vget_high_s16(vk5x01234567));
312         const int16x8_t vi6x01234567 = vmovl_s8(vld1_s8(i6)); i6 += 8;
313         const int16x8_t vk6x01234567 = vmovl_s8(vld1_s8((const void*) (k + 136)));
314 
315         vacc0123 = vmlal_s16(vacc0123, vget_low_s16(vi6x01234567), vget_low_s16(vk6x01234567));
316         vacc4567 = vmlal_s16(vacc4567, vget_high_s16(vi6x01234567), vget_high_s16(vk6x01234567));
317         const int16x8_t vi7x01234567 = vmovl_s8(vld1_s8(i7)); i7 += 8;
318         const int16x8_t vk7x01234567 = vmovl_s8(vld1_s8((const void*) (k + 160)));
319 
320         vacc0123 = vmlal_s16(vacc0123, vget_low_s16(vi7x01234567), vget_low_s16(vk7x01234567));
321         vacc4567 = vmlal_s16(vacc4567, vget_high_s16(vi7x01234567), vget_high_s16(vk7x01234567));
322         const int16x8_t vi8x01234567 = vmovl_s8(vld1_s8(i8)); i8 += 8;
323         const int16x8_t vk8x01234567 = vmovl_s8(vld1_s8((const void*) (k + 184)));
324 
325         vacc0123 = vmlal_s16(vacc0123, vget_low_s16(vi8x01234567), vget_low_s16(vk8x01234567));
326         vacc4567 = vmlal_s16(vacc4567, vget_high_s16(vi8x01234567), vget_high_s16(vk8x01234567));
327 
328         float32x4_t vfpacc0123 = vcvtq_f32_s32(vacc0123);
329         float32x4_t vfpacc4567 = vcvtq_f32_s32(vacc4567);
330 
331         vfpacc0123 = vmulq_f32(vfpacc0123, vscale);
332         vfpacc4567 = vmulq_f32(vfpacc4567, vscale);
333 
334         vacc0123 = vcvtnq_s32_f32(vfpacc0123);
335         vacc4567 = vcvtnq_s32_f32(vfpacc4567);
336 
337 #if XNN_ARCH_ARM64
338         int16x8_t vacc01234567 = vqmovn_high_s32(vqmovn_s32(vacc0123), vacc4567);
339 #else
340         int16x8_t vacc01234567 = vcombine_s16(vqmovn_s32(vacc0123), vqmovn_s32(vacc4567));
341 #endif
342         vacc01234567 = vqaddq_s16(vacc01234567, voutput_zero_point);
343 
344         int8x8_t vout01234567 = vqmovn_s16(vacc01234567);
345         vout01234567 = vmax_s8(vout01234567, vget_low_s8(voutput_min));
346         vout01234567 = vmin_s8(vout01234567, vget_low_s8(voutput_max));
347 
348         if XNN_LIKELY(c >= 8) {
349           vst1_s8(output, vout01234567); output += 8;
350           c -= 8;
351         } else {
352           if (c & 4) {
353             vst1_lane_u32((void*) output, vreinterpret_u32_s8(vout01234567), 0); output += 4;
354             vout01234567 = vext_s8(vout01234567, vout01234567, 4);
355           }
356           if (c & 2) {
357             vst1_lane_u16((void*) output, vreinterpret_u16_s8(vout01234567), 0); output += 2;
358             vout01234567 = vext_s8(vout01234567, vout01234567, 2);
359           }
360           if (c & 1) {
361             vst1_lane_s8(output, vout01234567, 0); output += 1;
362           }
363           c = 0;
364         }
365       } while (c != 0);
366     }
367 
368     output = (int8_t*) ((uintptr_t) output + output_increment);
369   } while (--output_width != 0);
370 }
371