Debian Codegraph @

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