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