Debian Codegraph @

src/qd8-f32-qc4w-gemm/gen/qd8-f32-qc4w-gemm-6x16c8-minmax-neoni8mm.c

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/qs8-gemm/c8-neoni8mm.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2023 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
18 void xnn_qd8_f32_qc4w_gemm_minmax_ukernel_6x16c8__neoni8mm(
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 float* restrict c,
26 size_t cm_stride,
27 size_t cn_stride,
28 const struct xnn_f32_qc4w_minmax_params params[restrict XNN_MIN_ELEMENTS(1)],
29 const struct xnn_qd8_quantization_params quantization_params[restrict XNN_MIN_ELEMENTS(1)]) XNN_OOB_READS
30 {
31 assert(mr != 0);
32 assert(mr <= 6);
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, 8 * sizeof(int8_t));
41 const int8_t* a0 = a;
42 float* c0 = c;
43 const int8_t* a1 = (const int8_t*) ((uintptr_t) a0 + a_stride);
44 float* c1 = (float*) ((uintptr_t) c0 + cm_stride);
45 if XNN_UNPREDICTABLE(mr < 2) {
46 a1 = a0;
47 c1 = c0;
48 }
49 const int8_t* a2 = (const int8_t*) ((uintptr_t) a1 + a_stride);
50 float* c2 = (float*) ((uintptr_t) c1 + cm_stride);
51 if XNN_UNPREDICTABLE(mr <= 2) {
52 a2 = a1;
53 c2 = c1;
54 }
55 const int8_t* a3 = (const int8_t*) ((uintptr_t) a2 + a_stride);
56 float* c3 = (float*) ((uintptr_t) c2 + cm_stride);
57 if XNN_UNPREDICTABLE(mr < 4) {
58 a3 = a2;
59 c3 = c2;
60 }
61 const int8_t* a4 = (const int8_t*) ((uintptr_t) a3 + a_stride);
62 float* c4 = (float*) ((uintptr_t) c3 + cm_stride);
63 if XNN_UNPREDICTABLE(mr <= 4) {
64 a4 = a3;
65 c4 = c3;
66 }
67 const int8_t* a5 = (const int8_t*) ((uintptr_t) a4 + a_stride);
68 float* c5 = (float*) ((uintptr_t) c4 + cm_stride);
69 if XNN_UNPREDICTABLE(mr != 6) {
70 a5 = a4;
71 c5 = c4;
72 }
73 const int8x16_t vmask = vmovq_n_s8(INT8_C(0xF0));
74
75 // Loop over groups of 16 columns.
76 do {
77 // Initialize accumulators with bias. 16 bias values are loaded from the
78 // weight matrix, at the start of the group of 16 columns.
79 const int32x4_t vinput_zero_point01 = vld1q_s32(&quantization_params[0].zero_point);
80 const int32x4_t vksum0123 = vld1q_s32(w); w = (const int32_t*) w + 4;
81 const int32x4_t vksumzp0x0123 = vmulq_lane_s32(vksum0123, vget_low_s32(vinput_zero_point01), 0);
82 const int32x4_t vksumzp1x0123 = vmulq_lane_s32(vksum0123, vget_high_s32(vinput_zero_point01), 0);
83 const int32x4_t vksum4567 = vld1q_s32(w); w = (const int32_t*) w + 4;
84 const int32x4_t vksumzp0x4567 = vmulq_lane_s32(vksum4567, vget_low_s32(vinput_zero_point01), 0);
85 const int32x4_t vksumzp1x4567 = vmulq_lane_s32(vksum4567, vget_high_s32(vinput_zero_point01), 0);
86 const int32x4_t vksum89AB = vld1q_s32(w); w = (const int32_t*) w + 4;
87 const int32x4_t vksumzp0x89AB = vmulq_lane_s32(vksum89AB, vget_low_s32(vinput_zero_point01), 0);
88 const int32x4_t vksumzp1x89AB = vmulq_lane_s32(vksum89AB, vget_high_s32(vinput_zero_point01), 0);
89 const int32x4_t vksumCDEF = vld1q_s32(w); w = (const int32_t*) w + 4;
90 const int32x4_t vksumzp0xCDEF = vmulq_lane_s32(vksumCDEF, vget_low_s32(vinput_zero_point01), 0);
91 const int32x4_t vksumzp1xCDEF = vmulq_lane_s32(vksumCDEF, vget_high_s32(vinput_zero_point01), 0);
92 const int32x4_t vinput_zero_point23 = vld1q_s32(&quantization_params[2].zero_point);
93 const int32x4_t vksumzp2x0123 = vmulq_lane_s32(vksum0123, vget_low_s32(vinput_zero_point23), 0);
94 const int32x4_t vksumzp3x0123 = vmulq_lane_s32(vksum0123, vget_high_s32(vinput_zero_point23), 0);
95 const int32x4_t vksumzp2x4567 = vmulq_lane_s32(vksum4567, vget_low_s32(vinput_zero_point23), 0);
96 const int32x4_t vksumzp3x4567 = vmulq_lane_s32(vksum4567, vget_high_s32(vinput_zero_point23), 0);
97 const int32x4_t vksumzp2x89AB = vmulq_lane_s32(vksum89AB, vget_low_s32(vinput_zero_point23), 0);
98 const int32x4_t vksumzp3x89AB = vmulq_lane_s32(vksum89AB, vget_high_s32(vinput_zero_point23), 0);
99 const int32x4_t vksumzp2xCDEF = vmulq_lane_s32(vksumCDEF, vget_low_s32(vinput_zero_point23), 0);
100 const int32x4_t vksumzp3xCDEF = vmulq_lane_s32(vksumCDEF, vget_high_s32(vinput_zero_point23), 0);
101 const int32x4_t vinput_zero_point45 = vld1q_s32(&quantization_params[4].zero_point);
102 const int32x4_t vksumzp4x0123 = vmulq_lane_s32(vksum0123, vget_low_s32(vinput_zero_point45), 0);
103 const int32x4_t vksumzp5x0123 = vmulq_lane_s32(vksum0123, vget_high_s32(vinput_zero_point45), 0);
104 const int32x4_t vksumzp4x4567 = vmulq_lane_s32(vksum4567, vget_low_s32(vinput_zero_point45), 0);
105 const int32x4_t vksumzp5x4567 = vmulq_lane_s32(vksum4567, vget_high_s32(vinput_zero_point45), 0);
106 const int32x4_t vksumzp4x89AB = vmulq_lane_s32(vksum89AB, vget_low_s32(vinput_zero_point45), 0);
107 const int32x4_t vksumzp5x89AB = vmulq_lane_s32(vksum89AB, vget_high_s32(vinput_zero_point45), 0);
108 const int32x4_t vksumzp4xCDEF = vmulq_lane_s32(vksumCDEF, vget_low_s32(vinput_zero_point45), 0);
109 const int32x4_t vksumzp5xCDEF = vmulq_lane_s32(vksumCDEF, vget_high_s32(vinput_zero_point45), 0);
110
111 int32x4_t vacc01x01 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp0x0123), vreinterpretq_u64_s32(vksumzp1x0123)));
112 int32x4_t vacc01x23 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp0x0123), vreinterpretq_u64_s32(vksumzp1x0123)));
113 int32x4_t vacc01x45 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp0x4567), vreinterpretq_u64_s32(vksumzp1x4567)));
114 int32x4_t vacc01x67 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp0x4567), vreinterpretq_u64_s32(vksumzp1x4567)));
115 int32x4_t vacc01x89 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp0x89AB), vreinterpretq_u64_s32(vksumzp1x89AB)));
116 int32x4_t vacc01xAB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp0x89AB), vreinterpretq_u64_s32(vksumzp1x89AB)));
117 int32x4_t vacc01xCD = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp0xCDEF), vreinterpretq_u64_s32(vksumzp1xCDEF)));
118 int32x4_t vacc01xEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp0xCDEF), vreinterpretq_u64_s32(vksumzp1xCDEF)));
119 int32x4_t vacc23x01 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp2x0123), vreinterpretq_u64_s32(vksumzp3x0123)));
120 int32x4_t vacc23x23 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp2x0123), vreinterpretq_u64_s32(vksumzp3x0123)));
121 int32x4_t vacc23x45 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp2x4567), vreinterpretq_u64_s32(vksumzp3x4567)));
122 int32x4_t vacc23x67 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp2x4567), vreinterpretq_u64_s32(vksumzp3x4567)));
123 int32x4_t vacc23x89 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp2x89AB), vreinterpretq_u64_s32(vksumzp3x89AB)));
124 int32x4_t vacc23xAB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp2x89AB), vreinterpretq_u64_s32(vksumzp3x89AB)));
125 int32x4_t vacc23xCD = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp2xCDEF), vreinterpretq_u64_s32(vksumzp3xCDEF)));
126 int32x4_t vacc23xEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp2xCDEF), vreinterpretq_u64_s32(vksumzp3xCDEF)));
127 int32x4_t vacc45x01 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp4x0123), vreinterpretq_u64_s32(vksumzp5x0123)));
128 int32x4_t vacc45x23 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp4x0123), vreinterpretq_u64_s32(vksumzp5x0123)));
129 int32x4_t vacc45x45 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp4x4567), vreinterpretq_u64_s32(vksumzp5x4567)));
130 int32x4_t vacc45x67 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp4x4567), vreinterpretq_u64_s32(vksumzp5x4567)));
131 int32x4_t vacc45x89 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp4x89AB), vreinterpretq_u64_s32(vksumzp5x89AB)));
132 int32x4_t vacc45xAB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp4x89AB), vreinterpretq_u64_s32(vksumzp5x89AB)));
133 int32x4_t vacc45xCD = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp4xCDEF), vreinterpretq_u64_s32(vksumzp5xCDEF)));
134 int32x4_t vacc45xEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp4xCDEF), vreinterpretq_u64_s32(vksumzp5xCDEF)));
135
136 // Inner accumulation loop along the 16 columns.
137 size_t k = kc;
138 // 2x partial unrolled loop to load 8 bytes at a time.
139
140 uint64x2x2_t va01x0123456789ABCDEF;
141 va01x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
142 va01x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
143 uint64x2x2_t va23x0123456789ABCDEF;
144 va23x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
145 va23x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
146 uint64x2x2_t va45x0123456789ABCDEF;
147 va45x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
148 va45x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
149
150 while (k >= 16 * sizeof(int8_t)) {
151 // Load a 6x16 block of activations.
152 va01x0123456789ABCDEF = vld2q_lane_u64((const void*) a0, va01x0123456789ABCDEF, 0); a0 += 16;
153 va23x0123456789ABCDEF = vld2q_lane_u64((const void*) a2, va23x0123456789ABCDEF, 0); a2 += 16;
154 va45x0123456789ABCDEF = vld2q_lane_u64((const void*) a4, va45x0123456789ABCDEF, 0); a4 += 16;
155 va01x0123456789ABCDEF = vld2q_lane_u64((const void*) a1, va01x0123456789ABCDEF, 1); a1 += 16;
156 va23x0123456789ABCDEF = vld2q_lane_u64((const void*) a3, va23x0123456789ABCDEF, 1); a3 += 16;
157 va45x0123456789ABCDEF = vld2q_lane_u64((const void*) a5, va45x0123456789ABCDEF, 1); a5 += 16;
158
159 const int8x16_t va01x01234567 = vreinterpretq_s8_u64(va01x0123456789ABCDEF.val[0]);
160 const int8x16_t va01x89ABCDEF = vreinterpretq_s8_u64(va01x0123456789ABCDEF.val[1]);
161 const int8x16_t va23x01234567 = vreinterpretq_s8_u64(va23x0123456789ABCDEF.val[0]);
162 const int8x16_t va23x89ABCDEF = vreinterpretq_s8_u64(va23x0123456789ABCDEF.val[1]);
163 const int8x16_t va45x01234567 = vreinterpretq_s8_u64(va45x0123456789ABCDEF.val[0]);
164 const int8x16_t va45x89ABCDEF = vreinterpretq_s8_u64(va45x0123456789ABCDEF.val[1]);
165
166 // Load a 16x16 block of weights.
167 const int8x16_t vb01x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
168 const int8x16_t vb23x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
169 const int8x16_t vb45x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
170 const int8x16_t vb67x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
171 const int8x16_t vb89x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
172 const int8x16_t vbABx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
173 const int8x16_t vbCDx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
174 const int8x16_t vbEFx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
175 const int8x16_t vb01x01234567 = vshlq_n_s8(vb01x0123456789ABCDEF, 4);
176 const int8x16_t vb23x01234567 = vshlq_n_s8(vb23x0123456789ABCDEF, 4);
177 const int8x16_t vb45x01234567 = vshlq_n_s8(vb45x0123456789ABCDEF, 4);
178 const int8x16_t vb67x01234567 = vshlq_n_s8(vb67x0123456789ABCDEF, 4);
179 const int8x16_t vb89x01234567 = vshlq_n_s8(vb89x0123456789ABCDEF, 4);
180 const int8x16_t vbABx01234567 = vshlq_n_s8(vbABx0123456789ABCDEF, 4);
181 const int8x16_t vbCDx01234567 = vshlq_n_s8(vbCDx0123456789ABCDEF, 4);
182 const int8x16_t vbEFx01234567 = vshlq_n_s8(vbEFx0123456789ABCDEF, 4);
183 const int8x16_t vb01x89ABCDEF = vandq_s8(vb01x0123456789ABCDEF, vmask);
184 const int8x16_t vb23x89ABCDEF = vandq_s8(vb23x0123456789ABCDEF, vmask);
185 const int8x16_t vb45x89ABCDEF = vandq_s8(vb45x0123456789ABCDEF, vmask);
186 const int8x16_t vb67x89ABCDEF = vandq_s8(vb67x0123456789ABCDEF, vmask);
187 const int8x16_t vb89x89ABCDEF = vandq_s8(vb89x0123456789ABCDEF, vmask);
188 const int8x16_t vbABx89ABCDEF = vandq_s8(vbABx0123456789ABCDEF, vmask);
189 const int8x16_t vbCDx89ABCDEF = vandq_s8(vbCDx0123456789ABCDEF, vmask);
190 const int8x16_t vbEFx89ABCDEF = vandq_s8(vbEFx0123456789ABCDEF, vmask);
191
192 // Multiply-accumulate: 6x8 * 8x16 --> 6x16.
193 vacc01x01 = vmmlaq_s32(vacc01x01, va01x01234567, vb01x01234567);
194 vacc01x23 = vmmlaq_s32(vacc01x23, va01x01234567, vb23x01234567);
195 vacc01x45 = vmmlaq_s32(vacc01x45, va01x01234567, vb45x01234567);
196 vacc01x67 = vmmlaq_s32(vacc01x67, va01x01234567, vb67x01234567);
197 vacc01x89 = vmmlaq_s32(vacc01x89, va01x01234567, vb89x01234567);
198 vacc01xAB = vmmlaq_s32(vacc01xAB, va01x01234567, vbABx01234567);
199 vacc01xCD = vmmlaq_s32(vacc01xCD, va01x01234567, vbCDx01234567);
200 vacc01xEF = vmmlaq_s32(vacc01xEF, va01x01234567, vbEFx01234567);
201 vacc23x01 = vmmlaq_s32(vacc23x01, va23x01234567, vb01x01234567);
202 vacc23x23 = vmmlaq_s32(vacc23x23, va23x01234567, vb23x01234567);
203 vacc23x45 = vmmlaq_s32(vacc23x45, va23x01234567, vb45x01234567);
204 vacc23x67 = vmmlaq_s32(vacc23x67, va23x01234567, vb67x01234567);
205 vacc23x89 = vmmlaq_s32(vacc23x89, va23x01234567, vb89x01234567);
206 vacc23xAB = vmmlaq_s32(vacc23xAB, va23x01234567, vbABx01234567);
207 vacc23xCD = vmmlaq_s32(vacc23xCD, va23x01234567, vbCDx01234567);
208 vacc23xEF = vmmlaq_s32(vacc23xEF, va23x01234567, vbEFx01234567);
209 vacc45x01 = vmmlaq_s32(vacc45x01, va45x01234567, vb01x01234567);
210 vacc45x23 = vmmlaq_s32(vacc45x23, va45x01234567, vb23x01234567);
211 vacc45x45 = vmmlaq_s32(vacc45x45, va45x01234567, vb45x01234567);
212 vacc45x67 = vmmlaq_s32(vacc45x67, va45x01234567, vb67x01234567);
213 vacc45x89 = vmmlaq_s32(vacc45x89, va45x01234567, vb89x01234567);
214 vacc45xAB = vmmlaq_s32(vacc45xAB, va45x01234567, vbABx01234567);
215 vacc45xCD = vmmlaq_s32(vacc45xCD, va45x01234567, vbCDx01234567);
216 vacc45xEF = vmmlaq_s32(vacc45xEF, va45x01234567, vbEFx01234567);
217 vacc01x01 = vmmlaq_s32(vacc01x01, va01x89ABCDEF, vb01x89ABCDEF);
218 vacc01x23 = vmmlaq_s32(vacc01x23, va01x89ABCDEF, vb23x89ABCDEF);
219 vacc01x45 = vmmlaq_s32(vacc01x45, va01x89ABCDEF, vb45x89ABCDEF);
220 vacc01x67 = vmmlaq_s32(vacc01x67, va01x89ABCDEF, vb67x89ABCDEF);
221 vacc01x89 = vmmlaq_s32(vacc01x89, va01x89ABCDEF, vb89x89ABCDEF);
222 vacc01xAB = vmmlaq_s32(vacc01xAB, va01x89ABCDEF, vbABx89ABCDEF);
223 vacc01xCD = vmmlaq_s32(vacc01xCD, va01x89ABCDEF, vbCDx89ABCDEF);
224 vacc01xEF = vmmlaq_s32(vacc01xEF, va01x89ABCDEF, vbEFx89ABCDEF);
225 vacc23x01 = vmmlaq_s32(vacc23x01, va23x89ABCDEF, vb01x89ABCDEF);
226 vacc23x23 = vmmlaq_s32(vacc23x23, va23x89ABCDEF, vb23x89ABCDEF);
227 vacc23x45 = vmmlaq_s32(vacc23x45, va23x89ABCDEF, vb45x89ABCDEF);
228 vacc23x67 = vmmlaq_s32(vacc23x67, va23x89ABCDEF, vb67x89ABCDEF);
229 vacc23x89 = vmmlaq_s32(vacc23x89, va23x89ABCDEF, vb89x89ABCDEF);
230 vacc23xAB = vmmlaq_s32(vacc23xAB, va23x89ABCDEF, vbABx89ABCDEF);
231 vacc23xCD = vmmlaq_s32(vacc23xCD, va23x89ABCDEF, vbCDx89ABCDEF);
232 vacc23xEF = vmmlaq_s32(vacc23xEF, va23x89ABCDEF, vbEFx89ABCDEF);
233 vacc45x01 = vmmlaq_s32(vacc45x01, va45x89ABCDEF, vb01x89ABCDEF);
234 vacc45x23 = vmmlaq_s32(vacc45x23, va45x89ABCDEF, vb23x89ABCDEF);
235 vacc45x45 = vmmlaq_s32(vacc45x45, va45x89ABCDEF, vb45x89ABCDEF);
236 vacc45x67 = vmmlaq_s32(vacc45x67, va45x89ABCDEF, vb67x89ABCDEF);
237 vacc45x89 = vmmlaq_s32(vacc45x89, va45x89ABCDEF, vb89x89ABCDEF);
238 vacc45xAB = vmmlaq_s32(vacc45xAB, va45x89ABCDEF, vbABx89ABCDEF);
239 vacc45xCD = vmmlaq_s32(vacc45xCD, va45x89ABCDEF, vbCDx89ABCDEF);
240 vacc45xEF = vmmlaq_s32(vacc45xEF, va45x89ABCDEF, vbEFx89ABCDEF);
241
242 k -= 16 * sizeof(int8_t);
243 }
244 // Handle up to 8 final positions of `k`
245 if XNN_UNLIKELY(k != 0) {
246 // Load a 6x8 block of activations.
247 uint64x2_t va01x01234567 = vld1q_dup_u64((const void*) a0); a0 += 8;
248 uint64x2_t va23x01234567 = vld1q_dup_u64((const void*) a2); a2 += 8;
249 uint64x2_t va45x01234567 = vld1q_dup_u64((const void*) a4); a4 += 8;
250 va01x01234567 = vld1q_lane_u64((const void*) a1, va01x01234567, 1); a1 += 8;
251 va23x01234567 = vld1q_lane_u64((const void*) a3, va23x01234567, 1); a3 += 8;
252 va45x01234567 = vld1q_lane_u64((const void*) a5, va45x01234567, 1); a5 += 8;
253
254 // Load a 16x16 block of weights.
255 const int8x16_t vb01x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
256 const int8x16_t vb23x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
257 const int8x16_t vb45x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
258 const int8x16_t vb67x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
259 const int8x16_t vb89x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
260 const int8x16_t vbABx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
261 const int8x16_t vbCDx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
262 const int8x16_t vbEFx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
263 const int8x16_t vb01x01234567 = vshlq_n_s8(vb01x0123456789ABCDEF, 4);
264 const int8x16_t vb23x01234567 = vshlq_n_s8(vb23x0123456789ABCDEF, 4);
265 const int8x16_t vb45x01234567 = vshlq_n_s8(vb45x0123456789ABCDEF, 4);
266 const int8x16_t vb67x01234567 = vshlq_n_s8(vb67x0123456789ABCDEF, 4);
267 const int8x16_t vb89x01234567 = vshlq_n_s8(vb89x0123456789ABCDEF, 4);
268 const int8x16_t vbABx01234567 = vshlq_n_s8(vbABx0123456789ABCDEF, 4);
269 const int8x16_t vbCDx01234567 = vshlq_n_s8(vbCDx0123456789ABCDEF, 4);
270 const int8x16_t vbEFx01234567 = vshlq_n_s8(vbEFx0123456789ABCDEF, 4);
271
272 // Multiply-accumulate: 6x4 * 4x16 --> 6x16.
273 vacc01x01 = vmmlaq_s32(vacc01x01, vreinterpretq_s8_u64(va01x01234567), vb01x01234567);
274 vacc01x23 = vmmlaq_s32(vacc01x23, vreinterpretq_s8_u64(va01x01234567), vb23x01234567);
275 vacc01x45 = vmmlaq_s32(vacc01x45, vreinterpretq_s8_u64(va01x01234567), vb45x01234567);
276 vacc01x67 = vmmlaq_s32(vacc01x67, vreinterpretq_s8_u64(va01x01234567), vb67x01234567);
277 vacc01x89 = vmmlaq_s32(vacc01x89, vreinterpretq_s8_u64(va01x01234567), vb89x01234567);
278 vacc01xAB = vmmlaq_s32(vacc01xAB, vreinterpretq_s8_u64(va01x01234567), vbABx01234567);
279 vacc01xCD = vmmlaq_s32(vacc01xCD, vreinterpretq_s8_u64(va01x01234567), vbCDx01234567);
280 vacc01xEF = vmmlaq_s32(vacc01xEF, vreinterpretq_s8_u64(va01x01234567), vbEFx01234567);
281 vacc23x01 = vmmlaq_s32(vacc23x01, vreinterpretq_s8_u64(va23x01234567), vb01x01234567);
282 vacc23x23 = vmmlaq_s32(vacc23x23, vreinterpretq_s8_u64(va23x01234567), vb23x01234567);
283 vacc23x45 = vmmlaq_s32(vacc23x45, vreinterpretq_s8_u64(va23x01234567), vb45x01234567);
284 vacc23x67 = vmmlaq_s32(vacc23x67, vreinterpretq_s8_u64(va23x01234567), vb67x01234567);
285 vacc23x89 = vmmlaq_s32(vacc23x89, vreinterpretq_s8_u64(va23x01234567), vb89x01234567);
286 vacc23xAB = vmmlaq_s32(vacc23xAB, vreinterpretq_s8_u64(va23x01234567), vbABx01234567);
287 vacc23xCD = vmmlaq_s32(vacc23xCD, vreinterpretq_s8_u64(va23x01234567), vbCDx01234567);
288 vacc23xEF = vmmlaq_s32(vacc23xEF, vreinterpretq_s8_u64(va23x01234567), vbEFx01234567);
289 vacc45x01 = vmmlaq_s32(vacc45x01, vreinterpretq_s8_u64(va45x01234567), vb01x01234567);
290 vacc45x23 = vmmlaq_s32(vacc45x23, vreinterpretq_s8_u64(va45x01234567), vb23x01234567);
291 vacc45x45 = vmmlaq_s32(vacc45x45, vreinterpretq_s8_u64(va45x01234567), vb45x01234567);
292 vacc45x67 = vmmlaq_s32(vacc45x67, vreinterpretq_s8_u64(va45x01234567), vb67x01234567);
293 vacc45x89 = vmmlaq_s32(vacc45x89, vreinterpretq_s8_u64(va45x01234567), vb89x01234567);
294 vacc45xAB = vmmlaq_s32(vacc45xAB, vreinterpretq_s8_u64(va45x01234567), vbABx01234567);
295 vacc45xCD = vmmlaq_s32(vacc45xCD, vreinterpretq_s8_u64(va45x01234567), vbCDx01234567);
296 vacc45xEF = vmmlaq_s32(vacc45xEF, vreinterpretq_s8_u64(va45x01234567), vbEFx01234567);
297 }
298
299 int32x4_t vacc0x0123 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01x01), vreinterpretq_u64_s32(vacc01x23)));
300 int32x4_t vacc1x0123 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01x01), vreinterpretq_u64_s32(vacc01x23)));
301 int32x4_t vacc0x4567 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01x45), vreinterpretq_u64_s32(vacc01x67)));
302 int32x4_t vacc1x4567 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01x45), vreinterpretq_u64_s32(vacc01x67)));
303 int32x4_t vacc0x89AB = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01x89), vreinterpretq_u64_s32(vacc01xAB)));
304 int32x4_t vacc1x89AB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01x89), vreinterpretq_u64_s32(vacc01xAB)));
305 int32x4_t vacc0xCDEF = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01xCD), vreinterpretq_u64_s32(vacc01xEF)));
306 int32x4_t vacc1xCDEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01xCD), vreinterpretq_u64_s32(vacc01xEF)));
307 int32x4_t vacc2x0123 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23x01), vreinterpretq_u64_s32(vacc23x23)));
308 int32x4_t vacc3x0123 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23x01), vreinterpretq_u64_s32(vacc23x23)));
309 int32x4_t vacc2x4567 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23x45), vreinterpretq_u64_s32(vacc23x67)));
310 int32x4_t vacc3x4567 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23x45), vreinterpretq_u64_s32(vacc23x67)));
311 int32x4_t vacc2x89AB = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23x89), vreinterpretq_u64_s32(vacc23xAB)));
312 int32x4_t vacc3x89AB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23x89), vreinterpretq_u64_s32(vacc23xAB)));
313 int32x4_t vacc2xCDEF = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23xCD), vreinterpretq_u64_s32(vacc23xEF)));
314 int32x4_t vacc3xCDEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23xCD), vreinterpretq_u64_s32(vacc23xEF)));
315 int32x4_t vacc4x0123 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45x01), vreinterpretq_u64_s32(vacc45x23)));
316 int32x4_t vacc5x0123 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc45x01), vreinterpretq_u64_s32(vacc45x23)));
317 int32x4_t vacc4x4567 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45x45), vreinterpretq_u64_s32(vacc45x67)));
318 int32x4_t vacc5x4567 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc45x45), vreinterpretq_u64_s32(vacc45x67)));
319 int32x4_t vacc4x89AB = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45x89), vreinterpretq_u64_s32(vacc45xAB)));
320 int32x4_t vacc5x89AB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc45x89), vreinterpretq_u64_s32(vacc45xAB)));
321 int32x4_t vacc4xCDEF = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45xCD), vreinterpretq_u64_s32(vacc45xEF)));
322 int32x4_t vacc5xCDEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc45xCD), vreinterpretq_u64_s32(vacc45xEF)));
323 float32x4_t vout0x0123 = vcvtq_n_f32_s32(vacc0x0123, 4);
324 float32x4_t vout0x4567 = vcvtq_n_f32_s32(vacc0x4567, 4);
325 float32x4_t vout0x89AB = vcvtq_n_f32_s32(vacc0x89AB, 4);
326 float32x4_t vout0xCDEF = vcvtq_n_f32_s32(vacc0xCDEF, 4);
327 float32x4_t vout1x0123 = vcvtq_n_f32_s32(vacc1x0123, 4);
328 float32x4_t vout1x4567 = vcvtq_n_f32_s32(vacc1x4567, 4);
329 float32x4_t vout1x89AB = vcvtq_n_f32_s32(vacc1x89AB, 4);
330 float32x4_t vout1xCDEF = vcvtq_n_f32_s32(vacc1xCDEF, 4);
331 float32x4_t vout2x0123 = vcvtq_n_f32_s32(vacc2x0123, 4);
332 float32x4_t vout2x4567 = vcvtq_n_f32_s32(vacc2x4567, 4);
333 float32x4_t vout2x89AB = vcvtq_n_f32_s32(vacc2x89AB, 4);
334 float32x4_t vout2xCDEF = vcvtq_n_f32_s32(vacc2xCDEF, 4);
335 float32x4_t vout3x0123 = vcvtq_n_f32_s32(vacc3x0123, 4);
336 float32x4_t vout3x4567 = vcvtq_n_f32_s32(vacc3x4567, 4);
337 float32x4_t vout3x89AB = vcvtq_n_f32_s32(vacc3x89AB, 4);
338 float32x4_t vout3xCDEF = vcvtq_n_f32_s32(vacc3xCDEF, 4);
339 float32x4_t vout4x0123 = vcvtq_n_f32_s32(vacc4x0123, 4);
340 float32x4_t vout4x4567 = vcvtq_n_f32_s32(vacc4x4567, 4);
341 float32x4_t vout4x89AB = vcvtq_n_f32_s32(vacc4x89AB, 4);
342 float32x4_t vout4xCDEF = vcvtq_n_f32_s32(vacc4xCDEF, 4);
343 float32x4_t vout5x0123 = vcvtq_n_f32_s32(vacc5x0123, 4);
344 float32x4_t vout5x4567 = vcvtq_n_f32_s32(vacc5x4567, 4);
345 float32x4_t vout5x89AB = vcvtq_n_f32_s32(vacc5x89AB, 4);
346 float32x4_t vout5xCDEF = vcvtq_n_f32_s32(vacc5xCDEF, 4);
347
348 const float32x4_t vinput_scale01 = vreinterpretq_f32_s32(vld1q_s32(&quantization_params[0].zero_point));
349 vout0x0123 = vmulq_lane_f32(vout0x0123, vget_low_f32(vinput_scale01), 1);
350 vout1x0123 = vmulq_lane_f32(vout1x0123, vget_high_f32(vinput_scale01), 1);
351 vout0x4567 = vmulq_lane_f32(vout0x4567, vget_low_f32(vinput_scale01), 1);
352 vout1x4567 = vmulq_lane_f32(vout1x4567, vget_high_f32(vinput_scale01), 1);
353 vout0x89AB = vmulq_lane_f32(vout0x89AB, vget_low_f32(vinput_scale01), 1);
354 vout1x89AB = vmulq_lane_f32(vout1x89AB, vget_high_f32(vinput_scale01), 1);
355 vout0xCDEF = vmulq_lane_f32(vout0xCDEF, vget_low_f32(vinput_scale01), 1);
356 vout1xCDEF = vmulq_lane_f32(vout1xCDEF, vget_high_f32(vinput_scale01), 1);
357 const float32x4_t vinput_scale23 = vreinterpretq_f32_s32(vld1q_s32(&quantization_params[2].zero_point));
358 vout2x0123 = vmulq_lane_f32(vout2x0123, vget_low_f32(vinput_scale23), 1);
359 vout3x0123 = vmulq_lane_f32(vout3x0123, vget_high_f32(vinput_scale23), 1);
360 vout2x4567 = vmulq_lane_f32(vout2x4567, vget_low_f32(vinput_scale23), 1);
361 vout3x4567 = vmulq_lane_f32(vout3x4567, vget_high_f32(vinput_scale23), 1);
362 vout2x89AB = vmulq_lane_f32(vout2x89AB, vget_low_f32(vinput_scale23), 1);
363 vout3x89AB = vmulq_lane_f32(vout3x89AB, vget_high_f32(vinput_scale23), 1);
364 vout2xCDEF = vmulq_lane_f32(vout2xCDEF, vget_low_f32(vinput_scale23), 1);
365 vout3xCDEF = vmulq_lane_f32(vout3xCDEF, vget_high_f32(vinput_scale23), 1);
366 const float32x4_t vinput_scale45 = vreinterpretq_f32_s32(vld1q_s32(&quantization_params[4].zero_point));
367 vout4x0123 = vmulq_lane_f32(vout4x0123, vget_low_f32(vinput_scale45), 1);
368 vout5x0123 = vmulq_lane_f32(vout5x0123, vget_high_f32(vinput_scale45), 1);
369 vout4x4567 = vmulq_lane_f32(vout4x4567, vget_low_f32(vinput_scale45), 1);
370 vout5x4567 = vmulq_lane_f32(vout5x4567, vget_high_f32(vinput_scale45), 1);
371 vout4x89AB = vmulq_lane_f32(vout4x89AB, vget_low_f32(vinput_scale45), 1);
372 vout5x89AB = vmulq_lane_f32(vout5x89AB, vget_high_f32(vinput_scale45), 1);
373 vout4xCDEF = vmulq_lane_f32(vout4xCDEF, vget_low_f32(vinput_scale45), 1);
374 vout5xCDEF = vmulq_lane_f32(vout5xCDEF, vget_high_f32(vinput_scale45), 1);
375
376 const float32x4_t vfilter_output_scale0123 = vld1q_f32(w); w = (const float*) w + 4;
377 const float32x4_t vfilter_output_scale4567 = vld1q_f32(w); w = (const float*) w + 4;
378 const float32x4_t vfilter_output_scale89AB = vld1q_f32(w); w = (const float*) w + 4;
379 const float32x4_t vfilter_output_scaleCDEF = vld1q_f32(w); w = (const float*) w + 4;
380
381 const float32x4_t vbias0123 = vld1q_f32(w); w = (const float*) w + 4;
382 vout0x0123 = vfmaq_f32(vbias0123, vout0x0123, vfilter_output_scale0123);
383 vout1x0123 = vfmaq_f32(vbias0123, vout1x0123, vfilter_output_scale0123);
384 vout2x0123 = vfmaq_f32(vbias0123, vout2x0123, vfilter_output_scale0123);
385 vout3x0123 = vfmaq_f32(vbias0123, vout3x0123, vfilter_output_scale0123);
386 vout4x0123 = vfmaq_f32(vbias0123, vout4x0123, vfilter_output_scale0123);
387 vout5x0123 = vfmaq_f32(vbias0123, vout5x0123, vfilter_output_scale0123);
388 const float32x4_t vbias4567 = vld1q_f32(w); w = (const float*) w + 4;
389 vout0x4567 = vfmaq_f32(vbias4567, vout0x4567, vfilter_output_scale4567);
390 vout1x4567 = vfmaq_f32(vbias4567, vout1x4567, vfilter_output_scale4567);
391 vout2x4567 = vfmaq_f32(vbias4567, vout2x4567, vfilter_output_scale4567);
392 vout3x4567 = vfmaq_f32(vbias4567, vout3x4567, vfilter_output_scale4567);
393 vout4x4567 = vfmaq_f32(vbias4567, vout4x4567, vfilter_output_scale4567);
394 vout5x4567 = vfmaq_f32(vbias4567, vout5x4567, vfilter_output_scale4567);
395 const float32x4_t vbias89AB = vld1q_f32(w); w = (const float*) w + 4;
396 vout0x89AB = vfmaq_f32(vbias89AB, vout0x89AB, vfilter_output_scale89AB);
397 vout1x89AB = vfmaq_f32(vbias89AB, vout1x89AB, vfilter_output_scale89AB);
398 vout2x89AB = vfmaq_f32(vbias89AB, vout2x89AB, vfilter_output_scale89AB);
399 vout3x89AB = vfmaq_f32(vbias89AB, vout3x89AB, vfilter_output_scale89AB);
400 vout4x89AB = vfmaq_f32(vbias89AB, vout4x89AB, vfilter_output_scale89AB);
401 vout5x89AB = vfmaq_f32(vbias89AB, vout5x89AB, vfilter_output_scale89AB);
402 const float32x4_t vbiasCDEF = vld1q_f32(w); w = (const float*) w + 4;
403 vout0xCDEF = vfmaq_f32(vbiasCDEF, vout0xCDEF, vfilter_output_scaleCDEF);
404 vout1xCDEF = vfmaq_f32(vbiasCDEF, vout1xCDEF, vfilter_output_scaleCDEF);
405 vout2xCDEF = vfmaq_f32(vbiasCDEF, vout2xCDEF, vfilter_output_scaleCDEF);
406 vout3xCDEF = vfmaq_f32(vbiasCDEF, vout3xCDEF, vfilter_output_scaleCDEF);
407 vout4xCDEF = vfmaq_f32(vbiasCDEF, vout4xCDEF, vfilter_output_scaleCDEF);
408 vout5xCDEF = vfmaq_f32(vbiasCDEF, vout5xCDEF, vfilter_output_scaleCDEF);
409
410 const float32x4_t voutput_min = vld1q_dup_f32(&params->scalar.min);
411 vout0x0123 = vmaxq_f32(vout0x0123, voutput_min);
412 vout0x4567 = vmaxq_f32(vout0x4567, voutput_min);
413 vout0x89AB = vmaxq_f32(vout0x89AB, voutput_min);
414 vout0xCDEF = vmaxq_f32(vout0xCDEF, voutput_min);
415 vout1x0123 = vmaxq_f32(vout1x0123, voutput_min);
416 vout1x4567 = vmaxq_f32(vout1x4567, voutput_min);
417 vout1x89AB = vmaxq_f32(vout1x89AB, voutput_min);
418 vout1xCDEF = vmaxq_f32(vout1xCDEF, voutput_min);
419 vout2x0123 = vmaxq_f32(vout2x0123, voutput_min);
420 vout2x4567 = vmaxq_f32(vout2x4567, voutput_min);
421 vout2x89AB = vmaxq_f32(vout2x89AB, voutput_min);
422 vout2xCDEF = vmaxq_f32(vout2xCDEF, voutput_min);
423 vout3x0123 = vmaxq_f32(vout3x0123, voutput_min);
424 vout3x4567 = vmaxq_f32(vout3x4567, voutput_min);
425 vout3x89AB = vmaxq_f32(vout3x89AB, voutput_min);
426 vout3xCDEF = vmaxq_f32(vout3xCDEF, voutput_min);
427 vout4x0123 = vmaxq_f32(vout4x0123, voutput_min);
428 vout4x4567 = vmaxq_f32(vout4x4567, voutput_min);
429 vout4x89AB = vmaxq_f32(vout4x89AB, voutput_min);
430 vout4xCDEF = vmaxq_f32(vout4xCDEF, voutput_min);
431 vout5x0123 = vmaxq_f32(vout5x0123, voutput_min);
432 vout5x4567 = vmaxq_f32(vout5x4567, voutput_min);
433 vout5x89AB = vmaxq_f32(vout5x89AB, voutput_min);
434 vout5xCDEF = vmaxq_f32(vout5xCDEF, voutput_min);
435
436 const float32x4_t voutput_max = vld1q_dup_f32(&params->scalar.max);
437 vout0x0123 = vminq_f32(vout0x0123, voutput_max);
438 vout0x4567 = vminq_f32(vout0x4567, voutput_max);
439 vout0x89AB = vminq_f32(vout0x89AB, voutput_max);
440 vout0xCDEF = vminq_f32(vout0xCDEF, voutput_max);
441 vout1x0123 = vminq_f32(vout1x0123, voutput_max);
442 vout1x4567 = vminq_f32(vout1x4567, voutput_max);
443 vout1x89AB = vminq_f32(vout1x89AB, voutput_max);
444 vout1xCDEF = vminq_f32(vout1xCDEF, voutput_max);
445 vout2x0123 = vminq_f32(vout2x0123, voutput_max);
446 vout2x4567 = vminq_f32(vout2x4567, voutput_max);
447 vout2x89AB = vminq_f32(vout2x89AB, voutput_max);
448 vout2xCDEF = vminq_f32(vout2xCDEF, voutput_max);
449 vout3x0123 = vminq_f32(vout3x0123, voutput_max);
450 vout3x4567 = vminq_f32(vout3x4567, voutput_max);
451 vout3x89AB = vminq_f32(vout3x89AB, voutput_max);
452 vout3xCDEF = vminq_f32(vout3xCDEF, voutput_max);
453 vout4x0123 = vminq_f32(vout4x0123, voutput_max);
454 vout4x4567 = vminq_f32(vout4x4567, voutput_max);
455 vout4x89AB = vminq_f32(vout4x89AB, voutput_max);
456 vout4xCDEF = vminq_f32(vout4xCDEF, voutput_max);
457 vout5x0123 = vminq_f32(vout5x0123, voutput_max);
458 vout5x4567 = vminq_f32(vout5x4567, voutput_max);
459 vout5x89AB = vminq_f32(vout5x89AB, voutput_max);
460 vout5xCDEF = vminq_f32(vout5xCDEF, voutput_max);
461
462 if XNN_LIKELY(nc >= 16) {
463 vst1q_f32(c0, vout0x0123);
464 vst1q_f32(c0 + 4, vout0x4567);
465 vst1q_f32(c0 + 8, vout0x89AB);
466 vst1q_f32(c0 + 12, vout0xCDEF);
467 vst1q_f32(c1, vout1x0123);
468 vst1q_f32(c1 + 4, vout1x4567);
469 vst1q_f32(c1 + 8, vout1x89AB);
470 vst1q_f32(c1 + 12, vout1xCDEF);
471 vst1q_f32(c2, vout2x0123);
472 vst1q_f32(c2 + 4, vout2x4567);
473 vst1q_f32(c2 + 8, vout2x89AB);
474 vst1q_f32(c2 + 12, vout2xCDEF);
475 vst1q_f32(c3, vout3x0123);
476 vst1q_f32(c3 + 4, vout3x4567);
477 vst1q_f32(c3 + 8, vout3x89AB);
478 vst1q_f32(c3 + 12, vout3xCDEF);
479 vst1q_f32(c4, vout4x0123);
480 vst1q_f32(c4 + 4, vout4x4567);
481 vst1q_f32(c4 + 8, vout4x89AB);
482 vst1q_f32(c4 + 12, vout4xCDEF);
483 vst1q_f32(c5, vout5x0123);
484 vst1q_f32(c5 + 4, vout5x4567);
485 vst1q_f32(c5 + 8, vout5x89AB);
486 vst1q_f32(c5 + 12, vout5xCDEF);
487
488 a0 = (const int8_t*) ((uintptr_t) a0 - kc);
489 a1 = (const int8_t*) ((uintptr_t) a1 - kc);
490 a2 = (const int8_t*) ((uintptr_t) a2 - kc);
491 a3 = (const int8_t*) ((uintptr_t) a3 - kc);
492 a4 = (const int8_t*) ((uintptr_t) a4 - kc);
493 a5 = (const int8_t*) ((uintptr_t) a5 - kc);
494
495 c0 = (float*) ((uintptr_t) c0 + cn_stride);
496 c1 = (float*) ((uintptr_t) c1 + cn_stride);
497 c2 = (float*) ((uintptr_t) c2 + cn_stride);
498 c3 = (float*) ((uintptr_t) c3 + cn_stride);
499 c4 = (float*) ((uintptr_t) c4 + cn_stride);
500 c5 = (float*) ((uintptr_t) c5 + cn_stride);
501
502 nc -= 16;
503 } else {
504 if (nc & 8) {
505 vst1q_f32(c0, vout0x0123); c0 += 4;
506 vout0x0123 = vout0x89AB;
507 vst1q_f32(c1, vout1x0123); c1 += 4;
508 vout1x0123 = vout1x89AB;
509 vst1q_f32(c2, vout2x0123); c2 += 4;
510 vout2x0123 = vout2x89AB;
511 vst1q_f32(c3, vout3x0123); c3 += 4;
512 vout3x0123 = vout3x89AB;
513 vst1q_f32(c4, vout4x0123); c4 += 4;
514 vout4x0123 = vout4x89AB;
515 vst1q_f32(c5, vout5x0123); c5 += 4;
516 vout5x0123 = vout5x89AB;
517 vst1q_f32(c0, vout0x4567); c0 += 4;
518 vout0x4567 = vout0xCDEF;
519 vst1q_f32(c1, vout1x4567); c1 += 4;
520 vout1x4567 = vout1xCDEF;
521 vst1q_f32(c2, vout2x4567); c2 += 4;
522 vout2x4567 = vout2xCDEF;
523 vst1q_f32(c3, vout3x4567); c3 += 4;
524 vout3x4567 = vout3xCDEF;
525 vst1q_f32(c4, vout4x4567); c4 += 4;
526 vout4x4567 = vout4xCDEF;
527 vst1q_f32(c5, vout5x4567); c5 += 4;
528 vout5x4567 = vout5xCDEF;
529 }
530 if (nc & 4) {
531 vst1q_f32(c0, vout0x0123); c0 += 4;
532 vout0x0123 = vout0x4567;
533 vst1q_f32(c1, vout1x0123); c1 += 4;
534 vout1x0123 = vout1x4567;
535 vst1q_f32(c2, vout2x0123); c2 += 4;
536 vout2x0123 = vout2x4567;
537 vst1q_f32(c3, vout3x0123); c3 += 4;
538 vout3x0123 = vout3x4567;
539 vst1q_f32(c4, vout4x0123); c4 += 4;
540 vout4x0123 = vout4x4567;
541 vst1q_f32(c5, vout5x0123); c5 += 4;
542 vout5x0123 = vout5x4567;
543 }
544 float32x2_t vout0x01 = vget_low_f32(vout0x0123);
545 float32x2_t vout1x01 = vget_low_f32(vout1x0123);
546 float32x2_t vout2x01 = vget_low_f32(vout2x0123);
547 float32x2_t vout3x01 = vget_low_f32(vout3x0123);
548 float32x2_t vout4x01 = vget_low_f32(vout4x0123);
549 float32x2_t vout5x01 = vget_low_f32(vout5x0123);
550 if (nc & 2) {
551 vst1_f32(c0, vout0x01); c0 += 2;
552 vst1_f32(c1, vout1x01); c1 += 2;
553 vst1_f32(c2, vout2x01); c2 += 2;
554 vst1_f32(c3, vout3x01); c3 += 2;
555 vst1_f32(c4, vout4x01); c4 += 2;
556 vst1_f32(c5, vout5x01); c5 += 2;
557 vout0x01 = vget_high_f32(vout0x0123);
558 vout1x01 = vget_high_f32(vout1x0123);
559 vout2x01 = vget_high_f32(vout2x0123);
560 vout3x01 = vget_high_f32(vout3x0123);
561 vout4x01 = vget_high_f32(vout4x0123);
562 vout5x01 = vget_high_f32(vout5x0123);
563 }
564 if (nc & 1) {
565 vst1_lane_f32(c0, vout0x01, 0);
566 vst1_lane_f32(c1, vout1x01, 0);
567 vst1_lane_f32(c2, vout2x01, 0);
568 vst1_lane_f32(c3, vout3x01, 0);
569 vst1_lane_f32(c4, vout4x01, 0);
570 vst1_lane_f32(c5, vout5x01, 0);
571 }
572 nc = 0;
573 }
574 } while (nc != 0);
575 }