1 // Auto-generated file. Do not edit!
2 // Template: src/qs8-igemm/c2-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/intrinsics-polyfill.h>
16 #include <xnnpack/math.h>
17
xnn_qc8_igemm_minmax_fp32_ukernel_2x8c2__neonv8_mlal_ld2r(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_qc8_conv_minmax_params params[restrict XNN_MIN_ELEMENTS (1)])18 void xnn_qc8_igemm_minmax_fp32_ukernel_2x8c2__neonv8_mlal_ld2r(
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_qc8_conv_minmax_params params[restrict XNN_MIN_ELEMENTS(1)]) XNN_OOB_READS
31 {
32 assert(mr != 0);
33 assert(mr <= 2);
34 assert(nc != 0);
35 assert(kc != 0);
36 assert(ks != 0);
37 assert(ks % (2 * 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, 2 * 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
50 do {
51 int32x4_t vacc0x0123 = vld1q_s32(w); w = (const void*) ((uintptr_t) w + 4 * sizeof(int32_t));
52 int32x4_t vacc0x4567 = vld1q_s32(w); w = (const void*) ((uintptr_t) w + 4 * sizeof(int32_t));
53 int32x4_t vacc1x0123 = vacc0x0123;
54 int32x4_t vacc1x4567 = vacc0x4567;
55
56 size_t p = ks;
57 do {
58 const int8_t* restrict a0 = a[0];
59 if XNN_UNPREDICTABLE(a0 != zero) {
60 a0 = (const int8_t*) ((uintptr_t) a0 + a_offset);
61 }
62 const int8_t* restrict a1 = a[1];
63 if XNN_UNPREDICTABLE(a1 != zero) {
64 a1 = (const int8_t*) ((uintptr_t) a1 + a_offset);
65 }
66 a += 2;
67
68 size_t k = kc;
69
70 while (k >= 16 * sizeof(int8_t)) {
71 const int16x4x2_t va00x0 = vld2_dup_s16((const void*)a0);
72 const int16x4x2_t va01x0 = vld2_dup_s16((const void*)(a0 + 4)); a0 += 8;
73 const int16x4x2_t va00x1 = vld2_dup_s16((const void*)a0);
74 const int16x4x2_t va01x1 = vld2_dup_s16((const void*)(a0 + 4)); a0 += 8;
75 const int16x4x2_t va10x0 = vld2_dup_s16((const void*)a1);
76 const int16x4x2_t va11x0 = vld2_dup_s16((const void*)(a1 + 4)); a1 += 8;
77 const int16x4x2_t va10x1 = vld2_dup_s16((const void*)a1);
78 const int16x4x2_t va11x1 = vld2_dup_s16((const void*)(a1 + 4)); a1 += 8;
79
80 const int8x8_t vb0123c0x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
81 const int8x8_t vb4567c0x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
82 const int8x8_t vb0123c1x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
83 const int8x8_t vb4567c1x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
84 const int8x8_t vb0123c2x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
85 const int8x8_t vb4567c2x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
86 const int8x8_t vb0123c3x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
87 const int8x8_t vb4567c3x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
88
89 const int8x8_t va0c0x0 = vreinterpret_s8_s16(va00x0.val[0]);
90 const int8x8_t va0c0x1 = vreinterpret_s8_s16(va00x1.val[0]);
91 const int8x8_t va1c0x0 = vreinterpret_s8_s16(va10x0.val[0]);
92 const int8x8_t va1c0x1 = vreinterpret_s8_s16(va10x1.val[0]);
93
94 int16x8_t vprod0x0123c0 = vmull_s8(vb0123c0x0, va0c0x0);
95 int16x8_t vprod1x0123c0 = vmull_s8(vb0123c0x0, va1c0x0);
96 const int8x8_t vb0123c0x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
97 vprod0x0123c0 = vmlal_s8(vprod0x0123c0, vb0123c0x1, va0c0x1);
98 vprod1x0123c0 = vmlal_s8(vprod1x0123c0, vb0123c0x1, va1c0x1);
99 vacc0x0123 = vpadalq_s16(vacc0x0123, vprod0x0123c0);
100 vacc1x0123 = vpadalq_s16(vacc1x0123, vprod1x0123c0);
101 int16x8_t vprod0x4567c0 = vmull_s8(vb4567c0x0, va0c0x0);
102 int16x8_t vprod1x4567c0 = vmull_s8(vb4567c0x0, va1c0x0);
103 const int8x8_t vb4567c0x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
104 vprod0x4567c0 = vmlal_s8(vprod0x4567c0, vb4567c0x1, va0c0x1);
105 vprod1x4567c0 = vmlal_s8(vprod1x4567c0, vb4567c0x1, va1c0x1);
106 vacc0x4567 = vpadalq_s16(vacc0x4567, vprod0x4567c0);
107 vacc1x4567 = vpadalq_s16(vacc1x4567, vprod1x4567c0);
108 const int8x8_t va0c1x0 = vreinterpret_s8_s16(va00x0.val[1]);
109 const int8x8_t va0c1x1 = vreinterpret_s8_s16(va00x1.val[1]);
110 const int8x8_t va1c1x0 = vreinterpret_s8_s16(va10x0.val[1]);
111 const int8x8_t va1c1x1 = vreinterpret_s8_s16(va10x1.val[1]);
112
113 int16x8_t vprod0x0123c1 = vmull_s8(vb0123c1x0, va0c1x0);
114 int16x8_t vprod1x0123c1 = vmull_s8(vb0123c1x0, va1c1x0);
115 const int8x8_t vb0123c1x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
116 vprod0x0123c1 = vmlal_s8(vprod0x0123c1, vb0123c1x1, va0c1x1);
117 vprod1x0123c1 = vmlal_s8(vprod1x0123c1, vb0123c1x1, va1c1x1);
118 vacc0x0123 = vpadalq_s16(vacc0x0123, vprod0x0123c1);
119 vacc1x0123 = vpadalq_s16(vacc1x0123, vprod1x0123c1);
120 int16x8_t vprod0x4567c1 = vmull_s8(vb4567c1x0, va0c1x0);
121 int16x8_t vprod1x4567c1 = vmull_s8(vb4567c1x0, va1c1x0);
122 const int8x8_t vb4567c1x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
123 vprod0x4567c1 = vmlal_s8(vprod0x4567c1, vb4567c1x1, va0c1x1);
124 vprod1x4567c1 = vmlal_s8(vprod1x4567c1, vb4567c1x1, va1c1x1);
125 vacc0x4567 = vpadalq_s16(vacc0x4567, vprod0x4567c1);
126 vacc1x4567 = vpadalq_s16(vacc1x4567, vprod1x4567c1);
127 const int8x8_t va0c2x0 = vreinterpret_s8_s16(va01x0.val[0]);
128 const int8x8_t va0c2x1 = vreinterpret_s8_s16(va01x1.val[0]);
129 const int8x8_t va1c2x0 = vreinterpret_s8_s16(va11x0.val[0]);
130 const int8x8_t va1c2x1 = vreinterpret_s8_s16(va11x1.val[0]);
131
132 int16x8_t vprod0x0123c2 = vmull_s8(vb0123c2x0, va0c2x0);
133 int16x8_t vprod1x0123c2 = vmull_s8(vb0123c2x0, va1c2x0);
134 const int8x8_t vb0123c2x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
135 vprod0x0123c2 = vmlal_s8(vprod0x0123c2, vb0123c2x1, va0c2x1);
136 vprod1x0123c2 = vmlal_s8(vprod1x0123c2, vb0123c2x1, va1c2x1);
137 vacc0x0123 = vpadalq_s16(vacc0x0123, vprod0x0123c2);
138 vacc1x0123 = vpadalq_s16(vacc1x0123, vprod1x0123c2);
139 int16x8_t vprod0x4567c2 = vmull_s8(vb4567c2x0, va0c2x0);
140 int16x8_t vprod1x4567c2 = vmull_s8(vb4567c2x0, va1c2x0);
141 const int8x8_t vb4567c2x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
142 vprod0x4567c2 = vmlal_s8(vprod0x4567c2, vb4567c2x1, va0c2x1);
143 vprod1x4567c2 = vmlal_s8(vprod1x4567c2, vb4567c2x1, va1c2x1);
144 vacc0x4567 = vpadalq_s16(vacc0x4567, vprod0x4567c2);
145 vacc1x4567 = vpadalq_s16(vacc1x4567, vprod1x4567c2);
146 const int8x8_t va0c3x0 = vreinterpret_s8_s16(va01x0.val[1]);
147 const int8x8_t va0c3x1 = vreinterpret_s8_s16(va01x1.val[1]);
148 const int8x8_t va1c3x0 = vreinterpret_s8_s16(va11x0.val[1]);
149 const int8x8_t va1c3x1 = vreinterpret_s8_s16(va11x1.val[1]);
150
151 int16x8_t vprod0x0123c3 = vmull_s8(vb0123c3x0, va0c3x0);
152 int16x8_t vprod1x0123c3 = vmull_s8(vb0123c3x0, va1c3x0);
153 const int8x8_t vb0123c3x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
154 vprod0x0123c3 = vmlal_s8(vprod0x0123c3, vb0123c3x1, va0c3x1);
155 vprod1x0123c3 = vmlal_s8(vprod1x0123c3, vb0123c3x1, va1c3x1);
156 vacc0x0123 = vpadalq_s16(vacc0x0123, vprod0x0123c3);
157 vacc1x0123 = vpadalq_s16(vacc1x0123, vprod1x0123c3);
158 int16x8_t vprod0x4567c3 = vmull_s8(vb4567c3x0, va0c3x0);
159 int16x8_t vprod1x4567c3 = vmull_s8(vb4567c3x0, va1c3x0);
160 const int8x8_t vb4567c3x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
161 vprod0x4567c3 = vmlal_s8(vprod0x4567c3, vb4567c3x1, va0c3x1);
162 vprod1x4567c3 = vmlal_s8(vprod1x4567c3, vb4567c3x1, va1c3x1);
163 vacc0x4567 = vpadalq_s16(vacc0x4567, vprod0x4567c3);
164 vacc1x4567 = vpadalq_s16(vacc1x4567, vprod1x4567c3);
165
166 k -= 16 * sizeof(int8_t);
167 }
168
169 if (k >= 8 * sizeof(int8_t)) {
170 const int16x4x2_t va00 = vld2_dup_s16((const void*)a0);
171 const int16x4x2_t va01 = vld2_dup_s16((const void*)(a0 + 4)); a0 += 8;
172 const int16x4x2_t va10 = vld2_dup_s16((const void*)a1);
173 const int16x4x2_t va11 = vld2_dup_s16((const void*)(a1 + 4)); a1 += 8;
174
175 const int8x8_t vb0123c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
176 const int8x8_t vb4567c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
177 const int8x8_t vb0123c1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
178 const int8x8_t vb4567c1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
179 const int8x8_t vb0123c2 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
180 const int8x8_t vb4567c2 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
181 const int8x8_t vb0123c3 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
182 const int8x8_t vb4567c3 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
183
184 const int8x8_t va0c0 = vreinterpret_s8_s16(va00.val[0]);
185 const int8x8_t va1c0 = vreinterpret_s8_s16(va10.val[0]);
186
187 const int16x8_t vprod0x0123c0 = vmull_s8(vb0123c0, va0c0);
188 const int16x8_t vprod1x0123c0 = vmull_s8(vb0123c0, va1c0);
189 vacc0x0123 = vpadalq_s16(vacc0x0123, vprod0x0123c0);
190 vacc1x0123 = vpadalq_s16(vacc1x0123, vprod1x0123c0);
191 const int16x8_t vprod0x4567c0 = vmull_s8(vb4567c0, va0c0);
192 const int16x8_t vprod1x4567c0 = vmull_s8(vb4567c0, va1c0);
193 vacc0x4567 = vpadalq_s16(vacc0x4567, vprod0x4567c0);
194 vacc1x4567 = vpadalq_s16(vacc1x4567, vprod1x4567c0);
195 const int8x8_t va0c1 = vreinterpret_s8_s16(va00.val[1]);
196 const int8x8_t va1c1 = vreinterpret_s8_s16(va10.val[1]);
197
198 const int16x8_t vprod0x0123c1 = vmull_s8(vb0123c1, va0c1);
199 const int16x8_t vprod1x0123c1 = vmull_s8(vb0123c1, va1c1);
200 vacc0x0123 = vpadalq_s16(vacc0x0123, vprod0x0123c1);
201 vacc1x0123 = vpadalq_s16(vacc1x0123, vprod1x0123c1);
202 const int16x8_t vprod0x4567c1 = vmull_s8(vb4567c1, va0c1);
203 const int16x8_t vprod1x4567c1 = vmull_s8(vb4567c1, va1c1);
204 vacc0x4567 = vpadalq_s16(vacc0x4567, vprod0x4567c1);
205 vacc1x4567 = vpadalq_s16(vacc1x4567, vprod1x4567c1);
206 const int8x8_t va0c2 = vreinterpret_s8_s16(va01.val[0]);
207 const int8x8_t va1c2 = vreinterpret_s8_s16(va11.val[0]);
208
209 const int16x8_t vprod0x0123c2 = vmull_s8(vb0123c2, va0c2);
210 const int16x8_t vprod1x0123c2 = vmull_s8(vb0123c2, va1c2);
211 vacc0x0123 = vpadalq_s16(vacc0x0123, vprod0x0123c2);
212 vacc1x0123 = vpadalq_s16(vacc1x0123, vprod1x0123c2);
213 const int16x8_t vprod0x4567c2 = vmull_s8(vb4567c2, va0c2);
214 const int16x8_t vprod1x4567c2 = vmull_s8(vb4567c2, va1c2);
215 vacc0x4567 = vpadalq_s16(vacc0x4567, vprod0x4567c2);
216 vacc1x4567 = vpadalq_s16(vacc1x4567, vprod1x4567c2);
217 const int8x8_t va0c3 = vreinterpret_s8_s16(va01.val[1]);
218 const int8x8_t va1c3 = vreinterpret_s8_s16(va11.val[1]);
219
220 const int16x8_t vprod0x0123c3 = vmull_s8(vb0123c3, va0c3);
221 const int16x8_t vprod1x0123c3 = vmull_s8(vb0123c3, va1c3);
222 vacc0x0123 = vpadalq_s16(vacc0x0123, vprod0x0123c3);
223 vacc1x0123 = vpadalq_s16(vacc1x0123, vprod1x0123c3);
224 const int16x8_t vprod0x4567c3 = vmull_s8(vb4567c3, va0c3);
225 const int16x8_t vprod1x4567c3 = vmull_s8(vb4567c3, va1c3);
226 vacc0x4567 = vpadalq_s16(vacc0x4567, vprod0x4567c3);
227 vacc1x4567 = vpadalq_s16(vacc1x4567, vprod1x4567c3);
228
229 k -= 8 * sizeof(int8_t);
230 }
231
232 if XNN_UNLIKELY(k != 0) {
233 const int8x8_t va0 = vld1_s8(a0); a0 = (const int8_t*) ((uintptr_t) a0 + k);
234 const int8x8_t va1 = vld1_s8(a1); a1 = (const int8_t*) ((uintptr_t) a1 + k);
235
236 const int8x8_t vb0123c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
237 const int8x8_t vb4567c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
238
239 const int8x8_t va0c0 = vreinterpret_s8_s16(vdup_lane_s16(vreinterpret_s16_s8(va0), 0));
240 const int16x8_t vprod0x0123c0 = vmull_s8(vb0123c0, va0c0);
241 vacc0x0123 = vpadalq_s16(vacc0x0123, vprod0x0123c0);
242 const int16x8_t vprod0x4567c0 = vmull_s8(vb4567c0, va0c0);
243 vacc0x4567 = vpadalq_s16(vacc0x4567, vprod0x4567c0);
244 const int8x8_t va1c0 = vreinterpret_s8_s16(vdup_lane_s16(vreinterpret_s16_s8(va1), 0));
245 const int16x8_t vprod1x0123c0 = vmull_s8(vb0123c0, va1c0);
246 vacc1x0123 = vpadalq_s16(vacc1x0123, vprod1x0123c0);
247 const int16x8_t vprod1x4567c0 = vmull_s8(vb4567c0, va1c0);
248 vacc1x4567 = vpadalq_s16(vacc1x4567, vprod1x4567c0);
249
250 if (k > 2 * sizeof(int8_t)) {
251 const int8x8_t vb0123c1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
252 const int8x8_t vb4567c1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
253
254 const int8x8_t va0c1 = vreinterpret_s8_s16(vdup_lane_s16(vreinterpret_s16_s8(va0), 1));
255 const int16x8_t vprod0x0123c1 = vmull_s8(vb0123c1, va0c1);
256 vacc0x0123 = vpadalq_s16(vacc0x0123, vprod0x0123c1);
257 const int16x8_t vprod0x4567c1 = vmull_s8(vb4567c1, va0c1);
258 vacc0x4567 = vpadalq_s16(vacc0x4567, vprod0x4567c1);
259 const int8x8_t va1c1 = vreinterpret_s8_s16(vdup_lane_s16(vreinterpret_s16_s8(va1), 1));
260 const int16x8_t vprod1x0123c1 = vmull_s8(vb0123c1, va1c1);
261 vacc1x0123 = vpadalq_s16(vacc1x0123, vprod1x0123c1);
262 const int16x8_t vprod1x4567c1 = vmull_s8(vb4567c1, va1c1);
263 vacc1x4567 = vpadalq_s16(vacc1x4567, vprod1x4567c1);
264
265 if (k > 4 * sizeof(int8_t)) {
266 const int8x8_t vb0123c2 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
267 const int8x8_t vb4567c2 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
268
269 const int8x8_t va0c2 = vreinterpret_s8_s16(vdup_lane_s16(vreinterpret_s16_s8(va0), 2));
270 const int16x8_t vprod0x0123c2 = vmull_s8(vb0123c2, va0c2);
271 vacc0x0123 = vpadalq_s16(vacc0x0123, vprod0x0123c2);
272 const int16x8_t vprod0x4567c2 = vmull_s8(vb4567c2, va0c2);
273 vacc0x4567 = vpadalq_s16(vacc0x4567, vprod0x4567c2);
274 const int8x8_t va1c2 = vreinterpret_s8_s16(vdup_lane_s16(vreinterpret_s16_s8(va1), 2));
275 const int16x8_t vprod1x0123c2 = vmull_s8(vb0123c2, va1c2);
276 vacc1x0123 = vpadalq_s16(vacc1x0123, vprod1x0123c2);
277 const int16x8_t vprod1x4567c2 = vmull_s8(vb4567c2, va1c2);
278 vacc1x4567 = vpadalq_s16(vacc1x4567, vprod1x4567c2);
279 }
280 }
281 }
282 p -= 2 * sizeof(void*);
283 } while (p != 0);
284
285 float32x4_t vfpacc0x0123 = vcvtq_f32_s32(vacc0x0123);
286 float32x4_t vfpacc0x4567 = vcvtq_f32_s32(vacc0x4567);
287 float32x4_t vfpacc1x0123 = vcvtq_f32_s32(vacc1x0123);
288 float32x4_t vfpacc1x4567 = vcvtq_f32_s32(vacc1x4567);
289
290 const float32x4_t vscale0123 = vld1q_f32((const float*) w); w = (const void*) ((const float*) w + 4);
291 vfpacc0x0123 = vmulq_f32(vfpacc0x0123, vscale0123);
292 vfpacc1x0123 = vmulq_f32(vfpacc1x0123, vscale0123);
293 const float32x4_t vscale4567 = vld1q_f32((const float*) w); w = (const void*) ((const float*) w + 4);
294 vfpacc0x4567 = vmulq_f32(vfpacc0x4567, vscale4567);
295 vfpacc1x4567 = vmulq_f32(vfpacc1x4567, vscale4567);
296
297 vacc0x0123 = vcvtnq_s32_f32(vfpacc0x0123);
298 vacc0x4567 = vcvtnq_s32_f32(vfpacc0x4567);
299 vacc1x0123 = vcvtnq_s32_f32(vfpacc1x0123);
300 vacc1x4567 = vcvtnq_s32_f32(vfpacc1x4567);
301
302 const int16x8_t voutput_zero_point = vld1q_dup_s16(¶ms->fp32_neonv8.output_zero_point);
303 #if XNN_ARCH_ARM64
304 int16x8_t vacc0x01234567 = vqmovn_high_s32(vqmovn_s32(vacc0x0123), vacc0x4567);
305 int16x8_t vacc1x01234567 = vqmovn_high_s32(vqmovn_s32(vacc1x0123), vacc1x4567);
306
307 vacc0x01234567 = vqaddq_s16(vacc0x01234567, voutput_zero_point);
308 vacc1x01234567 = vqaddq_s16(vacc1x01234567, voutput_zero_point);
309
310 int8x16_t vout0x01234567_1x01234567 = vqmovn_high_s16(vqmovn_s16(vacc0x01234567), vacc1x01234567);
311 #else
312 int16x8_t vacc0x01234567 = vcombine_s16(vqmovn_s32(vacc0x0123), vqmovn_s32(vacc0x4567));
313 int16x8_t vacc1x01234567 = vcombine_s16(vqmovn_s32(vacc1x0123), vqmovn_s32(vacc1x4567));
314
315 vacc0x01234567 = vqaddq_s16(vacc0x01234567, voutput_zero_point);
316 vacc1x01234567 = vqaddq_s16(vacc1x01234567, voutput_zero_point);
317
318 int8x16_t vout0x01234567_1x01234567 = vcombine_s8(vqmovn_s16(vacc0x01234567), vqmovn_s16(vacc1x01234567));
319 #endif
320
321 const int8x16_t voutput_min = vld1q_dup_s8(¶ms->fp32_neonv8.output_min);
322 vout0x01234567_1x01234567 = vmaxq_s8(vout0x01234567_1x01234567, voutput_min);
323
324 const int8x16_t voutput_max = vld1q_dup_s8(¶ms->fp32_neonv8.output_max);
325 vout0x01234567_1x01234567 = vminq_s8(vout0x01234567_1x01234567, voutput_max);
326
327 if (nc >= 8) {
328 vst1_s8(c1 + 0, vget_high_s8(vout0x01234567_1x01234567));
329 vst1_s8(c0 + 0, vget_low_s8(vout0x01234567_1x01234567));
330
331 c1 = (int8_t*) ((uintptr_t) c1 + cn_stride);
332 c0 = (int8_t*) ((uintptr_t) c0 + cn_stride);
333
334 a = (const int8_t**restrict) ((uintptr_t) a - ks);
335
336 nc -= 8;
337 } else {
338 if (nc & 4) {
339 vst1q_lane_u32((void*) c1, vreinterpretq_u32_s8(vout0x01234567_1x01234567), 2); c1 += 4;
340 vst1q_lane_u32((void*) c0, vreinterpretq_u32_s8(vout0x01234567_1x01234567), 0); c0 += 4;
341 vout0x01234567_1x01234567 = vextq_s8(vout0x01234567_1x01234567, vout0x01234567_1x01234567, 4);
342 }
343 if (nc & 2) {
344 vst1q_lane_u16((void*) c1, vreinterpretq_u16_s8(vout0x01234567_1x01234567), 4); c1 += 2;
345 vst1q_lane_u16((void*) c0, vreinterpretq_u16_s8(vout0x01234567_1x01234567), 0); c0 += 2;
346 vout0x01234567_1x01234567 = vextq_s8(vout0x01234567_1x01234567, vout0x01234567_1x01234567, 2);
347 }
348 if (nc & 1) {
349 vst1q_lane_s8(c1, vout0x01234567_1x01234567, 8);
350 vst1q_lane_s8(c0, vout0x01234567_1x01234567, 0);
351 }
352
353 nc = 0;
354 }
355 } while (nc != 0);
356 }
357