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