• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Auto-generated file. Do not edit!
2 //   Template: src/qs8-igemm/c4-neondot.c.in
3 //   Generator: tools/xngen
4 //
5 // Copyright 2020 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/math.h>
16 
17 
xnn_qs8_igemm_minmax_rndnu_ukernel_4x16c4__neondot(size_t mr,size_t nc,size_t kc,size_t ks,const int8_t ** restrict a,const void * restrict w,int8_t * restrict c,size_t cm_stride,size_t cn_stride,size_t a_offset,const int8_t * zero,const union xnn_qs8_conv_minmax_params params[restrict XNN_MIN_ELEMENTS (1)])18 void xnn_qs8_igemm_minmax_rndnu_ukernel_4x16c4__neondot(
19     size_t mr,
20     size_t nc,
21     size_t kc,
22     size_t ks,
23     const int8_t** restrict a,
24     const void* restrict w,
25     int8_t* restrict c,
26     size_t cm_stride,
27     size_t cn_stride,
28     size_t a_offset,
29     const int8_t* zero,
30     const union xnn_qs8_conv_minmax_params params[restrict XNN_MIN_ELEMENTS(1)]) XNN_OOB_READS
31 {
32   assert(mr != 0);
33   assert(mr <= 4);
34   assert(nc != 0);
35   assert(kc != 0);
36   assert(ks != 0);
37   assert(ks % (4 * sizeof(void*)) == 0);
38   assert(a_offset % sizeof(int8_t) == 0);
39   assert(a != NULL);
40   assert(w != NULL);
41   assert(c != NULL);
42 
43   kc = round_up_po2(kc, 4 * sizeof(int8_t));
44   int8_t* c0 = c;
45   int8_t* c1 = (int8_t*) ((uintptr_t) c0 + cm_stride);
46   if XNN_UNPREDICTABLE(mr < 2) {
47     c1 = c0;
48   }
49   int8_t* c2 = (int8_t*) ((uintptr_t) c1 + cm_stride);
50   if XNN_UNPREDICTABLE(mr <= 2) {
51     c2 = c1;
52   }
53   int8_t* c3 = (int8_t*) ((uintptr_t) c2 + cm_stride);
54   if XNN_UNPREDICTABLE(mr != 4) {
55     c3 = c2;
56   }
57 
58   do {
59     int32x4_t vacc0x0123 = vld1q_s32(w); w = (const void*) ((const int32_t*) w + 4);
60     int32x4_t vacc0x4567 = vld1q_s32(w); w = (const void*) ((const int32_t*) w + 4);
61     int32x4_t vacc0x89AB = vld1q_s32(w); w = (const void*) ((const int32_t*) w + 4);
62     int32x4_t vacc0xCDEF = vld1q_s32(w); w = (const void*) ((const int32_t*) w + 4);
63     int32x4_t vacc1x0123 = vacc0x0123;
64     int32x4_t vacc1x4567 = vacc0x4567;
65     int32x4_t vacc1x89AB = vacc0x89AB;
66     int32x4_t vacc1xCDEF = vacc0xCDEF;
67     int32x4_t vacc2x0123 = vacc0x0123;
68     int32x4_t vacc2x4567 = vacc0x4567;
69     int32x4_t vacc2x89AB = vacc0x89AB;
70     int32x4_t vacc2xCDEF = vacc0xCDEF;
71     int32x4_t vacc3x0123 = vacc0x0123;
72     int32x4_t vacc3x4567 = vacc0x4567;
73     int32x4_t vacc3x89AB = vacc0x89AB;
74     int32x4_t vacc3xCDEF = vacc0xCDEF;
75 
76     size_t p = ks;
77     do {
78       const int8_t* restrict a0 = a[0];
79       if XNN_UNPREDICTABLE(a0 != zero) {
80         a0 = (const int8_t*) ((uintptr_t) a0 + a_offset);
81       }
82       const int8_t* restrict a1 = a[1];
83       if XNN_UNPREDICTABLE(a1 != zero) {
84         a1 = (const int8_t*) ((uintptr_t) a1 + a_offset);
85       }
86       const int8_t* restrict a2 = a[2];
87       if XNN_UNPREDICTABLE(a2 != zero) {
88         a2 = (const int8_t*) ((uintptr_t) a2 + a_offset);
89       }
90       const int8_t* restrict a3 = a[3];
91       if XNN_UNPREDICTABLE(a3 != zero) {
92         a3 = (const int8_t*) ((uintptr_t) a3 + a_offset);
93       }
94       a += 4;
95 
96       // Inner accumulation loop along the 16 columns.
97       size_t k = kc;
98       // 2x partial unrolled loop to load 8 bytes at a time.
99       while (k >= 8 * sizeof(int8_t)) {
100         // Load a 4x8 block of activations.
101         const int8x8_t va0x01234567 = vld1_s8(a0); a0 += 8;
102         const int8x8_t va1x01234567 = vld1_s8(a1); a1 += 8;
103         const int8x8_t va2x01234567 = vld1_s8(a2); a2 += 8;
104         const int8x8_t va3x01234567 = vld1_s8(a3); a3 += 8;
105 
106         // Load a 8x16 block of weights.
107         const int8x16_t vb0123x0123 = vld1q_s8(w); w = (const void*) ((const int8_t*) w + 16);
108         const int8x16_t vb0123x4567 = vld1q_s8(w); w = (const void*) ((const int8_t*) w + 16);
109         const int8x16_t vb0123x89AB = vld1q_s8(w); w = (const void*) ((const int8_t*) w + 16);
110         const int8x16_t vb0123xCDEF = vld1q_s8(w); w = (const void*) ((const int8_t*) w + 16);
111         const int8x16_t vb4567x0123 = vld1q_s8(w); w = (const void*) ((const int8_t*) w + 16);
112         const int8x16_t vb4567x4567 = vld1q_s8(w); w = (const void*) ((const int8_t*) w + 16);
113         const int8x16_t vb4567x89AB = vld1q_s8(w); w = (const void*) ((const int8_t*) w + 16);
114         const int8x16_t vb4567xCDEF = vld1q_s8(w); w = (const void*) ((const int8_t*) w + 16);
115 
116         // Multiply-accumulate: 4x8 * 8x16 --> 4x16.
117         vacc0x0123 = vdotq_lane_s32(vacc0x0123, vb0123x0123, va0x01234567, 0);
118         vacc0x4567 = vdotq_lane_s32(vacc0x4567, vb0123x4567, va0x01234567, 0);
119         vacc0x89AB = vdotq_lane_s32(vacc0x89AB, vb0123x89AB, va0x01234567, 0);
120         vacc0xCDEF = vdotq_lane_s32(vacc0xCDEF, vb0123xCDEF, va0x01234567, 0);
121         vacc1x0123 = vdotq_lane_s32(vacc1x0123, vb0123x0123, va1x01234567, 0);
122         vacc1x4567 = vdotq_lane_s32(vacc1x4567, vb0123x4567, va1x01234567, 0);
123         vacc1x89AB = vdotq_lane_s32(vacc1x89AB, vb0123x89AB, va1x01234567, 0);
124         vacc1xCDEF = vdotq_lane_s32(vacc1xCDEF, vb0123xCDEF, va1x01234567, 0);
125         vacc2x0123 = vdotq_lane_s32(vacc2x0123, vb0123x0123, va2x01234567, 0);
126         vacc2x4567 = vdotq_lane_s32(vacc2x4567, vb0123x4567, va2x01234567, 0);
127         vacc2x89AB = vdotq_lane_s32(vacc2x89AB, vb0123x89AB, va2x01234567, 0);
128         vacc2xCDEF = vdotq_lane_s32(vacc2xCDEF, vb0123xCDEF, va2x01234567, 0);
129         vacc3x0123 = vdotq_lane_s32(vacc3x0123, vb0123x0123, va3x01234567, 0);
130         vacc3x4567 = vdotq_lane_s32(vacc3x4567, vb0123x4567, va3x01234567, 0);
131         vacc3x89AB = vdotq_lane_s32(vacc3x89AB, vb0123x89AB, va3x01234567, 0);
132         vacc3xCDEF = vdotq_lane_s32(vacc3xCDEF, vb0123xCDEF, va3x01234567, 0);
133         vacc0x0123 = vdotq_lane_s32(vacc0x0123, vb4567x0123, va0x01234567, 1);
134         vacc0x4567 = vdotq_lane_s32(vacc0x4567, vb4567x4567, va0x01234567, 1);
135         vacc0x89AB = vdotq_lane_s32(vacc0x89AB, vb4567x89AB, va0x01234567, 1);
136         vacc0xCDEF = vdotq_lane_s32(vacc0xCDEF, vb4567xCDEF, va0x01234567, 1);
137         vacc1x0123 = vdotq_lane_s32(vacc1x0123, vb4567x0123, va1x01234567, 1);
138         vacc1x4567 = vdotq_lane_s32(vacc1x4567, vb4567x4567, va1x01234567, 1);
139         vacc1x89AB = vdotq_lane_s32(vacc1x89AB, vb4567x89AB, va1x01234567, 1);
140         vacc1xCDEF = vdotq_lane_s32(vacc1xCDEF, vb4567xCDEF, va1x01234567, 1);
141         vacc2x0123 = vdotq_lane_s32(vacc2x0123, vb4567x0123, va2x01234567, 1);
142         vacc2x4567 = vdotq_lane_s32(vacc2x4567, vb4567x4567, va2x01234567, 1);
143         vacc2x89AB = vdotq_lane_s32(vacc2x89AB, vb4567x89AB, va2x01234567, 1);
144         vacc2xCDEF = vdotq_lane_s32(vacc2xCDEF, vb4567xCDEF, va2x01234567, 1);
145         vacc3x0123 = vdotq_lane_s32(vacc3x0123, vb4567x0123, va3x01234567, 1);
146         vacc3x4567 = vdotq_lane_s32(vacc3x4567, vb4567x4567, va3x01234567, 1);
147         vacc3x89AB = vdotq_lane_s32(vacc3x89AB, vb4567x89AB, va3x01234567, 1);
148         vacc3xCDEF = vdotq_lane_s32(vacc3xCDEF, vb4567xCDEF, va3x01234567, 1);
149 
150         k -= 8 * sizeof(int8_t);
151       }
152       // Handle up to 4 final positions of `k`
153       if XNN_UNLIKELY(k != 0) {
154         // Load a 4x4 block of activations.
155         const int8x8_t va0x01234567 = vld1_s8(a0);
156         const int8x8_t va1x01234567 = vld1_s8(a1);
157         const int8x8_t va2x01234567 = vld1_s8(a2);
158         const int8x8_t va3x01234567 = vld1_s8(a3);
159 
160         // Load a 4x16 block of weights.
161         const int8x16_t vb0123x0123 = vld1q_s8(w); w = (const void*) ((const int8_t*) w + 16);
162         const int8x16_t vb0123x4567 = vld1q_s8(w); w = (const void*) ((const int8_t*) w + 16);
163         const int8x16_t vb0123x89AB = vld1q_s8(w); w = (const void*) ((const int8_t*) w + 16);
164         const int8x16_t vb0123xCDEF = vld1q_s8(w); w = (const void*) ((const int8_t*) w + 16);
165 
166         // Multiply-accumulate: 4x4 * 4x16 --> 4x16.
167         vacc0x0123 = vdotq_lane_s32(vacc0x0123, vb0123x0123, va0x01234567, 0);
168         vacc0x4567 = vdotq_lane_s32(vacc0x4567, vb0123x4567, va0x01234567, 0);
169         vacc0x89AB = vdotq_lane_s32(vacc0x89AB, vb0123x89AB, va0x01234567, 0);
170         vacc0xCDEF = vdotq_lane_s32(vacc0xCDEF, vb0123xCDEF, va0x01234567, 0);
171         vacc1x0123 = vdotq_lane_s32(vacc1x0123, vb0123x0123, va1x01234567, 0);
172         vacc1x4567 = vdotq_lane_s32(vacc1x4567, vb0123x4567, va1x01234567, 0);
173         vacc1x89AB = vdotq_lane_s32(vacc1x89AB, vb0123x89AB, va1x01234567, 0);
174         vacc1xCDEF = vdotq_lane_s32(vacc1xCDEF, vb0123xCDEF, va1x01234567, 0);
175         vacc2x0123 = vdotq_lane_s32(vacc2x0123, vb0123x0123, va2x01234567, 0);
176         vacc2x4567 = vdotq_lane_s32(vacc2x4567, vb0123x4567, va2x01234567, 0);
177         vacc2x89AB = vdotq_lane_s32(vacc2x89AB, vb0123x89AB, va2x01234567, 0);
178         vacc2xCDEF = vdotq_lane_s32(vacc2xCDEF, vb0123xCDEF, va2x01234567, 0);
179         vacc3x0123 = vdotq_lane_s32(vacc3x0123, vb0123x0123, va3x01234567, 0);
180         vacc3x4567 = vdotq_lane_s32(vacc3x4567, vb0123x4567, va3x01234567, 0);
181         vacc3x89AB = vdotq_lane_s32(vacc3x89AB, vb0123x89AB, va3x01234567, 0);
182         vacc3xCDEF = vdotq_lane_s32(vacc3xCDEF, vb0123xCDEF, va3x01234567, 0);
183       }
184       p -= 4 * sizeof(void*);
185     } while (p != 0);
186 
187     const int32x4_t vright_pre_shift = vld1q_dup_s32(&params->rndnu_neon.right_pre_shift);
188     const int32x4_t vmultiplier = vld1q_dup_s32(&params->rndnu_neon.multiplier);
189     const int32x4_t vright_post_shift = vld1q_dup_s32(&params->rndnu_neon.right_post_shift);
190 
191     vacc0x0123 = vshlq_s32(vacc0x0123, vright_pre_shift);
192     vacc0x4567 = vshlq_s32(vacc0x4567, vright_pre_shift);
193     vacc0x89AB = vshlq_s32(vacc0x89AB, vright_pre_shift);
194     vacc0xCDEF = vshlq_s32(vacc0xCDEF, vright_pre_shift);
195     vacc1x0123 = vshlq_s32(vacc1x0123, vright_pre_shift);
196     vacc1x4567 = vshlq_s32(vacc1x4567, vright_pre_shift);
197     vacc1x89AB = vshlq_s32(vacc1x89AB, vright_pre_shift);
198     vacc1xCDEF = vshlq_s32(vacc1xCDEF, vright_pre_shift);
199     vacc2x0123 = vshlq_s32(vacc2x0123, vright_pre_shift);
200     vacc2x4567 = vshlq_s32(vacc2x4567, vright_pre_shift);
201     vacc2x89AB = vshlq_s32(vacc2x89AB, vright_pre_shift);
202     vacc2xCDEF = vshlq_s32(vacc2xCDEF, vright_pre_shift);
203     vacc3x0123 = vshlq_s32(vacc3x0123, vright_pre_shift);
204     vacc3x4567 = vshlq_s32(vacc3x4567, vright_pre_shift);
205     vacc3x89AB = vshlq_s32(vacc3x89AB, vright_pre_shift);
206     vacc3xCDEF = vshlq_s32(vacc3xCDEF, vright_pre_shift);
207 
208     vacc0x0123 = vqdmulhq_s32(vacc0x0123, vmultiplier);
209     vacc0x4567 = vqdmulhq_s32(vacc0x4567, vmultiplier);
210     vacc0x89AB = vqdmulhq_s32(vacc0x89AB, vmultiplier);
211     vacc0xCDEF = vqdmulhq_s32(vacc0xCDEF, vmultiplier);
212     vacc1x0123 = vqdmulhq_s32(vacc1x0123, vmultiplier);
213     vacc1x4567 = vqdmulhq_s32(vacc1x4567, vmultiplier);
214     vacc1x89AB = vqdmulhq_s32(vacc1x89AB, vmultiplier);
215     vacc1xCDEF = vqdmulhq_s32(vacc1xCDEF, vmultiplier);
216     vacc2x0123 = vqdmulhq_s32(vacc2x0123, vmultiplier);
217     vacc2x4567 = vqdmulhq_s32(vacc2x4567, vmultiplier);
218     vacc2x89AB = vqdmulhq_s32(vacc2x89AB, vmultiplier);
219     vacc2xCDEF = vqdmulhq_s32(vacc2xCDEF, vmultiplier);
220     vacc3x0123 = vqdmulhq_s32(vacc3x0123, vmultiplier);
221     vacc3x4567 = vqdmulhq_s32(vacc3x4567, vmultiplier);
222     vacc3x89AB = vqdmulhq_s32(vacc3x89AB, vmultiplier);
223     vacc3xCDEF = vqdmulhq_s32(vacc3xCDEF, vmultiplier);
224 
225     vacc0x0123 = vrshlq_s32(vacc0x0123, vright_post_shift);
226     vacc0x4567 = vrshlq_s32(vacc0x4567, vright_post_shift);
227     vacc0x89AB = vrshlq_s32(vacc0x89AB, vright_post_shift);
228     vacc0xCDEF = vrshlq_s32(vacc0xCDEF, vright_post_shift);
229     vacc1x0123 = vrshlq_s32(vacc1x0123, vright_post_shift);
230     vacc1x4567 = vrshlq_s32(vacc1x4567, vright_post_shift);
231     vacc1x89AB = vrshlq_s32(vacc1x89AB, vright_post_shift);
232     vacc1xCDEF = vrshlq_s32(vacc1xCDEF, vright_post_shift);
233     vacc2x0123 = vrshlq_s32(vacc2x0123, vright_post_shift);
234     vacc2x4567 = vrshlq_s32(vacc2x4567, vright_post_shift);
235     vacc2x89AB = vrshlq_s32(vacc2x89AB, vright_post_shift);
236     vacc2xCDEF = vrshlq_s32(vacc2xCDEF, vright_post_shift);
237     vacc3x0123 = vrshlq_s32(vacc3x0123, vright_post_shift);
238     vacc3x4567 = vrshlq_s32(vacc3x4567, vright_post_shift);
239     vacc3x89AB = vrshlq_s32(vacc3x89AB, vright_post_shift);
240     vacc3xCDEF = vrshlq_s32(vacc3xCDEF, vright_post_shift);
241 
242     const int16x8_t voutput_zero_point = vld1q_dup_s16(&params->rndnu_neon.output_zero_point);
243 #if XNN_ARCH_ARM64
244     const int16x8_t vacc0x01234567 = vqaddq_s16(vqmovn_high_s32(vqmovn_s32(vacc0x0123), vacc0x4567), voutput_zero_point);
245     const int16x8_t vacc0x89ABCDEF = vqaddq_s16(vqmovn_high_s32(vqmovn_s32(vacc0x89AB), vacc0xCDEF), voutput_zero_point);
246     const int16x8_t vacc1x01234567 = vqaddq_s16(vqmovn_high_s32(vqmovn_s32(vacc1x0123), vacc1x4567), voutput_zero_point);
247     const int16x8_t vacc1x89ABCDEF = vqaddq_s16(vqmovn_high_s32(vqmovn_s32(vacc1x89AB), vacc1xCDEF), voutput_zero_point);
248     const int16x8_t vacc2x01234567 = vqaddq_s16(vqmovn_high_s32(vqmovn_s32(vacc2x0123), vacc2x4567), voutput_zero_point);
249     const int16x8_t vacc2x89ABCDEF = vqaddq_s16(vqmovn_high_s32(vqmovn_s32(vacc2x89AB), vacc2xCDEF), voutput_zero_point);
250     const int16x8_t vacc3x01234567 = vqaddq_s16(vqmovn_high_s32(vqmovn_s32(vacc3x0123), vacc3x4567), voutput_zero_point);
251     const int16x8_t vacc3x89ABCDEF = vqaddq_s16(vqmovn_high_s32(vqmovn_s32(vacc3x89AB), vacc3xCDEF), voutput_zero_point);
252 
253     int8x16_t vout0x0123456789ABCDEF = vqmovn_high_s16(vqmovn_s16(vacc0x01234567), vacc0x89ABCDEF);
254     int8x16_t vout1x0123456789ABCDEF = vqmovn_high_s16(vqmovn_s16(vacc1x01234567), vacc1x89ABCDEF);
255     int8x16_t vout2x0123456789ABCDEF = vqmovn_high_s16(vqmovn_s16(vacc2x01234567), vacc2x89ABCDEF);
256     int8x16_t vout3x0123456789ABCDEF = vqmovn_high_s16(vqmovn_s16(vacc3x01234567), vacc3x89ABCDEF);
257 #else
258     const int16x8_t vacc0x01234567 = vqaddq_s16(vcombine_s16(vqmovn_s32(vacc0x0123), vqmovn_s32(vacc0x4567)), voutput_zero_point);
259     const int16x8_t vacc0x89ABCDEF = vqaddq_s16(vcombine_s16(vqmovn_s32(vacc0x89AB), vqmovn_s32(vacc0xCDEF)), voutput_zero_point);
260     const int16x8_t vacc1x01234567 = vqaddq_s16(vcombine_s16(vqmovn_s32(vacc1x0123), vqmovn_s32(vacc1x4567)), voutput_zero_point);
261     const int16x8_t vacc1x89ABCDEF = vqaddq_s16(vcombine_s16(vqmovn_s32(vacc1x89AB), vqmovn_s32(vacc1xCDEF)), voutput_zero_point);
262     const int16x8_t vacc2x01234567 = vqaddq_s16(vcombine_s16(vqmovn_s32(vacc2x0123), vqmovn_s32(vacc2x4567)), voutput_zero_point);
263     const int16x8_t vacc2x89ABCDEF = vqaddq_s16(vcombine_s16(vqmovn_s32(vacc2x89AB), vqmovn_s32(vacc2xCDEF)), voutput_zero_point);
264     const int16x8_t vacc3x01234567 = vqaddq_s16(vcombine_s16(vqmovn_s32(vacc3x0123), vqmovn_s32(vacc3x4567)), voutput_zero_point);
265     const int16x8_t vacc3x89ABCDEF = vqaddq_s16(vcombine_s16(vqmovn_s32(vacc3x89AB), vqmovn_s32(vacc3xCDEF)), voutput_zero_point);
266 
267     int8x16_t vout0x0123456789ABCDEF = vcombine_s8(vqmovn_s16(vacc0x01234567), vqmovn_s16(vacc0x89ABCDEF));
268     int8x16_t vout1x0123456789ABCDEF = vcombine_s8(vqmovn_s16(vacc1x01234567), vqmovn_s16(vacc1x89ABCDEF));
269     int8x16_t vout2x0123456789ABCDEF = vcombine_s8(vqmovn_s16(vacc2x01234567), vqmovn_s16(vacc2x89ABCDEF));
270     int8x16_t vout3x0123456789ABCDEF = vcombine_s8(vqmovn_s16(vacc3x01234567), vqmovn_s16(vacc3x89ABCDEF));
271 #endif
272     const int8x16_t voutput_min = vld1q_dup_s8(&params->rndnu_neon.output_min);
273     const int8x16_t voutput_max = vld1q_dup_s8(&params->rndnu_neon.output_max);
274 
275     vout3x0123456789ABCDEF = vmaxq_s8(vout3x0123456789ABCDEF, voutput_min);
276     vout2x0123456789ABCDEF = vmaxq_s8(vout2x0123456789ABCDEF, voutput_min);
277     vout1x0123456789ABCDEF = vmaxq_s8(vout1x0123456789ABCDEF, voutput_min);
278     vout0x0123456789ABCDEF = vmaxq_s8(vout0x0123456789ABCDEF, voutput_min);
279 
280     vout3x0123456789ABCDEF = vminq_s8(vout3x0123456789ABCDEF, voutput_max);
281     vout2x0123456789ABCDEF = vminq_s8(vout2x0123456789ABCDEF, voutput_max);
282     vout1x0123456789ABCDEF = vminq_s8(vout1x0123456789ABCDEF, voutput_max);
283     vout0x0123456789ABCDEF = vminq_s8(vout0x0123456789ABCDEF, voutput_max);
284 
285     if (nc >= 16) {
286       vst1q_s8(c3 + 0, vout3x0123456789ABCDEF);
287       vst1q_s8(c2 + 0, vout2x0123456789ABCDEF);
288       vst1q_s8(c1 + 0, vout1x0123456789ABCDEF);
289       vst1q_s8(c0 + 0, vout0x0123456789ABCDEF);
290 
291       c3 = (int8_t*) ((uintptr_t) c3 + cn_stride);
292       c2 = (int8_t*) ((uintptr_t) c2 + cn_stride);
293       c1 = (int8_t*) ((uintptr_t) c1 + cn_stride);
294       c0 = (int8_t*) ((uintptr_t) c0 + cn_stride);
295 
296       a = (const int8_t**restrict) ((uintptr_t) a - ks);
297 
298       nc -= 16;
299     } else {
300       int8x16_t vout2x01234567_3x01234567 = vcombine_s8(vget_low_s8(vout2x0123456789ABCDEF), vget_low_s8(vout3x0123456789ABCDEF));
301       int8x16_t vout0x01234567_1x01234567 = vcombine_s8(vget_low_s8(vout0x0123456789ABCDEF), vget_low_s8(vout1x0123456789ABCDEF));
302       if (nc & 8) {
303         vst1_s8(c3, vget_high_s8(vout2x01234567_3x01234567)); c3 += 8;
304         vst1_s8(c2, vget_low_s8(vout2x01234567_3x01234567)); c2 += 8;
305         vst1_s8(c1, vget_high_s8(vout0x01234567_1x01234567)); c1 += 8;
306         vst1_s8(c0, vget_low_s8(vout0x01234567_1x01234567)); c0 += 8;
307         vout2x01234567_3x01234567 = vcombine_s8(vget_high_s8(vout2x0123456789ABCDEF), vget_high_s8(vout3x0123456789ABCDEF));
308         vout0x01234567_1x01234567 = vcombine_s8(vget_high_s8(vout0x0123456789ABCDEF), vget_high_s8(vout1x0123456789ABCDEF));
309       }
310       if (nc & 4) {
311         vst1q_lane_u32((void*) c3, vreinterpretq_u32_s8(vout2x01234567_3x01234567), 2); c3 += 4;
312         vst1q_lane_u32((void*) c2, vreinterpretq_u32_s8(vout2x01234567_3x01234567), 0); c2 += 4;
313         vst1q_lane_u32((void*) c1, vreinterpretq_u32_s8(vout0x01234567_1x01234567), 2); c1 += 4;
314         vst1q_lane_u32((void*) c0, vreinterpretq_u32_s8(vout0x01234567_1x01234567), 0); c0 += 4;
315         vout2x01234567_3x01234567 = vextq_s8(vout2x01234567_3x01234567, vout2x01234567_3x01234567, 4);
316         vout0x01234567_1x01234567 = vextq_s8(vout0x01234567_1x01234567, vout0x01234567_1x01234567, 4);
317       }
318       if (nc & 2) {
319         vst1q_lane_u16((void*) c3, vreinterpretq_u16_s8(vout2x01234567_3x01234567), 4); c3 += 2;
320         vst1q_lane_u16((void*) c2, vreinterpretq_u16_s8(vout2x01234567_3x01234567), 0); c2 += 2;
321         vst1q_lane_u16((void*) c1, vreinterpretq_u16_s8(vout0x01234567_1x01234567), 4); c1 += 2;
322         vst1q_lane_u16((void*) c0, vreinterpretq_u16_s8(vout0x01234567_1x01234567), 0); c0 += 2;
323         vout2x01234567_3x01234567 = vextq_s8(vout2x01234567_3x01234567, vout2x01234567_3x01234567, 2);
324         vout0x01234567_1x01234567 = vextq_s8(vout0x01234567_1x01234567, vout0x01234567_1x01234567, 2);
325       }
326       if (nc & 1) {
327         vst1q_lane_s8(c3, vout2x01234567_3x01234567, 8);
328         vst1q_lane_s8(c2, vout2x01234567_3x01234567, 0);
329         vst1q_lane_s8(c1, vout0x01234567_1x01234567, 8);
330         vst1q_lane_s8(c0, vout0x01234567_1x01234567, 0);
331       }
332 
333       nc = 0;
334     }
335   } while (nc != 0);
336 }
337