Debian Codegraph @

src/qd8-f16-qc8w-igemm/gen/qd8-f16-qc8w-igemm-2x32c4-minmax-neondotfp16arith.c

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/qs8-igemm/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/igemm.h"
15 #include "xnnpack/math.h"
16
17
18 void xnn_qd8_f16_qc8w_igemm_minmax_ukernel_2x32c4__neondotfp16arith(
19 size_t mr,
20 size_t nc,
21 size_t kc,
22 size_t ks,
23 const int8_t** restrict a,
24 const void* restrict w,
25 xnn_float16* restrict c,
26 size_t cm_stride,
27 size_t cn_stride,
28 size_t a_offset,
29 const int8_t* zero,
30 const int8_t* zero_data,
31 const union xnn_f16_minmax_params params[restrict XNN_MIN_ELEMENTS(1)],
32 const struct xnn_qd8_quantization_params quantization_params[restrict XNN_MIN_ELEMENTS(1)]) XNN_OOB_READS
33 {
34 assert(mr != 0);
35 assert(mr <= 2);
36 assert(nc != 0);
37 assert(kc != 0);
38 assert(ks != 0);
39 assert(ks % (2 * sizeof(void*)) == 0);
40 assert(a_offset % sizeof(int8_t) == 0);
41 assert(a != NULL);
42 assert(w != NULL);
43 assert(c != NULL);
44
45 kc = round_up_po2(kc, 4 * sizeof(int8_t));
46 uint16_t* c0 = (uint16_t*) c;
47 uint16_t* c1 = (uint16_t*) ((uintptr_t) c0 + cm_stride);
48 if XNN_UNPREDICTABLE(mr != 2) {
49 c1 = c0;
50 }
51
52 do {
53 const int32x4_t vinput_zero_point = vld1q_dup_s32(&quantization_params->zero_point);
54 const int32x4_t vksum0123 = vld1q_s32(w); w = (const int32_t*) w + 4;
55 int32x4_t vacc0x0123 = vmulq_s32(vksum0123, vinput_zero_point);
56 const int32x4_t vksum4567 = vld1q_s32(w); w = (const int32_t*) w + 4;
57 int32x4_t vacc0x4567 = vmulq_s32(vksum4567, vinput_zero_point);
58 const int32x4_t vksum89AB = vld1q_s32(w); w = (const int32_t*) w + 4;
59 int32x4_t vacc0x89AB = vmulq_s32(vksum89AB, vinput_zero_point);
60 const int32x4_t vksumCDEF = vld1q_s32(w); w = (const int32_t*) w + 4;
61 int32x4_t vacc0xCDEF = vmulq_s32(vksumCDEF, vinput_zero_point);
62 const int32x4_t vksumGHIJ = vld1q_s32(w); w = (const int32_t*) w + 4;
63 int32x4_t vacc0xGHIJ = vmulq_s32(vksumGHIJ, vinput_zero_point);
64 const int32x4_t vksumKLMN = vld1q_s32(w); w = (const int32_t*) w + 4;
65 int32x4_t vacc0xKLMN = vmulq_s32(vksumKLMN, vinput_zero_point);
66 const int32x4_t vksumOPQR = vld1q_s32(w); w = (const int32_t*) w + 4;
67 int32x4_t vacc0xOPQR = vmulq_s32(vksumOPQR, vinput_zero_point);
68 const int32x4_t vksumSTUV = vld1q_s32(w); w = (const int32_t*) w + 4;
69 int32x4_t vacc0xSTUV = vmulq_s32(vksumSTUV, vinput_zero_point);
70 int32x4_t vacc1x0123 = vacc0x0123;
71 int32x4_t vacc1x4567 = vacc0x4567;
72 int32x4_t vacc1x89AB = vacc0x89AB;
73 int32x4_t vacc1xCDEF = vacc0xCDEF;
74 int32x4_t vacc1xGHIJ = vacc0xGHIJ;
75 int32x4_t vacc1xKLMN = vacc0xKLMN;
76 int32x4_t vacc1xOPQR = vacc0xOPQR;
77 int32x4_t vacc1xSTUV = vacc0xSTUV;
78
79 size_t p = ks;
80 do {
81 const int8_t* restrict a0 = a[0];
82 if XNN_UNPREDICTABLE(a0 != zero) {
83 a0 = (const int8_t*) ((uintptr_t) a0 + a_offset);
84 } else {
85 a0 = zero_data;
86 }
87 const int8_t* restrict a1 = a[1];
88 if XNN_UNPREDICTABLE(a1 != zero) {
89 a1 = (const int8_t*) ((uintptr_t) a1 + a_offset);
90 } else {
91 a1 = zero_data;
92 }
93 a += 2;
94
95 // Inner accumulation loop along the 32 columns.
96 size_t k = kc;
97 // 2x partial unrolled loop to load 8 bytes at a time.
98 while (k >= 8 * sizeof(int8_t)) {
99 // Load a 2x8 block of activations.
100 const int8x8_t va0x01234567 = vld1_s8(a0); a0 += 8;
101 const int8x8_t va1x01234567 = vld1_s8(a1); a1 += 8;
102
103 // Load a 8x32 block of weights.
104 const int8x16_t vb0123x0123 = vld1q_s8(w); w = (const int8_t*) w + 16;
105 const int8x16_t vb0123x4567 = vld1q_s8(w); w = (const int8_t*) w + 16;
106 const int8x16_t vb0123x89AB = vld1q_s8(w); w = (const int8_t*) w + 16;
107 const int8x16_t vb0123xCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
108 const int8x16_t vb0123xGHIJ = vld1q_s8(w); w = (const int8_t*) w + 16;
109 const int8x16_t vb0123xKLMN = vld1q_s8(w); w = (const int8_t*) w + 16;
110 const int8x16_t vb0123xOPQR = vld1q_s8(w); w = (const int8_t*) w + 16;
111 const int8x16_t vb0123xSTUV = vld1q_s8(w); w = (const int8_t*) w + 16;
112 const int8x16_t vb4567x0123 = vld1q_s8(w); w = (const int8_t*) w + 16;
113 const int8x16_t vb4567x4567 = vld1q_s8(w); w = (const int8_t*) w + 16;
114 const int8x16_t vb4567x89AB = vld1q_s8(w); w = (const int8_t*) w + 16;
115 const int8x16_t vb4567xCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
116 const int8x16_t vb4567xGHIJ = vld1q_s8(w); w = (const int8_t*) w + 16;
117 const int8x16_t vb4567xKLMN = vld1q_s8(w); w = (const int8_t*) w + 16;
118 const int8x16_t vb4567xOPQR = vld1q_s8(w); w = (const int8_t*) w + 16;
119 const int8x16_t vb4567xSTUV = vld1q_s8(w); w = (const int8_t*) w + 16;
120
121 // Multiply-accumulate: 2x8 * 8x32 --> 2x32.
122 vacc0x0123 = vdotq_lane_s32(vacc0x0123, vb0123x0123, va0x01234567, 0);
123 vacc0x4567 = vdotq_lane_s32(vacc0x4567, vb0123x4567, va0x01234567, 0);
124 vacc0x89AB = vdotq_lane_s32(vacc0x89AB, vb0123x89AB, va0x01234567, 0);
125 vacc0xCDEF = vdotq_lane_s32(vacc0xCDEF, vb0123xCDEF, va0x01234567, 0);
126 vacc0xGHIJ = vdotq_lane_s32(vacc0xGHIJ, vb0123xGHIJ, va0x01234567, 0);
127 vacc0xKLMN = vdotq_lane_s32(vacc0xKLMN, vb0123xKLMN, va0x01234567, 0);
128 vacc0xOPQR = vdotq_lane_s32(vacc0xOPQR, vb0123xOPQR, va0x01234567, 0);
129 vacc0xSTUV = vdotq_lane_s32(vacc0xSTUV, vb0123xSTUV, va0x01234567, 0);
130 vacc1x0123 = vdotq_lane_s32(vacc1x0123, vb0123x0123, va1x01234567, 0);
131 vacc1x4567 = vdotq_lane_s32(vacc1x4567, vb0123x4567, va1x01234567, 0);
132 vacc1x89AB = vdotq_lane_s32(vacc1x89AB, vb0123x89AB, va1x01234567, 0);
133 vacc1xCDEF = vdotq_lane_s32(vacc1xCDEF, vb0123xCDEF, va1x01234567, 0);
134 vacc1xGHIJ = vdotq_lane_s32(vacc1xGHIJ, vb0123xGHIJ, va1x01234567, 0);
135 vacc1xKLMN = vdotq_lane_s32(vacc1xKLMN, vb0123xKLMN, va1x01234567, 0);
136 vacc1xOPQR = vdotq_lane_s32(vacc1xOPQR, vb0123xOPQR, va1x01234567, 0);
137 vacc1xSTUV = vdotq_lane_s32(vacc1xSTUV, vb0123xSTUV, va1x01234567, 0);
138 vacc0x0123 = vdotq_lane_s32(vacc0x0123, vb4567x0123, va0x01234567, 1);
139 vacc0x4567 = vdotq_lane_s32(vacc0x4567, vb4567x4567, va0x01234567, 1);
140 vacc0x89AB = vdotq_lane_s32(vacc0x89AB, vb4567x89AB, va0x01234567, 1);
141 vacc0xCDEF = vdotq_lane_s32(vacc0xCDEF, vb4567xCDEF, va0x01234567, 1);
142 vacc0xGHIJ = vdotq_lane_s32(vacc0xGHIJ, vb4567xGHIJ, va0x01234567, 1);
143 vacc0xKLMN = vdotq_lane_s32(vacc0xKLMN, vb4567xKLMN, va0x01234567, 1);
144 vacc0xOPQR = vdotq_lane_s32(vacc0xOPQR, vb4567xOPQR, va0x01234567, 1);
145 vacc0xSTUV = vdotq_lane_s32(vacc0xSTUV, vb4567xSTUV, va0x01234567, 1);
146 vacc1x0123 = vdotq_lane_s32(vacc1x0123, vb4567x0123, va1x01234567, 1);
147 vacc1x4567 = vdotq_lane_s32(vacc1x4567, vb4567x4567, va1x01234567, 1);
148 vacc1x89AB = vdotq_lane_s32(vacc1x89AB, vb4567x89AB, va1x01234567, 1);
149 vacc1xCDEF = vdotq_lane_s32(vacc1xCDEF, vb4567xCDEF, va1x01234567, 1);
150 vacc1xGHIJ = vdotq_lane_s32(vacc1xGHIJ, vb4567xGHIJ, va1x01234567, 1);
151 vacc1xKLMN = vdotq_lane_s32(vacc1xKLMN, vb4567xKLMN, va1x01234567, 1);
152 vacc1xOPQR = vdotq_lane_s32(vacc1xOPQR, vb4567xOPQR, va1x01234567, 1);
153 vacc1xSTUV = vdotq_lane_s32(vacc1xSTUV, vb4567xSTUV, va1x01234567, 1);
154
155 k -= 8 * sizeof(int8_t);
156 }
157 // Handle up to 4 final positions of `k`
158 if XNN_UNLIKELY(k != 0) {
159 // Load a 2x4 block of activations.
160 const int8x8_t va0x01234567 = vld1_s8(a0);
161 const int8x8_t va1x01234567 = vld1_s8(a1);
162
163 // Load a 4x32 block of weights.
164 const int8x16_t vb0123x0123 = vld1q_s8(w); w = (const int8_t*) w + 16;
165 const int8x16_t vb0123x4567 = vld1q_s8(w); w = (const int8_t*) w + 16;
166 const int8x16_t vb0123x89AB = vld1q_s8(w); w = (const int8_t*) w + 16;
167 const int8x16_t vb0123xCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
168 const int8x16_t vb0123xGHIJ = vld1q_s8(w); w = (const int8_t*) w + 16;
169 const int8x16_t vb0123xKLMN = vld1q_s8(w); w = (const int8_t*) w + 16;
170 const int8x16_t vb0123xOPQR = vld1q_s8(w); w = (const int8_t*) w + 16;
171 const int8x16_t vb0123xSTUV = vld1q_s8(w); w = (const int8_t*) w + 16;
172
173 // Multiply-accumulate: 2x4 * 4x32 --> 2x32.
174 vacc0x0123 = vdotq_lane_s32(vacc0x0123, vb0123x0123, va0x01234567, 0);
175 vacc0x4567 = vdotq_lane_s32(vacc0x4567, vb0123x4567, va0x01234567, 0);
176 vacc0x89AB = vdotq_lane_s32(vacc0x89AB, vb0123x89AB, va0x01234567, 0);
177 vacc0xCDEF = vdotq_lane_s32(vacc0xCDEF, vb0123xCDEF, va0x01234567, 0);
178 vacc0xGHIJ = vdotq_lane_s32(vacc0xGHIJ, vb0123xGHIJ, va0x01234567, 0);
179 vacc0xKLMN = vdotq_lane_s32(vacc0xKLMN, vb0123xKLMN, va0x01234567, 0);
180 vacc0xOPQR = vdotq_lane_s32(vacc0xOPQR, vb0123xOPQR, va0x01234567, 0);
181 vacc0xSTUV = vdotq_lane_s32(vacc0xSTUV, vb0123xSTUV, va0x01234567, 0);
182 vacc1x0123 = vdotq_lane_s32(vacc1x0123, vb0123x0123, va1x01234567, 0);
183 vacc1x4567 = vdotq_lane_s32(vacc1x4567, vb0123x4567, va1x01234567, 0);
184 vacc1x89AB = vdotq_lane_s32(vacc1x89AB, vb0123x89AB, va1x01234567, 0);
185 vacc1xCDEF = vdotq_lane_s32(vacc1xCDEF, vb0123xCDEF, va1x01234567, 0);
186 vacc1xGHIJ = vdotq_lane_s32(vacc1xGHIJ, vb0123xGHIJ, va1x01234567, 0);
187 vacc1xKLMN = vdotq_lane_s32(vacc1xKLMN, vb0123xKLMN, va1x01234567, 0);
188 vacc1xOPQR = vdotq_lane_s32(vacc1xOPQR, vb0123xOPQR, va1x01234567, 0);
189 vacc1xSTUV = vdotq_lane_s32(vacc1xSTUV, vb0123xSTUV, va1x01234567, 0);
190 }
191 p -= 2 * sizeof(void*);
192 } while (p != 0);
193
194 float32x4_t vout0x0123 = vcvtq_f32_s32(vacc0x0123);
195 float32x4_t vout0x4567 = vcvtq_f32_s32(vacc0x4567);
196 float32x4_t vout0x89AB = vcvtq_f32_s32(vacc0x89AB);
197 float32x4_t vout0xCDEF = vcvtq_f32_s32(vacc0xCDEF);
198 float32x4_t vout0xGHIJ = vcvtq_f32_s32(vacc0xGHIJ);
199 float32x4_t vout0xKLMN = vcvtq_f32_s32(vacc0xKLMN);
200 float32x4_t vout0xOPQR = vcvtq_f32_s32(vacc0xOPQR);
201 float32x4_t vout0xSTUV = vcvtq_f32_s32(vacc0xSTUV);
202 float32x4_t vout1x0123 = vcvtq_f32_s32(vacc1x0123);
203 float32x4_t vout1x4567 = vcvtq_f32_s32(vacc1x4567);
204 float32x4_t vout1x89AB = vcvtq_f32_s32(vacc1x89AB);
205 float32x4_t vout1xCDEF = vcvtq_f32_s32(vacc1xCDEF);
206 float32x4_t vout1xGHIJ = vcvtq_f32_s32(vacc1xGHIJ);
207 float32x4_t vout1xKLMN = vcvtq_f32_s32(vacc1xKLMN);
208 float32x4_t vout1xOPQR = vcvtq_f32_s32(vacc1xOPQR);
209 float32x4_t vout1xSTUV = vcvtq_f32_s32(vacc1xSTUV);
210 const float32x4_t vinput_scale = vld1q_dup_f32(&quantization_params->inv_scale);
211 vout0x0123 = vmulq_f32(vout0x0123, vinput_scale);
212 vout0x4567 = vmulq_f32(vout0x4567, vinput_scale);
213 vout0x89AB = vmulq_f32(vout0x89AB, vinput_scale);
214 vout0xCDEF = vmulq_f32(vout0xCDEF, vinput_scale);
215 vout0xGHIJ = vmulq_f32(vout0xGHIJ, vinput_scale);
216 vout0xKLMN = vmulq_f32(vout0xKLMN, vinput_scale);
217 vout0xOPQR = vmulq_f32(vout0xOPQR, vinput_scale);
218 vout0xSTUV = vmulq_f32(vout0xSTUV, vinput_scale);
219 vout1x0123 = vmulq_f32(vout1x0123, vinput_scale);
220 vout1x4567 = vmulq_f32(vout1x4567, vinput_scale);
221 vout1x89AB = vmulq_f32(vout1x89AB, vinput_scale);
222 vout1xCDEF = vmulq_f32(vout1xCDEF, vinput_scale);
223 vout1xGHIJ = vmulq_f32(vout1xGHIJ, vinput_scale);
224 vout1xKLMN = vmulq_f32(vout1xKLMN, vinput_scale);
225 vout1xOPQR = vmulq_f32(vout1xOPQR, vinput_scale);
226 vout1xSTUV = vmulq_f32(vout1xSTUV, vinput_scale);
227
228 const float32x4_t vfilter_output_scale0123 = vld1q_f32(w); w = (const float*) w + 4;
229 const float32x4_t vfilter_output_scale4567 = vld1q_f32(w); w = (const float*) w + 4;
230 const float32x4_t vfilter_output_scale89AB = vld1q_f32(w); w = (const float*) w + 4;
231 const float32x4_t vfilter_output_scaleCDEF = vld1q_f32(w); w = (const float*) w + 4;
232 const float32x4_t vfilter_output_scaleGHIJ = vld1q_f32(w); w = (const float*) w + 4;
233 const float32x4_t vfilter_output_scaleKLMN = vld1q_f32(w); w = (const float*) w + 4;
234 const float32x4_t vfilter_output_scaleOPQR = vld1q_f32(w); w = (const float*) w + 4;
235 const float32x4_t vfilter_output_scaleSTUV = vld1q_f32(w); w = (const float*) w + 4;
236
237 const float32x4_t vbias0123 = vld1q_f32(w); w = (const float*) w + 4;
238 #if XNN_ARCH_ARM64
239 vout0x0123 = vfmaq_f32(vbias0123, vout0x0123, vfilter_output_scale0123);
240 vout1x0123 = vfmaq_f32(vbias0123, vout1x0123, vfilter_output_scale0123);
241 #else
242 vout0x0123 = vmlaq_f32(vbias0123, vout0x0123, vfilter_output_scale0123);
243 vout1x0123 = vmlaq_f32(vbias0123, vout1x0123, vfilter_output_scale0123);
244 #endif
245 const float32x4_t vbias4567 = vld1q_f32(w); w = (const float*) w + 4;
246 #if XNN_ARCH_ARM64
247 vout0x4567 = vfmaq_f32(vbias4567, vout0x4567, vfilter_output_scale4567);
248 vout1x4567 = vfmaq_f32(vbias4567, vout1x4567, vfilter_output_scale4567);
249 #else
250 vout0x4567 = vmlaq_f32(vbias4567, vout0x4567, vfilter_output_scale4567);
251 vout1x4567 = vmlaq_f32(vbias4567, vout1x4567, vfilter_output_scale4567);
252 #endif
253 const float32x4_t vbias89AB = vld1q_f32(w); w = (const float*) w + 4;
254 #if XNN_ARCH_ARM64
255 vout0x89AB = vfmaq_f32(vbias89AB, vout0x89AB, vfilter_output_scale89AB);
256 vout1x89AB = vfmaq_f32(vbias89AB, vout1x89AB, vfilter_output_scale89AB);
257 #else
258 vout0x89AB = vmlaq_f32(vbias89AB, vout0x89AB, vfilter_output_scale89AB);
259 vout1x89AB = vmlaq_f32(vbias89AB, vout1x89AB, vfilter_output_scale89AB);
260 #endif
261 const float32x4_t vbiasCDEF = vld1q_f32(w); w = (const float*) w + 4;
262 #if XNN_ARCH_ARM64
263 vout0xCDEF = vfmaq_f32(vbiasCDEF, vout0xCDEF, vfilter_output_scaleCDEF);
264 vout1xCDEF = vfmaq_f32(vbiasCDEF, vout1xCDEF, vfilter_output_scaleCDEF);
265 #else
266 vout0xCDEF = vmlaq_f32(vbiasCDEF, vout0xCDEF, vfilter_output_scaleCDEF);
267 vout1xCDEF = vmlaq_f32(vbiasCDEF, vout1xCDEF, vfilter_output_scaleCDEF);
268 #endif
269 const float32x4_t vbiasGHIJ = vld1q_f32(w); w = (const float*) w + 4;
270 #if XNN_ARCH_ARM64
271 vout0xGHIJ = vfmaq_f32(vbiasGHIJ, vout0xGHIJ, vfilter_output_scaleGHIJ);
272 vout1xGHIJ = vfmaq_f32(vbiasGHIJ, vout1xGHIJ, vfilter_output_scaleGHIJ);
273 #else
274 vout0xGHIJ = vmlaq_f32(vbiasGHIJ, vout0xGHIJ, vfilter_output_scaleGHIJ);
275 vout1xGHIJ = vmlaq_f32(vbiasGHIJ, vout1xGHIJ, vfilter_output_scaleGHIJ);
276 #endif
277 const float32x4_t vbiasKLMN = vld1q_f32(w); w = (const float*) w + 4;
278 #if XNN_ARCH_ARM64
279 vout0xKLMN = vfmaq_f32(vbiasKLMN, vout0xKLMN, vfilter_output_scaleKLMN);
280 vout1xKLMN = vfmaq_f32(vbiasKLMN, vout1xKLMN, vfilter_output_scaleKLMN);
281 #else
282 vout0xKLMN = vmlaq_f32(vbiasKLMN, vout0xKLMN, vfilter_output_scaleKLMN);
283 vout1xKLMN = vmlaq_f32(vbiasKLMN, vout1xKLMN, vfilter_output_scaleKLMN);
284 #endif
285 const float32x4_t vbiasOPQR = vld1q_f32(w); w = (const float*) w + 4;
286 #if XNN_ARCH_ARM64
287 vout0xOPQR = vfmaq_f32(vbiasOPQR, vout0xOPQR, vfilter_output_scaleOPQR);
288 vout1xOPQR = vfmaq_f32(vbiasOPQR, vout1xOPQR, vfilter_output_scaleOPQR);
289 #else
290 vout0xOPQR = vmlaq_f32(vbiasOPQR, vout0xOPQR, vfilter_output_scaleOPQR);
291 vout1xOPQR = vmlaq_f32(vbiasOPQR, vout1xOPQR, vfilter_output_scaleOPQR);
292 #endif
293 const float32x4_t vbiasSTUV = vld1q_f32(w); w = (const float*) w + 4;
294 #if XNN_ARCH_ARM64
295 vout0xSTUV = vfmaq_f32(vbiasSTUV, vout0xSTUV, vfilter_output_scaleSTUV);
296 vout1xSTUV = vfmaq_f32(vbiasSTUV, vout1xSTUV, vfilter_output_scaleSTUV);
297 #else
298 vout0xSTUV = vmlaq_f32(vbiasSTUV, vout0xSTUV, vfilter_output_scaleSTUV);
299 vout1xSTUV = vmlaq_f32(vbiasSTUV, vout1xSTUV, vfilter_output_scaleSTUV);
300 #endif
301
302 float16x8_t vfp16out0x01234567 = vcombine_f16(vcvt_f16_f32(vout0x0123), vcvt_f16_f32(vout0x4567));
303 float16x8_t vfp16out0x89ABCDEF = vcombine_f16(vcvt_f16_f32(vout0x89AB), vcvt_f16_f32(vout0xCDEF));
304 float16x8_t vfp16out0xGHIJKLMN = vcombine_f16(vcvt_f16_f32(vout0xGHIJ), vcvt_f16_f32(vout0xKLMN));
305 float16x8_t vfp16out0xOPQRSTUV = vcombine_f16(vcvt_f16_f32(vout0xOPQR), vcvt_f16_f32(vout0xSTUV));
306 float16x8_t vfp16out1x01234567 = vcombine_f16(vcvt_f16_f32(vout1x0123), vcvt_f16_f32(vout1x4567));
307 float16x8_t vfp16out1x89ABCDEF = vcombine_f16(vcvt_f16_f32(vout1x89AB), vcvt_f16_f32(vout1xCDEF));
308 float16x8_t vfp16out1xGHIJKLMN = vcombine_f16(vcvt_f16_f32(vout1xGHIJ), vcvt_f16_f32(vout1xKLMN));
309 float16x8_t vfp16out1xOPQRSTUV = vcombine_f16(vcvt_f16_f32(vout1xOPQR), vcvt_f16_f32(vout1xSTUV));
310
311 const float16x8_t voutput_min = vreinterpretq_f16_u16(vld1q_dup_u16((const uint16_t*) &params->scalar.min));
312 vfp16out0x01234567 = vmaxq_f16(vfp16out0x01234567, voutput_min);
313 vfp16out0x89ABCDEF = vmaxq_f16(vfp16out0x89ABCDEF, voutput_min);
314 vfp16out0xGHIJKLMN = vmaxq_f16(vfp16out0xGHIJKLMN, voutput_min);
315 vfp16out0xOPQRSTUV = vmaxq_f16(vfp16out0xOPQRSTUV, voutput_min);
316 vfp16out1x01234567 = vmaxq_f16(vfp16out1x01234567, voutput_min);
317 vfp16out1x89ABCDEF = vmaxq_f16(vfp16out1x89ABCDEF, voutput_min);
318 vfp16out1xGHIJKLMN = vmaxq_f16(vfp16out1xGHIJKLMN, voutput_min);
319 vfp16out1xOPQRSTUV = vmaxq_f16(vfp16out1xOPQRSTUV, voutput_min);
320 const float16x8_t voutput_max = vreinterpretq_f16_u16(vld1q_dup_u16((const uint16_t*) &params->scalar.max));
321 vfp16out0x01234567 = vminq_f16(vfp16out0x01234567, voutput_max);
322 vfp16out0x89ABCDEF = vminq_f16(vfp16out0x89ABCDEF, voutput_max);
323 vfp16out0xGHIJKLMN = vminq_f16(vfp16out0xGHIJKLMN, voutput_max);
324 vfp16out0xOPQRSTUV = vminq_f16(vfp16out0xOPQRSTUV, voutput_max);
325 vfp16out1x01234567 = vminq_f16(vfp16out1x01234567, voutput_max);
326 vfp16out1x89ABCDEF = vminq_f16(vfp16out1x89ABCDEF, voutput_max);
327 vfp16out1xGHIJKLMN = vminq_f16(vfp16out1xGHIJKLMN, voutput_max);
328 vfp16out1xOPQRSTUV = vminq_f16(vfp16out1xOPQRSTUV, voutput_max);
329 if XNN_LIKELY(nc >= 32) {
330 vst1q_u16(c1, vreinterpretq_u16_f16(vfp16out1x01234567));
331 vst1q_u16(c1 + 8, vreinterpretq_u16_f16(vfp16out1x89ABCDEF));
332 vst1q_u16(c1 + 16, vreinterpretq_u16_f16(vfp16out1xGHIJKLMN));
333 vst1q_u16(c1 + 24, vreinterpretq_u16_f16(vfp16out1xOPQRSTUV));
334 vst1q_u16(c0, vreinterpretq_u16_f16(vfp16out0x01234567));
335 vst1q_u16(c0 + 8, vreinterpretq_u16_f16(vfp16out0x89ABCDEF));
336 vst1q_u16(c0 + 16, vreinterpretq_u16_f16(vfp16out0xGHIJKLMN));
337 vst1q_u16(c0 + 24, vreinterpretq_u16_f16(vfp16out0xOPQRSTUV));
338
339 a = (const int8_t**restrict) ((uintptr_t) a - ks);
340
341 c0 = (uint16_t*) ((uintptr_t) c0 + cn_stride);
342 c1 = (uint16_t*) ((uintptr_t) c1 + cn_stride);
343
344 nc -= 32;
345 } else {
346 if (nc & 16) {
347 vst1q_u16(c1, vreinterpretq_u16_f16(vfp16out1x01234567)); c1 += 8;
348 vfp16out1x01234567 = vfp16out1xGHIJKLMN;
349 vst1q_u16(c0, vreinterpretq_u16_f16(vfp16out0x01234567)); c0 += 8;
350 vfp16out0x01234567 = vfp16out0xGHIJKLMN;
351 vst1q_u16(c1, vreinterpretq_u16_f16(vfp16out1x89ABCDEF)); c1 += 8;
352 vfp16out1x89ABCDEF = vfp16out1xOPQRSTUV;
353 vst1q_u16(c0, vreinterpretq_u16_f16(vfp16out0x89ABCDEF)); c0 += 8;
354 vfp16out0x89ABCDEF = vfp16out0xOPQRSTUV;
355 }
356 if (nc & 8) {
357 vst1q_u16(c1, vreinterpretq_u16_f16(vfp16out1x01234567)); c1 += 8;
358 vfp16out1x01234567 = vfp16out1x89ABCDEF;
359 vst1q_u16(c0, vreinterpretq_u16_f16(vfp16out0x01234567)); c0 += 8;
360 vfp16out0x01234567 = vfp16out0x89ABCDEF;
361 }
362 float16x4_t vfp16out1x0123 = vget_low_f16(vfp16out1x01234567);
363 float16x4_t vfp16out0x0123 = vget_low_f16(vfp16out0x01234567);
364 if (nc & 4) {
365 vst1_u16(c1, vreinterpret_u16_f16(vfp16out1x0123)); c1 += 4;
366 vst1_u16(c0, vreinterpret_u16_f16(vfp16out0x0123)); c0 += 4;
367 vfp16out1x0123 = vget_high_f16(vfp16out1x01234567);
368 vfp16out0x0123 = vget_high_f16(vfp16out0x01234567);
369 }
370 if (nc & 2) {
371 vst1_lane_u32((void*) c1, vreinterpret_u32_f16(vfp16out1x0123), 0); c1 += 2;
372 vst1_lane_u32((void*) c0, vreinterpret_u32_f16(vfp16out0x0123), 0); c0 += 2;
373 vfp16out1x0123 = vext_f16(vfp16out1x0123, vfp16out1x0123, 2);
374 vfp16out0x0123 = vext_f16(vfp16out0x0123, vfp16out0x0123, 2);
375 }
376 if (nc & 1) {
377 vst1_lane_u16(c1, vreinterpret_u16_f16(vfp16out1x0123), 0);
378 vst1_lane_u16(c0, vreinterpret_u16_f16(vfp16out0x0123), 0);
379 }
380 nc = 0;
381 }
382 } while (nc != 0);
383 }