Debian Codegraph @

src/qs8-qc8w-igemm/gen/qs8-qc8w-igemm-6x8c8-minmax-fp32-neoni8mm.c

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/qs8-igemm/c8-neoni8mm.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2023 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/igemm.h"
15 #include "xnnpack/intrinsics-polyfill.h"
16 #include "xnnpack/math.h"
17
18
19 void xnn_qs8_qc8w_igemm_minmax_fp32_ukernel_6x8c8__neoni8mm(
20 size_t mr,
21 size_t nc,
22 size_t kc,
23 size_t ks,
24 const int8_t** restrict a,
25 const void* restrict w,
26 int8_t* restrict c,
27 size_t cm_stride,
28 size_t cn_stride,
29 size_t a_offset,
30 const int8_t* zero,
31 const union xnn_qs8_qc8w_conv_minmax_params params[restrict XNN_MIN_ELEMENTS(1)]) XNN_OOB_READS
32 {
33 assert(mr != 0);
34 assert(mr <= 6);
35 assert(nc != 0);
36 assert(kc != 0);
37 assert(ks != 0);
38 assert(ks % (6 * sizeof(void*)) == 0);
39 assert(a_offset % sizeof(int8_t) == 0);
40 assert(a != NULL);
41 assert(w != NULL);
42 assert(c != NULL);
43
44 kc = round_up_po2(kc, 8 * sizeof(int8_t));
45 int8_t* c0 = c;
46 int8_t* c1 = (int8_t*) ((uintptr_t) c0 + cm_stride);
47 if XNN_UNPREDICTABLE(mr < 2) {
48 c1 = c0;
49 }
50 int8_t* c2 = (int8_t*) ((uintptr_t) c1 + cm_stride);
51 if XNN_UNPREDICTABLE(mr <= 2) {
52 c2 = c1;
53 }
54 int8_t* c3 = (int8_t*) ((uintptr_t) c2 + cm_stride);
55 if XNN_UNPREDICTABLE(mr < 4) {
56 c3 = c2;
57 }
58 int8_t* c4 = (int8_t*) ((uintptr_t) c3 + cm_stride);
59 if XNN_UNPREDICTABLE(mr <= 4) {
60 c4 = c3;
61 }
62 int8_t* c5 = (int8_t*) ((uintptr_t) c4 + cm_stride);
63 if XNN_UNPREDICTABLE(mr != 6) {
64 c5 = c4;
65 }
66
67 do {
68 const uint64x2x2_t vbias01x0123 = vld2q_dup_u64(w); w = (const int32_t*) w + 4;
69 const uint64x2x2_t vbias01x4567 = vld2q_dup_u64(w); w = (const int32_t*) w + 4;
70 int32x4_t vacc01x01 = vreinterpretq_s32_u64(vbias01x0123.val[0]);
71 int32x4_t vacc01x23 = vreinterpretq_s32_u64(vbias01x0123.val[1]);
72 int32x4_t vacc01x45 = vreinterpretq_s32_u64(vbias01x4567.val[0]);
73 int32x4_t vacc01x67 = vreinterpretq_s32_u64(vbias01x4567.val[1]);
74 int32x4_t vacc23x01 = vreinterpretq_s32_u64(vbias01x0123.val[0]);
75 int32x4_t vacc23x23 = vreinterpretq_s32_u64(vbias01x0123.val[1]);
76 int32x4_t vacc23x45 = vreinterpretq_s32_u64(vbias01x4567.val[0]);
77 int32x4_t vacc23x67 = vreinterpretq_s32_u64(vbias01x4567.val[1]);
78 int32x4_t vacc45x01 = vreinterpretq_s32_u64(vbias01x0123.val[0]);
79 int32x4_t vacc45x23 = vreinterpretq_s32_u64(vbias01x0123.val[1]);
80 int32x4_t vacc45x45 = vreinterpretq_s32_u64(vbias01x4567.val[0]);
81 int32x4_t vacc45x67 = vreinterpretq_s32_u64(vbias01x4567.val[1]);
82
83 size_t p = ks;
84 do {
85 const int8_t* restrict a0 = a[0];
86 if XNN_UNPREDICTABLE(a0 != zero) {
87 a0 = (const int8_t*) ((uintptr_t) a0 + a_offset);
88 }
89 const int8_t* restrict a1 = a[1];
90 if XNN_UNPREDICTABLE(a1 != zero) {
91 a1 = (const int8_t*) ((uintptr_t) a1 + a_offset);
92 }
93 const int8_t* restrict a2 = a[2];
94 if XNN_UNPREDICTABLE(a2 != zero) {
95 a2 = (const int8_t*) ((uintptr_t) a2 + a_offset);
96 }
97 const int8_t* restrict a3 = a[3];
98 if XNN_UNPREDICTABLE(a3 != zero) {
99 a3 = (const int8_t*) ((uintptr_t) a3 + a_offset);
100 }
101 const int8_t* restrict a4 = a[4];
102 if XNN_UNPREDICTABLE(a4 != zero) {
103 a4 = (const int8_t*) ((uintptr_t) a4 + a_offset);
104 }
105 const int8_t* restrict a5 = a[5];
106 if XNN_UNPREDICTABLE(a5 != zero) {
107 a5 = (const int8_t*) ((uintptr_t) a5 + a_offset);
108 }
109 a += 6;
110
111 uint64x2x2_t va01x0123456789ABCDEF;
112 va01x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
113 va01x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
114 uint64x2x2_t va23x0123456789ABCDEF;
115 va23x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
116 va23x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
117 uint64x2x2_t va45x0123456789ABCDEF;
118 va45x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
119 va45x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
120
121 // Inner accumulation loop along the 8 columns.
122 size_t k = kc;
123 // 2x partial unrolled loop to load 8 bytes at a time.
124 while (k >= 16 * sizeof(int8_t)) {
125 // Load a 6x16 block of activations.
126 va01x0123456789ABCDEF = vld2q_lane_u64((const void*) a0, va01x0123456789ABCDEF, 0); a0 += 16;
127 va23x0123456789ABCDEF = vld2q_lane_u64((const void*) a2, va23x0123456789ABCDEF, 0); a2 += 16;
128 va45x0123456789ABCDEF = vld2q_lane_u64((const void*) a4, va45x0123456789ABCDEF, 0); a4 += 16;
129 va01x0123456789ABCDEF = vld2q_lane_u64((const void*) a1, va01x0123456789ABCDEF, 1); a1 += 16;
130 va23x0123456789ABCDEF = vld2q_lane_u64((const void*) a3, va23x0123456789ABCDEF, 1); a3 += 16;
131 va45x0123456789ABCDEF = vld2q_lane_u64((const void*) a5, va45x0123456789ABCDEF, 1); a5 += 16;
132
133 // Load a 16x8 block of weights.
134 const int8x16_t vb01x01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
135 const int8x16_t vb23x01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
136 const int8x16_t vb45x01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
137 const int8x16_t vb67x01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
138 const int8x16_t vb01x89ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
139 const int8x16_t vb23x89ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
140 const int8x16_t vb45x89ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
141 const int8x16_t vb67x89ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
142
143 // Multiply-accumulate: 6x16 * 16x8 --> 6x8.
144 vacc01x01 = vmmlaq_s32(vacc01x01, vreinterpretq_s8_u64(va01x0123456789ABCDEF.val[0]), vb01x01234567);
145 vacc01x23 = vmmlaq_s32(vacc01x23, vreinterpretq_s8_u64(va01x0123456789ABCDEF.val[0]), vb23x01234567);
146 vacc01x45 = vmmlaq_s32(vacc01x45, vreinterpretq_s8_u64(va01x0123456789ABCDEF.val[0]), vb45x01234567);
147 vacc01x67 = vmmlaq_s32(vacc01x67, vreinterpretq_s8_u64(va01x0123456789ABCDEF.val[0]), vb67x01234567);
148 vacc23x01 = vmmlaq_s32(vacc23x01, vreinterpretq_s8_u64(va23x0123456789ABCDEF.val[0]), vb01x01234567);
149 vacc23x23 = vmmlaq_s32(vacc23x23, vreinterpretq_s8_u64(va23x0123456789ABCDEF.val[0]), vb23x01234567);
150 vacc23x45 = vmmlaq_s32(vacc23x45, vreinterpretq_s8_u64(va23x0123456789ABCDEF.val[0]), vb45x01234567);
151 vacc23x67 = vmmlaq_s32(vacc23x67, vreinterpretq_s8_u64(va23x0123456789ABCDEF.val[0]), vb67x01234567);
152 vacc45x01 = vmmlaq_s32(vacc45x01, vreinterpretq_s8_u64(va45x0123456789ABCDEF.val[0]), vb01x01234567);
153 vacc45x23 = vmmlaq_s32(vacc45x23, vreinterpretq_s8_u64(va45x0123456789ABCDEF.val[0]), vb23x01234567);
154 vacc45x45 = vmmlaq_s32(vacc45x45, vreinterpretq_s8_u64(va45x0123456789ABCDEF.val[0]), vb45x01234567);
155 vacc45x67 = vmmlaq_s32(vacc45x67, vreinterpretq_s8_u64(va45x0123456789ABCDEF.val[0]), vb67x01234567);
156 vacc01x01 = vmmlaq_s32(vacc01x01, vreinterpretq_s8_u64(va01x0123456789ABCDEF.val[1]), vb01x89ABCDEF);
157 vacc01x23 = vmmlaq_s32(vacc01x23, vreinterpretq_s8_u64(va01x0123456789ABCDEF.val[1]), vb23x89ABCDEF);
158 vacc01x45 = vmmlaq_s32(vacc01x45, vreinterpretq_s8_u64(va01x0123456789ABCDEF.val[1]), vb45x89ABCDEF);
159 vacc01x67 = vmmlaq_s32(vacc01x67, vreinterpretq_s8_u64(va01x0123456789ABCDEF.val[1]), vb67x89ABCDEF);
160 vacc23x01 = vmmlaq_s32(vacc23x01, vreinterpretq_s8_u64(va23x0123456789ABCDEF.val[1]), vb01x89ABCDEF);
161 vacc23x23 = vmmlaq_s32(vacc23x23, vreinterpretq_s8_u64(va23x0123456789ABCDEF.val[1]), vb23x89ABCDEF);
162 vacc23x45 = vmmlaq_s32(vacc23x45, vreinterpretq_s8_u64(va23x0123456789ABCDEF.val[1]), vb45x89ABCDEF);
163 vacc23x67 = vmmlaq_s32(vacc23x67, vreinterpretq_s8_u64(va23x0123456789ABCDEF.val[1]), vb67x89ABCDEF);
164 vacc45x01 = vmmlaq_s32(vacc45x01, vreinterpretq_s8_u64(va45x0123456789ABCDEF.val[1]), vb01x89ABCDEF);
165 vacc45x23 = vmmlaq_s32(vacc45x23, vreinterpretq_s8_u64(va45x0123456789ABCDEF.val[1]), vb23x89ABCDEF);
166 vacc45x45 = vmmlaq_s32(vacc45x45, vreinterpretq_s8_u64(va45x0123456789ABCDEF.val[1]), vb45x89ABCDEF);
167 vacc45x67 = vmmlaq_s32(vacc45x67, vreinterpretq_s8_u64(va45x0123456789ABCDEF.val[1]), vb67x89ABCDEF);
168
169 k -= 16 * sizeof(int8_t);
170 }
171 // Handle up to 8 final positions of `k`
172 if XNN_UNLIKELY(k != 0) {
173 // Load a 6x8 block of activations.
174 uint64x2_t va01x01234567 = vld1q_dup_u64((const void*) a0); a0 += 8;
175 uint64x2_t va23x01234567 = vld1q_dup_u64((const void*) a2); a2 += 8;
176 uint64x2_t va45x01234567 = vld1q_dup_u64((const void*) a4); a4 += 8;
177 va01x01234567 = vld1q_lane_u64((const void*) a1, va01x01234567, 1); a1 += 8;
178 va23x01234567 = vld1q_lane_u64((const void*) a3, va23x01234567, 1); a3 += 8;
179 va45x01234567 = vld1q_lane_u64((const void*) a5, va45x01234567, 1); a5 += 8;
180
181 // Load a 16x8 block of weights.
182 const int8x16_t vb01x01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
183 const int8x16_t vb23x01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
184 const int8x16_t vb45x01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
185 const int8x16_t vb67x01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
186
187 // Multiply-accumulate: 6x4 * 4x8 --> 6x8.
188 vacc01x01 = vmmlaq_s32(vacc01x01, vreinterpretq_s8_u64(va01x01234567), vb01x01234567);
189 vacc01x23 = vmmlaq_s32(vacc01x23, vreinterpretq_s8_u64(va01x01234567), vb23x01234567);
190 vacc01x45 = vmmlaq_s32(vacc01x45, vreinterpretq_s8_u64(va01x01234567), vb45x01234567);
191 vacc01x67 = vmmlaq_s32(vacc01x67, vreinterpretq_s8_u64(va01x01234567), vb67x01234567);
192 vacc23x01 = vmmlaq_s32(vacc23x01, vreinterpretq_s8_u64(va23x01234567), vb01x01234567);
193 vacc23x23 = vmmlaq_s32(vacc23x23, vreinterpretq_s8_u64(va23x01234567), vb23x01234567);
194 vacc23x45 = vmmlaq_s32(vacc23x45, vreinterpretq_s8_u64(va23x01234567), vb45x01234567);
195 vacc23x67 = vmmlaq_s32(vacc23x67, vreinterpretq_s8_u64(va23x01234567), vb67x01234567);
196 vacc45x01 = vmmlaq_s32(vacc45x01, vreinterpretq_s8_u64(va45x01234567), vb01x01234567);
197 vacc45x23 = vmmlaq_s32(vacc45x23, vreinterpretq_s8_u64(va45x01234567), vb23x01234567);
198 vacc45x45 = vmmlaq_s32(vacc45x45, vreinterpretq_s8_u64(va45x01234567), vb45x01234567);
199 vacc45x67 = vmmlaq_s32(vacc45x67, vreinterpretq_s8_u64(va45x01234567), vb67x01234567);
200 }
201
202 p -= 6 * sizeof(void*);
203 } while (p != 0);
204
205 int32x4_t vacc0x0123 = vcombine_s32(vget_low_s32(vacc01x01), vget_low_s32(vacc01x23));
206 int32x4_t vacc1x0123 = vcombine_s32(vget_high_s32(vacc01x01), vget_high_s32(vacc01x23));
207 int32x4_t vacc0x4567 = vcombine_s32(vget_low_s32(vacc01x45), vget_low_s32(vacc01x67));
208 int32x4_t vacc1x4567 = vcombine_s32(vget_high_s32(vacc01x45), vget_high_s32(vacc01x67));
209 int32x4_t vacc2x0123 = vcombine_s32(vget_low_s32(vacc23x01), vget_low_s32(vacc23x23));
210 int32x4_t vacc3x0123 = vcombine_s32(vget_high_s32(vacc23x01), vget_high_s32(vacc23x23));
211 int32x4_t vacc2x4567 = vcombine_s32(vget_low_s32(vacc23x45), vget_low_s32(vacc23x67));
212 int32x4_t vacc3x4567 = vcombine_s32(vget_high_s32(vacc23x45), vget_high_s32(vacc23x67));
213 int32x4_t vacc4x0123 = vcombine_s32(vget_low_s32(vacc45x01), vget_low_s32(vacc45x23));
214 int32x4_t vacc5x0123 = vcombine_s32(vget_high_s32(vacc45x01), vget_high_s32(vacc45x23));
215 int32x4_t vacc4x4567 = vcombine_s32(vget_low_s32(vacc45x45), vget_low_s32(vacc45x67));
216 int32x4_t vacc5x4567 = vcombine_s32(vget_high_s32(vacc45x45), vget_high_s32(vacc45x67));
217
218 float32x4_t vfpacc0x0123 = vcvtq_f32_s32(vacc0x0123);
219 float32x4_t vfpacc0x4567 = vcvtq_f32_s32(vacc0x4567);
220 float32x4_t vfpacc1x0123 = vcvtq_f32_s32(vacc1x0123);
221 float32x4_t vfpacc1x4567 = vcvtq_f32_s32(vacc1x4567);
222 float32x4_t vfpacc2x0123 = vcvtq_f32_s32(vacc2x0123);
223 float32x4_t vfpacc2x4567 = vcvtq_f32_s32(vacc2x4567);
224 float32x4_t vfpacc3x0123 = vcvtq_f32_s32(vacc3x0123);
225 float32x4_t vfpacc3x4567 = vcvtq_f32_s32(vacc3x4567);
226 float32x4_t vfpacc4x0123 = vcvtq_f32_s32(vacc4x0123);
227 float32x4_t vfpacc4x4567 = vcvtq_f32_s32(vacc4x4567);
228 float32x4_t vfpacc5x0123 = vcvtq_f32_s32(vacc5x0123);
229 float32x4_t vfpacc5x4567 = vcvtq_f32_s32(vacc5x4567);
230
231 const float32x4_t vscale0123 = vld1q_f32((const float*) w); w = (const float*) w + 4;
232 vfpacc0x0123 = vmulq_f32(vfpacc0x0123, vscale0123);
233 vfpacc1x0123 = vmulq_f32(vfpacc1x0123, vscale0123);
234 vfpacc2x0123 = vmulq_f32(vfpacc2x0123, vscale0123);
235 vfpacc3x0123 = vmulq_f32(vfpacc3x0123, vscale0123);
236 vfpacc4x0123 = vmulq_f32(vfpacc4x0123, vscale0123);
237 vfpacc5x0123 = vmulq_f32(vfpacc5x0123, vscale0123);
238 const float32x4_t vscale4567 = vld1q_f32((const float*) w); w = (const float*) w + 4;
239 vfpacc0x4567 = vmulq_f32(vfpacc0x4567, vscale4567);
240 vfpacc1x4567 = vmulq_f32(vfpacc1x4567, vscale4567);
241 vfpacc2x4567 = vmulq_f32(vfpacc2x4567, vscale4567);
242 vfpacc3x4567 = vmulq_f32(vfpacc3x4567, vscale4567);
243 vfpacc4x4567 = vmulq_f32(vfpacc4x4567, vscale4567);
244 vfpacc5x4567 = vmulq_f32(vfpacc5x4567, vscale4567);
245
246 vacc0x0123 = vcvtnq_s32_f32(vfpacc0x0123);
247 vacc0x4567 = vcvtnq_s32_f32(vfpacc0x4567);
248 vacc1x0123 = vcvtnq_s32_f32(vfpacc1x0123);
249 vacc1x4567 = vcvtnq_s32_f32(vfpacc1x4567);
250 vacc2x0123 = vcvtnq_s32_f32(vfpacc2x0123);
251 vacc2x4567 = vcvtnq_s32_f32(vfpacc2x4567);
252 vacc3x0123 = vcvtnq_s32_f32(vfpacc3x0123);
253 vacc3x4567 = vcvtnq_s32_f32(vfpacc3x4567);
254 vacc4x0123 = vcvtnq_s32_f32(vfpacc4x0123);
255 vacc4x4567 = vcvtnq_s32_f32(vfpacc4x4567);
256 vacc5x0123 = vcvtnq_s32_f32(vfpacc5x0123);
257 vacc5x4567 = vcvtnq_s32_f32(vfpacc5x4567);
258
259 const int16x8_t voutput_zero_point = vld1q_dup_s16(&params->fp32_neonv8.output_zero_point);
260 #if XNN_ARCH_ARM64
261 const int16x8_t vacc0x01234567 = vqaddq_s16(vqmovn_high_s32(vqmovn_s32(vacc0x0123), vacc0x4567), voutput_zero_point);
262 const int16x8_t vacc1x01234567 = vqaddq_s16(vqmovn_high_s32(vqmovn_s32(vacc1x0123), vacc1x4567), voutput_zero_point);
263 const int16x8_t vacc2x01234567 = vqaddq_s16(vqmovn_high_s32(vqmovn_s32(vacc2x0123), vacc2x4567), voutput_zero_point);
264 const int16x8_t vacc3x01234567 = vqaddq_s16(vqmovn_high_s32(vqmovn_s32(vacc3x0123), vacc3x4567), voutput_zero_point);
265 const int16x8_t vacc4x01234567 = vqaddq_s16(vqmovn_high_s32(vqmovn_s32(vacc4x0123), vacc4x4567), voutput_zero_point);
266 const int16x8_t vacc5x01234567 = vqaddq_s16(vqmovn_high_s32(vqmovn_s32(vacc5x0123), vacc5x4567), voutput_zero_point);
267
268 int8x16_t vout0x01234567_1x01234567 = vqmovn_high_s16(vqmovn_s16(vacc0x01234567), vacc1x01234567);
269 int8x16_t vout2x01234567_3x01234567 = vqmovn_high_s16(vqmovn_s16(vacc2x01234567), vacc3x01234567);
270 int8x16_t vout4x01234567_5x01234567 = vqmovn_high_s16(vqmovn_s16(vacc4x01234567), vacc5x01234567);
271 #else
272 const int16x8_t vacc0x01234567 = vqaddq_s16(vcombine_s16(vqmovn_s32(vacc0x0123), vqmovn_s32(vacc0x4567)), voutput_zero_point);
273 const int16x8_t vacc1x01234567 = vqaddq_s16(vcombine_s16(vqmovn_s32(vacc1x0123), vqmovn_s32(vacc1x4567)), voutput_zero_point);
274 const int16x8_t vacc2x01234567 = vqaddq_s16(vcombine_s16(vqmovn_s32(vacc2x0123), vqmovn_s32(vacc2x4567)), voutput_zero_point);
275 const int16x8_t vacc3x01234567 = vqaddq_s16(vcombine_s16(vqmovn_s32(vacc3x0123), vqmovn_s32(vacc3x4567)), voutput_zero_point);
276 const int16x8_t vacc4x01234567 = vqaddq_s16(vcombine_s16(vqmovn_s32(vacc4x0123), vqmovn_s32(vacc4x4567)), voutput_zero_point);
277 const int16x8_t vacc5x01234567 = vqaddq_s16(vcombine_s16(vqmovn_s32(vacc5x0123), vqmovn_s32(vacc5x4567)), voutput_zero_point);
278
279 int8x16_t vout0x01234567_1x01234567 = vcombine_s8(vqmovn_s16(vacc0x01234567), vqmovn_s16(vacc1x01234567));
280 int8x16_t vout2x01234567_3x01234567 = vcombine_s8(vqmovn_s16(vacc2x01234567), vqmovn_s16(vacc3x01234567));
281 int8x16_t vout4x01234567_5x01234567 = vcombine_s8(vqmovn_s16(vacc4x01234567), vqmovn_s16(vacc5x01234567));
282 #endif
283 const int8x16_t voutput_min = vld1q_dup_s8(&params->fp32_neonv8.output_min);
284 const int8x16_t voutput_max = vld1q_dup_s8(&params->fp32_neonv8.output_max);
285
286 vout4x01234567_5x01234567 = vmaxq_s8(vout4x01234567_5x01234567, voutput_min);
287 vout2x01234567_3x01234567 = vmaxq_s8(vout2x01234567_3x01234567, voutput_min);
288 vout0x01234567_1x01234567 = vmaxq_s8(vout0x01234567_1x01234567, voutput_min);
289
290 vout4x01234567_5x01234567 = vminq_s8(vout4x01234567_5x01234567, voutput_max);
291 vout2x01234567_3x01234567 = vminq_s8(vout2x01234567_3x01234567, voutput_max);
292 vout0x01234567_1x01234567 = vminq_s8(vout0x01234567_1x01234567, voutput_max);
293
294 if (nc >= 8) {
295 vst1_s8(c5, vget_high_s8(vout4x01234567_5x01234567));
296 vst1_s8(c4, vget_low_s8(vout4x01234567_5x01234567));
297 vst1_s8(c3, vget_high_s8(vout2x01234567_3x01234567));
298 vst1_s8(c2, vget_low_s8(vout2x01234567_3x01234567));
299 vst1_s8(c1, vget_high_s8(vout0x01234567_1x01234567));
300 vst1_s8(c0, vget_low_s8(vout0x01234567_1x01234567));
301
302 c5 = (int8_t*) ((uintptr_t) c5 + cn_stride);
303 c4 = (int8_t*) ((uintptr_t) c4 + cn_stride);
304 c3 = (int8_t*) ((uintptr_t) c3 + cn_stride);
305 c2 = (int8_t*) ((uintptr_t) c2 + cn_stride);
306 c1 = (int8_t*) ((uintptr_t) c1 + cn_stride);
307 c0 = (int8_t*) ((uintptr_t) c0 + cn_stride);
308
309 a = (const int8_t**restrict) ((uintptr_t) a - ks);
310
311 nc -= 8;
312 } else {
313 if (nc & 4) {
314 vst1q_lane_u32((void*) c5, vreinterpretq_u32_s8(vout4x01234567_5x01234567), 2); c5 += 4;
315 vst1q_lane_u32((void*) c4, vreinterpretq_u32_s8(vout4x01234567_5x01234567), 0); c4 += 4;
316 vst1q_lane_u32((void*) c3, vreinterpretq_u32_s8(vout2x01234567_3x01234567), 2); c3 += 4;
317 vst1q_lane_u32((void*) c2, vreinterpretq_u32_s8(vout2x01234567_3x01234567), 0); c2 += 4;
318 vst1q_lane_u32((void*) c1, vreinterpretq_u32_s8(vout0x01234567_1x01234567), 2); c1 += 4;
319 vst1q_lane_u32((void*) c0, vreinterpretq_u32_s8(vout0x01234567_1x01234567), 0); c0 += 4;
320 vout4x01234567_5x01234567 = vextq_s8(vout4x01234567_5x01234567, vout4x01234567_5x01234567, 4);
321 vout2x01234567_3x01234567 = vextq_s8(vout2x01234567_3x01234567, vout2x01234567_3x01234567, 4);
322 vout0x01234567_1x01234567 = vextq_s8(vout0x01234567_1x01234567, vout0x01234567_1x01234567, 4);
323 }
324 if (nc & 2) {
325 vst1q_lane_u16((void*) c5, vreinterpretq_u16_s8(vout4x01234567_5x01234567), 4); c5 += 2;
326 vst1q_lane_u16((void*) c4, vreinterpretq_u16_s8(vout4x01234567_5x01234567), 0); c4 += 2;
327 vst1q_lane_u16((void*) c3, vreinterpretq_u16_s8(vout2x01234567_3x01234567), 4); c3 += 2;
328 vst1q_lane_u16((void*) c2, vreinterpretq_u16_s8(vout2x01234567_3x01234567), 0); c2 += 2;
329 vst1q_lane_u16((void*) c1, vreinterpretq_u16_s8(vout0x01234567_1x01234567), 4); c1 += 2;
330 vst1q_lane_u16((void*) c0, vreinterpretq_u16_s8(vout0x01234567_1x01234567), 0); c0 += 2;
331 vout4x01234567_5x01234567 = vextq_s8(vout4x01234567_5x01234567, vout4x01234567_5x01234567, 2);
332 vout2x01234567_3x01234567 = vextq_s8(vout2x01234567_3x01234567, vout2x01234567_3x01234567, 2);
333 vout0x01234567_1x01234567 = vextq_s8(vout0x01234567_1x01234567, vout0x01234567_1x01234567, 2);
334 }
335 if (nc & 1) {
336 vst1q_lane_s8(c5, vout4x01234567_5x01234567, 8);
337 vst1q_lane_s8(c4, vout4x01234567_5x01234567, 0);
338 vst1q_lane_s8(c3, vout2x01234567_3x01234567, 8);
339 vst1q_lane_s8(c2, vout2x01234567_3x01234567, 0);
340 vst1q_lane_s8(c1, vout0x01234567_1x01234567, 8);
341 vst1q_lane_s8(c0, vout0x01234567_1x01234567, 0);
342 }
343
344 nc = 0;
345 }
346 } while (nc != 0);
347 }