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