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