Debian Codegraph @

src/qd8-f32-qb4w-gemm/gen/qd8-f32-qb4w-gemm-5x32c8-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_qb4w_gemm_minmax_ukernel_5x32c8__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_qb4w_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 <= 5);
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 size_t bl = params->scalar.blocksize;
42 assert(bl <= kc);
43 assert(bl != 0);
44 assert(bl % 32 == 0);
45 const int8_t* a0 = a;
46 float* c0 = c;
47 const int8_t* a1 = (const int8_t*) ((uintptr_t) a0 + a_stride);
48 float* c1 = (float*) ((uintptr_t) c0 + cm_stride);
49 if XNN_UNPREDICTABLE(mr < 2) {
50 a1 = a0;
51 c1 = c0;
52 }
53 const int8_t* a2 = (const int8_t*) ((uintptr_t) a1 + a_stride);
54 float* c2 = (float*) ((uintptr_t) c1 + cm_stride);
55 if XNN_UNPREDICTABLE(mr <= 2) {
56 a2 = a1;
57 c2 = c1;
58 }
59 const int8_t* a3 = (const int8_t*) ((uintptr_t) a2 + a_stride);
60 float* c3 = (float*) ((uintptr_t) c2 + cm_stride);
61 if XNN_UNPREDICTABLE(mr < 4) {
62 a3 = a2;
63 c3 = c2;
64 }
65 const int8_t* a4 = (const int8_t*) ((uintptr_t) a3 + a_stride);
66 float* c4 = (float*) ((uintptr_t) c3 + cm_stride);
67 if XNN_UNPREDICTABLE(mr <= 4) {
68 a4 = a3;
69 c4 = c3;
70 }
71 const int8x16_t vmask = vmovq_n_s8(INT8_C(0xF0));
72
73 // Loop over groups of 32 columns.
74 do {
75 // Initialize accumulators with scaled vksum. 32 scaled vksum values are loaded from the
76 // weight matrix, at the start of the group of 32 columns.
77 const float32x4_t vinput_zero_point01 = vcvtq_f32_s32(vld1q_s32(&quantization_params[0].zero_point));
78 const float32x4_t vksum0123 = vld1q_f32(w); w = (const float*) w + 4;
79 float32x4_t vout0x0123 = vmulq_lane_f32(vksum0123, vget_low_f32(vinput_zero_point01), 0);
80 float32x4_t vout1x0123 = vmulq_lane_f32(vksum0123, vget_high_f32(vinput_zero_point01), 0);
81 const float32x4_t vksum4567 = vld1q_f32(w); w = (const float*) w + 4;
82 float32x4_t vout0x4567 = vmulq_lane_f32(vksum4567, vget_low_f32(vinput_zero_point01), 0);
83 float32x4_t vout1x4567 = vmulq_lane_f32(vksum4567, vget_high_f32(vinput_zero_point01), 0);
84 const float32x4_t vksum89AB = vld1q_f32(w); w = (const float*) w + 4;
85 float32x4_t vout0x89AB = vmulq_lane_f32(vksum89AB, vget_low_f32(vinput_zero_point01), 0);
86 float32x4_t vout1x89AB = vmulq_lane_f32(vksum89AB, vget_high_f32(vinput_zero_point01), 0);
87 const float32x4_t vksumCDEF = vld1q_f32(w); w = (const float*) w + 4;
88 float32x4_t vout0xCDEF = vmulq_lane_f32(vksumCDEF, vget_low_f32(vinput_zero_point01), 0);
89 float32x4_t vout1xCDEF = vmulq_lane_f32(vksumCDEF, vget_high_f32(vinput_zero_point01), 0);
90 const float32x4_t vksumGHIJ = vld1q_f32(w); w = (const float*) w + 4;
91 float32x4_t vout0xGHIJ = vmulq_lane_f32(vksumGHIJ, vget_low_f32(vinput_zero_point01), 0);
92 float32x4_t vout1xGHIJ = vmulq_lane_f32(vksumGHIJ, vget_high_f32(vinput_zero_point01), 0);
93 const float32x4_t vksumKLMN = vld1q_f32(w); w = (const float*) w + 4;
94 float32x4_t vout0xKLMN = vmulq_lane_f32(vksumKLMN, vget_low_f32(vinput_zero_point01), 0);
95 float32x4_t vout1xKLMN = vmulq_lane_f32(vksumKLMN, vget_high_f32(vinput_zero_point01), 0);
96 const float32x4_t vksumOPQR = vld1q_f32(w); w = (const float*) w + 4;
97 float32x4_t vout0xOPQR = vmulq_lane_f32(vksumOPQR, vget_low_f32(vinput_zero_point01), 0);
98 float32x4_t vout1xOPQR = vmulq_lane_f32(vksumOPQR, vget_high_f32(vinput_zero_point01), 0);
99 const float32x4_t vksumSTUV = vld1q_f32(w); w = (const float*) w + 4;
100 float32x4_t vout0xSTUV = vmulq_lane_f32(vksumSTUV, vget_low_f32(vinput_zero_point01), 0);
101 float32x4_t vout1xSTUV = vmulq_lane_f32(vksumSTUV, vget_high_f32(vinput_zero_point01), 0);
102 const float32x4_t vinput_zero_point23 = vcvtq_f32_s32(vld1q_s32(&quantization_params[2].zero_point));
103 float32x4_t vout2x0123 = vmulq_lane_f32(vksum0123, vget_low_f32(vinput_zero_point23), 0);
104 float32x4_t vout3x0123 = vmulq_lane_f32(vksum0123, vget_high_f32(vinput_zero_point23), 0);
105 float32x4_t vout2x4567 = vmulq_lane_f32(vksum4567, vget_low_f32(vinput_zero_point23), 0);
106 float32x4_t vout3x4567 = vmulq_lane_f32(vksum4567, vget_high_f32(vinput_zero_point23), 0);
107 float32x4_t vout2x89AB = vmulq_lane_f32(vksum89AB, vget_low_f32(vinput_zero_point23), 0);
108 float32x4_t vout3x89AB = vmulq_lane_f32(vksum89AB, vget_high_f32(vinput_zero_point23), 0);
109 float32x4_t vout2xCDEF = vmulq_lane_f32(vksumCDEF, vget_low_f32(vinput_zero_point23), 0);
110 float32x4_t vout3xCDEF = vmulq_lane_f32(vksumCDEF, vget_high_f32(vinput_zero_point23), 0);
111 float32x4_t vout2xGHIJ = vmulq_lane_f32(vksumGHIJ, vget_low_f32(vinput_zero_point23), 0);
112 float32x4_t vout3xGHIJ = vmulq_lane_f32(vksumGHIJ, vget_high_f32(vinput_zero_point23), 0);
113 float32x4_t vout2xKLMN = vmulq_lane_f32(vksumKLMN, vget_low_f32(vinput_zero_point23), 0);
114 float32x4_t vout3xKLMN = vmulq_lane_f32(vksumKLMN, vget_high_f32(vinput_zero_point23), 0);
115 float32x4_t vout2xOPQR = vmulq_lane_f32(vksumOPQR, vget_low_f32(vinput_zero_point23), 0);
116 float32x4_t vout3xOPQR = vmulq_lane_f32(vksumOPQR, vget_high_f32(vinput_zero_point23), 0);
117 float32x4_t vout2xSTUV = vmulq_lane_f32(vksumSTUV, vget_low_f32(vinput_zero_point23), 0);
118 float32x4_t vout3xSTUV = vmulq_lane_f32(vksumSTUV, vget_high_f32(vinput_zero_point23), 0);
119 const float32x4_t vinput_zero_point45 = vcvtq_f32_s32(vld1q_dup_s32(&quantization_params[4].zero_point));
120 float32x4_t vout4x0123 = vmulq_f32(vksum0123, vinput_zero_point45);
121 float32x4_t vout4x4567 = vmulq_f32(vksum4567, vinput_zero_point45);
122 float32x4_t vout4x89AB = vmulq_f32(vksum89AB, vinput_zero_point45);
123 float32x4_t vout4xCDEF = vmulq_f32(vksumCDEF, vinput_zero_point45);
124 float32x4_t vout4xGHIJ = vmulq_f32(vksumGHIJ, vinput_zero_point45);
125 float32x4_t vout4xKLMN = vmulq_f32(vksumKLMN, vinput_zero_point45);
126 float32x4_t vout4xOPQR = vmulq_f32(vksumOPQR, vinput_zero_point45);
127 float32x4_t vout4xSTUV = vmulq_f32(vksumSTUV, vinput_zero_point45);
128
129
130 for (size_t kb=0; kb < kc; kb += bl) {
131 int32x4_t vacc01x01 = vdupq_n_s32(0);
132 int32x4_t vacc01x23 = vdupq_n_s32(0);
133 int32x4_t vacc01x45 = vdupq_n_s32(0);
134 int32x4_t vacc01x67 = vdupq_n_s32(0);
135 int32x4_t vacc01x89 = vdupq_n_s32(0);
136 int32x4_t vacc01xAB = vdupq_n_s32(0);
137 int32x4_t vacc01xCD = vdupq_n_s32(0);
138 int32x4_t vacc01xEF = vdupq_n_s32(0);
139 int32x4_t vacc01xGH = vdupq_n_s32(0);
140 int32x4_t vacc01xIJ = vdupq_n_s32(0);
141 int32x4_t vacc01xKL = vdupq_n_s32(0);
142 int32x4_t vacc01xMN = vdupq_n_s32(0);
143 int32x4_t vacc01xOP = vdupq_n_s32(0);
144 int32x4_t vacc01xQR = vdupq_n_s32(0);
145 int32x4_t vacc01xST = vdupq_n_s32(0);
146 int32x4_t vacc01xUV = vdupq_n_s32(0);
147 int32x4_t vacc23x01 = vdupq_n_s32(0);
148 int32x4_t vacc23x23 = vdupq_n_s32(0);
149 int32x4_t vacc23x45 = vdupq_n_s32(0);
150 int32x4_t vacc23x67 = vdupq_n_s32(0);
151 int32x4_t vacc23x89 = vdupq_n_s32(0);
152 int32x4_t vacc23xAB = vdupq_n_s32(0);
153 int32x4_t vacc23xCD = vdupq_n_s32(0);
154 int32x4_t vacc23xEF = vdupq_n_s32(0);
155 int32x4_t vacc23xGH = vdupq_n_s32(0);
156 int32x4_t vacc23xIJ = vdupq_n_s32(0);
157 int32x4_t vacc23xKL = vdupq_n_s32(0);
158 int32x4_t vacc23xMN = vdupq_n_s32(0);
159 int32x4_t vacc23xOP = vdupq_n_s32(0);
160 int32x4_t vacc23xQR = vdupq_n_s32(0);
161 int32x4_t vacc23xST = vdupq_n_s32(0);
162 int32x4_t vacc23xUV = vdupq_n_s32(0);
163 int32x4_t vacc45x01 = vdupq_n_s32(0);
164 int32x4_t vacc45x23 = vdupq_n_s32(0);
165 int32x4_t vacc45x45 = vdupq_n_s32(0);
166 int32x4_t vacc45x67 = vdupq_n_s32(0);
167 int32x4_t vacc45x89 = vdupq_n_s32(0);
168 int32x4_t vacc45xAB = vdupq_n_s32(0);
169 int32x4_t vacc45xCD = vdupq_n_s32(0);
170 int32x4_t vacc45xEF = vdupq_n_s32(0);
171 int32x4_t vacc45xGH = vdupq_n_s32(0);
172 int32x4_t vacc45xIJ = vdupq_n_s32(0);
173 int32x4_t vacc45xKL = vdupq_n_s32(0);
174 int32x4_t vacc45xMN = vdupq_n_s32(0);
175 int32x4_t vacc45xOP = vdupq_n_s32(0);
176 int32x4_t vacc45xQR = vdupq_n_s32(0);
177 int32x4_t vacc45xST = vdupq_n_s32(0);
178 int32x4_t vacc45xUV = vdupq_n_s32(0);
179
180 size_t k = bl;
181 // 2x partial unrolled loop to load 8 bytes at a time.
182
183 uint64x2x2_t va01x0123456789ABCDEF;
184 va01x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
185 va01x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
186 uint64x2x2_t va23x0123456789ABCDEF;
187 va23x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
188 va23x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
189 uint64x2x2_t va45x0123456789ABCDEF;
190 va45x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
191 va45x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
192
193 while (k >= 16 * sizeof(int8_t)) {
194 // Load a 5x16 block of activations.
195 va01x0123456789ABCDEF = vld2q_lane_u64((const void*) a0, va01x0123456789ABCDEF, 0); a0 += 16;
196 va23x0123456789ABCDEF = vld2q_lane_u64((const void*) a2, va23x0123456789ABCDEF, 0); a2 += 16;
197 va45x0123456789ABCDEF = vld2q_lane_u64((const void*) a4, va45x0123456789ABCDEF, 0); a4 += 16;
198 va01x0123456789ABCDEF = vld2q_lane_u64((const void*) a1, va01x0123456789ABCDEF, 1); a1 += 16;
199 va23x0123456789ABCDEF = vld2q_lane_u64((const void*) a3, va23x0123456789ABCDEF, 1); a3 += 16;
200
201 const int8x16_t va01x01234567 = vreinterpretq_s8_u64(va01x0123456789ABCDEF.val[0]);
202 const int8x16_t va01x89ABCDEF = vreinterpretq_s8_u64(va01x0123456789ABCDEF.val[1]);
203 const int8x16_t va23x01234567 = vreinterpretq_s8_u64(va23x0123456789ABCDEF.val[0]);
204 const int8x16_t va23x89ABCDEF = vreinterpretq_s8_u64(va23x0123456789ABCDEF.val[1]);
205 const int8x16_t va45x01234567 = vreinterpretq_s8_u64(va45x0123456789ABCDEF.val[0]);
206 const int8x16_t va45x89ABCDEF = vreinterpretq_s8_u64(va45x0123456789ABCDEF.val[1]);
207
208 // Load a 16x32 block of weights.
209 const int8x16_t vb01x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
210 const int8x16_t vb23x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
211 const int8x16_t vb45x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
212 const int8x16_t vb67x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
213 const int8x16_t vb89x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
214 const int8x16_t vbABx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
215 const int8x16_t vbCDx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
216 const int8x16_t vbEFx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
217 const int8x16_t vbGHx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
218 const int8x16_t vbIJx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
219 const int8x16_t vbKLx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
220 const int8x16_t vbMNx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
221 const int8x16_t vbOPx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
222 const int8x16_t vbQRx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
223 const int8x16_t vbSTx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
224 const int8x16_t vbUVx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
225 const int8x16_t vb01x01234567 = vshlq_n_s8(vb01x0123456789ABCDEF, 4);
226 const int8x16_t vb23x01234567 = vshlq_n_s8(vb23x0123456789ABCDEF, 4);
227 const int8x16_t vb45x01234567 = vshlq_n_s8(vb45x0123456789ABCDEF, 4);
228 const int8x16_t vb67x01234567 = vshlq_n_s8(vb67x0123456789ABCDEF, 4);
229 const int8x16_t vb89x01234567 = vshlq_n_s8(vb89x0123456789ABCDEF, 4);
230 const int8x16_t vbABx01234567 = vshlq_n_s8(vbABx0123456789ABCDEF, 4);
231 const int8x16_t vbCDx01234567 = vshlq_n_s8(vbCDx0123456789ABCDEF, 4);
232 const int8x16_t vbEFx01234567 = vshlq_n_s8(vbEFx0123456789ABCDEF, 4);
233 const int8x16_t vbGHx01234567 = vshlq_n_s8(vbGHx0123456789ABCDEF, 4);
234 const int8x16_t vbIJx01234567 = vshlq_n_s8(vbIJx0123456789ABCDEF, 4);
235 const int8x16_t vbKLx01234567 = vshlq_n_s8(vbKLx0123456789ABCDEF, 4);
236 const int8x16_t vbMNx01234567 = vshlq_n_s8(vbMNx0123456789ABCDEF, 4);
237 const int8x16_t vbOPx01234567 = vshlq_n_s8(vbOPx0123456789ABCDEF, 4);
238 const int8x16_t vbQRx01234567 = vshlq_n_s8(vbQRx0123456789ABCDEF, 4);
239 const int8x16_t vbSTx01234567 = vshlq_n_s8(vbSTx0123456789ABCDEF, 4);
240 const int8x16_t vbUVx01234567 = vshlq_n_s8(vbUVx0123456789ABCDEF, 4);
241 const int8x16_t vb01x89ABCDEF = vandq_s8(vb01x0123456789ABCDEF, vmask);
242 const int8x16_t vb23x89ABCDEF = vandq_s8(vb23x0123456789ABCDEF, vmask);
243 const int8x16_t vb45x89ABCDEF = vandq_s8(vb45x0123456789ABCDEF, vmask);
244 const int8x16_t vb67x89ABCDEF = vandq_s8(vb67x0123456789ABCDEF, vmask);
245 const int8x16_t vb89x89ABCDEF = vandq_s8(vb89x0123456789ABCDEF, vmask);
246 const int8x16_t vbABx89ABCDEF = vandq_s8(vbABx0123456789ABCDEF, vmask);
247 const int8x16_t vbCDx89ABCDEF = vandq_s8(vbCDx0123456789ABCDEF, vmask);
248 const int8x16_t vbEFx89ABCDEF = vandq_s8(vbEFx0123456789ABCDEF, vmask);
249 const int8x16_t vbGHx89ABCDEF = vandq_s8(vbGHx0123456789ABCDEF, vmask);
250 const int8x16_t vbIJx89ABCDEF = vandq_s8(vbIJx0123456789ABCDEF, vmask);
251 const int8x16_t vbKLx89ABCDEF = vandq_s8(vbKLx0123456789ABCDEF, vmask);
252 const int8x16_t vbMNx89ABCDEF = vandq_s8(vbMNx0123456789ABCDEF, vmask);
253 const int8x16_t vbOPx89ABCDEF = vandq_s8(vbOPx0123456789ABCDEF, vmask);
254 const int8x16_t vbQRx89ABCDEF = vandq_s8(vbQRx0123456789ABCDEF, vmask);
255 const int8x16_t vbSTx89ABCDEF = vandq_s8(vbSTx0123456789ABCDEF, vmask);
256 const int8x16_t vbUVx89ABCDEF = vandq_s8(vbUVx0123456789ABCDEF, vmask);
257
258 // Multiply-accumulate: 5x8 * 8x32 --> 5x32.
259 vacc01x01 = vmmlaq_s32(vacc01x01, va01x01234567, vb01x01234567);
260 vacc01x23 = vmmlaq_s32(vacc01x23, va01x01234567, vb23x01234567);
261 vacc01x45 = vmmlaq_s32(vacc01x45, va01x01234567, vb45x01234567);
262 vacc01x67 = vmmlaq_s32(vacc01x67, va01x01234567, vb67x01234567);
263 vacc01x89 = vmmlaq_s32(vacc01x89, va01x01234567, vb89x01234567);
264 vacc01xAB = vmmlaq_s32(vacc01xAB, va01x01234567, vbABx01234567);
265 vacc01xCD = vmmlaq_s32(vacc01xCD, va01x01234567, vbCDx01234567);
266 vacc01xEF = vmmlaq_s32(vacc01xEF, va01x01234567, vbEFx01234567);
267 vacc01xGH = vmmlaq_s32(vacc01xGH, va01x01234567, vbGHx01234567);
268 vacc01xIJ = vmmlaq_s32(vacc01xIJ, va01x01234567, vbIJx01234567);
269 vacc01xKL = vmmlaq_s32(vacc01xKL, va01x01234567, vbKLx01234567);
270 vacc01xMN = vmmlaq_s32(vacc01xMN, va01x01234567, vbMNx01234567);
271 vacc01xOP = vmmlaq_s32(vacc01xOP, va01x01234567, vbOPx01234567);
272 vacc01xQR = vmmlaq_s32(vacc01xQR, va01x01234567, vbQRx01234567);
273 vacc01xST = vmmlaq_s32(vacc01xST, va01x01234567, vbSTx01234567);
274 vacc01xUV = vmmlaq_s32(vacc01xUV, va01x01234567, vbUVx01234567);
275 vacc23x01 = vmmlaq_s32(vacc23x01, va23x01234567, vb01x01234567);
276 vacc23x23 = vmmlaq_s32(vacc23x23, va23x01234567, vb23x01234567);
277 vacc23x45 = vmmlaq_s32(vacc23x45, va23x01234567, vb45x01234567);
278 vacc23x67 = vmmlaq_s32(vacc23x67, va23x01234567, vb67x01234567);
279 vacc23x89 = vmmlaq_s32(vacc23x89, va23x01234567, vb89x01234567);
280 vacc23xAB = vmmlaq_s32(vacc23xAB, va23x01234567, vbABx01234567);
281 vacc23xCD = vmmlaq_s32(vacc23xCD, va23x01234567, vbCDx01234567);
282 vacc23xEF = vmmlaq_s32(vacc23xEF, va23x01234567, vbEFx01234567);
283 vacc23xGH = vmmlaq_s32(vacc23xGH, va23x01234567, vbGHx01234567);
284 vacc23xIJ = vmmlaq_s32(vacc23xIJ, va23x01234567, vbIJx01234567);
285 vacc23xKL = vmmlaq_s32(vacc23xKL, va23x01234567, vbKLx01234567);
286 vacc23xMN = vmmlaq_s32(vacc23xMN, va23x01234567, vbMNx01234567);
287 vacc23xOP = vmmlaq_s32(vacc23xOP, va23x01234567, vbOPx01234567);
288 vacc23xQR = vmmlaq_s32(vacc23xQR, va23x01234567, vbQRx01234567);
289 vacc23xST = vmmlaq_s32(vacc23xST, va23x01234567, vbSTx01234567);
290 vacc23xUV = vmmlaq_s32(vacc23xUV, va23x01234567, vbUVx01234567);
291 vacc45x01 = vmmlaq_s32(vacc45x01, va45x01234567, vb01x01234567);
292 vacc45x23 = vmmlaq_s32(vacc45x23, va45x01234567, vb23x01234567);
293 vacc45x45 = vmmlaq_s32(vacc45x45, va45x01234567, vb45x01234567);
294 vacc45x67 = vmmlaq_s32(vacc45x67, va45x01234567, vb67x01234567);
295 vacc45x89 = vmmlaq_s32(vacc45x89, va45x01234567, vb89x01234567);
296 vacc45xAB = vmmlaq_s32(vacc45xAB, va45x01234567, vbABx01234567);
297 vacc45xCD = vmmlaq_s32(vacc45xCD, va45x01234567, vbCDx01234567);
298 vacc45xEF = vmmlaq_s32(vacc45xEF, va45x01234567, vbEFx01234567);
299 vacc45xGH = vmmlaq_s32(vacc45xGH, va45x01234567, vbGHx01234567);
300 vacc45xIJ = vmmlaq_s32(vacc45xIJ, va45x01234567, vbIJx01234567);
301 vacc45xKL = vmmlaq_s32(vacc45xKL, va45x01234567, vbKLx01234567);
302 vacc45xMN = vmmlaq_s32(vacc45xMN, va45x01234567, vbMNx01234567);
303 vacc45xOP = vmmlaq_s32(vacc45xOP, va45x01234567, vbOPx01234567);
304 vacc45xQR = vmmlaq_s32(vacc45xQR, va45x01234567, vbQRx01234567);
305 vacc45xST = vmmlaq_s32(vacc45xST, va45x01234567, vbSTx01234567);
306 vacc45xUV = vmmlaq_s32(vacc45xUV, va45x01234567, vbUVx01234567);
307 vacc01x01 = vmmlaq_s32(vacc01x01, va01x89ABCDEF, vb01x89ABCDEF);
308 vacc01x23 = vmmlaq_s32(vacc01x23, va01x89ABCDEF, vb23x89ABCDEF);
309 vacc01x45 = vmmlaq_s32(vacc01x45, va01x89ABCDEF, vb45x89ABCDEF);
310 vacc01x67 = vmmlaq_s32(vacc01x67, va01x89ABCDEF, vb67x89ABCDEF);
311 vacc01x89 = vmmlaq_s32(vacc01x89, va01x89ABCDEF, vb89x89ABCDEF);
312 vacc01xAB = vmmlaq_s32(vacc01xAB, va01x89ABCDEF, vbABx89ABCDEF);
313 vacc01xCD = vmmlaq_s32(vacc01xCD, va01x89ABCDEF, vbCDx89ABCDEF);
314 vacc01xEF = vmmlaq_s32(vacc01xEF, va01x89ABCDEF, vbEFx89ABCDEF);
315 vacc01xGH = vmmlaq_s32(vacc01xGH, va01x89ABCDEF, vbGHx89ABCDEF);
316 vacc01xIJ = vmmlaq_s32(vacc01xIJ, va01x89ABCDEF, vbIJx89ABCDEF);
317 vacc01xKL = vmmlaq_s32(vacc01xKL, va01x89ABCDEF, vbKLx89ABCDEF);
318 vacc01xMN = vmmlaq_s32(vacc01xMN, va01x89ABCDEF, vbMNx89ABCDEF);
319 vacc01xOP = vmmlaq_s32(vacc01xOP, va01x89ABCDEF, vbOPx89ABCDEF);
320 vacc01xQR = vmmlaq_s32(vacc01xQR, va01x89ABCDEF, vbQRx89ABCDEF);
321 vacc01xST = vmmlaq_s32(vacc01xST, va01x89ABCDEF, vbSTx89ABCDEF);
322 vacc01xUV = vmmlaq_s32(vacc01xUV, va01x89ABCDEF, vbUVx89ABCDEF);
323 vacc23x01 = vmmlaq_s32(vacc23x01, va23x89ABCDEF, vb01x89ABCDEF);
324 vacc23x23 = vmmlaq_s32(vacc23x23, va23x89ABCDEF, vb23x89ABCDEF);
325 vacc23x45 = vmmlaq_s32(vacc23x45, va23x89ABCDEF, vb45x89ABCDEF);
326 vacc23x67 = vmmlaq_s32(vacc23x67, va23x89ABCDEF, vb67x89ABCDEF);
327 vacc23x89 = vmmlaq_s32(vacc23x89, va23x89ABCDEF, vb89x89ABCDEF);
328 vacc23xAB = vmmlaq_s32(vacc23xAB, va23x89ABCDEF, vbABx89ABCDEF);
329 vacc23xCD = vmmlaq_s32(vacc23xCD, va23x89ABCDEF, vbCDx89ABCDEF);
330 vacc23xEF = vmmlaq_s32(vacc23xEF, va23x89ABCDEF, vbEFx89ABCDEF);
331 vacc23xGH = vmmlaq_s32(vacc23xGH, va23x89ABCDEF, vbGHx89ABCDEF);
332 vacc23xIJ = vmmlaq_s32(vacc23xIJ, va23x89ABCDEF, vbIJx89ABCDEF);
333 vacc23xKL = vmmlaq_s32(vacc23xKL, va23x89ABCDEF, vbKLx89ABCDEF);
334 vacc23xMN = vmmlaq_s32(vacc23xMN, va23x89ABCDEF, vbMNx89ABCDEF);
335 vacc23xOP = vmmlaq_s32(vacc23xOP, va23x89ABCDEF, vbOPx89ABCDEF);
336 vacc23xQR = vmmlaq_s32(vacc23xQR, va23x89ABCDEF, vbQRx89ABCDEF);
337 vacc23xST = vmmlaq_s32(vacc23xST, va23x89ABCDEF, vbSTx89ABCDEF);
338 vacc23xUV = vmmlaq_s32(vacc23xUV, va23x89ABCDEF, vbUVx89ABCDEF);
339 vacc45x01 = vmmlaq_s32(vacc45x01, va45x89ABCDEF, vb01x89ABCDEF);
340 vacc45x23 = vmmlaq_s32(vacc45x23, va45x89ABCDEF, vb23x89ABCDEF);
341 vacc45x45 = vmmlaq_s32(vacc45x45, va45x89ABCDEF, vb45x89ABCDEF);
342 vacc45x67 = vmmlaq_s32(vacc45x67, va45x89ABCDEF, vb67x89ABCDEF);
343 vacc45x89 = vmmlaq_s32(vacc45x89, va45x89ABCDEF, vb89x89ABCDEF);
344 vacc45xAB = vmmlaq_s32(vacc45xAB, va45x89ABCDEF, vbABx89ABCDEF);
345 vacc45xCD = vmmlaq_s32(vacc45xCD, va45x89ABCDEF, vbCDx89ABCDEF);
346 vacc45xEF = vmmlaq_s32(vacc45xEF, va45x89ABCDEF, vbEFx89ABCDEF);
347 vacc45xGH = vmmlaq_s32(vacc45xGH, va45x89ABCDEF, vbGHx89ABCDEF);
348 vacc45xIJ = vmmlaq_s32(vacc45xIJ, va45x89ABCDEF, vbIJx89ABCDEF);
349 vacc45xKL = vmmlaq_s32(vacc45xKL, va45x89ABCDEF, vbKLx89ABCDEF);
350 vacc45xMN = vmmlaq_s32(vacc45xMN, va45x89ABCDEF, vbMNx89ABCDEF);
351 vacc45xOP = vmmlaq_s32(vacc45xOP, va45x89ABCDEF, vbOPx89ABCDEF);
352 vacc45xQR = vmmlaq_s32(vacc45xQR, va45x89ABCDEF, vbQRx89ABCDEF);
353 vacc45xST = vmmlaq_s32(vacc45xST, va45x89ABCDEF, vbSTx89ABCDEF);
354 vacc45xUV = vmmlaq_s32(vacc45xUV, va45x89ABCDEF, vbUVx89ABCDEF);
355
356 k -= 16 * sizeof(int8_t);
357 }
358 // Handle up to 8 final positions of `k`
359 if XNN_UNLIKELY(k != 0) {
360 // Load a 5x8 block of activations.
361 uint64x2_t va01x01234567 = vld1q_dup_u64((const void*) a0); a0 += 8;
362 uint64x2_t va23x01234567 = vld1q_dup_u64((const void*) a2); a2 += 8;
363 uint64x2_t va45x01234567 = vld1q_dup_u64((const void*) a4); a4 += 8;
364 va01x01234567 = vld1q_lane_u64((const void*) a1, va01x01234567, 1); a1 += 8;
365 va23x01234567 = vld1q_lane_u64((const void*) a3, va23x01234567, 1); a3 += 8;
366
367 // Load a 16x32 block of weights.
368 const int8x16_t vb01x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
369 const int8x16_t vb23x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
370 const int8x16_t vb45x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
371 const int8x16_t vb67x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
372 const int8x16_t vb89x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
373 const int8x16_t vbABx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
374 const int8x16_t vbCDx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
375 const int8x16_t vbEFx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
376 const int8x16_t vbGHx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
377 const int8x16_t vbIJx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
378 const int8x16_t vbKLx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
379 const int8x16_t vbMNx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
380 const int8x16_t vbOPx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
381 const int8x16_t vbQRx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
382 const int8x16_t vbSTx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
383 const int8x16_t vbUVx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
384 const int8x16_t vb01x01234567 = vshlq_n_s8(vb01x0123456789ABCDEF, 4);
385 const int8x16_t vb23x01234567 = vshlq_n_s8(vb23x0123456789ABCDEF, 4);
386 const int8x16_t vb45x01234567 = vshlq_n_s8(vb45x0123456789ABCDEF, 4);
387 const int8x16_t vb67x01234567 = vshlq_n_s8(vb67x0123456789ABCDEF, 4);
388 const int8x16_t vb89x01234567 = vshlq_n_s8(vb89x0123456789ABCDEF, 4);
389 const int8x16_t vbABx01234567 = vshlq_n_s8(vbABx0123456789ABCDEF, 4);
390 const int8x16_t vbCDx01234567 = vshlq_n_s8(vbCDx0123456789ABCDEF, 4);
391 const int8x16_t vbEFx01234567 = vshlq_n_s8(vbEFx0123456789ABCDEF, 4);
392 const int8x16_t vbGHx01234567 = vshlq_n_s8(vbGHx0123456789ABCDEF, 4);
393 const int8x16_t vbIJx01234567 = vshlq_n_s8(vbIJx0123456789ABCDEF, 4);
394 const int8x16_t vbKLx01234567 = vshlq_n_s8(vbKLx0123456789ABCDEF, 4);
395 const int8x16_t vbMNx01234567 = vshlq_n_s8(vbMNx0123456789ABCDEF, 4);
396 const int8x16_t vbOPx01234567 = vshlq_n_s8(vbOPx0123456789ABCDEF, 4);
397 const int8x16_t vbQRx01234567 = vshlq_n_s8(vbQRx0123456789ABCDEF, 4);
398 const int8x16_t vbSTx01234567 = vshlq_n_s8(vbSTx0123456789ABCDEF, 4);
399 const int8x16_t vbUVx01234567 = vshlq_n_s8(vbUVx0123456789ABCDEF, 4);
400
401 // Multiply-accumulate: 5x4 * 4x32 --> 5x32.
402 vacc01x01 = vmmlaq_s32(vacc01x01, vreinterpretq_s8_u64(va01x01234567), vb01x01234567);
403 vacc01x23 = vmmlaq_s32(vacc01x23, vreinterpretq_s8_u64(va01x01234567), vb23x01234567);
404 vacc01x45 = vmmlaq_s32(vacc01x45, vreinterpretq_s8_u64(va01x01234567), vb45x01234567);
405 vacc01x67 = vmmlaq_s32(vacc01x67, vreinterpretq_s8_u64(va01x01234567), vb67x01234567);
406 vacc01x89 = vmmlaq_s32(vacc01x89, vreinterpretq_s8_u64(va01x01234567), vb89x01234567);
407 vacc01xAB = vmmlaq_s32(vacc01xAB, vreinterpretq_s8_u64(va01x01234567), vbABx01234567);
408 vacc01xCD = vmmlaq_s32(vacc01xCD, vreinterpretq_s8_u64(va01x01234567), vbCDx01234567);
409 vacc01xEF = vmmlaq_s32(vacc01xEF, vreinterpretq_s8_u64(va01x01234567), vbEFx01234567);
410 vacc01xGH = vmmlaq_s32(vacc01xGH, vreinterpretq_s8_u64(va01x01234567), vbGHx01234567);
411 vacc01xIJ = vmmlaq_s32(vacc01xIJ, vreinterpretq_s8_u64(va01x01234567), vbIJx01234567);
412 vacc01xKL = vmmlaq_s32(vacc01xKL, vreinterpretq_s8_u64(va01x01234567), vbKLx01234567);
413 vacc01xMN = vmmlaq_s32(vacc01xMN, vreinterpretq_s8_u64(va01x01234567), vbMNx01234567);
414 vacc01xOP = vmmlaq_s32(vacc01xOP, vreinterpretq_s8_u64(va01x01234567), vbOPx01234567);
415 vacc01xQR = vmmlaq_s32(vacc01xQR, vreinterpretq_s8_u64(va01x01234567), vbQRx01234567);
416 vacc01xST = vmmlaq_s32(vacc01xST, vreinterpretq_s8_u64(va01x01234567), vbSTx01234567);
417 vacc01xUV = vmmlaq_s32(vacc01xUV, vreinterpretq_s8_u64(va01x01234567), vbUVx01234567);
418 vacc23x01 = vmmlaq_s32(vacc23x01, vreinterpretq_s8_u64(va23x01234567), vb01x01234567);
419 vacc23x23 = vmmlaq_s32(vacc23x23, vreinterpretq_s8_u64(va23x01234567), vb23x01234567);
420 vacc23x45 = vmmlaq_s32(vacc23x45, vreinterpretq_s8_u64(va23x01234567), vb45x01234567);
421 vacc23x67 = vmmlaq_s32(vacc23x67, vreinterpretq_s8_u64(va23x01234567), vb67x01234567);
422 vacc23x89 = vmmlaq_s32(vacc23x89, vreinterpretq_s8_u64(va23x01234567), vb89x01234567);
423 vacc23xAB = vmmlaq_s32(vacc23xAB, vreinterpretq_s8_u64(va23x01234567), vbABx01234567);
424 vacc23xCD = vmmlaq_s32(vacc23xCD, vreinterpretq_s8_u64(va23x01234567), vbCDx01234567);
425 vacc23xEF = vmmlaq_s32(vacc23xEF, vreinterpretq_s8_u64(va23x01234567), vbEFx01234567);
426 vacc23xGH = vmmlaq_s32(vacc23xGH, vreinterpretq_s8_u64(va23x01234567), vbGHx01234567);
427 vacc23xIJ = vmmlaq_s32(vacc23xIJ, vreinterpretq_s8_u64(va23x01234567), vbIJx01234567);
428 vacc23xKL = vmmlaq_s32(vacc23xKL, vreinterpretq_s8_u64(va23x01234567), vbKLx01234567);
429 vacc23xMN = vmmlaq_s32(vacc23xMN, vreinterpretq_s8_u64(va23x01234567), vbMNx01234567);
430 vacc23xOP = vmmlaq_s32(vacc23xOP, vreinterpretq_s8_u64(va23x01234567), vbOPx01234567);
431 vacc23xQR = vmmlaq_s32(vacc23xQR, vreinterpretq_s8_u64(va23x01234567), vbQRx01234567);
432 vacc23xST = vmmlaq_s32(vacc23xST, vreinterpretq_s8_u64(va23x01234567), vbSTx01234567);
433 vacc23xUV = vmmlaq_s32(vacc23xUV, vreinterpretq_s8_u64(va23x01234567), vbUVx01234567);
434 vacc45x01 = vmmlaq_s32(vacc45x01, vreinterpretq_s8_u64(va45x01234567), vb01x01234567);
435 vacc45x23 = vmmlaq_s32(vacc45x23, vreinterpretq_s8_u64(va45x01234567), vb23x01234567);
436 vacc45x45 = vmmlaq_s32(vacc45x45, vreinterpretq_s8_u64(va45x01234567), vb45x01234567);
437 vacc45x67 = vmmlaq_s32(vacc45x67, vreinterpretq_s8_u64(va45x01234567), vb67x01234567);
438 vacc45x89 = vmmlaq_s32(vacc45x89, vreinterpretq_s8_u64(va45x01234567), vb89x01234567);
439 vacc45xAB = vmmlaq_s32(vacc45xAB, vreinterpretq_s8_u64(va45x01234567), vbABx01234567);
440 vacc45xCD = vmmlaq_s32(vacc45xCD, vreinterpretq_s8_u64(va45x01234567), vbCDx01234567);
441 vacc45xEF = vmmlaq_s32(vacc45xEF, vreinterpretq_s8_u64(va45x01234567), vbEFx01234567);
442 vacc45xGH = vmmlaq_s32(vacc45xGH, vreinterpretq_s8_u64(va45x01234567), vbGHx01234567);
443 vacc45xIJ = vmmlaq_s32(vacc45xIJ, vreinterpretq_s8_u64(va45x01234567), vbIJx01234567);
444 vacc45xKL = vmmlaq_s32(vacc45xKL, vreinterpretq_s8_u64(va45x01234567), vbKLx01234567);
445 vacc45xMN = vmmlaq_s32(vacc45xMN, vreinterpretq_s8_u64(va45x01234567), vbMNx01234567);
446 vacc45xOP = vmmlaq_s32(vacc45xOP, vreinterpretq_s8_u64(va45x01234567), vbOPx01234567);
447 vacc45xQR = vmmlaq_s32(vacc45xQR, vreinterpretq_s8_u64(va45x01234567), vbQRx01234567);
448 vacc45xST = vmmlaq_s32(vacc45xST, vreinterpretq_s8_u64(va45x01234567), vbSTx01234567);
449 vacc45xUV = vmmlaq_s32(vacc45xUV, vreinterpretq_s8_u64(va45x01234567), vbUVx01234567);
450 }
451
452 int32x4_t vacc0x0123 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01x01), vreinterpretq_u64_s32(vacc01x23)));
453 int32x4_t vacc1x0123 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01x01), vreinterpretq_u64_s32(vacc01x23)));
454 int32x4_t vacc0x4567 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01x45), vreinterpretq_u64_s32(vacc01x67)));
455 int32x4_t vacc1x4567 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01x45), vreinterpretq_u64_s32(vacc01x67)));
456 int32x4_t vacc0x89AB = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01x89), vreinterpretq_u64_s32(vacc01xAB)));
457 int32x4_t vacc1x89AB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01x89), vreinterpretq_u64_s32(vacc01xAB)));
458 int32x4_t vacc0xCDEF = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01xCD), vreinterpretq_u64_s32(vacc01xEF)));
459 int32x4_t vacc1xCDEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01xCD), vreinterpretq_u64_s32(vacc01xEF)));
460 int32x4_t vacc0xGHIJ = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01xGH), vreinterpretq_u64_s32(vacc01xIJ)));
461 int32x4_t vacc1xGHIJ = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01xGH), vreinterpretq_u64_s32(vacc01xIJ)));
462 int32x4_t vacc0xKLMN = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01xKL), vreinterpretq_u64_s32(vacc01xMN)));
463 int32x4_t vacc1xKLMN = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01xKL), vreinterpretq_u64_s32(vacc01xMN)));
464 int32x4_t vacc0xOPQR = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01xOP), vreinterpretq_u64_s32(vacc01xQR)));
465 int32x4_t vacc1xOPQR = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01xOP), vreinterpretq_u64_s32(vacc01xQR)));
466 int32x4_t vacc0xSTUV = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01xST), vreinterpretq_u64_s32(vacc01xUV)));
467 int32x4_t vacc1xSTUV = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01xST), vreinterpretq_u64_s32(vacc01xUV)));
468 int32x4_t vacc2x0123 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23x01), vreinterpretq_u64_s32(vacc23x23)));
469 int32x4_t vacc3x0123 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23x01), vreinterpretq_u64_s32(vacc23x23)));
470 int32x4_t vacc2x4567 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23x45), vreinterpretq_u64_s32(vacc23x67)));
471 int32x4_t vacc3x4567 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23x45), vreinterpretq_u64_s32(vacc23x67)));
472 int32x4_t vacc2x89AB = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23x89), vreinterpretq_u64_s32(vacc23xAB)));
473 int32x4_t vacc3x89AB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23x89), vreinterpretq_u64_s32(vacc23xAB)));
474 int32x4_t vacc2xCDEF = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23xCD), vreinterpretq_u64_s32(vacc23xEF)));
475 int32x4_t vacc3xCDEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23xCD), vreinterpretq_u64_s32(vacc23xEF)));
476 int32x4_t vacc2xGHIJ = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23xGH), vreinterpretq_u64_s32(vacc23xIJ)));
477 int32x4_t vacc3xGHIJ = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23xGH), vreinterpretq_u64_s32(vacc23xIJ)));
478 int32x4_t vacc2xKLMN = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23xKL), vreinterpretq_u64_s32(vacc23xMN)));
479 int32x4_t vacc3xKLMN = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23xKL), vreinterpretq_u64_s32(vacc23xMN)));
480 int32x4_t vacc2xOPQR = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23xOP), vreinterpretq_u64_s32(vacc23xQR)));
481 int32x4_t vacc3xOPQR = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23xOP), vreinterpretq_u64_s32(vacc23xQR)));
482 int32x4_t vacc2xSTUV = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23xST), vreinterpretq_u64_s32(vacc23xUV)));
483 int32x4_t vacc3xSTUV = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23xST), vreinterpretq_u64_s32(vacc23xUV)));
484 int32x4_t vacc4x0123 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45x01), vreinterpretq_u64_s32(vacc45x23)));
485 int32x4_t vacc4x4567 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45x45), vreinterpretq_u64_s32(vacc45x67)));
486 int32x4_t vacc4x89AB = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45x89), vreinterpretq_u64_s32(vacc45xAB)));
487 int32x4_t vacc4xCDEF = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45xCD), vreinterpretq_u64_s32(vacc45xEF)));
488 int32x4_t vacc4xGHIJ = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45xGH), vreinterpretq_u64_s32(vacc45xIJ)));
489 int32x4_t vacc4xKLMN = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45xKL), vreinterpretq_u64_s32(vacc45xMN)));
490 int32x4_t vacc4xOPQR = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45xOP), vreinterpretq_u64_s32(vacc45xQR)));
491 int32x4_t vacc4xSTUV = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45xST), vreinterpretq_u64_s32(vacc45xUV)));
492 const float32x4_t vfilter_output_scale0123 = vreinterpretq_f32_u32(vshll_n_u16(vld1_u16(w), 16)); w = (const uint16_t*) w + 4;
493 const float32x4_t vfilter_output_scale4567 = vreinterpretq_f32_u32(vshll_n_u16(vld1_u16(w), 16)); w = (const uint16_t*) w + 4;
494 const float32x4_t vfilter_output_scale89AB = vreinterpretq_f32_u32(vshll_n_u16(vld1_u16(w), 16)); w = (const uint16_t*) w + 4;
495 const float32x4_t vfilter_output_scaleCDEF = vreinterpretq_f32_u32(vshll_n_u16(vld1_u16(w), 16)); w = (const uint16_t*) w + 4;
496 const float32x4_t vfilter_output_scaleGHIJ = vreinterpretq_f32_u32(vshll_n_u16(vld1_u16(w), 16)); w = (const uint16_t*) w + 4;
497 const float32x4_t vfilter_output_scaleKLMN = vreinterpretq_f32_u32(vshll_n_u16(vld1_u16(w), 16)); w = (const uint16_t*) w + 4;
498 const float32x4_t vfilter_output_scaleOPQR = vreinterpretq_f32_u32(vshll_n_u16(vld1_u16(w), 16)); w = (const uint16_t*) w + 4;
499 const float32x4_t vfilter_output_scaleSTUV = vreinterpretq_f32_u32(vshll_n_u16(vld1_u16(w), 16)); w = (const uint16_t*) w + 4;
500 float32x4_t vf0x0123 = vcvtq_f32_s32(vacc0x0123);
501 vout0x0123 = vfmaq_f32(vout0x0123, vf0x0123, vfilter_output_scale0123);
502 float32x4_t vf0x4567 = vcvtq_f32_s32(vacc0x4567);
503 vout0x4567 = vfmaq_f32(vout0x4567, vf0x4567, vfilter_output_scale4567);
504 float32x4_t vf0x89AB = vcvtq_f32_s32(vacc0x89AB);
505 vout0x89AB = vfmaq_f32(vout0x89AB, vf0x89AB, vfilter_output_scale89AB);
506 float32x4_t vf0xCDEF = vcvtq_f32_s32(vacc0xCDEF);
507 vout0xCDEF = vfmaq_f32(vout0xCDEF, vf0xCDEF, vfilter_output_scaleCDEF);
508 float32x4_t vf0xGHIJ = vcvtq_f32_s32(vacc0xGHIJ);
509 vout0xGHIJ = vfmaq_f32(vout0xGHIJ, vf0xGHIJ, vfilter_output_scaleGHIJ);
510 float32x4_t vf0xKLMN = vcvtq_f32_s32(vacc0xKLMN);
511 vout0xKLMN = vfmaq_f32(vout0xKLMN, vf0xKLMN, vfilter_output_scaleKLMN);
512 float32x4_t vf0xOPQR = vcvtq_f32_s32(vacc0xOPQR);
513 vout0xOPQR = vfmaq_f32(vout0xOPQR, vf0xOPQR, vfilter_output_scaleOPQR);
514 float32x4_t vf0xSTUV = vcvtq_f32_s32(vacc0xSTUV);
515 vout0xSTUV = vfmaq_f32(vout0xSTUV, vf0xSTUV, vfilter_output_scaleSTUV);
516 float32x4_t vf1x0123 = vcvtq_f32_s32(vacc1x0123);
517 vout1x0123 = vfmaq_f32(vout1x0123, vf1x0123, vfilter_output_scale0123);
518 float32x4_t vf1x4567 = vcvtq_f32_s32(vacc1x4567);
519 vout1x4567 = vfmaq_f32(vout1x4567, vf1x4567, vfilter_output_scale4567);
520 float32x4_t vf1x89AB = vcvtq_f32_s32(vacc1x89AB);
521 vout1x89AB = vfmaq_f32(vout1x89AB, vf1x89AB, vfilter_output_scale89AB);
522 float32x4_t vf1xCDEF = vcvtq_f32_s32(vacc1xCDEF);
523 vout1xCDEF = vfmaq_f32(vout1xCDEF, vf1xCDEF, vfilter_output_scaleCDEF);
524 float32x4_t vf1xGHIJ = vcvtq_f32_s32(vacc1xGHIJ);
525 vout1xGHIJ = vfmaq_f32(vout1xGHIJ, vf1xGHIJ, vfilter_output_scaleGHIJ);
526 float32x4_t vf1xKLMN = vcvtq_f32_s32(vacc1xKLMN);
527 vout1xKLMN = vfmaq_f32(vout1xKLMN, vf1xKLMN, vfilter_output_scaleKLMN);
528 float32x4_t vf1xOPQR = vcvtq_f32_s32(vacc1xOPQR);
529 vout1xOPQR = vfmaq_f32(vout1xOPQR, vf1xOPQR, vfilter_output_scaleOPQR);
530 float32x4_t vf1xSTUV = vcvtq_f32_s32(vacc1xSTUV);
531 vout1xSTUV = vfmaq_f32(vout1xSTUV, vf1xSTUV, vfilter_output_scaleSTUV);
532 float32x4_t vf2x0123 = vcvtq_f32_s32(vacc2x0123);
533 vout2x0123 = vfmaq_f32(vout2x0123, vf2x0123, vfilter_output_scale0123);
534 float32x4_t vf2x4567 = vcvtq_f32_s32(vacc2x4567);
535 vout2x4567 = vfmaq_f32(vout2x4567, vf2x4567, vfilter_output_scale4567);
536 float32x4_t vf2x89AB = vcvtq_f32_s32(vacc2x89AB);
537 vout2x89AB = vfmaq_f32(vout2x89AB, vf2x89AB, vfilter_output_scale89AB);
538 float32x4_t vf2xCDEF = vcvtq_f32_s32(vacc2xCDEF);
539 vout2xCDEF = vfmaq_f32(vout2xCDEF, vf2xCDEF, vfilter_output_scaleCDEF);
540 float32x4_t vf2xGHIJ = vcvtq_f32_s32(vacc2xGHIJ);
541 vout2xGHIJ = vfmaq_f32(vout2xGHIJ, vf2xGHIJ, vfilter_output_scaleGHIJ);
542 float32x4_t vf2xKLMN = vcvtq_f32_s32(vacc2xKLMN);
543 vout2xKLMN = vfmaq_f32(vout2xKLMN, vf2xKLMN, vfilter_output_scaleKLMN);
544 float32x4_t vf2xOPQR = vcvtq_f32_s32(vacc2xOPQR);
545 vout2xOPQR = vfmaq_f32(vout2xOPQR, vf2xOPQR, vfilter_output_scaleOPQR);
546 float32x4_t vf2xSTUV = vcvtq_f32_s32(vacc2xSTUV);
547 vout2xSTUV = vfmaq_f32(vout2xSTUV, vf2xSTUV, vfilter_output_scaleSTUV);
548 float32x4_t vf3x0123 = vcvtq_f32_s32(vacc3x0123);
549 vout3x0123 = vfmaq_f32(vout3x0123, vf3x0123, vfilter_output_scale0123);
550 float32x4_t vf3x4567 = vcvtq_f32_s32(vacc3x4567);
551 vout3x4567 = vfmaq_f32(vout3x4567, vf3x4567, vfilter_output_scale4567);
552 float32x4_t vf3x89AB = vcvtq_f32_s32(vacc3x89AB);
553 vout3x89AB = vfmaq_f32(vout3x89AB, vf3x89AB, vfilter_output_scale89AB);
554 float32x4_t vf3xCDEF = vcvtq_f32_s32(vacc3xCDEF);
555 vout3xCDEF = vfmaq_f32(vout3xCDEF, vf3xCDEF, vfilter_output_scaleCDEF);
556 float32x4_t vf3xGHIJ = vcvtq_f32_s32(vacc3xGHIJ);
557 vout3xGHIJ = vfmaq_f32(vout3xGHIJ, vf3xGHIJ, vfilter_output_scaleGHIJ);
558 float32x4_t vf3xKLMN = vcvtq_f32_s32(vacc3xKLMN);
559 vout3xKLMN = vfmaq_f32(vout3xKLMN, vf3xKLMN, vfilter_output_scaleKLMN);
560 float32x4_t vf3xOPQR = vcvtq_f32_s32(vacc3xOPQR);
561 vout3xOPQR = vfmaq_f32(vout3xOPQR, vf3xOPQR, vfilter_output_scaleOPQR);
562 float32x4_t vf3xSTUV = vcvtq_f32_s32(vacc3xSTUV);
563 vout3xSTUV = vfmaq_f32(vout3xSTUV, vf3xSTUV, vfilter_output_scaleSTUV);
564 float32x4_t vf4x0123 = vcvtq_f32_s32(vacc4x0123);
565 vout4x0123 = vfmaq_f32(vout4x0123, vf4x0123, vfilter_output_scale0123);
566 float32x4_t vf4x4567 = vcvtq_f32_s32(vacc4x4567);
567 vout4x4567 = vfmaq_f32(vout4x4567, vf4x4567, vfilter_output_scale4567);
568 float32x4_t vf4x89AB = vcvtq_f32_s32(vacc4x89AB);
569 vout4x89AB = vfmaq_f32(vout4x89AB, vf4x89AB, vfilter_output_scale89AB);
570 float32x4_t vf4xCDEF = vcvtq_f32_s32(vacc4xCDEF);
571 vout4xCDEF = vfmaq_f32(vout4xCDEF, vf4xCDEF, vfilter_output_scaleCDEF);
572 float32x4_t vf4xGHIJ = vcvtq_f32_s32(vacc4xGHIJ);
573 vout4xGHIJ = vfmaq_f32(vout4xGHIJ, vf4xGHIJ, vfilter_output_scaleGHIJ);
574 float32x4_t vf4xKLMN = vcvtq_f32_s32(vacc4xKLMN);
575 vout4xKLMN = vfmaq_f32(vout4xKLMN, vf4xKLMN, vfilter_output_scaleKLMN);
576 float32x4_t vf4xOPQR = vcvtq_f32_s32(vacc4xOPQR);
577 vout4xOPQR = vfmaq_f32(vout4xOPQR, vf4xOPQR, vfilter_output_scaleOPQR);
578 float32x4_t vf4xSTUV = vcvtq_f32_s32(vacc4xSTUV);
579 vout4xSTUV = vfmaq_f32(vout4xSTUV, vf4xSTUV, vfilter_output_scaleSTUV);
580 }
581
582 const float32x4_t vinput_scale01 = vreinterpretq_f32_s32(vld1q_s32(&quantization_params[0].zero_point));
583 vout0x0123 = vmulq_lane_f32(vout0x0123, vget_low_f32(vinput_scale01), 1);
584 vout1x0123 = vmulq_lane_f32(vout1x0123, vget_high_f32(vinput_scale01), 1);
585 vout0x4567 = vmulq_lane_f32(vout0x4567, vget_low_f32(vinput_scale01), 1);
586 vout1x4567 = vmulq_lane_f32(vout1x4567, vget_high_f32(vinput_scale01), 1);
587 vout0x89AB = vmulq_lane_f32(vout0x89AB, vget_low_f32(vinput_scale01), 1);
588 vout1x89AB = vmulq_lane_f32(vout1x89AB, vget_high_f32(vinput_scale01), 1);
589 vout0xCDEF = vmulq_lane_f32(vout0xCDEF, vget_low_f32(vinput_scale01), 1);
590 vout1xCDEF = vmulq_lane_f32(vout1xCDEF, vget_high_f32(vinput_scale01), 1);
591 vout0xGHIJ = vmulq_lane_f32(vout0xGHIJ, vget_low_f32(vinput_scale01), 1);
592 vout1xGHIJ = vmulq_lane_f32(vout1xGHIJ, vget_high_f32(vinput_scale01), 1);
593 vout0xKLMN = vmulq_lane_f32(vout0xKLMN, vget_low_f32(vinput_scale01), 1);
594 vout1xKLMN = vmulq_lane_f32(vout1xKLMN, vget_high_f32(vinput_scale01), 1);
595 vout0xOPQR = vmulq_lane_f32(vout0xOPQR, vget_low_f32(vinput_scale01), 1);
596 vout1xOPQR = vmulq_lane_f32(vout1xOPQR, vget_high_f32(vinput_scale01), 1);
597 vout0xSTUV = vmulq_lane_f32(vout0xSTUV, vget_low_f32(vinput_scale01), 1);
598 vout1xSTUV = vmulq_lane_f32(vout1xSTUV, vget_high_f32(vinput_scale01), 1);
599 const float32x4_t vinput_scale23 = vreinterpretq_f32_s32(vld1q_s32(&quantization_params[2].zero_point));
600 vout2x0123 = vmulq_lane_f32(vout2x0123, vget_low_f32(vinput_scale23), 1);
601 vout3x0123 = vmulq_lane_f32(vout3x0123, vget_high_f32(vinput_scale23), 1);
602 vout2x4567 = vmulq_lane_f32(vout2x4567, vget_low_f32(vinput_scale23), 1);
603 vout3x4567 = vmulq_lane_f32(vout3x4567, vget_high_f32(vinput_scale23), 1);
604 vout2x89AB = vmulq_lane_f32(vout2x89AB, vget_low_f32(vinput_scale23), 1);
605 vout3x89AB = vmulq_lane_f32(vout3x89AB, vget_high_f32(vinput_scale23), 1);
606 vout2xCDEF = vmulq_lane_f32(vout2xCDEF, vget_low_f32(vinput_scale23), 1);
607 vout3xCDEF = vmulq_lane_f32(vout3xCDEF, vget_high_f32(vinput_scale23), 1);
608 vout2xGHIJ = vmulq_lane_f32(vout2xGHIJ, vget_low_f32(vinput_scale23), 1);
609 vout3xGHIJ = vmulq_lane_f32(vout3xGHIJ, vget_high_f32(vinput_scale23), 1);
610 vout2xKLMN = vmulq_lane_f32(vout2xKLMN, vget_low_f32(vinput_scale23), 1);
611 vout3xKLMN = vmulq_lane_f32(vout3xKLMN, vget_high_f32(vinput_scale23), 1);
612 vout2xOPQR = vmulq_lane_f32(vout2xOPQR, vget_low_f32(vinput_scale23), 1);
613 vout3xOPQR = vmulq_lane_f32(vout3xOPQR, vget_high_f32(vinput_scale23), 1);
614 vout2xSTUV = vmulq_lane_f32(vout2xSTUV, vget_low_f32(vinput_scale23), 1);
615 vout3xSTUV = vmulq_lane_f32(vout3xSTUV, vget_high_f32(vinput_scale23), 1);
616 const float32x4_t vinput_scale4 = vld1q_dup_f32(&quantization_params[4].inv_scale);
617 vout4x0123 = vmulq_f32(vout4x0123, vinput_scale4);
618 vout4x4567 = vmulq_f32(vout4x4567, vinput_scale4);
619 vout4x89AB = vmulq_f32(vout4x89AB, vinput_scale4);
620 vout4xCDEF = vmulq_f32(vout4xCDEF, vinput_scale4);
621 vout4xGHIJ = vmulq_f32(vout4xGHIJ, vinput_scale4);
622 vout4xKLMN = vmulq_f32(vout4xKLMN, vinput_scale4);
623 vout4xOPQR = vmulq_f32(vout4xOPQR, vinput_scale4);
624 vout4xSTUV = vmulq_f32(vout4xSTUV, vinput_scale4);
625
626
627 const float32x4_t vbias0123 = vld1q_f32(w); w = (const float*) w + 4;
628 vout0x0123 = vaddq_f32(vbias0123, vout0x0123);
629 vout1x0123 = vaddq_f32(vbias0123, vout1x0123);
630 vout2x0123 = vaddq_f32(vbias0123, vout2x0123);
631 vout3x0123 = vaddq_f32(vbias0123, vout3x0123);
632 vout4x0123 = vaddq_f32(vbias0123, vout4x0123);
633 const float32x4_t vbias4567 = vld1q_f32(w); w = (const float*) w + 4;
634 vout0x4567 = vaddq_f32(vbias4567, vout0x4567);
635 vout1x4567 = vaddq_f32(vbias4567, vout1x4567);
636 vout2x4567 = vaddq_f32(vbias4567, vout2x4567);
637 vout3x4567 = vaddq_f32(vbias4567, vout3x4567);
638 vout4x4567 = vaddq_f32(vbias4567, vout4x4567);
639 const float32x4_t vbias89AB = vld1q_f32(w); w = (const float*) w + 4;
640 vout0x89AB = vaddq_f32(vbias89AB, vout0x89AB);
641 vout1x89AB = vaddq_f32(vbias89AB, vout1x89AB);
642 vout2x89AB = vaddq_f32(vbias89AB, vout2x89AB);
643 vout3x89AB = vaddq_f32(vbias89AB, vout3x89AB);
644 vout4x89AB = vaddq_f32(vbias89AB, vout4x89AB);
645 const float32x4_t vbiasCDEF = vld1q_f32(w); w = (const float*) w + 4;
646 vout0xCDEF = vaddq_f32(vbiasCDEF, vout0xCDEF);
647 vout1xCDEF = vaddq_f32(vbiasCDEF, vout1xCDEF);
648 vout2xCDEF = vaddq_f32(vbiasCDEF, vout2xCDEF);
649 vout3xCDEF = vaddq_f32(vbiasCDEF, vout3xCDEF);
650 vout4xCDEF = vaddq_f32(vbiasCDEF, vout4xCDEF);
651 const float32x4_t vbiasGHIJ = vld1q_f32(w); w = (const float*) w + 4;
652 vout0xGHIJ = vaddq_f32(vbiasGHIJ, vout0xGHIJ);
653 vout1xGHIJ = vaddq_f32(vbiasGHIJ, vout1xGHIJ);
654 vout2xGHIJ = vaddq_f32(vbiasGHIJ, vout2xGHIJ);
655 vout3xGHIJ = vaddq_f32(vbiasGHIJ, vout3xGHIJ);
656 vout4xGHIJ = vaddq_f32(vbiasGHIJ, vout4xGHIJ);
657 const float32x4_t vbiasKLMN = vld1q_f32(w); w = (const float*) w + 4;
658 vout0xKLMN = vaddq_f32(vbiasKLMN, vout0xKLMN);
659 vout1xKLMN = vaddq_f32(vbiasKLMN, vout1xKLMN);
660 vout2xKLMN = vaddq_f32(vbiasKLMN, vout2xKLMN);
661 vout3xKLMN = vaddq_f32(vbiasKLMN, vout3xKLMN);
662 vout4xKLMN = vaddq_f32(vbiasKLMN, vout4xKLMN);
663 const float32x4_t vbiasOPQR = vld1q_f32(w); w = (const float*) w + 4;
664 vout0xOPQR = vaddq_f32(vbiasOPQR, vout0xOPQR);
665 vout1xOPQR = vaddq_f32(vbiasOPQR, vout1xOPQR);
666 vout2xOPQR = vaddq_f32(vbiasOPQR, vout2xOPQR);
667 vout3xOPQR = vaddq_f32(vbiasOPQR, vout3xOPQR);
668 vout4xOPQR = vaddq_f32(vbiasOPQR, vout4xOPQR);
669 const float32x4_t vbiasSTUV = vld1q_f32(w); w = (const float*) w + 4;
670 vout0xSTUV = vaddq_f32(vbiasSTUV, vout0xSTUV);
671 vout1xSTUV = vaddq_f32(vbiasSTUV, vout1xSTUV);
672 vout2xSTUV = vaddq_f32(vbiasSTUV, vout2xSTUV);
673 vout3xSTUV = vaddq_f32(vbiasSTUV, vout3xSTUV);
674 vout4xSTUV = vaddq_f32(vbiasSTUV, vout4xSTUV);
675
676 const float32x4_t voutput_min = vld1q_dup_f32(&params->scalar.min);
677 vout0x0123 = vmaxq_f32(vout0x0123, voutput_min);
678 vout0x4567 = vmaxq_f32(vout0x4567, voutput_min);
679 vout0x89AB = vmaxq_f32(vout0x89AB, voutput_min);
680 vout0xCDEF = vmaxq_f32(vout0xCDEF, voutput_min);
681 vout0xGHIJ = vmaxq_f32(vout0xGHIJ, voutput_min);
682 vout0xKLMN = vmaxq_f32(vout0xKLMN, voutput_min);
683 vout0xOPQR = vmaxq_f32(vout0xOPQR, voutput_min);
684 vout0xSTUV = vmaxq_f32(vout0xSTUV, voutput_min);
685 vout1x0123 = vmaxq_f32(vout1x0123, voutput_min);
686 vout1x4567 = vmaxq_f32(vout1x4567, voutput_min);
687 vout1x89AB = vmaxq_f32(vout1x89AB, voutput_min);
688 vout1xCDEF = vmaxq_f32(vout1xCDEF, voutput_min);
689 vout1xGHIJ = vmaxq_f32(vout1xGHIJ, voutput_min);
690 vout1xKLMN = vmaxq_f32(vout1xKLMN, voutput_min);
691 vout1xOPQR = vmaxq_f32(vout1xOPQR, voutput_min);
692 vout1xSTUV = vmaxq_f32(vout1xSTUV, voutput_min);
693 vout2x0123 = vmaxq_f32(vout2x0123, voutput_min);
694 vout2x4567 = vmaxq_f32(vout2x4567, voutput_min);
695 vout2x89AB = vmaxq_f32(vout2x89AB, voutput_min);
696 vout2xCDEF = vmaxq_f32(vout2xCDEF, voutput_min);
697 vout2xGHIJ = vmaxq_f32(vout2xGHIJ, voutput_min);
698 vout2xKLMN = vmaxq_f32(vout2xKLMN, voutput_min);
699 vout2xOPQR = vmaxq_f32(vout2xOPQR, voutput_min);
700 vout2xSTUV = vmaxq_f32(vout2xSTUV, voutput_min);
701 vout3x0123 = vmaxq_f32(vout3x0123, voutput_min);
702 vout3x4567 = vmaxq_f32(vout3x4567, voutput_min);
703 vout3x89AB = vmaxq_f32(vout3x89AB, voutput_min);
704 vout3xCDEF = vmaxq_f32(vout3xCDEF, voutput_min);
705 vout3xGHIJ = vmaxq_f32(vout3xGHIJ, voutput_min);
706 vout3xKLMN = vmaxq_f32(vout3xKLMN, voutput_min);
707 vout3xOPQR = vmaxq_f32(vout3xOPQR, voutput_min);
708 vout3xSTUV = vmaxq_f32(vout3xSTUV, voutput_min);
709 vout4x0123 = vmaxq_f32(vout4x0123, voutput_min);
710 vout4x4567 = vmaxq_f32(vout4x4567, voutput_min);
711 vout4x89AB = vmaxq_f32(vout4x89AB, voutput_min);
712 vout4xCDEF = vmaxq_f32(vout4xCDEF, voutput_min);
713 vout4xGHIJ = vmaxq_f32(vout4xGHIJ, voutput_min);
714 vout4xKLMN = vmaxq_f32(vout4xKLMN, voutput_min);
715 vout4xOPQR = vmaxq_f32(vout4xOPQR, voutput_min);
716 vout4xSTUV = vmaxq_f32(vout4xSTUV, voutput_min);
717
718 const float32x4_t voutput_max = vld1q_dup_f32(&params->scalar.max);
719 vout0x0123 = vminq_f32(vout0x0123, voutput_max);
720 vout0x4567 = vminq_f32(vout0x4567, voutput_max);
721 vout0x89AB = vminq_f32(vout0x89AB, voutput_max);
722 vout0xCDEF = vminq_f32(vout0xCDEF, voutput_max);
723 vout0xGHIJ = vminq_f32(vout0xGHIJ, voutput_max);
724 vout0xKLMN = vminq_f32(vout0xKLMN, voutput_max);
725 vout0xOPQR = vminq_f32(vout0xOPQR, voutput_max);
726 vout0xSTUV = vminq_f32(vout0xSTUV, voutput_max);
727 vout1x0123 = vminq_f32(vout1x0123, voutput_max);
728 vout1x4567 = vminq_f32(vout1x4567, voutput_max);
729 vout1x89AB = vminq_f32(vout1x89AB, voutput_max);
730 vout1xCDEF = vminq_f32(vout1xCDEF, voutput_max);
731 vout1xGHIJ = vminq_f32(vout1xGHIJ, voutput_max);
732 vout1xKLMN = vminq_f32(vout1xKLMN, voutput_max);
733 vout1xOPQR = vminq_f32(vout1xOPQR, voutput_max);
734 vout1xSTUV = vminq_f32(vout1xSTUV, voutput_max);
735 vout2x0123 = vminq_f32(vout2x0123, voutput_max);
736 vout2x4567 = vminq_f32(vout2x4567, voutput_max);
737 vout2x89AB = vminq_f32(vout2x89AB, voutput_max);
738 vout2xCDEF = vminq_f32(vout2xCDEF, voutput_max);
739 vout2xGHIJ = vminq_f32(vout2xGHIJ, voutput_max);
740 vout2xKLMN = vminq_f32(vout2xKLMN, voutput_max);
741 vout2xOPQR = vminq_f32(vout2xOPQR, voutput_max);
742 vout2xSTUV = vminq_f32(vout2xSTUV, voutput_max);
743 vout3x0123 = vminq_f32(vout3x0123, voutput_max);
744 vout3x4567 = vminq_f32(vout3x4567, voutput_max);
745 vout3x89AB = vminq_f32(vout3x89AB, voutput_max);
746 vout3xCDEF = vminq_f32(vout3xCDEF, voutput_max);
747 vout3xGHIJ = vminq_f32(vout3xGHIJ, voutput_max);
748 vout3xKLMN = vminq_f32(vout3xKLMN, voutput_max);
749 vout3xOPQR = vminq_f32(vout3xOPQR, voutput_max);
750 vout3xSTUV = vminq_f32(vout3xSTUV, voutput_max);
751 vout4x0123 = vminq_f32(vout4x0123, voutput_max);
752 vout4x4567 = vminq_f32(vout4x4567, voutput_max);
753 vout4x89AB = vminq_f32(vout4x89AB, voutput_max);
754 vout4xCDEF = vminq_f32(vout4xCDEF, voutput_max);
755 vout4xGHIJ = vminq_f32(vout4xGHIJ, voutput_max);
756 vout4xKLMN = vminq_f32(vout4xKLMN, voutput_max);
757 vout4xOPQR = vminq_f32(vout4xOPQR, voutput_max);
758 vout4xSTUV = vminq_f32(vout4xSTUV, voutput_max);
759
760 if XNN_LIKELY(nc >= 32) {
761 vst1q_f32(c0, vout0x0123);
762 vst1q_f32(c0 + 4, vout0x4567);
763 vst1q_f32(c0 + 8, vout0x89AB);
764 vst1q_f32(c0 + 12, vout0xCDEF);
765 vst1q_f32(c0 + 16, vout0xGHIJ);
766 vst1q_f32(c0 + 20, vout0xKLMN);
767 vst1q_f32(c0 + 24, vout0xOPQR);
768 vst1q_f32(c0 + 28, vout0xSTUV);
769 vst1q_f32(c1, vout1x0123);
770 vst1q_f32(c1 + 4, vout1x4567);
771 vst1q_f32(c1 + 8, vout1x89AB);
772 vst1q_f32(c1 + 12, vout1xCDEF);
773 vst1q_f32(c1 + 16, vout1xGHIJ);
774 vst1q_f32(c1 + 20, vout1xKLMN);
775 vst1q_f32(c1 + 24, vout1xOPQR);
776 vst1q_f32(c1 + 28, vout1xSTUV);
777 vst1q_f32(c2, vout2x0123);
778 vst1q_f32(c2 + 4, vout2x4567);
779 vst1q_f32(c2 + 8, vout2x89AB);
780 vst1q_f32(c2 + 12, vout2xCDEF);
781 vst1q_f32(c2 + 16, vout2xGHIJ);
782 vst1q_f32(c2 + 20, vout2xKLMN);
783 vst1q_f32(c2 + 24, vout2xOPQR);
784 vst1q_f32(c2 + 28, vout2xSTUV);
785 vst1q_f32(c3, vout3x0123);
786 vst1q_f32(c3 + 4, vout3x4567);
787 vst1q_f32(c3 + 8, vout3x89AB);
788 vst1q_f32(c3 + 12, vout3xCDEF);
789 vst1q_f32(c3 + 16, vout3xGHIJ);
790 vst1q_f32(c3 + 20, vout3xKLMN);
791 vst1q_f32(c3 + 24, vout3xOPQR);
792 vst1q_f32(c3 + 28, vout3xSTUV);
793 vst1q_f32(c4, vout4x0123);
794 vst1q_f32(c4 + 4, vout4x4567);
795 vst1q_f32(c4 + 8, vout4x89AB);
796 vst1q_f32(c4 + 12, vout4xCDEF);
797 vst1q_f32(c4 + 16, vout4xGHIJ);
798 vst1q_f32(c4 + 20, vout4xKLMN);
799 vst1q_f32(c4 + 24, vout4xOPQR);
800 vst1q_f32(c4 + 28, vout4xSTUV);
801
802 a0 = (const int8_t*) ((uintptr_t) a0 - kc);
803 a1 = (const int8_t*) ((uintptr_t) a1 - kc);
804 a2 = (const int8_t*) ((uintptr_t) a2 - kc);
805 a3 = (const int8_t*) ((uintptr_t) a3 - kc);
806 a4 = (const int8_t*) ((uintptr_t) a4 - kc);
807
808 c0 = (float*) ((uintptr_t) c0 + cn_stride);
809 c1 = (float*) ((uintptr_t) c1 + cn_stride);
810 c2 = (float*) ((uintptr_t) c2 + cn_stride);
811 c3 = (float*) ((uintptr_t) c3 + cn_stride);
812 c4 = (float*) ((uintptr_t) c4 + cn_stride);
813
814 nc -= 32;
815 } else {
816 if (nc & 16) {
817 vst1q_f32(c0, vout0x0123); c0 += 4;
818 vout0x0123 = vout0xGHIJ;
819 vst1q_f32(c1, vout1x0123); c1 += 4;
820 vout1x0123 = vout1xGHIJ;
821 vst1q_f32(c2, vout2x0123); c2 += 4;
822 vout2x0123 = vout2xGHIJ;
823 vst1q_f32(c3, vout3x0123); c3 += 4;
824 vout3x0123 = vout3xGHIJ;
825 vst1q_f32(c4, vout4x0123); c4 += 4;
826 vout4x0123 = vout4xGHIJ;
827 vst1q_f32(c0, vout0x4567); c0 += 4;
828 vout0x4567 = vout0xKLMN;
829 vst1q_f32(c1, vout1x4567); c1 += 4;
830 vout1x4567 = vout1xKLMN;
831 vst1q_f32(c2, vout2x4567); c2 += 4;
832 vout2x4567 = vout2xKLMN;
833 vst1q_f32(c3, vout3x4567); c3 += 4;
834 vout3x4567 = vout3xKLMN;
835 vst1q_f32(c4, vout4x4567); c4 += 4;
836 vout4x4567 = vout4xKLMN;
837 vst1q_f32(c0, vout0x89AB); c0 += 4;
838 vout0x89AB = vout0xOPQR;
839 vst1q_f32(c1, vout1x89AB); c1 += 4;
840 vout1x89AB = vout1xOPQR;
841 vst1q_f32(c2, vout2x89AB); c2 += 4;
842 vout2x89AB = vout2xOPQR;
843 vst1q_f32(c3, vout3x89AB); c3 += 4;
844 vout3x89AB = vout3xOPQR;
845 vst1q_f32(c4, vout4x89AB); c4 += 4;
846 vout4x89AB = vout4xOPQR;
847 vst1q_f32(c0, vout0xCDEF); c0 += 4;
848 vout0xCDEF = vout0xSTUV;
849 vst1q_f32(c1, vout1xCDEF); c1 += 4;
850 vout1xCDEF = vout1xSTUV;
851 vst1q_f32(c2, vout2xCDEF); c2 += 4;
852 vout2xCDEF = vout2xSTUV;
853 vst1q_f32(c3, vout3xCDEF); c3 += 4;
854 vout3xCDEF = vout3xSTUV;
855 vst1q_f32(c4, vout4xCDEF); c4 += 4;
856 vout4xCDEF = vout4xSTUV;
857 }
858 if (nc & 8) {
859 vst1q_f32(c0, vout0x0123); c0 += 4;
860 vout0x0123 = vout0x89AB;
861 vst1q_f32(c1, vout1x0123); c1 += 4;
862 vout1x0123 = vout1x89AB;
863 vst1q_f32(c2, vout2x0123); c2 += 4;
864 vout2x0123 = vout2x89AB;
865 vst1q_f32(c3, vout3x0123); c3 += 4;
866 vout3x0123 = vout3x89AB;
867 vst1q_f32(c4, vout4x0123); c4 += 4;
868 vout4x0123 = vout4x89AB;
869 vst1q_f32(c0, vout0x4567); c0 += 4;
870 vout0x4567 = vout0xCDEF;
871 vst1q_f32(c1, vout1x4567); c1 += 4;
872 vout1x4567 = vout1xCDEF;
873 vst1q_f32(c2, vout2x4567); c2 += 4;
874 vout2x4567 = vout2xCDEF;
875 vst1q_f32(c3, vout3x4567); c3 += 4;
876 vout3x4567 = vout3xCDEF;
877 vst1q_f32(c4, vout4x4567); c4 += 4;
878 vout4x4567 = vout4xCDEF;
879 }
880 if (nc & 4) {
881 vst1q_f32(c0, vout0x0123); c0 += 4;
882 vout0x0123 = vout0x4567;
883 vst1q_f32(c1, vout1x0123); c1 += 4;
884 vout1x0123 = vout1x4567;
885 vst1q_f32(c2, vout2x0123); c2 += 4;
886 vout2x0123 = vout2x4567;
887 vst1q_f32(c3, vout3x0123); c3 += 4;
888 vout3x0123 = vout3x4567;
889 vst1q_f32(c4, vout4x0123); c4 += 4;
890 vout4x0123 = vout4x4567;
891 }
892 float32x2_t vout0x01 = vget_low_f32(vout0x0123);
893 float32x2_t vout1x01 = vget_low_f32(vout1x0123);
894 float32x2_t vout2x01 = vget_low_f32(vout2x0123);
895 float32x2_t vout3x01 = vget_low_f32(vout3x0123);
896 float32x2_t vout4x01 = vget_low_f32(vout4x0123);
897 if (nc & 2) {
898 vst1_f32(c0, vout0x01); c0 += 2;
899 vst1_f32(c1, vout1x01); c1 += 2;
900 vst1_f32(c2, vout2x01); c2 += 2;
901 vst1_f32(c3, vout3x01); c3 += 2;
902 vst1_f32(c4, vout4x01); c4 += 2;
903 vout0x01 = vget_high_f32(vout0x0123);
904 vout1x01 = vget_high_f32(vout1x0123);
905 vout2x01 = vget_high_f32(vout2x0123);
906 vout3x01 = vget_high_f32(vout3x0123);
907 vout4x01 = vget_high_f32(vout4x0123);
908 }
909 if (nc & 1) {
910 vst1_lane_f32(c0, vout0x01, 0);
911 vst1_lane_f32(c1, vout1x01, 0);
912 vst1_lane_f32(c2, vout2x01, 0);
913 vst1_lane_f32(c3, vout3x01, 0);
914 vst1_lane_f32(c4, vout4x01, 0);
915 }
916 nc = 0;
917 }
918 } while (nc != 0);
919 }