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_qc8_gemm_minmax_fp32_ukernel_2x8c4__neon_mlal_dup(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_qc8_conv_minmax_params params[restrict XNN_MIN_ELEMENTS (1)])18 void xnn_qc8_gemm_minmax_fp32_ukernel_2x8c4__neon_mlal_dup(
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_qc8_conv_minmax_params params[restrict XNN_MIN_ELEMENTS(1)]) XNN_OOB_READS
29 {
30 assert(mr != 0);
31 assert(mr <= 2);
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
49 do {
50 int32x4_t vacc0x01 = vreinterpretq_s32_u64(vmovl_u32(vld1_u32(w))); w = (const void*) ((uintptr_t) w + 2 * sizeof(int32_t));
51 int32x4_t vacc0x23 = vreinterpretq_s32_u64(vmovl_u32(vld1_u32(w))); w = (const void*) ((uintptr_t) w + 2 * sizeof(int32_t));
52 int32x4_t vacc0x45 = vreinterpretq_s32_u64(vmovl_u32(vld1_u32(w))); w = (const void*) ((uintptr_t) w + 2 * sizeof(int32_t));
53 int32x4_t vacc0x67 = vreinterpretq_s32_u64(vmovl_u32(vld1_u32(w))); w = (const void*) ((uintptr_t) w + 2 * sizeof(int32_t));
54 int32x4_t vacc1x01 = vacc0x01;
55 int32x4_t vacc1x23 = vacc0x23;
56 int32x4_t vacc1x45 = vacc0x45;
57 int32x4_t vacc1x67 = vacc0x67;
58
59 size_t k = kc;
60
61 while (k >= 16 * sizeof(int8_t)) {
62 const int8x8_t va0x0 = vld1_s8(a0); a0 += 8;
63 const int8x8_t va0x1 = vld1_s8(a0); a0 += 8;
64 const int8x8_t va1x0 = vld1_s8(a1); a1 += 8;
65 const int8x8_t va1x1 = vld1_s8(a1); a1 += 8;
66
67 const int8x8_t vb01c0x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
68 const int8x8_t vb23c0x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
69 const int8x8_t vb45c0x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
70 const int8x8_t vb67c0x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
71 const int8x8_t vb01c1x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
72 const int8x8_t vb23c1x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
73 const int8x8_t vb45c1x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
74 const int8x8_t vb67c1x0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
75
76 const int8x8_t va0c0x0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va0x0), 0));
77 const int8x8_t va0c0x1 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va0x1), 0));
78 const int8x8_t va1c0x0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va1x0), 0));
79 const int8x8_t va1c0x1 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va1x1), 0));
80
81 int16x8_t vprod0x01c0 = vmull_s8(vb01c0x0, va0c0x0);
82 int16x8_t vprod1x01c0 = vmull_s8(vb01c0x0, va1c0x0);
83 const int8x8_t vb01c0x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
84 vprod0x01c0 = vmlal_s8(vprod0x01c0, vb01c0x1, va0c0x1);
85 vprod1x01c0 = vmlal_s8(vprod1x01c0, vb01c0x1, va1c0x1);
86 vacc0x01 = vpadalq_s16(vacc0x01, vprod0x01c0);
87 vacc1x01 = vpadalq_s16(vacc1x01, vprod1x01c0);
88 int16x8_t vprod0x23c0 = vmull_s8(vb23c0x0, va0c0x0);
89 int16x8_t vprod1x23c0 = vmull_s8(vb23c0x0, va1c0x0);
90 const int8x8_t vb23c0x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
91 vprod0x23c0 = vmlal_s8(vprod0x23c0, vb23c0x1, va0c0x1);
92 vprod1x23c0 = vmlal_s8(vprod1x23c0, vb23c0x1, va1c0x1);
93 vacc0x23 = vpadalq_s16(vacc0x23, vprod0x23c0);
94 vacc1x23 = vpadalq_s16(vacc1x23, vprod1x23c0);
95 int16x8_t vprod0x45c0 = vmull_s8(vb45c0x0, va0c0x0);
96 int16x8_t vprod1x45c0 = vmull_s8(vb45c0x0, va1c0x0);
97 const int8x8_t vb45c0x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
98 vprod0x45c0 = vmlal_s8(vprod0x45c0, vb45c0x1, va0c0x1);
99 vprod1x45c0 = vmlal_s8(vprod1x45c0, vb45c0x1, va1c0x1);
100 vacc0x45 = vpadalq_s16(vacc0x45, vprod0x45c0);
101 vacc1x45 = vpadalq_s16(vacc1x45, vprod1x45c0);
102 int16x8_t vprod0x67c0 = vmull_s8(vb67c0x0, va0c0x0);
103 int16x8_t vprod1x67c0 = vmull_s8(vb67c0x0, va1c0x0);
104 const int8x8_t vb67c0x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
105 vprod0x67c0 = vmlal_s8(vprod0x67c0, vb67c0x1, va0c0x1);
106 vprod1x67c0 = vmlal_s8(vprod1x67c0, vb67c0x1, va1c0x1);
107 vacc0x67 = vpadalq_s16(vacc0x67, vprod0x67c0);
108 vacc1x67 = vpadalq_s16(vacc1x67, vprod1x67c0);
109 const int8x8_t va0c1x0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va0x0), 1));
110 const int8x8_t va0c1x1 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va0x1), 1));
111 const int8x8_t va1c1x0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va1x0), 1));
112 const int8x8_t va1c1x1 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va1x1), 1));
113
114 int16x8_t vprod0x01c1 = vmull_s8(vb01c1x0, va0c1x0);
115 int16x8_t vprod1x01c1 = vmull_s8(vb01c1x0, va1c1x0);
116 const int8x8_t vb01c1x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
117 vprod0x01c1 = vmlal_s8(vprod0x01c1, vb01c1x1, va0c1x1);
118 vprod1x01c1 = vmlal_s8(vprod1x01c1, vb01c1x1, va1c1x1);
119 vacc0x01 = vpadalq_s16(vacc0x01, vprod0x01c1);
120 vacc1x01 = vpadalq_s16(vacc1x01, vprod1x01c1);
121 int16x8_t vprod0x23c1 = vmull_s8(vb23c1x0, va0c1x0);
122 int16x8_t vprod1x23c1 = vmull_s8(vb23c1x0, va1c1x0);
123 const int8x8_t vb23c1x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
124 vprod0x23c1 = vmlal_s8(vprod0x23c1, vb23c1x1, va0c1x1);
125 vprod1x23c1 = vmlal_s8(vprod1x23c1, vb23c1x1, va1c1x1);
126 vacc0x23 = vpadalq_s16(vacc0x23, vprod0x23c1);
127 vacc1x23 = vpadalq_s16(vacc1x23, vprod1x23c1);
128 int16x8_t vprod0x45c1 = vmull_s8(vb45c1x0, va0c1x0);
129 int16x8_t vprod1x45c1 = vmull_s8(vb45c1x0, va1c1x0);
130 const int8x8_t vb45c1x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
131 vprod0x45c1 = vmlal_s8(vprod0x45c1, vb45c1x1, va0c1x1);
132 vprod1x45c1 = vmlal_s8(vprod1x45c1, vb45c1x1, va1c1x1);
133 vacc0x45 = vpadalq_s16(vacc0x45, vprod0x45c1);
134 vacc1x45 = vpadalq_s16(vacc1x45, vprod1x45c1);
135 int16x8_t vprod0x67c1 = vmull_s8(vb67c1x0, va0c1x0);
136 int16x8_t vprod1x67c1 = vmull_s8(vb67c1x0, va1c1x0);
137 const int8x8_t vb67c1x1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
138 vprod0x67c1 = vmlal_s8(vprod0x67c1, vb67c1x1, va0c1x1);
139 vprod1x67c1 = vmlal_s8(vprod1x67c1, vb67c1x1, va1c1x1);
140 vacc0x67 = vpadalq_s16(vacc0x67, vprod0x67c1);
141 vacc1x67 = vpadalq_s16(vacc1x67, vprod1x67c1);
142
143 k -= 16 * sizeof(int8_t);
144 }
145
146 if (k >= 8 * sizeof(int8_t)) {
147 const int8x8_t va0 = vld1_s8(a0); a0 += 8;
148 const int8x8_t va1 = vld1_s8(a1); a1 += 8;
149
150 const int8x8_t vb01c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
151 const int8x8_t vb23c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
152 const int8x8_t vb45c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
153 const int8x8_t vb67c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
154 const int8x8_t vb01c1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
155 const int8x8_t vb23c1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
156 const int8x8_t vb45c1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
157 const int8x8_t vb67c1 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
158
159 const int8x8_t va0c0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va0), 0));
160 const int8x8_t va1c0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va1), 0));
161
162 const int16x8_t vprod0x01c0 = vmull_s8(vb01c0, va0c0);
163 const int16x8_t vprod1x01c0 = vmull_s8(vb01c0, va1c0);
164 vacc0x01 = vpadalq_s16(vacc0x01, vprod0x01c0);
165 vacc1x01 = vpadalq_s16(vacc1x01, vprod1x01c0);
166 const int16x8_t vprod0x23c0 = vmull_s8(vb23c0, va0c0);
167 const int16x8_t vprod1x23c0 = vmull_s8(vb23c0, va1c0);
168 vacc0x23 = vpadalq_s16(vacc0x23, vprod0x23c0);
169 vacc1x23 = vpadalq_s16(vacc1x23, vprod1x23c0);
170 const int16x8_t vprod0x45c0 = vmull_s8(vb45c0, va0c0);
171 const int16x8_t vprod1x45c0 = vmull_s8(vb45c0, va1c0);
172 vacc0x45 = vpadalq_s16(vacc0x45, vprod0x45c0);
173 vacc1x45 = vpadalq_s16(vacc1x45, vprod1x45c0);
174 const int16x8_t vprod0x67c0 = vmull_s8(vb67c0, va0c0);
175 const int16x8_t vprod1x67c0 = vmull_s8(vb67c0, va1c0);
176 vacc0x67 = vpadalq_s16(vacc0x67, vprod0x67c0);
177 vacc1x67 = vpadalq_s16(vacc1x67, vprod1x67c0);
178 const int8x8_t va0c1 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va0), 1));
179 const int8x8_t va1c1 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va1), 1));
180
181 const int16x8_t vprod0x01c1 = vmull_s8(vb01c1, va0c1);
182 const int16x8_t vprod1x01c1 = vmull_s8(vb01c1, va1c1);
183 vacc0x01 = vpadalq_s16(vacc0x01, vprod0x01c1);
184 vacc1x01 = vpadalq_s16(vacc1x01, vprod1x01c1);
185 const int16x8_t vprod0x23c1 = vmull_s8(vb23c1, va0c1);
186 const int16x8_t vprod1x23c1 = vmull_s8(vb23c1, va1c1);
187 vacc0x23 = vpadalq_s16(vacc0x23, vprod0x23c1);
188 vacc1x23 = vpadalq_s16(vacc1x23, vprod1x23c1);
189 const int16x8_t vprod0x45c1 = vmull_s8(vb45c1, va0c1);
190 const int16x8_t vprod1x45c1 = vmull_s8(vb45c1, va1c1);
191 vacc0x45 = vpadalq_s16(vacc0x45, vprod0x45c1);
192 vacc1x45 = vpadalq_s16(vacc1x45, vprod1x45c1);
193 const int16x8_t vprod0x67c1 = vmull_s8(vb67c1, va0c1);
194 const int16x8_t vprod1x67c1 = vmull_s8(vb67c1, va1c1);
195 vacc0x67 = vpadalq_s16(vacc0x67, vprod0x67c1);
196 vacc1x67 = vpadalq_s16(vacc1x67, vprod1x67c1);
197
198 k -= 8 * sizeof(int8_t);
199 }
200
201 if XNN_UNLIKELY(k != 0) {
202 const int8x8_t va0 = vld1_s8(a0); a0 = (const int8_t*) ((uintptr_t) a0 + k);
203 const int8x8_t va1 = vld1_s8(a1); a1 = (const int8_t*) ((uintptr_t) a1 + k);
204
205 const int8x8_t vb01c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
206 const int8x8_t vb23c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
207 const int8x8_t vb45c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
208 const int8x8_t vb67c0 = vld1_s8(w); w = (const void*) ((uintptr_t) w + 8 * sizeof(int8_t));
209
210 const int8x8_t va0c0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va0), 0));
211 const int16x8_t vprod0x01c0 = vmull_s8(vb01c0, va0c0);
212 vacc0x01 = vpadalq_s16(vacc0x01, vprod0x01c0);
213 const int16x8_t vprod0x23c0 = vmull_s8(vb23c0, va0c0);
214 vacc0x23 = vpadalq_s16(vacc0x23, vprod0x23c0);
215 const int16x8_t vprod0x45c0 = vmull_s8(vb45c0, va0c0);
216 vacc0x45 = vpadalq_s16(vacc0x45, vprod0x45c0);
217 const int16x8_t vprod0x67c0 = vmull_s8(vb67c0, va0c0);
218 vacc0x67 = vpadalq_s16(vacc0x67, vprod0x67c0);
219 const int8x8_t va1c0 = vreinterpret_s8_s32(vdup_lane_s32(vreinterpret_s32_s8(va1), 0));
220 const int16x8_t vprod1x01c0 = vmull_s8(vb01c0, va1c0);
221 vacc1x01 = vpadalq_s16(vacc1x01, vprod1x01c0);
222 const int16x8_t vprod1x23c0 = vmull_s8(vb23c0, va1c0);
223 vacc1x23 = vpadalq_s16(vacc1x23, vprod1x23c0);
224 const int16x8_t vprod1x45c0 = vmull_s8(vb45c0, va1c0);
225 vacc1x45 = vpadalq_s16(vacc1x45, vprod1x45c0);
226 const int16x8_t vprod1x67c0 = vmull_s8(vb67c0, va1c0);
227 vacc1x67 = vpadalq_s16(vacc1x67, vprod1x67c0);
228 }
229
230 #if XNN_ARCH_ARM64
231 int32x4_t vacc0x0123 = vpaddq_s32(vacc0x01, vacc0x23);
232 int32x4_t vacc0x4567 = vpaddq_s32(vacc0x45, vacc0x67);
233 int32x4_t vacc1x0123 = vpaddq_s32(vacc1x01, vacc1x23);
234 int32x4_t vacc1x4567 = vpaddq_s32(vacc1x45, vacc1x67);
235 #else
236 const int32x2_t vsum0x01 = vpadd_s32(vget_low_s32(vacc0x01), vget_high_s32(vacc0x01));
237 const int32x2_t vsum0x23 = vpadd_s32(vget_low_s32(vacc0x23), vget_high_s32(vacc0x23));
238 int32x4_t vacc0x0123 = vcombine_s32(vsum0x01, vsum0x23);
239 const int32x2_t vsum0x45 = vpadd_s32(vget_low_s32(vacc0x45), vget_high_s32(vacc0x45));
240 const int32x2_t vsum0x67 = vpadd_s32(vget_low_s32(vacc0x67), vget_high_s32(vacc0x67));
241 int32x4_t vacc0x4567 = vcombine_s32(vsum0x45, vsum0x67);
242 const int32x2_t vsum1x01 = vpadd_s32(vget_low_s32(vacc1x01), vget_high_s32(vacc1x01));
243 const int32x2_t vsum1x23 = vpadd_s32(vget_low_s32(vacc1x23), vget_high_s32(vacc1x23));
244 int32x4_t vacc1x0123 = vcombine_s32(vsum1x01, vsum1x23);
245 const int32x2_t vsum1x45 = vpadd_s32(vget_low_s32(vacc1x45), vget_high_s32(vacc1x45));
246 const int32x2_t vsum1x67 = vpadd_s32(vget_low_s32(vacc1x67), vget_high_s32(vacc1x67));
247 int32x4_t vacc1x4567 = vcombine_s32(vsum1x45, vsum1x67);
248 #endif
249
250 float32x4_t vfpacc0x0123 = vcvtq_f32_s32(vacc0x0123);
251 float32x4_t vfpacc0x4567 = vcvtq_f32_s32(vacc0x4567);
252 float32x4_t vfpacc1x0123 = vcvtq_f32_s32(vacc1x0123);
253 float32x4_t vfpacc1x4567 = vcvtq_f32_s32(vacc1x4567);
254
255 const float32x4_t vscale0123 = vld1q_f32((const float*) w); w = (const void*) ((const float*) w + 4);
256 vfpacc0x0123 = vmulq_f32(vfpacc0x0123, vscale0123);
257 vfpacc1x0123 = vmulq_f32(vfpacc1x0123, vscale0123);
258 const float32x4_t vscale4567 = vld1q_f32((const float*) w); w = (const void*) ((const float*) w + 4);
259 vfpacc0x4567 = vmulq_f32(vfpacc0x4567, vscale4567);
260 vfpacc1x4567 = vmulq_f32(vfpacc1x4567, vscale4567);
261
262 const float32x4_t vmagic_bias = vld1q_dup_f32(¶ms->fp32_neon.magic_bias);
263 vacc0x0123 = vreinterpretq_s32_f32(vaddq_f32(vfpacc0x0123, vmagic_bias));
264 vacc0x4567 = vreinterpretq_s32_f32(vaddq_f32(vfpacc0x4567, vmagic_bias));
265 vacc1x0123 = vreinterpretq_s32_f32(vaddq_f32(vfpacc1x0123, vmagic_bias));
266 vacc1x4567 = vreinterpretq_s32_f32(vaddq_f32(vfpacc1x4567, vmagic_bias));
267
268 const int32x4_t vmagic_bias_less_output_zero_point = vld1q_dup_s32(¶ms->fp32_neon.magic_bias_less_output_zero_point);
269 vacc0x0123 = vqsubq_s32(vacc0x0123, vmagic_bias_less_output_zero_point);
270 vacc0x4567 = vqsubq_s32(vacc0x4567, vmagic_bias_less_output_zero_point);
271 vacc1x0123 = vqsubq_s32(vacc1x0123, vmagic_bias_less_output_zero_point);
272 vacc1x4567 = vqsubq_s32(vacc1x4567, vmagic_bias_less_output_zero_point);
273
274 #if XNN_ARCH_ARM64
275 int16x8_t vacc0x01234567 = vqmovn_high_s32(vqmovn_s32(vacc0x0123), vacc0x4567);
276 int16x8_t vacc1x01234567 = vqmovn_high_s32(vqmovn_s32(vacc1x0123), vacc1x4567);
277
278
279 int8x16_t vout0x01234567_1x01234567 = vqmovn_high_s16(vqmovn_s16(vacc0x01234567), vacc1x01234567);
280 #else
281 int16x8_t vacc0x01234567 = vcombine_s16(vqmovn_s32(vacc0x0123), vqmovn_s32(vacc0x4567));
282 int16x8_t vacc1x01234567 = vcombine_s16(vqmovn_s32(vacc1x0123), vqmovn_s32(vacc1x4567));
283
284
285 int8x16_t vout0x01234567_1x01234567 = vcombine_s8(vqmovn_s16(vacc0x01234567), vqmovn_s16(vacc1x01234567));
286 #endif
287
288 const int8x16_t voutput_min = vld1q_dup_s8(¶ms->fp32_neon.output_min);
289 vout0x01234567_1x01234567 = vmaxq_s8(vout0x01234567_1x01234567, voutput_min);
290
291 const int8x16_t voutput_max = vld1q_dup_s8(¶ms->fp32_neon.output_max);
292 vout0x01234567_1x01234567 = vminq_s8(vout0x01234567_1x01234567, voutput_max);
293
294 if (nc >= 8) {
295 vst1_s8(c0 + 0, vget_low_s8(vout0x01234567_1x01234567));
296 vst1_s8(c1 + 0, vget_high_s8(vout0x01234567_1x01234567));
297
298 c0 = (int8_t*) ((uintptr_t) c0 + cn_stride);
299 c1 = (int8_t*) ((uintptr_t) c1 + cn_stride);
300
301 a0 = (const int8_t*) ((uintptr_t) a0 - kc);
302 a1 = (const int8_t*) ((uintptr_t) a1 - kc);
303
304 nc -= 8;
305 } else {
306 // Final case where not all of the 8 columns fit in the destination.
307 if (nc & 4) {
308 vst1q_lane_u32((void*) c0, vreinterpretq_u32_s8(vout0x01234567_1x01234567), 0); c0 += 4;
309 vst1q_lane_u32((void*) c1, vreinterpretq_u32_s8(vout0x01234567_1x01234567), 2); c1 += 4;
310 vout0x01234567_1x01234567 = vextq_s8(vout0x01234567_1x01234567, vout0x01234567_1x01234567, 4);
311 }
312 if (nc & 2) {
313 vst1q_lane_u16((void*) c0, vreinterpretq_u16_s8(vout0x01234567_1x01234567), 0); c0 += 2;
314 vst1q_lane_u16((void*) c1, vreinterpretq_u16_s8(vout0x01234567_1x01234567), 4); c1 += 2;
315 vout0x01234567_1x01234567 = vextq_s8(vout0x01234567_1x01234567, vout0x01234567_1x01234567, 2);
316 }
317 if (nc & 1) {
318 vst1q_lane_s8(c0, vout0x01234567_1x01234567, 0);
319 vst1q_lane_s8(c1, vout0x01234567_1x01234567, 8);
320 }
321
322 nc = 0;
323 }
324 } while (nc != 0);
325 }
326