Debian Codegraph @

src/qd8-f32-qc8w-gemm/gen/qd8-f32-qc8w-gemm-4x16c4-minmax-neondot.c

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/qs8-gemm/c4-neondot.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2020 Google LLC
6 //
7 // This source code is licensed under the BSD-style license found in the
8 // LICENSE file in the root directory of this source tree.
9
10 #include <assert.h>
11
12 #include <arm_neon.h>
13
14 #include "xnnpack/gemm.h"
15 #include "xnnpack/math.h"
16
17
18 void xnn_qd8_f32_qc8w_gemm_minmax_ukernel_4x16c4__neondot(
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 <= 4);
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, 4 * sizeof(int8_t));
41 const int8_t* a0 = a;
42 float* c0 = c;
43 const int8_t* a1 = (const int8_t*) ((uintptr_t) a0 + a_stride);
44 float* c1 = (float*) ((uintptr_t) c0 + cm_stride);
45 if XNN_UNPREDICTABLE(mr < 2) {
46 a1 = a0;
47 c1 = c0;
48 }
49 const int8_t* a2 = (const int8_t*) ((uintptr_t) a1 + a_stride);
50 float* c2 = (float*) ((uintptr_t) c1 + cm_stride);
51 if XNN_UNPREDICTABLE(mr <= 2) {
52 a2 = a1;
53 c2 = c1;
54 }
55 const int8_t* a3 = (const int8_t*) ((uintptr_t) a2 + a_stride);
56 float* c3 = (float*) ((uintptr_t) c2 + cm_stride);
57 if XNN_UNPREDICTABLE(mr != 4) {
58 a3 = a2;
59 c3 = c2;
60 }
61
62 // Loop over groups of 16 columns.
63 do {
64 // Initialize accumulators with bias. 16 bias values are loaded from the
65 // weight matrix, at the start of the group of 16 columns.
66 const int32x4_t vinput_zero_point01 = vld1q_s32(&quantization_params[0].zero_point);
67 const int32x4_t vksum0123 = vld1q_s32(w); w = (const int32_t*) w + 4;
68 int32x4_t vacc0x0123 = vmulq_lane_s32(vksum0123, vget_low_s32(vinput_zero_point01), 0);
69 int32x4_t vacc1x0123 = vmulq_lane_s32(vksum0123, vget_high_s32(vinput_zero_point01), 0);
70 const int32x4_t vksum4567 = vld1q_s32(w); w = (const int32_t*) w + 4;
71 int32x4_t vacc0x4567 = vmulq_lane_s32(vksum4567, vget_low_s32(vinput_zero_point01), 0);
72 int32x4_t vacc1x4567 = vmulq_lane_s32(vksum4567, vget_high_s32(vinput_zero_point01), 0);
73 const int32x4_t vksum89AB = vld1q_s32(w); w = (const int32_t*) w + 4;
74 int32x4_t vacc0x89AB = vmulq_lane_s32(vksum89AB, vget_low_s32(vinput_zero_point01), 0);
75 int32x4_t vacc1x89AB = vmulq_lane_s32(vksum89AB, vget_high_s32(vinput_zero_point01), 0);
76 const int32x4_t vksumCDEF = vld1q_s32(w); w = (const int32_t*) w + 4;
77 int32x4_t vacc0xCDEF = vmulq_lane_s32(vksumCDEF, vget_low_s32(vinput_zero_point01), 0);
78 int32x4_t vacc1xCDEF = vmulq_lane_s32(vksumCDEF, vget_high_s32(vinput_zero_point01), 0);
79 const int32x4_t vinput_zero_point23 = vld1q_s32(&quantization_params[2].zero_point);
80 int32x4_t vacc2x0123 = vmulq_lane_s32(vksum0123, vget_low_s32(vinput_zero_point23), 0);
81 int32x4_t vacc3x0123 = vmulq_lane_s32(vksum0123, vget_high_s32(vinput_zero_point23), 0);
82 int32x4_t vacc2x4567 = vmulq_lane_s32(vksum4567, vget_low_s32(vinput_zero_point23), 0);
83 int32x4_t vacc3x4567 = vmulq_lane_s32(vksum4567, vget_high_s32(vinput_zero_point23), 0);
84 int32x4_t vacc2x89AB = vmulq_lane_s32(vksum89AB, vget_low_s32(vinput_zero_point23), 0);
85 int32x4_t vacc3x89AB = vmulq_lane_s32(vksum89AB, vget_high_s32(vinput_zero_point23), 0);
86 int32x4_t vacc2xCDEF = vmulq_lane_s32(vksumCDEF, vget_low_s32(vinput_zero_point23), 0);
87 int32x4_t vacc3xCDEF = vmulq_lane_s32(vksumCDEF, vget_high_s32(vinput_zero_point23), 0);
88
89 // Inner accumulation loop along the 16 columns.
90 size_t k = kc;
91 // 2x partial unrolled loop to load 8 bytes at a time.
92 while (k >= 8 * sizeof(int8_t)) {
93 // Load a 4x8 block of activations.
94 const int8x8_t va0x01234567 = vld1_s8(a0); a0 += 8;
95 const int8x8_t va1x01234567 = vld1_s8(a1); a1 += 8;
96 const int8x8_t va2x01234567 = vld1_s8(a2); a2 += 8;
97 const int8x8_t va3x01234567 = vld1_s8(a3); a3 += 8;
98
99 // Load a 8x16 block of weights.
100 const int8x16_t vb0123x0123 = vld1q_s8(w); w = (const int8_t*) w + 16;
101 const int8x16_t vb0123x4567 = vld1q_s8(w); w = (const int8_t*) w + 16;
102 const int8x16_t vb0123x89AB = vld1q_s8(w); w = (const int8_t*) w + 16;
103 const int8x16_t vb0123xCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
104 const int8x16_t vb4567x0123 = vld1q_s8(w); w = (const int8_t*) w + 16;
105 const int8x16_t vb4567x4567 = vld1q_s8(w); w = (const int8_t*) w + 16;
106 const int8x16_t vb4567x89AB = vld1q_s8(w); w = (const int8_t*) w + 16;
107 const int8x16_t vb4567xCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
108
109 // Multiply-accumulate: 4x8 * 8x16 --> 4x16.
110 vacc0x0123 = vdotq_lane_s32(vacc0x0123, vb0123x0123, va0x01234567, 0);
111 vacc0x4567 = vdotq_lane_s32(vacc0x4567, vb0123x4567, va0x01234567, 0);
112 vacc0x89AB = vdotq_lane_s32(vacc0x89AB, vb0123x89AB, va0x01234567, 0);
113 vacc0xCDEF = vdotq_lane_s32(vacc0xCDEF, vb0123xCDEF, va0x01234567, 0);
114 vacc1x0123 = vdotq_lane_s32(vacc1x0123, vb0123x0123, va1x01234567, 0);
115 vacc1x4567 = vdotq_lane_s32(vacc1x4567, vb0123x4567, va1x01234567, 0);
116 vacc1x89AB = vdotq_lane_s32(vacc1x89AB, vb0123x89AB, va1x01234567, 0);
117 vacc1xCDEF = vdotq_lane_s32(vacc1xCDEF, vb0123xCDEF, va1x01234567, 0);
118 vacc2x0123 = vdotq_lane_s32(vacc2x0123, vb0123x0123, va2x01234567, 0);
119 vacc2x4567 = vdotq_lane_s32(vacc2x4567, vb0123x4567, va2x01234567, 0);
120 vacc2x89AB = vdotq_lane_s32(vacc2x89AB, vb0123x89AB, va2x01234567, 0);
121 vacc2xCDEF = vdotq_lane_s32(vacc2xCDEF, vb0123xCDEF, va2x01234567, 0);
122 vacc3x0123 = vdotq_lane_s32(vacc3x0123, vb0123x0123, va3x01234567, 0);
123 vacc3x4567 = vdotq_lane_s32(vacc3x4567, vb0123x4567, va3x01234567, 0);
124 vacc3x89AB = vdotq_lane_s32(vacc3x89AB, vb0123x89AB, va3x01234567, 0);
125 vacc3xCDEF = vdotq_lane_s32(vacc3xCDEF, vb0123xCDEF, va3x01234567, 0);
126 vacc0x0123 = vdotq_lane_s32(vacc0x0123, vb4567x0123, va0x01234567, 1);
127 vacc0x4567 = vdotq_lane_s32(vacc0x4567, vb4567x4567, va0x01234567, 1);
128 vacc0x89AB = vdotq_lane_s32(vacc0x89AB, vb4567x89AB, va0x01234567, 1);
129 vacc0xCDEF = vdotq_lane_s32(vacc0xCDEF, vb4567xCDEF, va0x01234567, 1);
130 vacc1x0123 = vdotq_lane_s32(vacc1x0123, vb4567x0123, va1x01234567, 1);
131 vacc1x4567 = vdotq_lane_s32(vacc1x4567, vb4567x4567, va1x01234567, 1);
132 vacc1x89AB = vdotq_lane_s32(vacc1x89AB, vb4567x89AB, va1x01234567, 1);
133 vacc1xCDEF = vdotq_lane_s32(vacc1xCDEF, vb4567xCDEF, va1x01234567, 1);
134 vacc2x0123 = vdotq_lane_s32(vacc2x0123, vb4567x0123, va2x01234567, 1);
135 vacc2x4567 = vdotq_lane_s32(vacc2x4567, vb4567x4567, va2x01234567, 1);
136 vacc2x89AB = vdotq_lane_s32(vacc2x89AB, vb4567x89AB, va2x01234567, 1);
137 vacc2xCDEF = vdotq_lane_s32(vacc2xCDEF, vb4567xCDEF, va2x01234567, 1);
138 vacc3x0123 = vdotq_lane_s32(vacc3x0123, vb4567x0123, va3x01234567, 1);
139 vacc3x4567 = vdotq_lane_s32(vacc3x4567, vb4567x4567, va3x01234567, 1);
140 vacc3x89AB = vdotq_lane_s32(vacc3x89AB, vb4567x89AB, va3x01234567, 1);
141 vacc3xCDEF = vdotq_lane_s32(vacc3xCDEF, vb4567xCDEF, va3x01234567, 1);
142
143 k -= 8 * sizeof(int8_t);
144 }
145 // Handle up to 4 final positions of `k`
146 if XNN_UNLIKELY(k != 0) {
147 // Load a 4x4 block of activations.
148 const int8x8_t va0x01234567 = vld1_s8(a0); a0 += 4;
149 const int8x8_t va1x01234567 = vld1_s8(a1); a1 += 4;
150 const int8x8_t va2x01234567 = vld1_s8(a2); a2 += 4;
151 const int8x8_t va3x01234567 = vld1_s8(a3); a3 += 4;
152
153 // Load a 4x16 block of weights.
154 const int8x16_t vb0123x0123 = vld1q_s8(w); w = (const int8_t*) w + 16;
155 const int8x16_t vb0123x4567 = vld1q_s8(w); w = (const int8_t*) w + 16;
156 const int8x16_t vb0123x89AB = vld1q_s8(w); w = (const int8_t*) w + 16;
157 const int8x16_t vb0123xCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
158
159 // Multiply-accumulate: 4x4 * 4x16 --> 4x16.
160 vacc0x0123 = vdotq_lane_s32(vacc0x0123, vb0123x0123, va0x01234567, 0);
161 vacc0x4567 = vdotq_lane_s32(vacc0x4567, vb0123x4567, va0x01234567, 0);
162 vacc0x89AB = vdotq_lane_s32(vacc0x89AB, vb0123x89AB, va0x01234567, 0);
163 vacc0xCDEF = vdotq_lane_s32(vacc0xCDEF, vb0123xCDEF, va0x01234567, 0);
164 vacc1x0123 = vdotq_lane_s32(vacc1x0123, vb0123x0123, va1x01234567, 0);
165 vacc1x4567 = vdotq_lane_s32(vacc1x4567, vb0123x4567, va1x01234567, 0);
166 vacc1x89AB = vdotq_lane_s32(vacc1x89AB, vb0123x89AB, va1x01234567, 0);
167 vacc1xCDEF = vdotq_lane_s32(vacc1xCDEF, vb0123xCDEF, va1x01234567, 0);
168 vacc2x0123 = vdotq_lane_s32(vacc2x0123, vb0123x0123, va2x01234567, 0);
169 vacc2x4567 = vdotq_lane_s32(vacc2x4567, vb0123x4567, va2x01234567, 0);
170 vacc2x89AB = vdotq_lane_s32(vacc2x89AB, vb0123x89AB, va2x01234567, 0);
171 vacc2xCDEF = vdotq_lane_s32(vacc2xCDEF, vb0123xCDEF, va2x01234567, 0);
172 vacc3x0123 = vdotq_lane_s32(vacc3x0123, vb0123x0123, va3x01234567, 0);
173 vacc3x4567 = vdotq_lane_s32(vacc3x4567, vb0123x4567, va3x01234567, 0);
174 vacc3x89AB = vdotq_lane_s32(vacc3x89AB, vb0123x89AB, va3x01234567, 0);
175 vacc3xCDEF = vdotq_lane_s32(vacc3xCDEF, vb0123xCDEF, va3x01234567, 0);
176 }
177
178 float32x4_t vout0x0123 = vcvtq_f32_s32(vacc0x0123);
179 float32x4_t vout0x4567 = vcvtq_f32_s32(vacc0x4567);
180 float32x4_t vout0x89AB = vcvtq_f32_s32(vacc0x89AB);
181 float32x4_t vout0xCDEF = vcvtq_f32_s32(vacc0xCDEF);
182 float32x4_t vout1x0123 = vcvtq_f32_s32(vacc1x0123);
183 float32x4_t vout1x4567 = vcvtq_f32_s32(vacc1x4567);
184 float32x4_t vout1x89AB = vcvtq_f32_s32(vacc1x89AB);
185 float32x4_t vout1xCDEF = vcvtq_f32_s32(vacc1xCDEF);
186 float32x4_t vout2x0123 = vcvtq_f32_s32(vacc2x0123);
187 float32x4_t vout2x4567 = vcvtq_f32_s32(vacc2x4567);
188 float32x4_t vout2x89AB = vcvtq_f32_s32(vacc2x89AB);
189 float32x4_t vout2xCDEF = vcvtq_f32_s32(vacc2xCDEF);
190 float32x4_t vout3x0123 = vcvtq_f32_s32(vacc3x0123);
191 float32x4_t vout3x4567 = vcvtq_f32_s32(vacc3x4567);
192 float32x4_t vout3x89AB = vcvtq_f32_s32(vacc3x89AB);
193 float32x4_t vout3xCDEF = vcvtq_f32_s32(vacc3xCDEF);
194 const float32x4_t vinput_scale01 = vreinterpretq_f32_s32(vld1q_s32(&quantization_params[0].zero_point));
195 vout0x0123 = vmulq_lane_f32(vout0x0123, vget_low_f32(vinput_scale01), 1);
196 vout1x0123 = vmulq_lane_f32(vout1x0123, vget_high_f32(vinput_scale01), 1);
197 vout0x4567 = vmulq_lane_f32(vout0x4567, vget_low_f32(vinput_scale01), 1);
198 vout1x4567 = vmulq_lane_f32(vout1x4567, vget_high_f32(vinput_scale01), 1);
199 vout0x89AB = vmulq_lane_f32(vout0x89AB, vget_low_f32(vinput_scale01), 1);
200 vout1x89AB = vmulq_lane_f32(vout1x89AB, vget_high_f32(vinput_scale01), 1);
201 vout0xCDEF = vmulq_lane_f32(vout0xCDEF, vget_low_f32(vinput_scale01), 1);
202 vout1xCDEF = vmulq_lane_f32(vout1xCDEF, vget_high_f32(vinput_scale01), 1);
203 const float32x4_t vinput_scale23 = vreinterpretq_f32_s32(vld1q_s32(&quantization_params[2].zero_point));
204 vout2x0123 = vmulq_lane_f32(vout2x0123, vget_low_f32(vinput_scale23), 1);
205 vout3x0123 = vmulq_lane_f32(vout3x0123, vget_high_f32(vinput_scale23), 1);
206 vout2x4567 = vmulq_lane_f32(vout2x4567, vget_low_f32(vinput_scale23), 1);
207 vout3x4567 = vmulq_lane_f32(vout3x4567, vget_high_f32(vinput_scale23), 1);
208 vout2x89AB = vmulq_lane_f32(vout2x89AB, vget_low_f32(vinput_scale23), 1);
209 vout3x89AB = vmulq_lane_f32(vout3x89AB, vget_high_f32(vinput_scale23), 1);
210 vout2xCDEF = vmulq_lane_f32(vout2xCDEF, vget_low_f32(vinput_scale23), 1);
211 vout3xCDEF = vmulq_lane_f32(vout3xCDEF, vget_high_f32(vinput_scale23), 1);
212
213 const float32x4_t vfilter_output_scale0123 = vld1q_f32(w); w = (const float*) w + 4;
214 const float32x4_t vfilter_output_scale4567 = vld1q_f32(w); w = (const float*) w + 4;
215 const float32x4_t vfilter_output_scale89AB = vld1q_f32(w); w = (const float*) w + 4;
216 const float32x4_t vfilter_output_scaleCDEF = vld1q_f32(w); w = (const float*) w + 4;
217
218 const float32x4_t vbias0123 = vld1q_f32(w); w = (const float*) w + 4;
219 #if XNN_ARCH_ARM64
220 vout0x0123 = vfmaq_f32(vbias0123, vout0x0123, vfilter_output_scale0123);
221 vout1x0123 = vfmaq_f32(vbias0123, vout1x0123, vfilter_output_scale0123);
222 vout2x0123 = vfmaq_f32(vbias0123, vout2x0123, vfilter_output_scale0123);
223 vout3x0123 = vfmaq_f32(vbias0123, vout3x0123, vfilter_output_scale0123);
224 #else
225 vout0x0123 = vmlaq_f32(vbias0123, vout0x0123, vfilter_output_scale0123);
226 vout1x0123 = vmlaq_f32(vbias0123, vout1x0123, vfilter_output_scale0123);
227 vout2x0123 = vmlaq_f32(vbias0123, vout2x0123, vfilter_output_scale0123);
228 vout3x0123 = vmlaq_f32(vbias0123, vout3x0123, vfilter_output_scale0123);
229 #endif
230 const float32x4_t vbias4567 = vld1q_f32(w); w = (const float*) w + 4;
231 #if XNN_ARCH_ARM64
232 vout0x4567 = vfmaq_f32(vbias4567, vout0x4567, vfilter_output_scale4567);
233 vout1x4567 = vfmaq_f32(vbias4567, vout1x4567, vfilter_output_scale4567);
234 vout2x4567 = vfmaq_f32(vbias4567, vout2x4567, vfilter_output_scale4567);
235 vout3x4567 = vfmaq_f32(vbias4567, vout3x4567, vfilter_output_scale4567);
236 #else
237 vout0x4567 = vmlaq_f32(vbias4567, vout0x4567, vfilter_output_scale4567);
238 vout1x4567 = vmlaq_f32(vbias4567, vout1x4567, vfilter_output_scale4567);
239 vout2x4567 = vmlaq_f32(vbias4567, vout2x4567, vfilter_output_scale4567);
240 vout3x4567 = vmlaq_f32(vbias4567, vout3x4567, vfilter_output_scale4567);
241 #endif
242 const float32x4_t vbias89AB = vld1q_f32(w); w = (const float*) w + 4;
243 #if XNN_ARCH_ARM64
244 vout0x89AB = vfmaq_f32(vbias89AB, vout0x89AB, vfilter_output_scale89AB);
245 vout1x89AB = vfmaq_f32(vbias89AB, vout1x89AB, vfilter_output_scale89AB);
246 vout2x89AB = vfmaq_f32(vbias89AB, vout2x89AB, vfilter_output_scale89AB);
247 vout3x89AB = vfmaq_f32(vbias89AB, vout3x89AB, vfilter_output_scale89AB);
248 #else
249 vout0x89AB = vmlaq_f32(vbias89AB, vout0x89AB, vfilter_output_scale89AB);
250 vout1x89AB = vmlaq_f32(vbias89AB, vout1x89AB, vfilter_output_scale89AB);
251 vout2x89AB = vmlaq_f32(vbias89AB, vout2x89AB, vfilter_output_scale89AB);
252 vout3x89AB = vmlaq_f32(vbias89AB, vout3x89AB, vfilter_output_scale89AB);
253 #endif
254 const float32x4_t vbiasCDEF = vld1q_f32(w); w = (const float*) w + 4;
255 #if XNN_ARCH_ARM64
256 vout0xCDEF = vfmaq_f32(vbiasCDEF, vout0xCDEF, vfilter_output_scaleCDEF);
257 vout1xCDEF = vfmaq_f32(vbiasCDEF, vout1xCDEF, vfilter_output_scaleCDEF);
258 vout2xCDEF = vfmaq_f32(vbiasCDEF, vout2xCDEF, vfilter_output_scaleCDEF);
259 vout3xCDEF = vfmaq_f32(vbiasCDEF, vout3xCDEF, vfilter_output_scaleCDEF);
260 #else
261 vout0xCDEF = vmlaq_f32(vbiasCDEF, vout0xCDEF, vfilter_output_scaleCDEF);
262 vout1xCDEF = vmlaq_f32(vbiasCDEF, vout1xCDEF, vfilter_output_scaleCDEF);
263 vout2xCDEF = vmlaq_f32(vbiasCDEF, vout2xCDEF, vfilter_output_scaleCDEF);
264 vout3xCDEF = vmlaq_f32(vbiasCDEF, vout3xCDEF, vfilter_output_scaleCDEF);
265 #endif
266
267 const float32x4_t voutput_min = vld1q_dup_f32(&params->scalar.min);
268 vout0x0123 = vmaxq_f32(vout0x0123, voutput_min);
269 vout0x4567 = vmaxq_f32(vout0x4567, voutput_min);
270 vout0x89AB = vmaxq_f32(vout0x89AB, voutput_min);
271 vout0xCDEF = vmaxq_f32(vout0xCDEF, voutput_min);
272 vout1x0123 = vmaxq_f32(vout1x0123, voutput_min);
273 vout1x4567 = vmaxq_f32(vout1x4567, voutput_min);
274 vout1x89AB = vmaxq_f32(vout1x89AB, voutput_min);
275 vout1xCDEF = vmaxq_f32(vout1xCDEF, voutput_min);
276 vout2x0123 = vmaxq_f32(vout2x0123, voutput_min);
277 vout2x4567 = vmaxq_f32(vout2x4567, voutput_min);
278 vout2x89AB = vmaxq_f32(vout2x89AB, voutput_min);
279 vout2xCDEF = vmaxq_f32(vout2xCDEF, voutput_min);
280 vout3x0123 = vmaxq_f32(vout3x0123, voutput_min);
281 vout3x4567 = vmaxq_f32(vout3x4567, voutput_min);
282 vout3x89AB = vmaxq_f32(vout3x89AB, voutput_min);
283 vout3xCDEF = vmaxq_f32(vout3xCDEF, voutput_min);
284
285 const float32x4_t voutput_max = vld1q_dup_f32(&params->scalar.max);
286 vout0x0123 = vminq_f32(vout0x0123, voutput_max);
287 vout0x4567 = vminq_f32(vout0x4567, voutput_max);
288 vout0x89AB = vminq_f32(vout0x89AB, voutput_max);
289 vout0xCDEF = vminq_f32(vout0xCDEF, voutput_max);
290 vout1x0123 = vminq_f32(vout1x0123, voutput_max);
291 vout1x4567 = vminq_f32(vout1x4567, voutput_max);
292 vout1x89AB = vminq_f32(vout1x89AB, voutput_max);
293 vout1xCDEF = vminq_f32(vout1xCDEF, voutput_max);
294 vout2x0123 = vminq_f32(vout2x0123, voutput_max);
295 vout2x4567 = vminq_f32(vout2x4567, voutput_max);
296 vout2x89AB = vminq_f32(vout2x89AB, voutput_max);
297 vout2xCDEF = vminq_f32(vout2xCDEF, voutput_max);
298 vout3x0123 = vminq_f32(vout3x0123, voutput_max);
299 vout3x4567 = vminq_f32(vout3x4567, voutput_max);
300 vout3x89AB = vminq_f32(vout3x89AB, voutput_max);
301 vout3xCDEF = vminq_f32(vout3xCDEF, voutput_max);
302
303 if XNN_LIKELY(nc >= 16) {
304 vst1q_f32(c0, vout0x0123);
305 vst1q_f32(c0 + 4, vout0x4567);
306 vst1q_f32(c0 + 8, vout0x89AB);
307 vst1q_f32(c0 + 12, vout0xCDEF);
308 vst1q_f32(c1, vout1x0123);
309 vst1q_f32(c1 + 4, vout1x4567);
310 vst1q_f32(c1 + 8, vout1x89AB);
311 vst1q_f32(c1 + 12, vout1xCDEF);
312 vst1q_f32(c2, vout2x0123);
313 vst1q_f32(c2 + 4, vout2x4567);
314 vst1q_f32(c2 + 8, vout2x89AB);
315 vst1q_f32(c2 + 12, vout2xCDEF);
316 vst1q_f32(c3, vout3x0123);
317 vst1q_f32(c3 + 4, vout3x4567);
318 vst1q_f32(c3 + 8, vout3x89AB);
319 vst1q_f32(c3 + 12, vout3xCDEF);
320
321 a0 = (const int8_t*) ((uintptr_t) a0 - kc);
322 a1 = (const int8_t*) ((uintptr_t) a1 - kc);
323 a2 = (const int8_t*) ((uintptr_t) a2 - kc);
324 a3 = (const int8_t*) ((uintptr_t) a3 - kc);
325
326 c0 = (float*) ((uintptr_t) c0 + cn_stride);
327 c1 = (float*) ((uintptr_t) c1 + cn_stride);
328 c2 = (float*) ((uintptr_t) c2 + cn_stride);
329 c3 = (float*) ((uintptr_t) c3 + cn_stride);
330
331 nc -= 16;
332 } else {
333 if (nc & 8) {
334 vst1q_f32(c0, vout0x0123); c0 += 4;
335 vout0x0123 = vout0x89AB;
336 vst1q_f32(c1, vout1x0123); c1 += 4;
337 vout1x0123 = vout1x89AB;
338 vst1q_f32(c2, vout2x0123); c2 += 4;
339 vout2x0123 = vout2x89AB;
340 vst1q_f32(c3, vout3x0123); c3 += 4;
341 vout3x0123 = vout3x89AB;
342 vst1q_f32(c0, vout0x4567); c0 += 4;
343 vout0x4567 = vout0xCDEF;
344 vst1q_f32(c1, vout1x4567); c1 += 4;
345 vout1x4567 = vout1xCDEF;
346 vst1q_f32(c2, vout2x4567); c2 += 4;
347 vout2x4567 = vout2xCDEF;
348 vst1q_f32(c3, vout3x4567); c3 += 4;
349 vout3x4567 = vout3xCDEF;
350 }
351 if (nc & 4) {
352 vst1q_f32(c0, vout0x0123); c0 += 4;
353 vout0x0123 = vout0x4567;
354 vst1q_f32(c1, vout1x0123); c1 += 4;
355 vout1x0123 = vout1x4567;
356 vst1q_f32(c2, vout2x0123); c2 += 4;
357 vout2x0123 = vout2x4567;
358 vst1q_f32(c3, vout3x0123); c3 += 4;
359 vout3x0123 = vout3x4567;
360 }
361 float32x2_t vout0x01 = vget_low_f32(vout0x0123);
362 float32x2_t vout1x01 = vget_low_f32(vout1x0123);
363 float32x2_t vout2x01 = vget_low_f32(vout2x0123);
364 float32x2_t vout3x01 = vget_low_f32(vout3x0123);
365 if (nc & 2) {
366 vst1_f32(c0, vout0x01); c0 += 2;
367 vst1_f32(c1, vout1x01); c1 += 2;
368 vst1_f32(c2, vout2x01); c2 += 2;
369 vst1_f32(c3, vout3x01); c3 += 2;
370 vout0x01 = vget_high_f32(vout0x0123);
371 vout1x01 = vget_high_f32(vout1x0123);
372 vout2x01 = vget_high_f32(vout2x0123);
373 vout3x01 = vget_high_f32(vout3x0123);
374 }
375 if (nc & 1) {
376 vst1_lane_f32(c0, vout0x01, 0);
377 vst1_lane_f32(c1, vout1x01, 0);
378 vst1_lane_f32(c2, vout2x01, 0);
379 vst1_lane_f32(c3, vout3x01, 0);
380 }
381 nc = 0;
382 }
383 } while (nc != 0);
384 }