Debian Codegraph @

src/qd8-f32-qb4w-gemm/gen/qd8-f32-qb4w-gemm-3x32c8-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_3x32c8__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 <= 3);
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 int8x16_t vmask = vmovq_n_s8(INT8_C(0xF0));
60
61 // Loop over groups of 32 columns.
62 do {
63 // Initialize accumulators with scaled vksum. 32 scaled vksum values are loaded from the
64 // weight matrix, at the start of the group of 32 columns.
65 const float32x4_t vinput_zero_point01 = vcvtq_f32_s32(vld1q_s32(&quantization_params[0].zero_point));
66 const float32x4_t vksum0123 = vld1q_f32(w); w = (const float*) w + 4;
67 float32x4_t vout0x0123 = vmulq_lane_f32(vksum0123, vget_low_f32(vinput_zero_point01), 0);
68 float32x4_t vout1x0123 = vmulq_lane_f32(vksum0123, vget_high_f32(vinput_zero_point01), 0);
69 const float32x4_t vksum4567 = vld1q_f32(w); w = (const float*) w + 4;
70 float32x4_t vout0x4567 = vmulq_lane_f32(vksum4567, vget_low_f32(vinput_zero_point01), 0);
71 float32x4_t vout1x4567 = vmulq_lane_f32(vksum4567, vget_high_f32(vinput_zero_point01), 0);
72 const float32x4_t vksum89AB = vld1q_f32(w); w = (const float*) w + 4;
73 float32x4_t vout0x89AB = vmulq_lane_f32(vksum89AB, vget_low_f32(vinput_zero_point01), 0);
74 float32x4_t vout1x89AB = vmulq_lane_f32(vksum89AB, vget_high_f32(vinput_zero_point01), 0);
75 const float32x4_t vksumCDEF = vld1q_f32(w); w = (const float*) w + 4;
76 float32x4_t vout0xCDEF = vmulq_lane_f32(vksumCDEF, vget_low_f32(vinput_zero_point01), 0);
77 float32x4_t vout1xCDEF = vmulq_lane_f32(vksumCDEF, vget_high_f32(vinput_zero_point01), 0);
78 const float32x4_t vksumGHIJ = vld1q_f32(w); w = (const float*) w + 4;
79 float32x4_t vout0xGHIJ = vmulq_lane_f32(vksumGHIJ, vget_low_f32(vinput_zero_point01), 0);
80 float32x4_t vout1xGHIJ = vmulq_lane_f32(vksumGHIJ, vget_high_f32(vinput_zero_point01), 0);
81 const float32x4_t vksumKLMN = vld1q_f32(w); w = (const float*) w + 4;
82 float32x4_t vout0xKLMN = vmulq_lane_f32(vksumKLMN, vget_low_f32(vinput_zero_point01), 0);
83 float32x4_t vout1xKLMN = vmulq_lane_f32(vksumKLMN, vget_high_f32(vinput_zero_point01), 0);
84 const float32x4_t vksumOPQR = vld1q_f32(w); w = (const float*) w + 4;
85 float32x4_t vout0xOPQR = vmulq_lane_f32(vksumOPQR, vget_low_f32(vinput_zero_point01), 0);
86 float32x4_t vout1xOPQR = vmulq_lane_f32(vksumOPQR, vget_high_f32(vinput_zero_point01), 0);
87 const float32x4_t vksumSTUV = vld1q_f32(w); w = (const float*) w + 4;
88 float32x4_t vout0xSTUV = vmulq_lane_f32(vksumSTUV, vget_low_f32(vinput_zero_point01), 0);
89 float32x4_t vout1xSTUV = vmulq_lane_f32(vksumSTUV, vget_high_f32(vinput_zero_point01), 0);
90 const float32x4_t vinput_zero_point23 = vcvtq_f32_s32(vld1q_dup_s32(&quantization_params[2].zero_point));
91 float32x4_t vout2x0123 = vmulq_f32(vksum0123, vinput_zero_point23);
92 float32x4_t vout2x4567 = vmulq_f32(vksum4567, vinput_zero_point23);
93 float32x4_t vout2x89AB = vmulq_f32(vksum89AB, vinput_zero_point23);
94 float32x4_t vout2xCDEF = vmulq_f32(vksumCDEF, vinput_zero_point23);
95 float32x4_t vout2xGHIJ = vmulq_f32(vksumGHIJ, vinput_zero_point23);
96 float32x4_t vout2xKLMN = vmulq_f32(vksumKLMN, vinput_zero_point23);
97 float32x4_t vout2xOPQR = vmulq_f32(vksumOPQR, vinput_zero_point23);
98 float32x4_t vout2xSTUV = vmulq_f32(vksumSTUV, vinput_zero_point23);
99
100
101 for (size_t kb=0; kb < kc; kb += bl) {
102 int32x4_t vacc01x01 = vdupq_n_s32(0);
103 int32x4_t vacc01x23 = vdupq_n_s32(0);
104 int32x4_t vacc01x45 = vdupq_n_s32(0);
105 int32x4_t vacc01x67 = vdupq_n_s32(0);
106 int32x4_t vacc01x89 = vdupq_n_s32(0);
107 int32x4_t vacc01xAB = vdupq_n_s32(0);
108 int32x4_t vacc01xCD = vdupq_n_s32(0);
109 int32x4_t vacc01xEF = vdupq_n_s32(0);
110 int32x4_t vacc01xGH = vdupq_n_s32(0);
111 int32x4_t vacc01xIJ = vdupq_n_s32(0);
112 int32x4_t vacc01xKL = vdupq_n_s32(0);
113 int32x4_t vacc01xMN = vdupq_n_s32(0);
114 int32x4_t vacc01xOP = vdupq_n_s32(0);
115 int32x4_t vacc01xQR = vdupq_n_s32(0);
116 int32x4_t vacc01xST = vdupq_n_s32(0);
117 int32x4_t vacc01xUV = vdupq_n_s32(0);
118 int32x4_t vacc23x01 = vdupq_n_s32(0);
119 int32x4_t vacc23x23 = vdupq_n_s32(0);
120 int32x4_t vacc23x45 = vdupq_n_s32(0);
121 int32x4_t vacc23x67 = vdupq_n_s32(0);
122 int32x4_t vacc23x89 = vdupq_n_s32(0);
123 int32x4_t vacc23xAB = vdupq_n_s32(0);
124 int32x4_t vacc23xCD = vdupq_n_s32(0);
125 int32x4_t vacc23xEF = vdupq_n_s32(0);
126 int32x4_t vacc23xGH = vdupq_n_s32(0);
127 int32x4_t vacc23xIJ = vdupq_n_s32(0);
128 int32x4_t vacc23xKL = vdupq_n_s32(0);
129 int32x4_t vacc23xMN = vdupq_n_s32(0);
130 int32x4_t vacc23xOP = vdupq_n_s32(0);
131 int32x4_t vacc23xQR = vdupq_n_s32(0);
132 int32x4_t vacc23xST = vdupq_n_s32(0);
133 int32x4_t vacc23xUV = vdupq_n_s32(0);
134
135 size_t k = bl;
136 // 2x partial unrolled loop to load 8 bytes at a time.
137
138 uint64x2x2_t va01x0123456789ABCDEF;
139 va01x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
140 va01x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
141 uint64x2x2_t va23x0123456789ABCDEF;
142 va23x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
143 va23x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
144
145 while (k >= 16 * sizeof(int8_t)) {
146 // Load a 3x16 block of activations.
147 va01x0123456789ABCDEF = vld2q_lane_u64((const void*) a0, va01x0123456789ABCDEF, 0); a0 += 16;
148 va23x0123456789ABCDEF = vld2q_lane_u64((const void*) a2, va23x0123456789ABCDEF, 0); a2 += 16;
149 va01x0123456789ABCDEF = vld2q_lane_u64((const void*) a1, va01x0123456789ABCDEF, 1); a1 += 16;
150
151 const int8x16_t va01x01234567 = vreinterpretq_s8_u64(va01x0123456789ABCDEF.val[0]);
152 const int8x16_t va01x89ABCDEF = vreinterpretq_s8_u64(va01x0123456789ABCDEF.val[1]);
153 const int8x16_t va23x01234567 = vreinterpretq_s8_u64(va23x0123456789ABCDEF.val[0]);
154 const int8x16_t va23x89ABCDEF = vreinterpretq_s8_u64(va23x0123456789ABCDEF.val[1]);
155
156 // Load a 16x32 block of weights.
157 const int8x16_t vb01x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
158 const int8x16_t vb23x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
159 const int8x16_t vb45x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
160 const int8x16_t vb67x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
161 const int8x16_t vb89x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
162 const int8x16_t vbABx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
163 const int8x16_t vbCDx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
164 const int8x16_t vbEFx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
165 const int8x16_t vbGHx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
166 const int8x16_t vbIJx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
167 const int8x16_t vbKLx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
168 const int8x16_t vbMNx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
169 const int8x16_t vbOPx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
170 const int8x16_t vbQRx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
171 const int8x16_t vbSTx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
172 const int8x16_t vbUVx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
173 const int8x16_t vb01x01234567 = vshlq_n_s8(vb01x0123456789ABCDEF, 4);
174 const int8x16_t vb23x01234567 = vshlq_n_s8(vb23x0123456789ABCDEF, 4);
175 const int8x16_t vb45x01234567 = vshlq_n_s8(vb45x0123456789ABCDEF, 4);
176 const int8x16_t vb67x01234567 = vshlq_n_s8(vb67x0123456789ABCDEF, 4);
177 const int8x16_t vb89x01234567 = vshlq_n_s8(vb89x0123456789ABCDEF, 4);
178 const int8x16_t vbABx01234567 = vshlq_n_s8(vbABx0123456789ABCDEF, 4);
179 const int8x16_t vbCDx01234567 = vshlq_n_s8(vbCDx0123456789ABCDEF, 4);
180 const int8x16_t vbEFx01234567 = vshlq_n_s8(vbEFx0123456789ABCDEF, 4);
181 const int8x16_t vbGHx01234567 = vshlq_n_s8(vbGHx0123456789ABCDEF, 4);
182 const int8x16_t vbIJx01234567 = vshlq_n_s8(vbIJx0123456789ABCDEF, 4);
183 const int8x16_t vbKLx01234567 = vshlq_n_s8(vbKLx0123456789ABCDEF, 4);
184 const int8x16_t vbMNx01234567 = vshlq_n_s8(vbMNx0123456789ABCDEF, 4);
185 const int8x16_t vbOPx01234567 = vshlq_n_s8(vbOPx0123456789ABCDEF, 4);
186 const int8x16_t vbQRx01234567 = vshlq_n_s8(vbQRx0123456789ABCDEF, 4);
187 const int8x16_t vbSTx01234567 = vshlq_n_s8(vbSTx0123456789ABCDEF, 4);
188 const int8x16_t vbUVx01234567 = vshlq_n_s8(vbUVx0123456789ABCDEF, 4);
189 const int8x16_t vb01x89ABCDEF = vandq_s8(vb01x0123456789ABCDEF, vmask);
190 const int8x16_t vb23x89ABCDEF = vandq_s8(vb23x0123456789ABCDEF, vmask);
191 const int8x16_t vb45x89ABCDEF = vandq_s8(vb45x0123456789ABCDEF, vmask);
192 const int8x16_t vb67x89ABCDEF = vandq_s8(vb67x0123456789ABCDEF, vmask);
193 const int8x16_t vb89x89ABCDEF = vandq_s8(vb89x0123456789ABCDEF, vmask);
194 const int8x16_t vbABx89ABCDEF = vandq_s8(vbABx0123456789ABCDEF, vmask);
195 const int8x16_t vbCDx89ABCDEF = vandq_s8(vbCDx0123456789ABCDEF, vmask);
196 const int8x16_t vbEFx89ABCDEF = vandq_s8(vbEFx0123456789ABCDEF, vmask);
197 const int8x16_t vbGHx89ABCDEF = vandq_s8(vbGHx0123456789ABCDEF, vmask);
198 const int8x16_t vbIJx89ABCDEF = vandq_s8(vbIJx0123456789ABCDEF, vmask);
199 const int8x16_t vbKLx89ABCDEF = vandq_s8(vbKLx0123456789ABCDEF, vmask);
200 const int8x16_t vbMNx89ABCDEF = vandq_s8(vbMNx0123456789ABCDEF, vmask);
201 const int8x16_t vbOPx89ABCDEF = vandq_s8(vbOPx0123456789ABCDEF, vmask);
202 const int8x16_t vbQRx89ABCDEF = vandq_s8(vbQRx0123456789ABCDEF, vmask);
203 const int8x16_t vbSTx89ABCDEF = vandq_s8(vbSTx0123456789ABCDEF, vmask);
204 const int8x16_t vbUVx89ABCDEF = vandq_s8(vbUVx0123456789ABCDEF, vmask);
205
206 // Multiply-accumulate: 3x8 * 8x32 --> 3x32.
207 vacc01x01 = vmmlaq_s32(vacc01x01, va01x01234567, vb01x01234567);
208 vacc01x23 = vmmlaq_s32(vacc01x23, va01x01234567, vb23x01234567);
209 vacc01x45 = vmmlaq_s32(vacc01x45, va01x01234567, vb45x01234567);
210 vacc01x67 = vmmlaq_s32(vacc01x67, va01x01234567, vb67x01234567);
211 vacc01x89 = vmmlaq_s32(vacc01x89, va01x01234567, vb89x01234567);
212 vacc01xAB = vmmlaq_s32(vacc01xAB, va01x01234567, vbABx01234567);
213 vacc01xCD = vmmlaq_s32(vacc01xCD, va01x01234567, vbCDx01234567);
214 vacc01xEF = vmmlaq_s32(vacc01xEF, va01x01234567, vbEFx01234567);
215 vacc01xGH = vmmlaq_s32(vacc01xGH, va01x01234567, vbGHx01234567);
216 vacc01xIJ = vmmlaq_s32(vacc01xIJ, va01x01234567, vbIJx01234567);
217 vacc01xKL = vmmlaq_s32(vacc01xKL, va01x01234567, vbKLx01234567);
218 vacc01xMN = vmmlaq_s32(vacc01xMN, va01x01234567, vbMNx01234567);
219 vacc01xOP = vmmlaq_s32(vacc01xOP, va01x01234567, vbOPx01234567);
220 vacc01xQR = vmmlaq_s32(vacc01xQR, va01x01234567, vbQRx01234567);
221 vacc01xST = vmmlaq_s32(vacc01xST, va01x01234567, vbSTx01234567);
222 vacc01xUV = vmmlaq_s32(vacc01xUV, va01x01234567, vbUVx01234567);
223 vacc23x01 = vmmlaq_s32(vacc23x01, va23x01234567, vb01x01234567);
224 vacc23x23 = vmmlaq_s32(vacc23x23, va23x01234567, vb23x01234567);
225 vacc23x45 = vmmlaq_s32(vacc23x45, va23x01234567, vb45x01234567);
226 vacc23x67 = vmmlaq_s32(vacc23x67, va23x01234567, vb67x01234567);
227 vacc23x89 = vmmlaq_s32(vacc23x89, va23x01234567, vb89x01234567);
228 vacc23xAB = vmmlaq_s32(vacc23xAB, va23x01234567, vbABx01234567);
229 vacc23xCD = vmmlaq_s32(vacc23xCD, va23x01234567, vbCDx01234567);
230 vacc23xEF = vmmlaq_s32(vacc23xEF, va23x01234567, vbEFx01234567);
231 vacc23xGH = vmmlaq_s32(vacc23xGH, va23x01234567, vbGHx01234567);
232 vacc23xIJ = vmmlaq_s32(vacc23xIJ, va23x01234567, vbIJx01234567);
233 vacc23xKL = vmmlaq_s32(vacc23xKL, va23x01234567, vbKLx01234567);
234 vacc23xMN = vmmlaq_s32(vacc23xMN, va23x01234567, vbMNx01234567);
235 vacc23xOP = vmmlaq_s32(vacc23xOP, va23x01234567, vbOPx01234567);
236 vacc23xQR = vmmlaq_s32(vacc23xQR, va23x01234567, vbQRx01234567);
237 vacc23xST = vmmlaq_s32(vacc23xST, va23x01234567, vbSTx01234567);
238 vacc23xUV = vmmlaq_s32(vacc23xUV, va23x01234567, vbUVx01234567);
239 vacc01x01 = vmmlaq_s32(vacc01x01, va01x89ABCDEF, vb01x89ABCDEF);
240 vacc01x23 = vmmlaq_s32(vacc01x23, va01x89ABCDEF, vb23x89ABCDEF);
241 vacc01x45 = vmmlaq_s32(vacc01x45, va01x89ABCDEF, vb45x89ABCDEF);
242 vacc01x67 = vmmlaq_s32(vacc01x67, va01x89ABCDEF, vb67x89ABCDEF);
243 vacc01x89 = vmmlaq_s32(vacc01x89, va01x89ABCDEF, vb89x89ABCDEF);
244 vacc01xAB = vmmlaq_s32(vacc01xAB, va01x89ABCDEF, vbABx89ABCDEF);
245 vacc01xCD = vmmlaq_s32(vacc01xCD, va01x89ABCDEF, vbCDx89ABCDEF);
246 vacc01xEF = vmmlaq_s32(vacc01xEF, va01x89ABCDEF, vbEFx89ABCDEF);
247 vacc01xGH = vmmlaq_s32(vacc01xGH, va01x89ABCDEF, vbGHx89ABCDEF);
248 vacc01xIJ = vmmlaq_s32(vacc01xIJ, va01x89ABCDEF, vbIJx89ABCDEF);
249 vacc01xKL = vmmlaq_s32(vacc01xKL, va01x89ABCDEF, vbKLx89ABCDEF);
250 vacc01xMN = vmmlaq_s32(vacc01xMN, va01x89ABCDEF, vbMNx89ABCDEF);
251 vacc01xOP = vmmlaq_s32(vacc01xOP, va01x89ABCDEF, vbOPx89ABCDEF);
252 vacc01xQR = vmmlaq_s32(vacc01xQR, va01x89ABCDEF, vbQRx89ABCDEF);
253 vacc01xST = vmmlaq_s32(vacc01xST, va01x89ABCDEF, vbSTx89ABCDEF);
254 vacc01xUV = vmmlaq_s32(vacc01xUV, va01x89ABCDEF, vbUVx89ABCDEF);
255 vacc23x01 = vmmlaq_s32(vacc23x01, va23x89ABCDEF, vb01x89ABCDEF);
256 vacc23x23 = vmmlaq_s32(vacc23x23, va23x89ABCDEF, vb23x89ABCDEF);
257 vacc23x45 = vmmlaq_s32(vacc23x45, va23x89ABCDEF, vb45x89ABCDEF);
258 vacc23x67 = vmmlaq_s32(vacc23x67, va23x89ABCDEF, vb67x89ABCDEF);
259 vacc23x89 = vmmlaq_s32(vacc23x89, va23x89ABCDEF, vb89x89ABCDEF);
260 vacc23xAB = vmmlaq_s32(vacc23xAB, va23x89ABCDEF, vbABx89ABCDEF);
261 vacc23xCD = vmmlaq_s32(vacc23xCD, va23x89ABCDEF, vbCDx89ABCDEF);
262 vacc23xEF = vmmlaq_s32(vacc23xEF, va23x89ABCDEF, vbEFx89ABCDEF);
263 vacc23xGH = vmmlaq_s32(vacc23xGH, va23x89ABCDEF, vbGHx89ABCDEF);
264 vacc23xIJ = vmmlaq_s32(vacc23xIJ, va23x89ABCDEF, vbIJx89ABCDEF);
265 vacc23xKL = vmmlaq_s32(vacc23xKL, va23x89ABCDEF, vbKLx89ABCDEF);
266 vacc23xMN = vmmlaq_s32(vacc23xMN, va23x89ABCDEF, vbMNx89ABCDEF);
267 vacc23xOP = vmmlaq_s32(vacc23xOP, va23x89ABCDEF, vbOPx89ABCDEF);
268 vacc23xQR = vmmlaq_s32(vacc23xQR, va23x89ABCDEF, vbQRx89ABCDEF);
269 vacc23xST = vmmlaq_s32(vacc23xST, va23x89ABCDEF, vbSTx89ABCDEF);
270 vacc23xUV = vmmlaq_s32(vacc23xUV, va23x89ABCDEF, vbUVx89ABCDEF);
271
272 k -= 16 * sizeof(int8_t);
273 }
274 // Handle up to 8 final positions of `k`
275 if XNN_UNLIKELY(k != 0) {
276 // Load a 3x8 block of activations.
277 uint64x2_t va01x01234567 = vld1q_dup_u64((const void*) a0); a0 += 8;
278 uint64x2_t va23x01234567 = vld1q_dup_u64((const void*) a2); a2 += 8;
279 va01x01234567 = vld1q_lane_u64((const void*) a1, va01x01234567, 1); a1 += 8;
280
281 // Load a 16x32 block of weights.
282 const int8x16_t vb01x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
283 const int8x16_t vb23x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
284 const int8x16_t vb45x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
285 const int8x16_t vb67x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
286 const int8x16_t vb89x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
287 const int8x16_t vbABx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
288 const int8x16_t vbCDx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
289 const int8x16_t vbEFx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
290 const int8x16_t vbGHx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
291 const int8x16_t vbIJx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
292 const int8x16_t vbKLx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
293 const int8x16_t vbMNx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
294 const int8x16_t vbOPx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
295 const int8x16_t vbQRx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
296 const int8x16_t vbSTx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
297 const int8x16_t vbUVx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
298 const int8x16_t vb01x01234567 = vshlq_n_s8(vb01x0123456789ABCDEF, 4);
299 const int8x16_t vb23x01234567 = vshlq_n_s8(vb23x0123456789ABCDEF, 4);
300 const int8x16_t vb45x01234567 = vshlq_n_s8(vb45x0123456789ABCDEF, 4);
301 const int8x16_t vb67x01234567 = vshlq_n_s8(vb67x0123456789ABCDEF, 4);
302 const int8x16_t vb89x01234567 = vshlq_n_s8(vb89x0123456789ABCDEF, 4);
303 const int8x16_t vbABx01234567 = vshlq_n_s8(vbABx0123456789ABCDEF, 4);
304 const int8x16_t vbCDx01234567 = vshlq_n_s8(vbCDx0123456789ABCDEF, 4);
305 const int8x16_t vbEFx01234567 = vshlq_n_s8(vbEFx0123456789ABCDEF, 4);
306 const int8x16_t vbGHx01234567 = vshlq_n_s8(vbGHx0123456789ABCDEF, 4);
307 const int8x16_t vbIJx01234567 = vshlq_n_s8(vbIJx0123456789ABCDEF, 4);
308 const int8x16_t vbKLx01234567 = vshlq_n_s8(vbKLx0123456789ABCDEF, 4);
309 const int8x16_t vbMNx01234567 = vshlq_n_s8(vbMNx0123456789ABCDEF, 4);
310 const int8x16_t vbOPx01234567 = vshlq_n_s8(vbOPx0123456789ABCDEF, 4);
311 const int8x16_t vbQRx01234567 = vshlq_n_s8(vbQRx0123456789ABCDEF, 4);
312 const int8x16_t vbSTx01234567 = vshlq_n_s8(vbSTx0123456789ABCDEF, 4);
313 const int8x16_t vbUVx01234567 = vshlq_n_s8(vbUVx0123456789ABCDEF, 4);
314
315 // Multiply-accumulate: 3x4 * 4x32 --> 3x32.
316 vacc01x01 = vmmlaq_s32(vacc01x01, vreinterpretq_s8_u64(va01x01234567), vb01x01234567);
317 vacc01x23 = vmmlaq_s32(vacc01x23, vreinterpretq_s8_u64(va01x01234567), vb23x01234567);
318 vacc01x45 = vmmlaq_s32(vacc01x45, vreinterpretq_s8_u64(va01x01234567), vb45x01234567);
319 vacc01x67 = vmmlaq_s32(vacc01x67, vreinterpretq_s8_u64(va01x01234567), vb67x01234567);
320 vacc01x89 = vmmlaq_s32(vacc01x89, vreinterpretq_s8_u64(va01x01234567), vb89x01234567);
321 vacc01xAB = vmmlaq_s32(vacc01xAB, vreinterpretq_s8_u64(va01x01234567), vbABx01234567);
322 vacc01xCD = vmmlaq_s32(vacc01xCD, vreinterpretq_s8_u64(va01x01234567), vbCDx01234567);
323 vacc01xEF = vmmlaq_s32(vacc01xEF, vreinterpretq_s8_u64(va01x01234567), vbEFx01234567);
324 vacc01xGH = vmmlaq_s32(vacc01xGH, vreinterpretq_s8_u64(va01x01234567), vbGHx01234567);
325 vacc01xIJ = vmmlaq_s32(vacc01xIJ, vreinterpretq_s8_u64(va01x01234567), vbIJx01234567);
326 vacc01xKL = vmmlaq_s32(vacc01xKL, vreinterpretq_s8_u64(va01x01234567), vbKLx01234567);
327 vacc01xMN = vmmlaq_s32(vacc01xMN, vreinterpretq_s8_u64(va01x01234567), vbMNx01234567);
328 vacc01xOP = vmmlaq_s32(vacc01xOP, vreinterpretq_s8_u64(va01x01234567), vbOPx01234567);
329 vacc01xQR = vmmlaq_s32(vacc01xQR, vreinterpretq_s8_u64(va01x01234567), vbQRx01234567);
330 vacc01xST = vmmlaq_s32(vacc01xST, vreinterpretq_s8_u64(va01x01234567), vbSTx01234567);
331 vacc01xUV = vmmlaq_s32(vacc01xUV, vreinterpretq_s8_u64(va01x01234567), vbUVx01234567);
332 vacc23x01 = vmmlaq_s32(vacc23x01, vreinterpretq_s8_u64(va23x01234567), vb01x01234567);
333 vacc23x23 = vmmlaq_s32(vacc23x23, vreinterpretq_s8_u64(va23x01234567), vb23x01234567);
334 vacc23x45 = vmmlaq_s32(vacc23x45, vreinterpretq_s8_u64(va23x01234567), vb45x01234567);
335 vacc23x67 = vmmlaq_s32(vacc23x67, vreinterpretq_s8_u64(va23x01234567), vb67x01234567);
336 vacc23x89 = vmmlaq_s32(vacc23x89, vreinterpretq_s8_u64(va23x01234567), vb89x01234567);
337 vacc23xAB = vmmlaq_s32(vacc23xAB, vreinterpretq_s8_u64(va23x01234567), vbABx01234567);
338 vacc23xCD = vmmlaq_s32(vacc23xCD, vreinterpretq_s8_u64(va23x01234567), vbCDx01234567);
339 vacc23xEF = vmmlaq_s32(vacc23xEF, vreinterpretq_s8_u64(va23x01234567), vbEFx01234567);
340 vacc23xGH = vmmlaq_s32(vacc23xGH, vreinterpretq_s8_u64(va23x01234567), vbGHx01234567);
341 vacc23xIJ = vmmlaq_s32(vacc23xIJ, vreinterpretq_s8_u64(va23x01234567), vbIJx01234567);
342 vacc23xKL = vmmlaq_s32(vacc23xKL, vreinterpretq_s8_u64(va23x01234567), vbKLx01234567);
343 vacc23xMN = vmmlaq_s32(vacc23xMN, vreinterpretq_s8_u64(va23x01234567), vbMNx01234567);
344 vacc23xOP = vmmlaq_s32(vacc23xOP, vreinterpretq_s8_u64(va23x01234567), vbOPx01234567);
345 vacc23xQR = vmmlaq_s32(vacc23xQR, vreinterpretq_s8_u64(va23x01234567), vbQRx01234567);
346 vacc23xST = vmmlaq_s32(vacc23xST, vreinterpretq_s8_u64(va23x01234567), vbSTx01234567);
347 vacc23xUV = vmmlaq_s32(vacc23xUV, vreinterpretq_s8_u64(va23x01234567), vbUVx01234567);
348 }
349
350 int32x4_t vacc0x0123 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01x01), vreinterpretq_u64_s32(vacc01x23)));
351 int32x4_t vacc1x0123 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01x01), vreinterpretq_u64_s32(vacc01x23)));
352 int32x4_t vacc0x4567 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01x45), vreinterpretq_u64_s32(vacc01x67)));
353 int32x4_t vacc1x4567 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01x45), vreinterpretq_u64_s32(vacc01x67)));
354 int32x4_t vacc0x89AB = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01x89), vreinterpretq_u64_s32(vacc01xAB)));
355 int32x4_t vacc1x89AB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01x89), vreinterpretq_u64_s32(vacc01xAB)));
356 int32x4_t vacc0xCDEF = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01xCD), vreinterpretq_u64_s32(vacc01xEF)));
357 int32x4_t vacc1xCDEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01xCD), vreinterpretq_u64_s32(vacc01xEF)));
358 int32x4_t vacc0xGHIJ = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01xGH), vreinterpretq_u64_s32(vacc01xIJ)));
359 int32x4_t vacc1xGHIJ = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01xGH), vreinterpretq_u64_s32(vacc01xIJ)));
360 int32x4_t vacc0xKLMN = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01xKL), vreinterpretq_u64_s32(vacc01xMN)));
361 int32x4_t vacc1xKLMN = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01xKL), vreinterpretq_u64_s32(vacc01xMN)));
362 int32x4_t vacc0xOPQR = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01xOP), vreinterpretq_u64_s32(vacc01xQR)));
363 int32x4_t vacc1xOPQR = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01xOP), vreinterpretq_u64_s32(vacc01xQR)));
364 int32x4_t vacc0xSTUV = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01xST), vreinterpretq_u64_s32(vacc01xUV)));
365 int32x4_t vacc1xSTUV = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01xST), vreinterpretq_u64_s32(vacc01xUV)));
366 int32x4_t vacc2x0123 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23x01), vreinterpretq_u64_s32(vacc23x23)));
367 int32x4_t vacc2x4567 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23x45), vreinterpretq_u64_s32(vacc23x67)));
368 int32x4_t vacc2x89AB = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23x89), vreinterpretq_u64_s32(vacc23xAB)));
369 int32x4_t vacc2xCDEF = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23xCD), vreinterpretq_u64_s32(vacc23xEF)));
370 int32x4_t vacc2xGHIJ = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23xGH), vreinterpretq_u64_s32(vacc23xIJ)));
371 int32x4_t vacc2xKLMN = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23xKL), vreinterpretq_u64_s32(vacc23xMN)));
372 int32x4_t vacc2xOPQR = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23xOP), vreinterpretq_u64_s32(vacc23xQR)));
373 int32x4_t vacc2xSTUV = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23xST), vreinterpretq_u64_s32(vacc23xUV)));
374 const float32x4_t vfilter_output_scale0123 = vreinterpretq_f32_u32(vshll_n_u16(vld1_u16(w), 16)); w = (const uint16_t*) w + 4;
375 const float32x4_t vfilter_output_scale4567 = vreinterpretq_f32_u32(vshll_n_u16(vld1_u16(w), 16)); w = (const uint16_t*) w + 4;
376 const float32x4_t vfilter_output_scale89AB = vreinterpretq_f32_u32(vshll_n_u16(vld1_u16(w), 16)); w = (const uint16_t*) w + 4;
377 const float32x4_t vfilter_output_scaleCDEF = vreinterpretq_f32_u32(vshll_n_u16(vld1_u16(w), 16)); w = (const uint16_t*) w + 4;
378 const float32x4_t vfilter_output_scaleGHIJ = vreinterpretq_f32_u32(vshll_n_u16(vld1_u16(w), 16)); w = (const uint16_t*) w + 4;
379 const float32x4_t vfilter_output_scaleKLMN = vreinterpretq_f32_u32(vshll_n_u16(vld1_u16(w), 16)); w = (const uint16_t*) w + 4;
380 const float32x4_t vfilter_output_scaleOPQR = vreinterpretq_f32_u32(vshll_n_u16(vld1_u16(w), 16)); w = (const uint16_t*) w + 4;
381 const float32x4_t vfilter_output_scaleSTUV = vreinterpretq_f32_u32(vshll_n_u16(vld1_u16(w), 16)); w = (const uint16_t*) w + 4;
382 float32x4_t vf0x0123 = vcvtq_f32_s32(vacc0x0123);
383 vout0x0123 = vfmaq_f32(vout0x0123, vf0x0123, vfilter_output_scale0123);
384 float32x4_t vf0x4567 = vcvtq_f32_s32(vacc0x4567);
385 vout0x4567 = vfmaq_f32(vout0x4567, vf0x4567, vfilter_output_scale4567);
386 float32x4_t vf0x89AB = vcvtq_f32_s32(vacc0x89AB);
387 vout0x89AB = vfmaq_f32(vout0x89AB, vf0x89AB, vfilter_output_scale89AB);
388 float32x4_t vf0xCDEF = vcvtq_f32_s32(vacc0xCDEF);
389 vout0xCDEF = vfmaq_f32(vout0xCDEF, vf0xCDEF, vfilter_output_scaleCDEF);
390 float32x4_t vf0xGHIJ = vcvtq_f32_s32(vacc0xGHIJ);
391 vout0xGHIJ = vfmaq_f32(vout0xGHIJ, vf0xGHIJ, vfilter_output_scaleGHIJ);
392 float32x4_t vf0xKLMN = vcvtq_f32_s32(vacc0xKLMN);
393 vout0xKLMN = vfmaq_f32(vout0xKLMN, vf0xKLMN, vfilter_output_scaleKLMN);
394 float32x4_t vf0xOPQR = vcvtq_f32_s32(vacc0xOPQR);
395 vout0xOPQR = vfmaq_f32(vout0xOPQR, vf0xOPQR, vfilter_output_scaleOPQR);
396 float32x4_t vf0xSTUV = vcvtq_f32_s32(vacc0xSTUV);
397 vout0xSTUV = vfmaq_f32(vout0xSTUV, vf0xSTUV, vfilter_output_scaleSTUV);
398 float32x4_t vf1x0123 = vcvtq_f32_s32(vacc1x0123);
399 vout1x0123 = vfmaq_f32(vout1x0123, vf1x0123, vfilter_output_scale0123);
400 float32x4_t vf1x4567 = vcvtq_f32_s32(vacc1x4567);
401 vout1x4567 = vfmaq_f32(vout1x4567, vf1x4567, vfilter_output_scale4567);
402 float32x4_t vf1x89AB = vcvtq_f32_s32(vacc1x89AB);
403 vout1x89AB = vfmaq_f32(vout1x89AB, vf1x89AB, vfilter_output_scale89AB);
404 float32x4_t vf1xCDEF = vcvtq_f32_s32(vacc1xCDEF);
405 vout1xCDEF = vfmaq_f32(vout1xCDEF, vf1xCDEF, vfilter_output_scaleCDEF);
406 float32x4_t vf1xGHIJ = vcvtq_f32_s32(vacc1xGHIJ);
407 vout1xGHIJ = vfmaq_f32(vout1xGHIJ, vf1xGHIJ, vfilter_output_scaleGHIJ);
408 float32x4_t vf1xKLMN = vcvtq_f32_s32(vacc1xKLMN);
409 vout1xKLMN = vfmaq_f32(vout1xKLMN, vf1xKLMN, vfilter_output_scaleKLMN);
410 float32x4_t vf1xOPQR = vcvtq_f32_s32(vacc1xOPQR);
411 vout1xOPQR = vfmaq_f32(vout1xOPQR, vf1xOPQR, vfilter_output_scaleOPQR);
412 float32x4_t vf1xSTUV = vcvtq_f32_s32(vacc1xSTUV);
413 vout1xSTUV = vfmaq_f32(vout1xSTUV, vf1xSTUV, vfilter_output_scaleSTUV);
414 float32x4_t vf2x0123 = vcvtq_f32_s32(vacc2x0123);
415 vout2x0123 = vfmaq_f32(vout2x0123, vf2x0123, vfilter_output_scale0123);
416 float32x4_t vf2x4567 = vcvtq_f32_s32(vacc2x4567);
417 vout2x4567 = vfmaq_f32(vout2x4567, vf2x4567, vfilter_output_scale4567);
418 float32x4_t vf2x89AB = vcvtq_f32_s32(vacc2x89AB);
419 vout2x89AB = vfmaq_f32(vout2x89AB, vf2x89AB, vfilter_output_scale89AB);
420 float32x4_t vf2xCDEF = vcvtq_f32_s32(vacc2xCDEF);
421 vout2xCDEF = vfmaq_f32(vout2xCDEF, vf2xCDEF, vfilter_output_scaleCDEF);
422 float32x4_t vf2xGHIJ = vcvtq_f32_s32(vacc2xGHIJ);
423 vout2xGHIJ = vfmaq_f32(vout2xGHIJ, vf2xGHIJ, vfilter_output_scaleGHIJ);
424 float32x4_t vf2xKLMN = vcvtq_f32_s32(vacc2xKLMN);
425 vout2xKLMN = vfmaq_f32(vout2xKLMN, vf2xKLMN, vfilter_output_scaleKLMN);
426 float32x4_t vf2xOPQR = vcvtq_f32_s32(vacc2xOPQR);
427 vout2xOPQR = vfmaq_f32(vout2xOPQR, vf2xOPQR, vfilter_output_scaleOPQR);
428 float32x4_t vf2xSTUV = vcvtq_f32_s32(vacc2xSTUV);
429 vout2xSTUV = vfmaq_f32(vout2xSTUV, vf2xSTUV, vfilter_output_scaleSTUV);
430 }
431
432 const float32x4_t vinput_scale01 = vreinterpretq_f32_s32(vld1q_s32(&quantization_params[0].zero_point));
433 vout0x0123 = vmulq_lane_f32(vout0x0123, vget_low_f32(vinput_scale01), 1);
434 vout1x0123 = vmulq_lane_f32(vout1x0123, vget_high_f32(vinput_scale01), 1);
435 vout0x4567 = vmulq_lane_f32(vout0x4567, vget_low_f32(vinput_scale01), 1);
436 vout1x4567 = vmulq_lane_f32(vout1x4567, vget_high_f32(vinput_scale01), 1);
437 vout0x89AB = vmulq_lane_f32(vout0x89AB, vget_low_f32(vinput_scale01), 1);
438 vout1x89AB = vmulq_lane_f32(vout1x89AB, vget_high_f32(vinput_scale01), 1);
439 vout0xCDEF = vmulq_lane_f32(vout0xCDEF, vget_low_f32(vinput_scale01), 1);
440 vout1xCDEF = vmulq_lane_f32(vout1xCDEF, vget_high_f32(vinput_scale01), 1);
441 vout0xGHIJ = vmulq_lane_f32(vout0xGHIJ, vget_low_f32(vinput_scale01), 1);
442 vout1xGHIJ = vmulq_lane_f32(vout1xGHIJ, vget_high_f32(vinput_scale01), 1);
443 vout0xKLMN = vmulq_lane_f32(vout0xKLMN, vget_low_f32(vinput_scale01), 1);
444 vout1xKLMN = vmulq_lane_f32(vout1xKLMN, vget_high_f32(vinput_scale01), 1);
445 vout0xOPQR = vmulq_lane_f32(vout0xOPQR, vget_low_f32(vinput_scale01), 1);
446 vout1xOPQR = vmulq_lane_f32(vout1xOPQR, vget_high_f32(vinput_scale01), 1);
447 vout0xSTUV = vmulq_lane_f32(vout0xSTUV, vget_low_f32(vinput_scale01), 1);
448 vout1xSTUV = vmulq_lane_f32(vout1xSTUV, vget_high_f32(vinput_scale01), 1);
449 const float32x4_t vinput_scale2 = vld1q_dup_f32(&quantization_params[2].inv_scale);
450 vout2x0123 = vmulq_f32(vout2x0123, vinput_scale2);
451 vout2x4567 = vmulq_f32(vout2x4567, vinput_scale2);
452 vout2x89AB = vmulq_f32(vout2x89AB, vinput_scale2);
453 vout2xCDEF = vmulq_f32(vout2xCDEF, vinput_scale2);
454 vout2xGHIJ = vmulq_f32(vout2xGHIJ, vinput_scale2);
455 vout2xKLMN = vmulq_f32(vout2xKLMN, vinput_scale2);
456 vout2xOPQR = vmulq_f32(vout2xOPQR, vinput_scale2);
457 vout2xSTUV = vmulq_f32(vout2xSTUV, vinput_scale2);
458
459
460 const float32x4_t vbias0123 = vld1q_f32(w); w = (const float*) w + 4;
461 vout0x0123 = vaddq_f32(vbias0123, vout0x0123);
462 vout1x0123 = vaddq_f32(vbias0123, vout1x0123);
463 vout2x0123 = vaddq_f32(vbias0123, vout2x0123);
464 const float32x4_t vbias4567 = vld1q_f32(w); w = (const float*) w + 4;
465 vout0x4567 = vaddq_f32(vbias4567, vout0x4567);
466 vout1x4567 = vaddq_f32(vbias4567, vout1x4567);
467 vout2x4567 = vaddq_f32(vbias4567, vout2x4567);
468 const float32x4_t vbias89AB = vld1q_f32(w); w = (const float*) w + 4;
469 vout0x89AB = vaddq_f32(vbias89AB, vout0x89AB);
470 vout1x89AB = vaddq_f32(vbias89AB, vout1x89AB);
471 vout2x89AB = vaddq_f32(vbias89AB, vout2x89AB);
472 const float32x4_t vbiasCDEF = vld1q_f32(w); w = (const float*) w + 4;
473 vout0xCDEF = vaddq_f32(vbiasCDEF, vout0xCDEF);
474 vout1xCDEF = vaddq_f32(vbiasCDEF, vout1xCDEF);
475 vout2xCDEF = vaddq_f32(vbiasCDEF, vout2xCDEF);
476 const float32x4_t vbiasGHIJ = vld1q_f32(w); w = (const float*) w + 4;
477 vout0xGHIJ = vaddq_f32(vbiasGHIJ, vout0xGHIJ);
478 vout1xGHIJ = vaddq_f32(vbiasGHIJ, vout1xGHIJ);
479 vout2xGHIJ = vaddq_f32(vbiasGHIJ, vout2xGHIJ);
480 const float32x4_t vbiasKLMN = vld1q_f32(w); w = (const float*) w + 4;
481 vout0xKLMN = vaddq_f32(vbiasKLMN, vout0xKLMN);
482 vout1xKLMN = vaddq_f32(vbiasKLMN, vout1xKLMN);
483 vout2xKLMN = vaddq_f32(vbiasKLMN, vout2xKLMN);
484 const float32x4_t vbiasOPQR = vld1q_f32(w); w = (const float*) w + 4;
485 vout0xOPQR = vaddq_f32(vbiasOPQR, vout0xOPQR);
486 vout1xOPQR = vaddq_f32(vbiasOPQR, vout1xOPQR);
487 vout2xOPQR = vaddq_f32(vbiasOPQR, vout2xOPQR);
488 const float32x4_t vbiasSTUV = vld1q_f32(w); w = (const float*) w + 4;
489 vout0xSTUV = vaddq_f32(vbiasSTUV, vout0xSTUV);
490 vout1xSTUV = vaddq_f32(vbiasSTUV, vout1xSTUV);
491 vout2xSTUV = vaddq_f32(vbiasSTUV, vout2xSTUV);
492
493 const float32x4_t voutput_min = vld1q_dup_f32(&params->scalar.min);
494 vout0x0123 = vmaxq_f32(vout0x0123, voutput_min);
495 vout0x4567 = vmaxq_f32(vout0x4567, voutput_min);
496 vout0x89AB = vmaxq_f32(vout0x89AB, voutput_min);
497 vout0xCDEF = vmaxq_f32(vout0xCDEF, voutput_min);
498 vout0xGHIJ = vmaxq_f32(vout0xGHIJ, voutput_min);
499 vout0xKLMN = vmaxq_f32(vout0xKLMN, voutput_min);
500 vout0xOPQR = vmaxq_f32(vout0xOPQR, voutput_min);
501 vout0xSTUV = vmaxq_f32(vout0xSTUV, voutput_min);
502 vout1x0123 = vmaxq_f32(vout1x0123, voutput_min);
503 vout1x4567 = vmaxq_f32(vout1x4567, voutput_min);
504 vout1x89AB = vmaxq_f32(vout1x89AB, voutput_min);
505 vout1xCDEF = vmaxq_f32(vout1xCDEF, voutput_min);
506 vout1xGHIJ = vmaxq_f32(vout1xGHIJ, voutput_min);
507 vout1xKLMN = vmaxq_f32(vout1xKLMN, voutput_min);
508 vout1xOPQR = vmaxq_f32(vout1xOPQR, voutput_min);
509 vout1xSTUV = vmaxq_f32(vout1xSTUV, voutput_min);
510 vout2x0123 = vmaxq_f32(vout2x0123, voutput_min);
511 vout2x4567 = vmaxq_f32(vout2x4567, voutput_min);
512 vout2x89AB = vmaxq_f32(vout2x89AB, voutput_min);
513 vout2xCDEF = vmaxq_f32(vout2xCDEF, voutput_min);
514 vout2xGHIJ = vmaxq_f32(vout2xGHIJ, voutput_min);
515 vout2xKLMN = vmaxq_f32(vout2xKLMN, voutput_min);
516 vout2xOPQR = vmaxq_f32(vout2xOPQR, voutput_min);
517 vout2xSTUV = vmaxq_f32(vout2xSTUV, voutput_min);
518
519 const float32x4_t voutput_max = vld1q_dup_f32(&params->scalar.max);
520 vout0x0123 = vminq_f32(vout0x0123, voutput_max);
521 vout0x4567 = vminq_f32(vout0x4567, voutput_max);
522 vout0x89AB = vminq_f32(vout0x89AB, voutput_max);
523 vout0xCDEF = vminq_f32(vout0xCDEF, voutput_max);
524 vout0xGHIJ = vminq_f32(vout0xGHIJ, voutput_max);
525 vout0xKLMN = vminq_f32(vout0xKLMN, voutput_max);
526 vout0xOPQR = vminq_f32(vout0xOPQR, voutput_max);
527 vout0xSTUV = vminq_f32(vout0xSTUV, voutput_max);
528 vout1x0123 = vminq_f32(vout1x0123, voutput_max);
529 vout1x4567 = vminq_f32(vout1x4567, voutput_max);
530 vout1x89AB = vminq_f32(vout1x89AB, voutput_max);
531 vout1xCDEF = vminq_f32(vout1xCDEF, voutput_max);
532 vout1xGHIJ = vminq_f32(vout1xGHIJ, voutput_max);
533 vout1xKLMN = vminq_f32(vout1xKLMN, voutput_max);
534 vout1xOPQR = vminq_f32(vout1xOPQR, voutput_max);
535 vout1xSTUV = vminq_f32(vout1xSTUV, voutput_max);
536 vout2x0123 = vminq_f32(vout2x0123, voutput_max);
537 vout2x4567 = vminq_f32(vout2x4567, voutput_max);
538 vout2x89AB = vminq_f32(vout2x89AB, voutput_max);
539 vout2xCDEF = vminq_f32(vout2xCDEF, voutput_max);
540 vout2xGHIJ = vminq_f32(vout2xGHIJ, voutput_max);
541 vout2xKLMN = vminq_f32(vout2xKLMN, voutput_max);
542 vout2xOPQR = vminq_f32(vout2xOPQR, voutput_max);
543 vout2xSTUV = vminq_f32(vout2xSTUV, voutput_max);
544
545 if XNN_LIKELY(nc >= 32) {
546 vst1q_f32(c0, vout0x0123);
547 vst1q_f32(c0 + 4, vout0x4567);
548 vst1q_f32(c0 + 8, vout0x89AB);
549 vst1q_f32(c0 + 12, vout0xCDEF);
550 vst1q_f32(c0 + 16, vout0xGHIJ);
551 vst1q_f32(c0 + 20, vout0xKLMN);
552 vst1q_f32(c0 + 24, vout0xOPQR);
553 vst1q_f32(c0 + 28, vout0xSTUV);
554 vst1q_f32(c1, vout1x0123);
555 vst1q_f32(c1 + 4, vout1x4567);
556 vst1q_f32(c1 + 8, vout1x89AB);
557 vst1q_f32(c1 + 12, vout1xCDEF);
558 vst1q_f32(c1 + 16, vout1xGHIJ);
559 vst1q_f32(c1 + 20, vout1xKLMN);
560 vst1q_f32(c1 + 24, vout1xOPQR);
561 vst1q_f32(c1 + 28, vout1xSTUV);
562 vst1q_f32(c2, vout2x0123);
563 vst1q_f32(c2 + 4, vout2x4567);
564 vst1q_f32(c2 + 8, vout2x89AB);
565 vst1q_f32(c2 + 12, vout2xCDEF);
566 vst1q_f32(c2 + 16, vout2xGHIJ);
567 vst1q_f32(c2 + 20, vout2xKLMN);
568 vst1q_f32(c2 + 24, vout2xOPQR);
569 vst1q_f32(c2 + 28, vout2xSTUV);
570
571 a0 = (const int8_t*) ((uintptr_t) a0 - kc);
572 a1 = (const int8_t*) ((uintptr_t) a1 - kc);
573 a2 = (const int8_t*) ((uintptr_t) a2 - kc);
574
575 c0 = (float*) ((uintptr_t) c0 + cn_stride);
576 c1 = (float*) ((uintptr_t) c1 + cn_stride);
577 c2 = (float*) ((uintptr_t) c2 + cn_stride);
578
579 nc -= 32;
580 } else {
581 if (nc & 16) {
582 vst1q_f32(c0, vout0x0123); c0 += 4;
583 vout0x0123 = vout0xGHIJ;
584 vst1q_f32(c1, vout1x0123); c1 += 4;
585 vout1x0123 = vout1xGHIJ;
586 vst1q_f32(c2, vout2x0123); c2 += 4;
587 vout2x0123 = vout2xGHIJ;
588 vst1q_f32(c0, vout0x4567); c0 += 4;
589 vout0x4567 = vout0xKLMN;
590 vst1q_f32(c1, vout1x4567); c1 += 4;
591 vout1x4567 = vout1xKLMN;
592 vst1q_f32(c2, vout2x4567); c2 += 4;
593 vout2x4567 = vout2xKLMN;
594 vst1q_f32(c0, vout0x89AB); c0 += 4;
595 vout0x89AB = vout0xOPQR;
596 vst1q_f32(c1, vout1x89AB); c1 += 4;
597 vout1x89AB = vout1xOPQR;
598 vst1q_f32(c2, vout2x89AB); c2 += 4;
599 vout2x89AB = vout2xOPQR;
600 vst1q_f32(c0, vout0xCDEF); c0 += 4;
601 vout0xCDEF = vout0xSTUV;
602 vst1q_f32(c1, vout1xCDEF); c1 += 4;
603 vout1xCDEF = vout1xSTUV;
604 vst1q_f32(c2, vout2xCDEF); c2 += 4;
605 vout2xCDEF = vout2xSTUV;
606 }
607 if (nc & 8) {
608 vst1q_f32(c0, vout0x0123); c0 += 4;
609 vout0x0123 = vout0x89AB;
610 vst1q_f32(c1, vout1x0123); c1 += 4;
611 vout1x0123 = vout1x89AB;
612 vst1q_f32(c2, vout2x0123); c2 += 4;
613 vout2x0123 = vout2x89AB;
614 vst1q_f32(c0, vout0x4567); c0 += 4;
615 vout0x4567 = vout0xCDEF;
616 vst1q_f32(c1, vout1x4567); c1 += 4;
617 vout1x4567 = vout1xCDEF;
618 vst1q_f32(c2, vout2x4567); c2 += 4;
619 vout2x4567 = vout2xCDEF;
620 }
621 if (nc & 4) {
622 vst1q_f32(c0, vout0x0123); c0 += 4;
623 vout0x0123 = vout0x4567;
624 vst1q_f32(c1, vout1x0123); c1 += 4;
625 vout1x0123 = vout1x4567;
626 vst1q_f32(c2, vout2x0123); c2 += 4;
627 vout2x0123 = vout2x4567;
628 }
629 float32x2_t vout0x01 = vget_low_f32(vout0x0123);
630 float32x2_t vout1x01 = vget_low_f32(vout1x0123);
631 float32x2_t vout2x01 = vget_low_f32(vout2x0123);
632 if (nc & 2) {
633 vst1_f32(c0, vout0x01); c0 += 2;
634 vst1_f32(c1, vout1x01); c1 += 2;
635 vst1_f32(c2, vout2x01); c2 += 2;
636 vout0x01 = vget_high_f32(vout0x0123);
637 vout1x01 = vget_high_f32(vout1x0123);
638 vout2x01 = vget_high_f32(vout2x0123);
639 }
640 if (nc & 1) {
641 vst1_lane_f32(c0, vout0x01, 0);
642 vst1_lane_f32(c1, vout1x01, 0);
643 vst1_lane_f32(c2, vout2x01, 0);
644 }
645 nc = 0;
646 }
647 } while (nc != 0);
648 }