1 // Auto-generated file. Do not edit!
2 // Template: src/qs8-igemm/c4-neon-mull-dup.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2021 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/gemm.h>
15 #include <xnnpack/math.h>
16
17
xnn_qs8_igemm_minmax_rndnu_ukernel_4x16c4__neon_mlal_dup(size_t mr,size_t nc,size_t kc,size_t ks,const int8_t ** restrict a,const void * restrict w,int8_t * restrict c,size_t cm_stride,size_t cn_stride,size_t a_offset,const int8_t * zero,const union xnn_qs8_conv_minmax_params params[restrict XNN_MIN_ELEMENTS (1)])18 void xnn_qs8_igemm_minmax_rndnu_ukernel_4x16c4__neon_mlal_dup(
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 int8_t* restrict c,
26 size_t cm_stride,
27 size_t cn_stride,
28 size_t a_offset,
29 const int8_t* zero,
30 const union xnn_qs8_conv_minmax_params params[restrict XNN_MIN_ELEMENTS(1)]) XNN_OOB_READS
31 {
32 assert(mr != 0);
33 assert(mr <= 4);
34 assert(nc != 0);
35 assert(kc != 0);
36 assert(ks != 0);
37 assert(ks % (4 * sizeof(void*)) == 0);
38 assert(a_offset % sizeof(int8_t) == 0);
39 assert(a != NULL);
40 assert(w != NULL);
41 assert(c != NULL);
42
43 kc = round_up_po2(kc, 4 * sizeof(int8_t));
44 int8_t* c0 = c;
45 int8_t* c1 = (int8_t*) ((uintptr_t) c0 + cm_stride);
46 if XNN_UNPREDICTABLE(mr < 2) {
47 c1 = c0;
48 }
49 int8_t* c2 = (int8_t*) ((uintptr_t) c1 + cm_stride);
50 if XNN_UNPREDICTABLE(mr <= 2) {
51 c2 = c1;
52 }
53 int8_t* c3 = (int8_t*) ((uintptr_t) c2 + cm_stride);
54 if XNN_UNPREDICTABLE(mr != 4) {
55 c3 = c2;
56 }
57
58 do {
59 int32x4_t vacc0x01 = vreinterpretq_s32_u64(vmovl_u32(vld1_u32(w))); w = (const void*) ((uintptr_t) w + 2 * sizeof(int32_t));
60 int32x4_t vacc0x23 = vreinterpretq_s32_u64(vmovl_u32(vld1_u32(w))); w = (const void*) ((uintptr_t) w + 2 * sizeof(int32_t));
61 int32x4_t vacc0x45 = vreinterpretq_s32_u64(vmovl_u32(vld1_u32(w))); w = (const void*) ((uintptr_t) w + 2 * sizeof(int32_t));
62 int32x4_t vacc0x67 = vreinterpretq_s32_u64(vmovl_u32(vld1_u32(w))); w = (const void*) ((uintptr_t) w + 2 * sizeof(int32_t));
63 int32x4_t vacc0x89 = vreinterpretq_s32_u64(vmovl_u32(vld1_u32(w))); w = (const void*) ((uintptr_t) w + 2 * sizeof(int32_t));
64 int32x4_t vacc0xAB = vreinterpretq_s32_u64(vmovl_u32(vld1_u32(w))); w = (const void*) ((uintptr_t) w + 2 * sizeof(int32_t));
65 int32x4_t vacc0xCD = vreinterpretq_s32_u64(vmovl_u32(vld1_u32(w))); w = (const void*) ((uintptr_t) w + 2 * sizeof(int32_t));
66 int32x4_t vacc0xEF = vreinterpretq_s32_u64(vmovl_u32(vld1_u32(w))); w = (const void*) ((uintptr_t) w + 2 * sizeof(int32_t));
67 int32x4_t vacc1x01 = vacc0x01;
68 int32x4_t vacc1x23 = vacc0x23;
69 int32x4_t vacc1x45 = vacc0x45;
70 int32x4_t vacc1x67 = vacc0x67;
71 int32x4_t vacc1x89 = vacc0x89;
72 int32x4_t vacc1xAB = vacc0xAB;
73 int32x4_t vacc1xCD = vacc0xCD;
74 int32x4_t vacc1xEF = vacc0xEF;
75 int32x4_t vacc2x01 = vacc0x01;
76 int32x4_t vacc2x23 = vacc0x23;
77 int32x4_t vacc2x45 = vacc0x45;
78 int32x4_t vacc2x67 = vacc0x67;
79 int32x4_t vacc2x89 = vacc0x89;
80 int32x4_t vacc2xAB = vacc0xAB;
81 int32x4_t vacc2xCD = vacc0xCD;
82 int32x4_t vacc2xEF = vacc0xEF;
83 int32x4_t vacc3x01 = vacc0x01;
84 int32x4_t vacc3x23 = vacc0x23;
85 int32x4_t vacc3x45 = vacc0x45;
86 int32x4_t vacc3x67 = vacc0x67;
87 int32x4_t vacc3x89 = vacc0x89;
88 int32x4_t vacc3xAB = vacc0xAB;
89 int32x4_t vacc3xCD = vacc0xCD;
90 int32x4_t vacc3xEF = vacc0xEF;
91
92 size_t p = ks;
93 do {
94 const int8_t* restrict a0 = a[0];
95 if XNN_UNPREDICTABLE(a0 != zero) {
96 a0 = (const int8_t*) ((uintptr_t) a0 + a_offset);
97 }
98 const int8_t* restrict a1 = a[1];
99 if XNN_UNPREDICTABLE(a1 != zero) {
100 a1 = (const int8_t*) ((uintptr_t) a1 + a_offset);
101 }
102 const int8_t* restrict a2 = a[2];
103 if XNN_UNPREDICTABLE(a2 != zero) {
104 a2 = (const int8_t*) ((uintptr_t) a2 + a_offset);
105 }
106 const int8_t* restrict a3 = a[3];
107 if XNN_UNPREDICTABLE(a3 != zero) {
108 a3 = (const int8_t*) ((uintptr_t) a3 + a_offset);
109 }
110 a += 4;
111
112 size_t k = kc;
113
114 while (k >= 16 * sizeof(int8_t)) {
115 const int8x8_t va0x0 = vld1_s8(a0); a0 += 8;
116 const int8x8_t va0x1 = vld1_s8(a0); a0 += 8;
117 const int8x8_t va1x0 = vld1_s8(a1); a1 += 8;
118 const int8x8_t va1x1 = vld1_s8(a1); a1 += 8;
119 const int8x8_t va2x0 = vld1_s8(a2); a2 += 8;
120 const int8x8_t va2x1 = vld1_s8(a2); a2 += 8;
121 const int8x8_t va3x0 = vld1_s8(a3); a3 += 8;
122 const int8x8_t va3x1 = vld1_s8(a3); a3 += 8;
123
124 const int8x8_t vb01c0x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
125 const int8x8_t vb23c0x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
126 const int8x8_t vb45c0x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
127 const int8x8_t vb67c0x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
128 const int8x8_t vb89c0x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
129 const int8x8_t vbABc0x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
130 const int8x8_t vbCDc0x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
131 const int8x8_t vbEFc0x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
132 const int8x8_t vb01c1x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
133 const int8x8_t vb23c1x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
134 const int8x8_t vb45c1x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
135 const int8x8_t vb67c1x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
136 const int8x8_t vb89c1x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
137 const int8x8_t vbABc1x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
138 const int8x8_t vbCDc1x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
139 const int8x8_t vbEFc1x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
140
141 const int8x8_t va0c0x0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va0x0), 0));
142 const int8x8_t va0c0x1 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va0x1), 0));
143 const int8x8_t va1c0x0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va1x0), 0));
144 const int8x8_t va1c0x1 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va1x1), 0));
145 const int8x8_t va2c0x0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va2x0), 0));
146 const int8x8_t va2c0x1 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va2x1), 0));
147 const int8x8_t va3c0x0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va3x0), 0));
148 const int8x8_t va3c0x1 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va3x1), 0));
149
150 int16x8_t vprod0x01c0 = vmull_s8(vb01c0x0, va0c0x0);
151 int16x8_t vprod1x01c0 = vmull_s8(vb01c0x0, va1c0x0);
152 int16x8_t vprod2x01c0 = vmull_s8(vb01c0x0, va2c0x0);
153 int16x8_t vprod3x01c0 = vmull_s8(vb01c0x0, va3c0x0);
154 const int8x8_t vb01c0x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
155 vprod0x01c0 = vmlal_s8(vprod0x01c0, vb01c0x1, va0c0x1);
156 vprod1x01c0 = vmlal_s8(vprod1x01c0, vb01c0x1, va1c0x1);
157 vprod2x01c0 = vmlal_s8(vprod2x01c0, vb01c0x1, va2c0x1);
158 vprod3x01c0 = vmlal_s8(vprod3x01c0, vb01c0x1, va3c0x1);
159 vacc0x01 = vpadalq_s16(vacc0x01, vprod0x01c0);
160 vacc1x01 = vpadalq_s16(vacc1x01, vprod1x01c0);
161 vacc2x01 = vpadalq_s16(vacc2x01, vprod2x01c0);
162 vacc3x01 = vpadalq_s16(vacc3x01, vprod3x01c0);
163 int16x8_t vprod0x23c0 = vmull_s8(vb23c0x0, va0c0x0);
164 int16x8_t vprod1x23c0 = vmull_s8(vb23c0x0, va1c0x0);
165 int16x8_t vprod2x23c0 = vmull_s8(vb23c0x0, va2c0x0);
166 int16x8_t vprod3x23c0 = vmull_s8(vb23c0x0, va3c0x0);
167 const int8x8_t vb23c0x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
168 vprod0x23c0 = vmlal_s8(vprod0x23c0, vb23c0x1, va0c0x1);
169 vprod1x23c0 = vmlal_s8(vprod1x23c0, vb23c0x1, va1c0x1);
170 vprod2x23c0 = vmlal_s8(vprod2x23c0, vb23c0x1, va2c0x1);
171 vprod3x23c0 = vmlal_s8(vprod3x23c0, vb23c0x1, va3c0x1);
172 vacc0x23 = vpadalq_s16(vacc0x23, vprod0x23c0);
173 vacc1x23 = vpadalq_s16(vacc1x23, vprod1x23c0);
174 vacc2x23 = vpadalq_s16(vacc2x23, vprod2x23c0);
175 vacc3x23 = vpadalq_s16(vacc3x23, vprod3x23c0);
176 int16x8_t vprod0x45c0 = vmull_s8(vb45c0x0, va0c0x0);
177 int16x8_t vprod1x45c0 = vmull_s8(vb45c0x0, va1c0x0);
178 int16x8_t vprod2x45c0 = vmull_s8(vb45c0x0, va2c0x0);
179 int16x8_t vprod3x45c0 = vmull_s8(vb45c0x0, va3c0x0);
180 const int8x8_t vb45c0x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
181 vprod0x45c0 = vmlal_s8(vprod0x45c0, vb45c0x1, va0c0x1);
182 vprod1x45c0 = vmlal_s8(vprod1x45c0, vb45c0x1, va1c0x1);
183 vprod2x45c0 = vmlal_s8(vprod2x45c0, vb45c0x1, va2c0x1);
184 vprod3x45c0 = vmlal_s8(vprod3x45c0, vb45c0x1, va3c0x1);
185 vacc0x45 = vpadalq_s16(vacc0x45, vprod0x45c0);
186 vacc1x45 = vpadalq_s16(vacc1x45, vprod1x45c0);
187 vacc2x45 = vpadalq_s16(vacc2x45, vprod2x45c0);
188 vacc3x45 = vpadalq_s16(vacc3x45, vprod3x45c0);
189 int16x8_t vprod0x67c0 = vmull_s8(vb67c0x0, va0c0x0);
190 int16x8_t vprod1x67c0 = vmull_s8(vb67c0x0, va1c0x0);
191 int16x8_t vprod2x67c0 = vmull_s8(vb67c0x0, va2c0x0);
192 int16x8_t vprod3x67c0 = vmull_s8(vb67c0x0, va3c0x0);
193 const int8x8_t vb67c0x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
194 vprod0x67c0 = vmlal_s8(vprod0x67c0, vb67c0x1, va0c0x1);
195 vprod1x67c0 = vmlal_s8(vprod1x67c0, vb67c0x1, va1c0x1);
196 vprod2x67c0 = vmlal_s8(vprod2x67c0, vb67c0x1, va2c0x1);
197 vprod3x67c0 = vmlal_s8(vprod3x67c0, vb67c0x1, va3c0x1);
198 vacc0x67 = vpadalq_s16(vacc0x67, vprod0x67c0);
199 vacc1x67 = vpadalq_s16(vacc1x67, vprod1x67c0);
200 vacc2x67 = vpadalq_s16(vacc2x67, vprod2x67c0);
201 vacc3x67 = vpadalq_s16(vacc3x67, vprod3x67c0);
202 int16x8_t vprod0x89c0 = vmull_s8(vb89c0x0, va0c0x0);
203 int16x8_t vprod1x89c0 = vmull_s8(vb89c0x0, va1c0x0);
204 int16x8_t vprod2x89c0 = vmull_s8(vb89c0x0, va2c0x0);
205 int16x8_t vprod3x89c0 = vmull_s8(vb89c0x0, va3c0x0);
206 const int8x8_t vb89c0x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
207 vprod0x89c0 = vmlal_s8(vprod0x89c0, vb89c0x1, va0c0x1);
208 vprod1x89c0 = vmlal_s8(vprod1x89c0, vb89c0x1, va1c0x1);
209 vprod2x89c0 = vmlal_s8(vprod2x89c0, vb89c0x1, va2c0x1);
210 vprod3x89c0 = vmlal_s8(vprod3x89c0, vb89c0x1, va3c0x1);
211 vacc0x89 = vpadalq_s16(vacc0x89, vprod0x89c0);
212 vacc1x89 = vpadalq_s16(vacc1x89, vprod1x89c0);
213 vacc2x89 = vpadalq_s16(vacc2x89, vprod2x89c0);
214 vacc3x89 = vpadalq_s16(vacc3x89, vprod3x89c0);
215 int16x8_t vprod0xABc0 = vmull_s8(vbABc0x0, va0c0x0);
216 int16x8_t vprod1xABc0 = vmull_s8(vbABc0x0, va1c0x0);
217 int16x8_t vprod2xABc0 = vmull_s8(vbABc0x0, va2c0x0);
218 int16x8_t vprod3xABc0 = vmull_s8(vbABc0x0, va3c0x0);
219 const int8x8_t vbABc0x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
220 vprod0xABc0 = vmlal_s8(vprod0xABc0, vbABc0x1, va0c0x1);
221 vprod1xABc0 = vmlal_s8(vprod1xABc0, vbABc0x1, va1c0x1);
222 vprod2xABc0 = vmlal_s8(vprod2xABc0, vbABc0x1, va2c0x1);
223 vprod3xABc0 = vmlal_s8(vprod3xABc0, vbABc0x1, va3c0x1);
224 vacc0xAB = vpadalq_s16(vacc0xAB, vprod0xABc0);
225 vacc1xAB = vpadalq_s16(vacc1xAB, vprod1xABc0);
226 vacc2xAB = vpadalq_s16(vacc2xAB, vprod2xABc0);
227 vacc3xAB = vpadalq_s16(vacc3xAB, vprod3xABc0);
228 int16x8_t vprod0xCDc0 = vmull_s8(vbCDc0x0, va0c0x0);
229 int16x8_t vprod1xCDc0 = vmull_s8(vbCDc0x0, va1c0x0);
230 int16x8_t vprod2xCDc0 = vmull_s8(vbCDc0x0, va2c0x0);
231 int16x8_t vprod3xCDc0 = vmull_s8(vbCDc0x0, va3c0x0);
232 const int8x8_t vbCDc0x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
233 vprod0xCDc0 = vmlal_s8(vprod0xCDc0, vbCDc0x1, va0c0x1);
234 vprod1xCDc0 = vmlal_s8(vprod1xCDc0, vbCDc0x1, va1c0x1);
235 vprod2xCDc0 = vmlal_s8(vprod2xCDc0, vbCDc0x1, va2c0x1);
236 vprod3xCDc0 = vmlal_s8(vprod3xCDc0, vbCDc0x1, va3c0x1);
237 vacc0xCD = vpadalq_s16(vacc0xCD, vprod0xCDc0);
238 vacc1xCD = vpadalq_s16(vacc1xCD, vprod1xCDc0);
239 vacc2xCD = vpadalq_s16(vacc2xCD, vprod2xCDc0);
240 vacc3xCD = vpadalq_s16(vacc3xCD, vprod3xCDc0);
241 int16x8_t vprod0xEFc0 = vmull_s8(vbEFc0x0, va0c0x0);
242 int16x8_t vprod1xEFc0 = vmull_s8(vbEFc0x0, va1c0x0);
243 int16x8_t vprod2xEFc0 = vmull_s8(vbEFc0x0, va2c0x0);
244 int16x8_t vprod3xEFc0 = vmull_s8(vbEFc0x0, va3c0x0);
245 const int8x8_t vbEFc0x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
246 vprod0xEFc0 = vmlal_s8(vprod0xEFc0, vbEFc0x1, va0c0x1);
247 vprod1xEFc0 = vmlal_s8(vprod1xEFc0, vbEFc0x1, va1c0x1);
248 vprod2xEFc0 = vmlal_s8(vprod2xEFc0, vbEFc0x1, va2c0x1);
249 vprod3xEFc0 = vmlal_s8(vprod3xEFc0, vbEFc0x1, va3c0x1);
250 vacc0xEF = vpadalq_s16(vacc0xEF, vprod0xEFc0);
251 vacc1xEF = vpadalq_s16(vacc1xEF, vprod1xEFc0);
252 vacc2xEF = vpadalq_s16(vacc2xEF, vprod2xEFc0);
253 vacc3xEF = vpadalq_s16(vacc3xEF, vprod3xEFc0);
254 const int8x8_t va0c1x0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va0x0), 1));
255 const int8x8_t va0c1x1 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va0x1), 1));
256 const int8x8_t va1c1x0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va1x0), 1));
257 const int8x8_t va1c1x1 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va1x1), 1));
258 const int8x8_t va2c1x0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va2x0), 1));
259 const int8x8_t va2c1x1 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va2x1), 1));
260 const int8x8_t va3c1x0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va3x0), 1));
261 const int8x8_t va3c1x1 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va3x1), 1));
262
263 int16x8_t vprod0x01c1 = vmull_s8(vb01c1x0, va0c1x0);
264 int16x8_t vprod1x01c1 = vmull_s8(vb01c1x0, va1c1x0);
265 int16x8_t vprod2x01c1 = vmull_s8(vb01c1x0, va2c1x0);
266 int16x8_t vprod3x01c1 = vmull_s8(vb01c1x0, va3c1x0);
267 const int8x8_t vb01c1x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
268 vprod0x01c1 = vmlal_s8(vprod0x01c1, vb01c1x1, va0c1x1);
269 vprod1x01c1 = vmlal_s8(vprod1x01c1, vb01c1x1, va1c1x1);
270 vprod2x01c1 = vmlal_s8(vprod2x01c1, vb01c1x1, va2c1x1);
271 vprod3x01c1 = vmlal_s8(vprod3x01c1, vb01c1x1, va3c1x1);
272 vacc0x01 = vpadalq_s16(vacc0x01, vprod0x01c1);
273 vacc1x01 = vpadalq_s16(vacc1x01, vprod1x01c1);
274 vacc2x01 = vpadalq_s16(vacc2x01, vprod2x01c1);
275 vacc3x01 = vpadalq_s16(vacc3x01, vprod3x01c1);
276 int16x8_t vprod0x23c1 = vmull_s8(vb23c1x0, va0c1x0);
277 int16x8_t vprod1x23c1 = vmull_s8(vb23c1x0, va1c1x0);
278 int16x8_t vprod2x23c1 = vmull_s8(vb23c1x0, va2c1x0);
279 int16x8_t vprod3x23c1 = vmull_s8(vb23c1x0, va3c1x0);
280 const int8x8_t vb23c1x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
281 vprod0x23c1 = vmlal_s8(vprod0x23c1, vb23c1x1, va0c1x1);
282 vprod1x23c1 = vmlal_s8(vprod1x23c1, vb23c1x1, va1c1x1);
283 vprod2x23c1 = vmlal_s8(vprod2x23c1, vb23c1x1, va2c1x1);
284 vprod3x23c1 = vmlal_s8(vprod3x23c1, vb23c1x1, va3c1x1);
285 vacc0x23 = vpadalq_s16(vacc0x23, vprod0x23c1);
286 vacc1x23 = vpadalq_s16(vacc1x23, vprod1x23c1);
287 vacc2x23 = vpadalq_s16(vacc2x23, vprod2x23c1);
288 vacc3x23 = vpadalq_s16(vacc3x23, vprod3x23c1);
289 int16x8_t vprod0x45c1 = vmull_s8(vb45c1x0, va0c1x0);
290 int16x8_t vprod1x45c1 = vmull_s8(vb45c1x0, va1c1x0);
291 int16x8_t vprod2x45c1 = vmull_s8(vb45c1x0, va2c1x0);
292 int16x8_t vprod3x45c1 = vmull_s8(vb45c1x0, va3c1x0);
293 const int8x8_t vb45c1x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
294 vprod0x45c1 = vmlal_s8(vprod0x45c1, vb45c1x1, va0c1x1);
295 vprod1x45c1 = vmlal_s8(vprod1x45c1, vb45c1x1, va1c1x1);
296 vprod2x45c1 = vmlal_s8(vprod2x45c1, vb45c1x1, va2c1x1);
297 vprod3x45c1 = vmlal_s8(vprod3x45c1, vb45c1x1, va3c1x1);
298 vacc0x45 = vpadalq_s16(vacc0x45, vprod0x45c1);
299 vacc1x45 = vpadalq_s16(vacc1x45, vprod1x45c1);
300 vacc2x45 = vpadalq_s16(vacc2x45, vprod2x45c1);
301 vacc3x45 = vpadalq_s16(vacc3x45, vprod3x45c1);
302 int16x8_t vprod0x67c1 = vmull_s8(vb67c1x0, va0c1x0);
303 int16x8_t vprod1x67c1 = vmull_s8(vb67c1x0, va1c1x0);
304 int16x8_t vprod2x67c1 = vmull_s8(vb67c1x0, va2c1x0);
305 int16x8_t vprod3x67c1 = vmull_s8(vb67c1x0, va3c1x0);
306 const int8x8_t vb67c1x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
307 vprod0x67c1 = vmlal_s8(vprod0x67c1, vb67c1x1, va0c1x1);
308 vprod1x67c1 = vmlal_s8(vprod1x67c1, vb67c1x1, va1c1x1);
309 vprod2x67c1 = vmlal_s8(vprod2x67c1, vb67c1x1, va2c1x1);
310 vprod3x67c1 = vmlal_s8(vprod3x67c1, vb67c1x1, va3c1x1);
311 vacc0x67 = vpadalq_s16(vacc0x67, vprod0x67c1);
312 vacc1x67 = vpadalq_s16(vacc1x67, vprod1x67c1);
313 vacc2x67 = vpadalq_s16(vacc2x67, vprod2x67c1);
314 vacc3x67 = vpadalq_s16(vacc3x67, vprod3x67c1);
315 int16x8_t vprod0x89c1 = vmull_s8(vb89c1x0, va0c1x0);
316 int16x8_t vprod1x89c1 = vmull_s8(vb89c1x0, va1c1x0);
317 int16x8_t vprod2x89c1 = vmull_s8(vb89c1x0, va2c1x0);
318 int16x8_t vprod3x89c1 = vmull_s8(vb89c1x0, va3c1x0);
319 const int8x8_t vb89c1x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
320 vprod0x89c1 = vmlal_s8(vprod0x89c1, vb89c1x1, va0c1x1);
321 vprod1x89c1 = vmlal_s8(vprod1x89c1, vb89c1x1, va1c1x1);
322 vprod2x89c1 = vmlal_s8(vprod2x89c1, vb89c1x1, va2c1x1);
323 vprod3x89c1 = vmlal_s8(vprod3x89c1, vb89c1x1, va3c1x1);
324 vacc0x89 = vpadalq_s16(vacc0x89, vprod0x89c1);
325 vacc1x89 = vpadalq_s16(vacc1x89, vprod1x89c1);
326 vacc2x89 = vpadalq_s16(vacc2x89, vprod2x89c1);
327 vacc3x89 = vpadalq_s16(vacc3x89, vprod3x89c1);
328 int16x8_t vprod0xABc1 = vmull_s8(vbABc1x0, va0c1x0);
329 int16x8_t vprod1xABc1 = vmull_s8(vbABc1x0, va1c1x0);
330 int16x8_t vprod2xABc1 = vmull_s8(vbABc1x0, va2c1x0);
331 int16x8_t vprod3xABc1 = vmull_s8(vbABc1x0, va3c1x0);
332 const int8x8_t vbABc1x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
333 vprod0xABc1 = vmlal_s8(vprod0xABc1, vbABc1x1, va0c1x1);
334 vprod1xABc1 = vmlal_s8(vprod1xABc1, vbABc1x1, va1c1x1);
335 vprod2xABc1 = vmlal_s8(vprod2xABc1, vbABc1x1, va2c1x1);
336 vprod3xABc1 = vmlal_s8(vprod3xABc1, vbABc1x1, va3c1x1);
337 vacc0xAB = vpadalq_s16(vacc0xAB, vprod0xABc1);
338 vacc1xAB = vpadalq_s16(vacc1xAB, vprod1xABc1);
339 vacc2xAB = vpadalq_s16(vacc2xAB, vprod2xABc1);
340 vacc3xAB = vpadalq_s16(vacc3xAB, vprod3xABc1);
341 int16x8_t vprod0xCDc1 = vmull_s8(vbCDc1x0, va0c1x0);
342 int16x8_t vprod1xCDc1 = vmull_s8(vbCDc1x0, va1c1x0);
343 int16x8_t vprod2xCDc1 = vmull_s8(vbCDc1x0, va2c1x0);
344 int16x8_t vprod3xCDc1 = vmull_s8(vbCDc1x0, va3c1x0);
345 const int8x8_t vbCDc1x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
346 vprod0xCDc1 = vmlal_s8(vprod0xCDc1, vbCDc1x1, va0c1x1);
347 vprod1xCDc1 = vmlal_s8(vprod1xCDc1, vbCDc1x1, va1c1x1);
348 vprod2xCDc1 = vmlal_s8(vprod2xCDc1, vbCDc1x1, va2c1x1);
349 vprod3xCDc1 = vmlal_s8(vprod3xCDc1, vbCDc1x1, va3c1x1);
350 vacc0xCD = vpadalq_s16(vacc0xCD, vprod0xCDc1);
351 vacc1xCD = vpadalq_s16(vacc1xCD, vprod1xCDc1);
352 vacc2xCD = vpadalq_s16(vacc2xCD, vprod2xCDc1);
353 vacc3xCD = vpadalq_s16(vacc3xCD, vprod3xCDc1);
354 int16x8_t vprod0xEFc1 = vmull_s8(vbEFc1x0, va0c1x0);
355 int16x8_t vprod1xEFc1 = vmull_s8(vbEFc1x0, va1c1x0);
356 int16x8_t vprod2xEFc1 = vmull_s8(vbEFc1x0, va2c1x0);
357 int16x8_t vprod3xEFc1 = vmull_s8(vbEFc1x0, va3c1x0);
358 const int8x8_t vbEFc1x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
359 vprod0xEFc1 = vmlal_s8(vprod0xEFc1, vbEFc1x1, va0c1x1);
360 vprod1xEFc1 = vmlal_s8(vprod1xEFc1, vbEFc1x1, va1c1x1);
361 vprod2xEFc1 = vmlal_s8(vprod2xEFc1, vbEFc1x1, va2c1x1);
362 vprod3xEFc1 = vmlal_s8(vprod3xEFc1, vbEFc1x1, va3c1x1);
363 vacc0xEF = vpadalq_s16(vacc0xEF, vprod0xEFc1);
364 vacc1xEF = vpadalq_s16(vacc1xEF, vprod1xEFc1);
365 vacc2xEF = vpadalq_s16(vacc2xEF, vprod2xEFc1);
366 vacc3xEF = vpadalq_s16(vacc3xEF, vprod3xEFc1);
367
368 k -= 16 * sizeof(int8_t);
369 }
370
371 if (k >= 8 * sizeof(int8_t)) {
372 const int8x8_t va0 = vld1_s8(a0); a0 += 8;
373 const int8x8_t va1 = vld1_s8(a1); a1 += 8;
374 const int8x8_t va2 = vld1_s8(a2); a2 += 8;
375 const int8x8_t va3 = vld1_s8(a3); a3 += 8;
376
377 const int8x8_t vb01c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
378 const int8x8_t vb23c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
379 const int8x8_t vb45c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
380 const int8x8_t vb67c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
381 const int8x8_t vb89c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
382 const int8x8_t vbABc0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
383 const int8x8_t vbCDc0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
384 const int8x8_t vbEFc0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
385 const int8x8_t vb01c1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
386 const int8x8_t vb23c1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
387 const int8x8_t vb45c1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
388 const int8x8_t vb67c1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
389 const int8x8_t vb89c1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
390 const int8x8_t vbABc1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
391 const int8x8_t vbCDc1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
392 const int8x8_t vbEFc1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
393
394 const int8x8_t va0c0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va0), 0));
395 const int8x8_t va1c0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va1), 0));
396 const int8x8_t va2c0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va2), 0));
397 const int8x8_t va3c0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va3), 0));
398
399 const int16x8_t vprod0x01c0 = vmull_s8(vb01c0, va0c0);
400 const int16x8_t vprod1x01c0 = vmull_s8(vb01c0, va1c0);
401 const int16x8_t vprod2x01c0 = vmull_s8(vb01c0, va2c0);
402 const int16x8_t vprod3x01c0 = vmull_s8(vb01c0, va3c0);
403 vacc0x01 = vpadalq_s16(vacc0x01, vprod0x01c0);
404 vacc1x01 = vpadalq_s16(vacc1x01, vprod1x01c0);
405 vacc2x01 = vpadalq_s16(vacc2x01, vprod2x01c0);
406 vacc3x01 = vpadalq_s16(vacc3x01, vprod3x01c0);
407 const int16x8_t vprod0x23c0 = vmull_s8(vb23c0, va0c0);
408 const int16x8_t vprod1x23c0 = vmull_s8(vb23c0, va1c0);
409 const int16x8_t vprod2x23c0 = vmull_s8(vb23c0, va2c0);
410 const int16x8_t vprod3x23c0 = vmull_s8(vb23c0, va3c0);
411 vacc0x23 = vpadalq_s16(vacc0x23, vprod0x23c0);
412 vacc1x23 = vpadalq_s16(vacc1x23, vprod1x23c0);
413 vacc2x23 = vpadalq_s16(vacc2x23, vprod2x23c0);
414 vacc3x23 = vpadalq_s16(vacc3x23, vprod3x23c0);
415 const int16x8_t vprod0x45c0 = vmull_s8(vb45c0, va0c0);
416 const int16x8_t vprod1x45c0 = vmull_s8(vb45c0, va1c0);
417 const int16x8_t vprod2x45c0 = vmull_s8(vb45c0, va2c0);
418 const int16x8_t vprod3x45c0 = vmull_s8(vb45c0, va3c0);
419 vacc0x45 = vpadalq_s16(vacc0x45, vprod0x45c0);
420 vacc1x45 = vpadalq_s16(vacc1x45, vprod1x45c0);
421 vacc2x45 = vpadalq_s16(vacc2x45, vprod2x45c0);
422 vacc3x45 = vpadalq_s16(vacc3x45, vprod3x45c0);
423 const int16x8_t vprod0x67c0 = vmull_s8(vb67c0, va0c0);
424 const int16x8_t vprod1x67c0 = vmull_s8(vb67c0, va1c0);
425 const int16x8_t vprod2x67c0 = vmull_s8(vb67c0, va2c0);
426 const int16x8_t vprod3x67c0 = vmull_s8(vb67c0, va3c0);
427 vacc0x67 = vpadalq_s16(vacc0x67, vprod0x67c0);
428 vacc1x67 = vpadalq_s16(vacc1x67, vprod1x67c0);
429 vacc2x67 = vpadalq_s16(vacc2x67, vprod2x67c0);
430 vacc3x67 = vpadalq_s16(vacc3x67, vprod3x67c0);
431 const int16x8_t vprod0x89c0 = vmull_s8(vb89c0, va0c0);
432 const int16x8_t vprod1x89c0 = vmull_s8(vb89c0, va1c0);
433 const int16x8_t vprod2x89c0 = vmull_s8(vb89c0, va2c0);
434 const int16x8_t vprod3x89c0 = vmull_s8(vb89c0, va3c0);
435 vacc0x89 = vpadalq_s16(vacc0x89, vprod0x89c0);
436 vacc1x89 = vpadalq_s16(vacc1x89, vprod1x89c0);
437 vacc2x89 = vpadalq_s16(vacc2x89, vprod2x89c0);
438 vacc3x89 = vpadalq_s16(vacc3x89, vprod3x89c0);
439 const int16x8_t vprod0xABc0 = vmull_s8(vbABc0, va0c0);
440 const int16x8_t vprod1xABc0 = vmull_s8(vbABc0, va1c0);
441 const int16x8_t vprod2xABc0 = vmull_s8(vbABc0, va2c0);
442 const int16x8_t vprod3xABc0 = vmull_s8(vbABc0, va3c0);
443 vacc0xAB = vpadalq_s16(vacc0xAB, vprod0xABc0);
444 vacc1xAB = vpadalq_s16(vacc1xAB, vprod1xABc0);
445 vacc2xAB = vpadalq_s16(vacc2xAB, vprod2xABc0);
446 vacc3xAB = vpadalq_s16(vacc3xAB, vprod3xABc0);
447 const int16x8_t vprod0xCDc0 = vmull_s8(vbCDc0, va0c0);
448 const int16x8_t vprod1xCDc0 = vmull_s8(vbCDc0, va1c0);
449 const int16x8_t vprod2xCDc0 = vmull_s8(vbCDc0, va2c0);
450 const int16x8_t vprod3xCDc0 = vmull_s8(vbCDc0, va3c0);
451 vacc0xCD = vpadalq_s16(vacc0xCD, vprod0xCDc0);
452 vacc1xCD = vpadalq_s16(vacc1xCD, vprod1xCDc0);
453 vacc2xCD = vpadalq_s16(vacc2xCD, vprod2xCDc0);
454 vacc3xCD = vpadalq_s16(vacc3xCD, vprod3xCDc0);
455 const int16x8_t vprod0xEFc0 = vmull_s8(vbEFc0, va0c0);
456 const int16x8_t vprod1xEFc0 = vmull_s8(vbEFc0, va1c0);
457 const int16x8_t vprod2xEFc0 = vmull_s8(vbEFc0, va2c0);
458 const int16x8_t vprod3xEFc0 = vmull_s8(vbEFc0, va3c0);
459 vacc0xEF = vpadalq_s16(vacc0xEF, vprod0xEFc0);
460 vacc1xEF = vpadalq_s16(vacc1xEF, vprod1xEFc0);
461 vacc2xEF = vpadalq_s16(vacc2xEF, vprod2xEFc0);
462 vacc3xEF = vpadalq_s16(vacc3xEF, vprod3xEFc0);
463 const int8x8_t va0c1 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va0), 1));
464 const int8x8_t va1c1 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va1), 1));
465 const int8x8_t va2c1 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va2), 1));
466 const int8x8_t va3c1 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va3), 1));
467
468 const int16x8_t vprod0x01c1 = vmull_s8(vb01c1, va0c1);
469 const int16x8_t vprod1x01c1 = vmull_s8(vb01c1, va1c1);
470 const int16x8_t vprod2x01c1 = vmull_s8(vb01c1, va2c1);
471 const int16x8_t vprod3x01c1 = vmull_s8(vb01c1, va3c1);
472 vacc0x01 = vpadalq_s16(vacc0x01, vprod0x01c1);
473 vacc1x01 = vpadalq_s16(vacc1x01, vprod1x01c1);
474 vacc2x01 = vpadalq_s16(vacc2x01, vprod2x01c1);
475 vacc3x01 = vpadalq_s16(vacc3x01, vprod3x01c1);
476 const int16x8_t vprod0x23c1 = vmull_s8(vb23c1, va0c1);
477 const int16x8_t vprod1x23c1 = vmull_s8(vb23c1, va1c1);
478 const int16x8_t vprod2x23c1 = vmull_s8(vb23c1, va2c1);
479 const int16x8_t vprod3x23c1 = vmull_s8(vb23c1, va3c1);
480 vacc0x23 = vpadalq_s16(vacc0x23, vprod0x23c1);
481 vacc1x23 = vpadalq_s16(vacc1x23, vprod1x23c1);
482 vacc2x23 = vpadalq_s16(vacc2x23, vprod2x23c1);
483 vacc3x23 = vpadalq_s16(vacc3x23, vprod3x23c1);
484 const int16x8_t vprod0x45c1 = vmull_s8(vb45c1, va0c1);
485 const int16x8_t vprod1x45c1 = vmull_s8(vb45c1, va1c1);
486 const int16x8_t vprod2x45c1 = vmull_s8(vb45c1, va2c1);
487 const int16x8_t vprod3x45c1 = vmull_s8(vb45c1, va3c1);
488 vacc0x45 = vpadalq_s16(vacc0x45, vprod0x45c1);
489 vacc1x45 = vpadalq_s16(vacc1x45, vprod1x45c1);
490 vacc2x45 = vpadalq_s16(vacc2x45, vprod2x45c1);
491 vacc3x45 = vpadalq_s16(vacc3x45, vprod3x45c1);
492 const int16x8_t vprod0x67c1 = vmull_s8(vb67c1, va0c1);
493 const int16x8_t vprod1x67c1 = vmull_s8(vb67c1, va1c1);
494 const int16x8_t vprod2x67c1 = vmull_s8(vb67c1, va2c1);
495 const int16x8_t vprod3x67c1 = vmull_s8(vb67c1, va3c1);
496 vacc0x67 = vpadalq_s16(vacc0x67, vprod0x67c1);
497 vacc1x67 = vpadalq_s16(vacc1x67, vprod1x67c1);
498 vacc2x67 = vpadalq_s16(vacc2x67, vprod2x67c1);
499 vacc3x67 = vpadalq_s16(vacc3x67, vprod3x67c1);
500 const int16x8_t vprod0x89c1 = vmull_s8(vb89c1, va0c1);
501 const int16x8_t vprod1x89c1 = vmull_s8(vb89c1, va1c1);
502 const int16x8_t vprod2x89c1 = vmull_s8(vb89c1, va2c1);
503 const int16x8_t vprod3x89c1 = vmull_s8(vb89c1, va3c1);
504 vacc0x89 = vpadalq_s16(vacc0x89, vprod0x89c1);
505 vacc1x89 = vpadalq_s16(vacc1x89, vprod1x89c1);
506 vacc2x89 = vpadalq_s16(vacc2x89, vprod2x89c1);
507 vacc3x89 = vpadalq_s16(vacc3x89, vprod3x89c1);
508 const int16x8_t vprod0xABc1 = vmull_s8(vbABc1, va0c1);
509 const int16x8_t vprod1xABc1 = vmull_s8(vbABc1, va1c1);
510 const int16x8_t vprod2xABc1 = vmull_s8(vbABc1, va2c1);
511 const int16x8_t vprod3xABc1 = vmull_s8(vbABc1, va3c1);
512 vacc0xAB = vpadalq_s16(vacc0xAB, vprod0xABc1);
513 vacc1xAB = vpadalq_s16(vacc1xAB, vprod1xABc1);
514 vacc2xAB = vpadalq_s16(vacc2xAB, vprod2xABc1);
515 vacc3xAB = vpadalq_s16(vacc3xAB, vprod3xABc1);
516 const int16x8_t vprod0xCDc1 = vmull_s8(vbCDc1, va0c1);
517 const int16x8_t vprod1xCDc1 = vmull_s8(vbCDc1, va1c1);
518 const int16x8_t vprod2xCDc1 = vmull_s8(vbCDc1, va2c1);
519 const int16x8_t vprod3xCDc1 = vmull_s8(vbCDc1, va3c1);
520 vacc0xCD = vpadalq_s16(vacc0xCD, vprod0xCDc1);
521 vacc1xCD = vpadalq_s16(vacc1xCD, vprod1xCDc1);
522 vacc2xCD = vpadalq_s16(vacc2xCD, vprod2xCDc1);
523 vacc3xCD = vpadalq_s16(vacc3xCD, vprod3xCDc1);
524 const int16x8_t vprod0xEFc1 = vmull_s8(vbEFc1, va0c1);
525 const int16x8_t vprod1xEFc1 = vmull_s8(vbEFc1, va1c1);
526 const int16x8_t vprod2xEFc1 = vmull_s8(vbEFc1, va2c1);
527 const int16x8_t vprod3xEFc1 = vmull_s8(vbEFc1, va3c1);
528 vacc0xEF = vpadalq_s16(vacc0xEF, vprod0xEFc1);
529 vacc1xEF = vpadalq_s16(vacc1xEF, vprod1xEFc1);
530 vacc2xEF = vpadalq_s16(vacc2xEF, vprod2xEFc1);
531 vacc3xEF = vpadalq_s16(vacc3xEF, vprod3xEFc1);
532
533 k -= 8 * sizeof(int8_t);
534 }
535
536 if XNN_UNLIKELY(k != 0) {
537 const int8x8_t va0 = vld1_s8(a0); a0 = (const int8_t*) ((uintptr_t) a0 + k);
538 const int8x8_t va1 = vld1_s8(a1); a1 = (const int8_t*) ((uintptr_t) a1 + k);
539 const int8x8_t va2 = vld1_s8(a2); a2 = (const int8_t*) ((uintptr_t) a2 + k);
540 const int8x8_t va3 = vld1_s8(a3); a3 = (const int8_t*) ((uintptr_t) a3 + k);
541
542 const int8x8_t vb01c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
543 const int8x8_t vb23c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
544 const int8x8_t vb45c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
545 const int8x8_t vb67c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
546 const int8x8_t vb89c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
547 const int8x8_t vbABc0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
548 const int8x8_t vbCDc0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
549 const int8x8_t vbEFc0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
550
551 const int8x8_t va0c0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va0), 0));
552 const int16x8_t vprod0x01c0 = vmull_s8(vb01c0, va0c0);
553 vacc0x01 = vpadalq_s16(vacc0x01, vprod0x01c0);
554 const int16x8_t vprod0x23c0 = vmull_s8(vb23c0, va0c0);
555 vacc0x23 = vpadalq_s16(vacc0x23, vprod0x23c0);
556 const int16x8_t vprod0x45c0 = vmull_s8(vb45c0, va0c0);
557 vacc0x45 = vpadalq_s16(vacc0x45, vprod0x45c0);
558 const int16x8_t vprod0x67c0 = vmull_s8(vb67c0, va0c0);
559 vacc0x67 = vpadalq_s16(vacc0x67, vprod0x67c0);
560 const int16x8_t vprod0x89c0 = vmull_s8(vb89c0, va0c0);
561 vacc0x89 = vpadalq_s16(vacc0x89, vprod0x89c0);
562 const int16x8_t vprod0xABc0 = vmull_s8(vbABc0, va0c0);
563 vacc0xAB = vpadalq_s16(vacc0xAB, vprod0xABc0);
564 const int16x8_t vprod0xCDc0 = vmull_s8(vbCDc0, va0c0);
565 vacc0xCD = vpadalq_s16(vacc0xCD, vprod0xCDc0);
566 const int16x8_t vprod0xEFc0 = vmull_s8(vbEFc0, va0c0);
567 vacc0xEF = vpadalq_s16(vacc0xEF, vprod0xEFc0);
568 const int8x8_t va1c0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va1), 0));
569 const int16x8_t vprod1x01c0 = vmull_s8(vb01c0, va1c0);
570 vacc1x01 = vpadalq_s16(vacc1x01, vprod1x01c0);
571 const int16x8_t vprod1x23c0 = vmull_s8(vb23c0, va1c0);
572 vacc1x23 = vpadalq_s16(vacc1x23, vprod1x23c0);
573 const int16x8_t vprod1x45c0 = vmull_s8(vb45c0, va1c0);
574 vacc1x45 = vpadalq_s16(vacc1x45, vprod1x45c0);
575 const int16x8_t vprod1x67c0 = vmull_s8(vb67c0, va1c0);
576 vacc1x67 = vpadalq_s16(vacc1x67, vprod1x67c0);
577 const int16x8_t vprod1x89c0 = vmull_s8(vb89c0, va1c0);
578 vacc1x89 = vpadalq_s16(vacc1x89, vprod1x89c0);
579 const int16x8_t vprod1xABc0 = vmull_s8(vbABc0, va1c0);
580 vacc1xAB = vpadalq_s16(vacc1xAB, vprod1xABc0);
581 const int16x8_t vprod1xCDc0 = vmull_s8(vbCDc0, va1c0);
582 vacc1xCD = vpadalq_s16(vacc1xCD, vprod1xCDc0);
583 const int16x8_t vprod1xEFc0 = vmull_s8(vbEFc0, va1c0);
584 vacc1xEF = vpadalq_s16(vacc1xEF, vprod1xEFc0);
585 const int8x8_t va2c0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va2), 0));
586 const int16x8_t vprod2x01c0 = vmull_s8(vb01c0, va2c0);
587 vacc2x01 = vpadalq_s16(vacc2x01, vprod2x01c0);
588 const int16x8_t vprod2x23c0 = vmull_s8(vb23c0, va2c0);
589 vacc2x23 = vpadalq_s16(vacc2x23, vprod2x23c0);
590 const int16x8_t vprod2x45c0 = vmull_s8(vb45c0, va2c0);
591 vacc2x45 = vpadalq_s16(vacc2x45, vprod2x45c0);
592 const int16x8_t vprod2x67c0 = vmull_s8(vb67c0, va2c0);
593 vacc2x67 = vpadalq_s16(vacc2x67, vprod2x67c0);
594 const int16x8_t vprod2x89c0 = vmull_s8(vb89c0, va2c0);
595 vacc2x89 = vpadalq_s16(vacc2x89, vprod2x89c0);
596 const int16x8_t vprod2xABc0 = vmull_s8(vbABc0, va2c0);
597 vacc2xAB = vpadalq_s16(vacc2xAB, vprod2xABc0);
598 const int16x8_t vprod2xCDc0 = vmull_s8(vbCDc0, va2c0);
599 vacc2xCD = vpadalq_s16(vacc2xCD, vprod2xCDc0);
600 const int16x8_t vprod2xEFc0 = vmull_s8(vbEFc0, va2c0);
601 vacc2xEF = vpadalq_s16(vacc2xEF, vprod2xEFc0);
602 const int8x8_t va3c0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va3), 0));
603 const int16x8_t vprod3x01c0 = vmull_s8(vb01c0, va3c0);
604 vacc3x01 = vpadalq_s16(vacc3x01, vprod3x01c0);
605 const int16x8_t vprod3x23c0 = vmull_s8(vb23c0, va3c0);
606 vacc3x23 = vpadalq_s16(vacc3x23, vprod3x23c0);
607 const int16x8_t vprod3x45c0 = vmull_s8(vb45c0, va3c0);
608 vacc3x45 = vpadalq_s16(vacc3x45, vprod3x45c0);
609 const int16x8_t vprod3x67c0 = vmull_s8(vb67c0, va3c0);
610 vacc3x67 = vpadalq_s16(vacc3x67, vprod3x67c0);
611 const int16x8_t vprod3x89c0 = vmull_s8(vb89c0, va3c0);
612 vacc3x89 = vpadalq_s16(vacc3x89, vprod3x89c0);
613 const int16x8_t vprod3xABc0 = vmull_s8(vbABc0, va3c0);
614 vacc3xAB = vpadalq_s16(vacc3xAB, vprod3xABc0);
615 const int16x8_t vprod3xCDc0 = vmull_s8(vbCDc0, va3c0);
616 vacc3xCD = vpadalq_s16(vacc3xCD, vprod3xCDc0);
617 const int16x8_t vprod3xEFc0 = vmull_s8(vbEFc0, va3c0);
618 vacc3xEF = vpadalq_s16(vacc3xEF, vprod3xEFc0);
619 }
620 p -= 4 * sizeof(void*);
621 } while (p != 0);
622
623 #if XNN_ARCH_ARM64
624 int32x4_t vacc0x0123 = vpaddq_s32(vacc0x01, vacc0x23);
625 int32x4_t vacc0x4567 = vpaddq_s32(vacc0x45, vacc0x67);
626 int32x4_t vacc0x89AB = vpaddq_s32(vacc0x89, vacc0xAB);
627 int32x4_t vacc0xCDEF = vpaddq_s32(vacc0xCD, vacc0xEF);
628 int32x4_t vacc1x0123 = vpaddq_s32(vacc1x01, vacc1x23);
629 int32x4_t vacc1x4567 = vpaddq_s32(vacc1x45, vacc1x67);
630 int32x4_t vacc1x89AB = vpaddq_s32(vacc1x89, vacc1xAB);
631 int32x4_t vacc1xCDEF = vpaddq_s32(vacc1xCD, vacc1xEF);
632 int32x4_t vacc2x0123 = vpaddq_s32(vacc2x01, vacc2x23);
633 int32x4_t vacc2x4567 = vpaddq_s32(vacc2x45, vacc2x67);
634 int32x4_t vacc2x89AB = vpaddq_s32(vacc2x89, vacc2xAB);
635 int32x4_t vacc2xCDEF = vpaddq_s32(vacc2xCD, vacc2xEF);
636 int32x4_t vacc3x0123 = vpaddq_s32(vacc3x01, vacc3x23);
637 int32x4_t vacc3x4567 = vpaddq_s32(vacc3x45, vacc3x67);
638 int32x4_t vacc3x89AB = vpaddq_s32(vacc3x89, vacc3xAB);
639 int32x4_t vacc3xCDEF = vpaddq_s32(vacc3xCD, vacc3xEF);
640 #else
641 const int32x2_t vsum0x01 = vpadd_s32(vget_low_s32(vacc0x01), vget_high_s32(vacc0x01));
642 const int32x2_t vsum0x23 = vpadd_s32(vget_low_s32(vacc0x23), vget_high_s32(vacc0x23));
643 int32x4_t vacc0x0123 = vcombine_s32(vsum0x01, vsum0x23);
644 const int32x2_t vsum0x45 = vpadd_s32(vget_low_s32(vacc0x45), vget_high_s32(vacc0x45));
645 const int32x2_t vsum0x67 = vpadd_s32(vget_low_s32(vacc0x67), vget_high_s32(vacc0x67));
646 int32x4_t vacc0x4567 = vcombine_s32(vsum0x45, vsum0x67);
647 const int32x2_t vsum0x89 = vpadd_s32(vget_low_s32(vacc0x89), vget_high_s32(vacc0x89));
648 const int32x2_t vsum0xAB = vpadd_s32(vget_low_s32(vacc0xAB), vget_high_s32(vacc0xAB));
649 int32x4_t vacc0x89AB = vcombine_s32(vsum0x89, vsum0xAB);
650 const int32x2_t vsum0xCD = vpadd_s32(vget_low_s32(vacc0xCD), vget_high_s32(vacc0xCD));
651 const int32x2_t vsum0xEF = vpadd_s32(vget_low_s32(vacc0xEF), vget_high_s32(vacc0xEF));
652 int32x4_t vacc0xCDEF = vcombine_s32(vsum0xCD, vsum0xEF);
653 const int32x2_t vsum1x01 = vpadd_s32(vget_low_s32(vacc1x01), vget_high_s32(vacc1x01));
654 const int32x2_t vsum1x23 = vpadd_s32(vget_low_s32(vacc1x23), vget_high_s32(vacc1x23));
655 int32x4_t vacc1x0123 = vcombine_s32(vsum1x01, vsum1x23);
656 const int32x2_t vsum1x45 = vpadd_s32(vget_low_s32(vacc1x45), vget_high_s32(vacc1x45));
657 const int32x2_t vsum1x67 = vpadd_s32(vget_low_s32(vacc1x67), vget_high_s32(vacc1x67));
658 int32x4_t vacc1x4567 = vcombine_s32(vsum1x45, vsum1x67);
659 const int32x2_t vsum1x89 = vpadd_s32(vget_low_s32(vacc1x89), vget_high_s32(vacc1x89));
660 const int32x2_t vsum1xAB = vpadd_s32(vget_low_s32(vacc1xAB), vget_high_s32(vacc1xAB));
661 int32x4_t vacc1x89AB = vcombine_s32(vsum1x89, vsum1xAB);
662 const int32x2_t vsum1xCD = vpadd_s32(vget_low_s32(vacc1xCD), vget_high_s32(vacc1xCD));
663 const int32x2_t vsum1xEF = vpadd_s32(vget_low_s32(vacc1xEF), vget_high_s32(vacc1xEF));
664 int32x4_t vacc1xCDEF = vcombine_s32(vsum1xCD, vsum1xEF);
665 const int32x2_t vsum2x01 = vpadd_s32(vget_low_s32(vacc2x01), vget_high_s32(vacc2x01));
666 const int32x2_t vsum2x23 = vpadd_s32(vget_low_s32(vacc2x23), vget_high_s32(vacc2x23));
667 int32x4_t vacc2x0123 = vcombine_s32(vsum2x01, vsum2x23);
668 const int32x2_t vsum2x45 = vpadd_s32(vget_low_s32(vacc2x45), vget_high_s32(vacc2x45));
669 const int32x2_t vsum2x67 = vpadd_s32(vget_low_s32(vacc2x67), vget_high_s32(vacc2x67));
670 int32x4_t vacc2x4567 = vcombine_s32(vsum2x45, vsum2x67);
671 const int32x2_t vsum2x89 = vpadd_s32(vget_low_s32(vacc2x89), vget_high_s32(vacc2x89));
672 const int32x2_t vsum2xAB = vpadd_s32(vget_low_s32(vacc2xAB), vget_high_s32(vacc2xAB));
673 int32x4_t vacc2x89AB = vcombine_s32(vsum2x89, vsum2xAB);
674 const int32x2_t vsum2xCD = vpadd_s32(vget_low_s32(vacc2xCD), vget_high_s32(vacc2xCD));
675 const int32x2_t vsum2xEF = vpadd_s32(vget_low_s32(vacc2xEF), vget_high_s32(vacc2xEF));
676 int32x4_t vacc2xCDEF = vcombine_s32(vsum2xCD, vsum2xEF);
677 const int32x2_t vsum3x01 = vpadd_s32(vget_low_s32(vacc3x01), vget_high_s32(vacc3x01));
678 const int32x2_t vsum3x23 = vpadd_s32(vget_low_s32(vacc3x23), vget_high_s32(vacc3x23));
679 int32x4_t vacc3x0123 = vcombine_s32(vsum3x01, vsum3x23);
680 const int32x2_t vsum3x45 = vpadd_s32(vget_low_s32(vacc3x45), vget_high_s32(vacc3x45));
681 const int32x2_t vsum3x67 = vpadd_s32(vget_low_s32(vacc3x67), vget_high_s32(vacc3x67));
682 int32x4_t vacc3x4567 = vcombine_s32(vsum3x45, vsum3x67);
683 const int32x2_t vsum3x89 = vpadd_s32(vget_low_s32(vacc3x89), vget_high_s32(vacc3x89));
684 const int32x2_t vsum3xAB = vpadd_s32(vget_low_s32(vacc3xAB), vget_high_s32(vacc3xAB));
685 int32x4_t vacc3x89AB = vcombine_s32(vsum3x89, vsum3xAB);
686 const int32x2_t vsum3xCD = vpadd_s32(vget_low_s32(vacc3xCD), vget_high_s32(vacc3xCD));
687 const int32x2_t vsum3xEF = vpadd_s32(vget_low_s32(vacc3xEF), vget_high_s32(vacc3xEF));
688 int32x4_t vacc3xCDEF = vcombine_s32(vsum3xCD, vsum3xEF);
689 #endif
690
691 const int32x4_t vright_pre_shift = vld1q_dup_s32(¶ms->rndnu_neon.right_pre_shift);
692 const int32x4_t vmultiplier = vld1q_dup_s32(¶ms->rndnu_neon.multiplier);
693 const int32x4_t vright_post_shift = vld1q_dup_s32(¶ms->rndnu_neon.right_post_shift);
694
695 vacc0x0123 = vqshlq_s32(vacc0x0123, vright_pre_shift);
696 vacc0x4567 = vqshlq_s32(vacc0x4567, vright_pre_shift);
697 vacc0x89AB = vqshlq_s32(vacc0x89AB, vright_pre_shift);
698 vacc0xCDEF = vqshlq_s32(vacc0xCDEF, vright_pre_shift);
699 vacc1x0123 = vqshlq_s32(vacc1x0123, vright_pre_shift);
700 vacc1x4567 = vqshlq_s32(vacc1x4567, vright_pre_shift);
701 vacc1x89AB = vqshlq_s32(vacc1x89AB, vright_pre_shift);
702 vacc1xCDEF = vqshlq_s32(vacc1xCDEF, vright_pre_shift);
703 vacc2x0123 = vqshlq_s32(vacc2x0123, vright_pre_shift);
704 vacc2x4567 = vqshlq_s32(vacc2x4567, vright_pre_shift);
705 vacc2x89AB = vqshlq_s32(vacc2x89AB, vright_pre_shift);
706 vacc2xCDEF = vqshlq_s32(vacc2xCDEF, vright_pre_shift);
707 vacc3x0123 = vqshlq_s32(vacc3x0123, vright_pre_shift);
708 vacc3x4567 = vqshlq_s32(vacc3x4567, vright_pre_shift);
709 vacc3x89AB = vqshlq_s32(vacc3x89AB, vright_pre_shift);
710 vacc3xCDEF = vqshlq_s32(vacc3xCDEF, vright_pre_shift);
711
712 vacc0x0123 = vqdmulhq_s32(vacc0x0123, vmultiplier);
713 vacc0x4567 = vqdmulhq_s32(vacc0x4567, vmultiplier);
714 vacc0x89AB = vqdmulhq_s32(vacc0x89AB, vmultiplier);
715 vacc0xCDEF = vqdmulhq_s32(vacc0xCDEF, vmultiplier);
716 vacc1x0123 = vqdmulhq_s32(vacc1x0123, vmultiplier);
717 vacc1x4567 = vqdmulhq_s32(vacc1x4567, vmultiplier);
718 vacc1x89AB = vqdmulhq_s32(vacc1x89AB, vmultiplier);
719 vacc1xCDEF = vqdmulhq_s32(vacc1xCDEF, vmultiplier);
720 vacc2x0123 = vqdmulhq_s32(vacc2x0123, vmultiplier);
721 vacc2x4567 = vqdmulhq_s32(vacc2x4567, vmultiplier);
722 vacc2x89AB = vqdmulhq_s32(vacc2x89AB, vmultiplier);
723 vacc2xCDEF = vqdmulhq_s32(vacc2xCDEF, vmultiplier);
724 vacc3x0123 = vqdmulhq_s32(vacc3x0123, vmultiplier);
725 vacc3x4567 = vqdmulhq_s32(vacc3x4567, vmultiplier);
726 vacc3x89AB = vqdmulhq_s32(vacc3x89AB, vmultiplier);
727 vacc3xCDEF = vqdmulhq_s32(vacc3xCDEF, vmultiplier);
728
729 vacc0x0123 = vrshlq_s32(vacc0x0123, vright_post_shift);
730 vacc0x4567 = vrshlq_s32(vacc0x4567, vright_post_shift);
731 vacc0x89AB = vrshlq_s32(vacc0x89AB, vright_post_shift);
732 vacc0xCDEF = vrshlq_s32(vacc0xCDEF, vright_post_shift);
733 vacc1x0123 = vrshlq_s32(vacc1x0123, vright_post_shift);
734 vacc1x4567 = vrshlq_s32(vacc1x4567, vright_post_shift);
735 vacc1x89AB = vrshlq_s32(vacc1x89AB, vright_post_shift);
736 vacc1xCDEF = vrshlq_s32(vacc1xCDEF, vright_post_shift);
737 vacc2x0123 = vrshlq_s32(vacc2x0123, vright_post_shift);
738 vacc2x4567 = vrshlq_s32(vacc2x4567, vright_post_shift);
739 vacc2x89AB = vrshlq_s32(vacc2x89AB, vright_post_shift);
740 vacc2xCDEF = vrshlq_s32(vacc2xCDEF, vright_post_shift);
741 vacc3x0123 = vrshlq_s32(vacc3x0123, vright_post_shift);
742 vacc3x4567 = vrshlq_s32(vacc3x4567, vright_post_shift);
743 vacc3x89AB = vrshlq_s32(vacc3x89AB, vright_post_shift);
744 vacc3xCDEF = vrshlq_s32(vacc3xCDEF, vright_post_shift);
745
746 const int16x8_t voutput_zero_point = vld1q_dup_s16(¶ms->rndnu_neon.output_zero_point);
747 #if XNN_ARCH_ARM64
748 int16x8_t vacc0x01234567 = vqmovn_high_s32(vqmovn_s32(vacc0x0123), vacc0x4567);
749 int16x8_t vacc0x89ABCDEF = vqmovn_high_s32(vqmovn_s32(vacc0x89AB), vacc0xCDEF);
750 int16x8_t vacc1x01234567 = vqmovn_high_s32(vqmovn_s32(vacc1x0123), vacc1x4567);
751 int16x8_t vacc1x89ABCDEF = vqmovn_high_s32(vqmovn_s32(vacc1x89AB), vacc1xCDEF);
752 int16x8_t vacc2x01234567 = vqmovn_high_s32(vqmovn_s32(vacc2x0123), vacc2x4567);
753 int16x8_t vacc2x89ABCDEF = vqmovn_high_s32(vqmovn_s32(vacc2x89AB), vacc2xCDEF);
754 int16x8_t vacc3x01234567 = vqmovn_high_s32(vqmovn_s32(vacc3x0123), vacc3x4567);
755 int16x8_t vacc3x89ABCDEF = vqmovn_high_s32(vqmovn_s32(vacc3x89AB), vacc3xCDEF);
756
757 vacc0x01234567 = vqaddq_s16(vacc0x01234567, voutput_zero_point);
758 vacc0x89ABCDEF = vqaddq_s16(vacc0x89ABCDEF, voutput_zero_point);
759 vacc1x01234567 = vqaddq_s16(vacc1x01234567, voutput_zero_point);
760 vacc1x89ABCDEF = vqaddq_s16(vacc1x89ABCDEF, voutput_zero_point);
761 vacc2x01234567 = vqaddq_s16(vacc2x01234567, voutput_zero_point);
762 vacc2x89ABCDEF = vqaddq_s16(vacc2x89ABCDEF, voutput_zero_point);
763 vacc3x01234567 = vqaddq_s16(vacc3x01234567, voutput_zero_point);
764 vacc3x89ABCDEF = vqaddq_s16(vacc3x89ABCDEF, voutput_zero_point);
765
766 int8x16_t vout0x0123456789ABCDEF = vqmovn_high_s16(vqmovn_s16(vacc0x01234567), vacc0x89ABCDEF);
767 int8x16_t vout1x0123456789ABCDEF = vqmovn_high_s16(vqmovn_s16(vacc1x01234567), vacc1x89ABCDEF);
768 int8x16_t vout2x0123456789ABCDEF = vqmovn_high_s16(vqmovn_s16(vacc2x01234567), vacc2x89ABCDEF);
769 int8x16_t vout3x0123456789ABCDEF = vqmovn_high_s16(vqmovn_s16(vacc3x01234567), vacc3x89ABCDEF);
770 #else
771 int16x8_t vacc0x01234567 = vcombine_s16(vqmovn_s32(vacc0x0123), vqmovn_s32(vacc0x4567));
772 int16x8_t vacc0x89ABCDEF = vcombine_s16(vqmovn_s32(vacc0x89AB), vqmovn_s32(vacc0xCDEF));
773 int16x8_t vacc1x01234567 = vcombine_s16(vqmovn_s32(vacc1x0123), vqmovn_s32(vacc1x4567));
774 int16x8_t vacc1x89ABCDEF = vcombine_s16(vqmovn_s32(vacc1x89AB), vqmovn_s32(vacc1xCDEF));
775 int16x8_t vacc2x01234567 = vcombine_s16(vqmovn_s32(vacc2x0123), vqmovn_s32(vacc2x4567));
776 int16x8_t vacc2x89ABCDEF = vcombine_s16(vqmovn_s32(vacc2x89AB), vqmovn_s32(vacc2xCDEF));
777 int16x8_t vacc3x01234567 = vcombine_s16(vqmovn_s32(vacc3x0123), vqmovn_s32(vacc3x4567));
778 int16x8_t vacc3x89ABCDEF = vcombine_s16(vqmovn_s32(vacc3x89AB), vqmovn_s32(vacc3xCDEF));
779
780 vacc0x01234567 = vqaddq_s16(vacc0x01234567, voutput_zero_point);
781 vacc0x89ABCDEF = vqaddq_s16(vacc0x89ABCDEF, voutput_zero_point);
782 vacc1x01234567 = vqaddq_s16(vacc1x01234567, voutput_zero_point);
783 vacc1x89ABCDEF = vqaddq_s16(vacc1x89ABCDEF, voutput_zero_point);
784 vacc2x01234567 = vqaddq_s16(vacc2x01234567, voutput_zero_point);
785 vacc2x89ABCDEF = vqaddq_s16(vacc2x89ABCDEF, voutput_zero_point);
786 vacc3x01234567 = vqaddq_s16(vacc3x01234567, voutput_zero_point);
787 vacc3x89ABCDEF = vqaddq_s16(vacc3x89ABCDEF, voutput_zero_point);
788
789 int8x16_t vout0x0123456789ABCDEF = vcombine_s8(vqmovn_s16(vacc0x01234567), vqmovn_s16(vacc0x89ABCDEF));
790 int8x16_t vout1x0123456789ABCDEF = vcombine_s8(vqmovn_s16(vacc1x01234567), vqmovn_s16(vacc1x89ABCDEF));
791 int8x16_t vout2x0123456789ABCDEF = vcombine_s8(vqmovn_s16(vacc2x01234567), vqmovn_s16(vacc2x89ABCDEF));
792 int8x16_t vout3x0123456789ABCDEF = vcombine_s8(vqmovn_s16(vacc3x01234567), vqmovn_s16(vacc3x89ABCDEF));
793 #endif
794
795 const int8x16_t voutput_min = vld1q_dup_s8(¶ms->rndnu_neon.output_min);
796 vout0x0123456789ABCDEF = vmaxq_s8(vout0x0123456789ABCDEF, voutput_min);
797 vout1x0123456789ABCDEF = vmaxq_s8(vout1x0123456789ABCDEF, voutput_min);
798 vout2x0123456789ABCDEF = vmaxq_s8(vout2x0123456789ABCDEF, voutput_min);
799 vout3x0123456789ABCDEF = vmaxq_s8(vout3x0123456789ABCDEF, voutput_min);
800
801 const int8x16_t voutput_max = vld1q_dup_s8(¶ms->rndnu_neon.output_max);
802 vout0x0123456789ABCDEF = vminq_s8(vout0x0123456789ABCDEF, voutput_max);
803 vout1x0123456789ABCDEF = vminq_s8(vout1x0123456789ABCDEF, voutput_max);
804 vout2x0123456789ABCDEF = vminq_s8(vout2x0123456789ABCDEF, voutput_max);
805 vout3x0123456789ABCDEF = vminq_s8(vout3x0123456789ABCDEF, voutput_max);
806
807 if (nc >= 16) {
808 vst1q_s8(c3 + 0, vout3x0123456789ABCDEF);
809 vst1q_s8(c2 + 0, vout2x0123456789ABCDEF);
810 vst1q_s8(c1 + 0, vout1x0123456789ABCDEF);
811 vst1q_s8(c0 + 0, vout0x0123456789ABCDEF);
812
813 c3 = (int8_t*) ((uintptr_t) c3 + cn_stride);
814 c2 = (int8_t*) ((uintptr_t) c2 + cn_stride);
815 c1 = (int8_t*) ((uintptr_t) c1 + cn_stride);
816 c0 = (int8_t*) ((uintptr_t) c0 + cn_stride);
817
818 a = (const int8_t**restrict) ((uintptr_t) a - ks);
819
820 nc -= 16;
821 } else {
822 int8x16_t vout2x01234567_3x01234567 = vcombine_s8(vget_low_s8(vout2x0123456789ABCDEF), vget_low_s8(vout3x0123456789ABCDEF));
823 int8x16_t vout0x01234567_1x01234567 = vcombine_s8(vget_low_s8(vout0x0123456789ABCDEF), vget_low_s8(vout1x0123456789ABCDEF));
824 if (nc & 8) {
825 vst1_s8(c3, vget_high_s8(vout2x01234567_3x01234567)); c3 += 8;
826 vst1_s8(c2, vget_low_s8(vout2x01234567_3x01234567)); c2 += 8;
827 vst1_s8(c1, vget_high_s8(vout0x01234567_1x01234567)); c1 += 8;
828 vst1_s8(c0, vget_low_s8(vout0x01234567_1x01234567)); c0 += 8;
829 vout2x01234567_3x01234567 = vcombine_s8(vget_high_s8(vout2x0123456789ABCDEF), vget_high_s8(vout3x0123456789ABCDEF));
830 vout0x01234567_1x01234567 = vcombine_s8(vget_high_s8(vout0x0123456789ABCDEF), vget_high_s8(vout1x0123456789ABCDEF));
831 }
832 if (nc & 4) {
833 vst1q_lane_u32((void*) c3, vreinterpretq_u32_s8(vout2x01234567_3x01234567), 2); c3 += 4;
834 vst1q_lane_u32((void*) c2, vreinterpretq_u32_s8(vout2x01234567_3x01234567), 0); c2 += 4;
835 vst1q_lane_u32((void*) c1, vreinterpretq_u32_s8(vout0x01234567_1x01234567), 2); c1 += 4;
836 vst1q_lane_u32((void*) c0, vreinterpretq_u32_s8(vout0x01234567_1x01234567), 0); c0 += 4;
837 vout2x01234567_3x01234567 = vextq_s8(vout2x01234567_3x01234567, vout2x01234567_3x01234567, 4);
838 vout0x01234567_1x01234567 = vextq_s8(vout0x01234567_1x01234567, vout0x01234567_1x01234567, 4);
839 }
840 if (nc & 2) {
841 vst1q_lane_u16((void*) c3, vreinterpretq_u16_s8(vout2x01234567_3x01234567), 4); c3 += 2;
842 vst1q_lane_u16((void*) c2, vreinterpretq_u16_s8(vout2x01234567_3x01234567), 0); c2 += 2;
843 vst1q_lane_u16((void*) c1, vreinterpretq_u16_s8(vout0x01234567_1x01234567), 4); c1 += 2;
844 vst1q_lane_u16((void*) c0, vreinterpretq_u16_s8(vout0x01234567_1x01234567), 0); c0 += 2;
845 vout2x01234567_3x01234567 = vextq_s8(vout2x01234567_3x01234567, vout2x01234567_3x01234567, 2);
846 vout0x01234567_1x01234567 = vextq_s8(vout0x01234567_1x01234567, vout0x01234567_1x01234567, 2);
847 }
848 if (nc & 1) {
849 vst1q_lane_s8(c3, vout2x01234567_3x01234567, 8);
850 vst1q_lane_s8(c2, vout2x01234567_3x01234567, 0);
851 vst1q_lane_s8(c1, vout0x01234567_1x01234567, 8);
852 vst1q_lane_s8(c0, vout0x01234567_1x01234567, 0);
853 }
854
855 nc = 0;
856 }
857 } while (nc != 0);
858 }
859