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