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