Debian Codegraph @

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