Debian Codegraph @

src/f16-igemm/gen/f16-igemm-8x16-minmax-neonfp16arith-ld64.c

raw symbols SCIP
1 // Auto-generated file. Do not edit!
2 // Template: src/f16-igemm/neonfp16arith-ld64.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2019 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
11 #include <assert.h>
12
13 #include <arm_neon.h>
14
15 #include "xnnpack/igemm.h"
16 #include "xnnpack/intrinsics-polyfill.h"
17
18
19 void xnn_f16_igemm_minmax_ukernel_8x16__neonfp16arith_ld64(
20 size_t mr,
21 size_t nc,
22 size_t kc,
23 size_t ks,
24 const xnn_float16** restrict a,
25 const xnn_float16* restrict w,
26 xnn_float16* restrict c,
27 size_t cm_stride,
28 size_t cn_stride,
29 size_t a_offset,
30 const xnn_float16* zero,
31 const union xnn_f16_minmax_params params[restrict XNN_MIN_ELEMENTS(1)])
32 {
33 assert(mr != 0);
34 assert(mr <= 8);
35 assert(nc != 0);
36 assert(kc != 0);
37 assert(kc % sizeof(uint16_t) == 0);
38 assert(ks != 0);
39 assert(ks % (8 * sizeof(void*)) == 0);
40 assert(a_offset % sizeof(uint16_t) == 0);
41 assert(a != NULL);
42 assert(w != NULL);
43 assert(c != NULL);
44
45 uint16_t* c0 = (uint16_t*) c;
46 uint16_t* c1 = (uint16_t*) ((uintptr_t) c0 + cm_stride);
47 if XNN_UNPREDICTABLE(mr < 2) {
48 c1 = c0;
49 }
50 uint16_t* c2 = (uint16_t*) ((uintptr_t) c1 + cm_stride);
51 if XNN_UNPREDICTABLE(mr <= 2) {
52 c2 = c1;
53 }
54 uint16_t* c3 = (uint16_t*) ((uintptr_t) c2 + cm_stride);
55 if XNN_UNPREDICTABLE(mr < 4) {
56 c3 = c2;
57 }
58 uint16_t* c4 = (uint16_t*) ((uintptr_t) c3 + cm_stride);
59 if XNN_UNPREDICTABLE(mr <= 4) {
60 c4 = c3;
61 }
62 uint16_t* c5 = (uint16_t*) ((uintptr_t) c4 + cm_stride);
63 if XNN_UNPREDICTABLE(mr < 6) {
64 c5 = c4;
65 }
66 uint16_t* c6 = (uint16_t*) ((uintptr_t) c5 + cm_stride);
67 if XNN_UNPREDICTABLE(mr <= 6) {
68 c6 = c5;
69 }
70 uint16_t* c7 = (uint16_t*) ((uintptr_t) c6 + cm_stride);
71 if XNN_UNPREDICTABLE(mr != 8) {
72 c7 = c6;
73 }
74
75 do {
76 float16x8_t vacc0x0 = vreinterpretq_f16_u16(vld1q_u16((const uint16_t*) w)); w = (const xnn_float16*) w + 8;
77 float16x8_t vacc0x1 = vreinterpretq_f16_u16(vld1q_u16((const uint16_t*) w)); w = (const xnn_float16*) w + 8;
78 float16x8_t vacc1x0 = vacc0x0;
79 float16x8_t vacc1x1 = vacc0x1;
80 float16x8_t vacc2x0 = vacc0x0;
81 float16x8_t vacc2x1 = vacc0x1;
82 float16x8_t vacc3x0 = vacc0x0;
83 float16x8_t vacc3x1 = vacc0x1;
84 float16x8_t vacc4x0 = vacc0x0;
85 float16x8_t vacc4x1 = vacc0x1;
86 float16x8_t vacc5x0 = vacc0x0;
87 float16x8_t vacc5x1 = vacc0x1;
88 float16x8_t vacc6x0 = vacc0x0;
89 float16x8_t vacc6x1 = vacc0x1;
90 float16x8_t vacc7x0 = vacc0x0;
91 float16x8_t vacc7x1 = vacc0x1;
92
93 size_t p = ks;
94 do {
95 const uint16_t* restrict a0 = (const uint16_t*) a[0];
96 assert(a0 != NULL);
97 if XNN_UNPREDICTABLE(a0 != (const uint16_t*) zero) {
98 a0 = (const uint16_t*) ((uintptr_t) a0 + a_offset);
99 }
100 const uint16_t* restrict a1 = (const uint16_t*) a[1];
101 assert(a1 != NULL);
102 if XNN_UNPREDICTABLE(a1 != (const uint16_t*) zero) {
103 a1 = (const uint16_t*) ((uintptr_t) a1 + a_offset);
104 }
105 const uint16_t* restrict a2 = (const uint16_t*) a[2];
106 assert(a2 != NULL);
107 if XNN_UNPREDICTABLE(a2 != (const uint16_t*) zero) {
108 a2 = (const uint16_t*) ((uintptr_t) a2 + a_offset);
109 }
110 const uint16_t* restrict a3 = (const uint16_t*) a[3];
111 assert(a3 != NULL);
112 if XNN_UNPREDICTABLE(a3 != (const uint16_t*) zero) {
113 a3 = (const uint16_t*) ((uintptr_t) a3 + a_offset);
114 }
115 const uint16_t* restrict a4 = (const uint16_t*) a[4];
116 assert(a4 != NULL);
117 if XNN_UNPREDICTABLE(a4 != (const uint16_t*) zero) {
118 a4 = (const uint16_t*) ((uintptr_t) a4 + a_offset);
119 }
120 const uint16_t* restrict a5 = (const uint16_t*) a[5];
121 assert(a5 != NULL);
122 if XNN_UNPREDICTABLE(a5 != (const uint16_t*) zero) {
123 a5 = (const uint16_t*) ((uintptr_t) a5 + a_offset);
124 }
125 const uint16_t* restrict a6 = (const uint16_t*) a[6];
126 assert(a6 != NULL);
127 if XNN_UNPREDICTABLE(a6 != (const uint16_t*) zero) {
128 a6 = (const uint16_t*) ((uintptr_t) a6 + a_offset);
129 }
130 const uint16_t* restrict a7 = (const uint16_t*) a[7];
131 assert(a7 != NULL);
132 if XNN_UNPREDICTABLE(a7 != (const uint16_t*) zero) {
133 a7 = (const uint16_t*) ((uintptr_t) a7 + a_offset);
134 }
135 a += 8;
136
137 size_t k = kc;
138 for (; k >= 4 * sizeof(uint16_t); k -= 4 * sizeof(uint16_t)) {
139 const float16x4_t va0 = vreinterpret_f16_u16(vld1_u16(a0)); a0 += 4;
140 const float16x4_t va1 = vreinterpret_f16_u16(vld1_u16(a1)); a1 += 4;
141 const float16x4_t va2 = vreinterpret_f16_u16(vld1_u16(a2)); a2 += 4;
142 const float16x4_t va3 = vreinterpret_f16_u16(vld1_u16(a3)); a3 += 4;
143 const float16x4_t va4 = vreinterpret_f16_u16(vld1_u16(a4)); a4 += 4;
144 const float16x4_t va5 = vreinterpret_f16_u16(vld1_u16(a5)); a5 += 4;
145 const float16x4_t va6 = vreinterpret_f16_u16(vld1_u16(a6)); a6 += 4;
146 const float16x4_t va7 = vreinterpret_f16_u16(vld1_u16(a7)); a7 += 4;
147
148 const float16x8_t vb0c0 = vreinterpretq_f16_u16(vld1q_u16((const uint16_t*) w)); w = (const xnn_float16*) w + 8;
149 const float16x8_t vb1c0 = vreinterpretq_f16_u16(vld1q_u16((const uint16_t*) w)); w = (const xnn_float16*) w + 8;
150
151 #if XNN_ARCH_ARM64
152 vacc0x0 = vfmaq_lane_f16(vacc0x0, vb0c0, va0, 0);
153 vacc1x0 = vfmaq_lane_f16(vacc1x0, vb0c0, va1, 0);
154 vacc2x0 = vfmaq_lane_f16(vacc2x0, vb0c0, va2, 0);
155 vacc3x0 = vfmaq_lane_f16(vacc3x0, vb0c0, va3, 0);
156 vacc4x0 = vfmaq_lane_f16(vacc4x0, vb0c0, va4, 0);
157 vacc5x0 = vfmaq_lane_f16(vacc5x0, vb0c0, va5, 0);
158 vacc6x0 = vfmaq_lane_f16(vacc6x0, vb0c0, va6, 0);
159 vacc7x0 = vfmaq_lane_f16(vacc7x0, vb0c0, va7, 0);
160 vacc0x1 = vfmaq_lane_f16(vacc0x1, vb1c0, va0, 0);
161 vacc1x1 = vfmaq_lane_f16(vacc1x1, vb1c0, va1, 0);
162 vacc2x1 = vfmaq_lane_f16(vacc2x1, vb1c0, va2, 0);
163 vacc3x1 = vfmaq_lane_f16(vacc3x1, vb1c0, va3, 0);
164 vacc4x1 = vfmaq_lane_f16(vacc4x1, vb1c0, va4, 0);
165 vacc5x1 = vfmaq_lane_f16(vacc5x1, vb1c0, va5, 0);
166 vacc6x1 = vfmaq_lane_f16(vacc6x1, vb1c0, va6, 0);
167 vacc7x1 = vfmaq_lane_f16(vacc7x1, vb1c0, va7, 0);
168 #else
169 vacc0x0 = vmlaq_lane_f16(vacc0x0, vb0c0, va0, 0);
170 vacc1x0 = vmlaq_lane_f16(vacc1x0, vb0c0, va1, 0);
171 vacc2x0 = vmlaq_lane_f16(vacc2x0, vb0c0, va2, 0);
172 vacc3x0 = vmlaq_lane_f16(vacc3x0, vb0c0, va3, 0);
173 vacc4x0 = vmlaq_lane_f16(vacc4x0, vb0c0, va4, 0);
174 vacc5x0 = vmlaq_lane_f16(vacc5x0, vb0c0, va5, 0);
175 vacc6x0 = vmlaq_lane_f16(vacc6x0, vb0c0, va6, 0);
176 vacc7x0 = vmlaq_lane_f16(vacc7x0, vb0c0, va7, 0);
177 vacc0x1 = vmlaq_lane_f16(vacc0x1, vb1c0, va0, 0);
178 vacc1x1 = vmlaq_lane_f16(vacc1x1, vb1c0, va1, 0);
179 vacc2x1 = vmlaq_lane_f16(vacc2x1, vb1c0, va2, 0);
180 vacc3x1 = vmlaq_lane_f16(vacc3x1, vb1c0, va3, 0);
181 vacc4x1 = vmlaq_lane_f16(vacc4x1, vb1c0, va4, 0);
182 vacc5x1 = vmlaq_lane_f16(vacc5x1, vb1c0, va5, 0);
183 vacc6x1 = vmlaq_lane_f16(vacc6x1, vb1c0, va6, 0);
184 vacc7x1 = vmlaq_lane_f16(vacc7x1, vb1c0, va7, 0);
185 #endif
186 const float16x8_t vb0c1 = vreinterpretq_f16_u16(vld1q_u16((const uint16_t*) w)); w = (const xnn_float16*) w + 8;
187 const float16x8_t vb1c1 = vreinterpretq_f16_u16(vld1q_u16((const uint16_t*) w)); w = (const xnn_float16*) w + 8;
188
189 #if XNN_ARCH_ARM64
190 vacc0x0 = vfmaq_lane_f16(vacc0x0, vb0c1, va0, 1);
191 vacc1x0 = vfmaq_lane_f16(vacc1x0, vb0c1, va1, 1);
192 vacc2x0 = vfmaq_lane_f16(vacc2x0, vb0c1, va2, 1);
193 vacc3x0 = vfmaq_lane_f16(vacc3x0, vb0c1, va3, 1);
194 vacc4x0 = vfmaq_lane_f16(vacc4x0, vb0c1, va4, 1);
195 vacc5x0 = vfmaq_lane_f16(vacc5x0, vb0c1, va5, 1);
196 vacc6x0 = vfmaq_lane_f16(vacc6x0, vb0c1, va6, 1);
197 vacc7x0 = vfmaq_lane_f16(vacc7x0, vb0c1, va7, 1);
198 vacc0x1 = vfmaq_lane_f16(vacc0x1, vb1c1, va0, 1);
199 vacc1x1 = vfmaq_lane_f16(vacc1x1, vb1c1, va1, 1);
200 vacc2x1 = vfmaq_lane_f16(vacc2x1, vb1c1, va2, 1);
201 vacc3x1 = vfmaq_lane_f16(vacc3x1, vb1c1, va3, 1);
202 vacc4x1 = vfmaq_lane_f16(vacc4x1, vb1c1, va4, 1);
203 vacc5x1 = vfmaq_lane_f16(vacc5x1, vb1c1, va5, 1);
204 vacc6x1 = vfmaq_lane_f16(vacc6x1, vb1c1, va6, 1);
205 vacc7x1 = vfmaq_lane_f16(vacc7x1, vb1c1, va7, 1);
206 #else
207 vacc0x0 = vmlaq_lane_f16(vacc0x0, vb0c1, va0, 1);
208 vacc1x0 = vmlaq_lane_f16(vacc1x0, vb0c1, va1, 1);
209 vacc2x0 = vmlaq_lane_f16(vacc2x0, vb0c1, va2, 1);
210 vacc3x0 = vmlaq_lane_f16(vacc3x0, vb0c1, va3, 1);
211 vacc4x0 = vmlaq_lane_f16(vacc4x0, vb0c1, va4, 1);
212 vacc5x0 = vmlaq_lane_f16(vacc5x0, vb0c1, va5, 1);
213 vacc6x0 = vmlaq_lane_f16(vacc6x0, vb0c1, va6, 1);
214 vacc7x0 = vmlaq_lane_f16(vacc7x0, vb0c1, va7, 1);
215 vacc0x1 = vmlaq_lane_f16(vacc0x1, vb1c1, va0, 1);
216 vacc1x1 = vmlaq_lane_f16(vacc1x1, vb1c1, va1, 1);
217 vacc2x1 = vmlaq_lane_f16(vacc2x1, vb1c1, va2, 1);
218 vacc3x1 = vmlaq_lane_f16(vacc3x1, vb1c1, va3, 1);
219 vacc4x1 = vmlaq_lane_f16(vacc4x1, vb1c1, va4, 1);
220 vacc5x1 = vmlaq_lane_f16(vacc5x1, vb1c1, va5, 1);
221 vacc6x1 = vmlaq_lane_f16(vacc6x1, vb1c1, va6, 1);
222 vacc7x1 = vmlaq_lane_f16(vacc7x1, vb1c1, va7, 1);
223 #endif
224 const float16x8_t vb0c2 = vreinterpretq_f16_u16(vld1q_u16((const uint16_t*) w)); w = (const xnn_float16*) w + 8;
225 const float16x8_t vb1c2 = vreinterpretq_f16_u16(vld1q_u16((const uint16_t*) w)); w = (const xnn_float16*) w + 8;
226
227 #if XNN_ARCH_ARM64
228 vacc0x0 = vfmaq_lane_f16(vacc0x0, vb0c2, va0, 2);
229 vacc1x0 = vfmaq_lane_f16(vacc1x0, vb0c2, va1, 2);
230 vacc2x0 = vfmaq_lane_f16(vacc2x0, vb0c2, va2, 2);
231 vacc3x0 = vfmaq_lane_f16(vacc3x0, vb0c2, va3, 2);
232 vacc4x0 = vfmaq_lane_f16(vacc4x0, vb0c2, va4, 2);
233 vacc5x0 = vfmaq_lane_f16(vacc5x0, vb0c2, va5, 2);
234 vacc6x0 = vfmaq_lane_f16(vacc6x0, vb0c2, va6, 2);
235 vacc7x0 = vfmaq_lane_f16(vacc7x0, vb0c2, va7, 2);
236 vacc0x1 = vfmaq_lane_f16(vacc0x1, vb1c2, va0, 2);
237 vacc1x1 = vfmaq_lane_f16(vacc1x1, vb1c2, va1, 2);
238 vacc2x1 = vfmaq_lane_f16(vacc2x1, vb1c2, va2, 2);
239 vacc3x1 = vfmaq_lane_f16(vacc3x1, vb1c2, va3, 2);
240 vacc4x1 = vfmaq_lane_f16(vacc4x1, vb1c2, va4, 2);
241 vacc5x1 = vfmaq_lane_f16(vacc5x1, vb1c2, va5, 2);
242 vacc6x1 = vfmaq_lane_f16(vacc6x1, vb1c2, va6, 2);
243 vacc7x1 = vfmaq_lane_f16(vacc7x1, vb1c2, va7, 2);
244 #else
245 vacc0x0 = vmlaq_lane_f16(vacc0x0, vb0c2, va0, 2);
246 vacc1x0 = vmlaq_lane_f16(vacc1x0, vb0c2, va1, 2);
247 vacc2x0 = vmlaq_lane_f16(vacc2x0, vb0c2, va2, 2);
248 vacc3x0 = vmlaq_lane_f16(vacc3x0, vb0c2, va3, 2);
249 vacc4x0 = vmlaq_lane_f16(vacc4x0, vb0c2, va4, 2);
250 vacc5x0 = vmlaq_lane_f16(vacc5x0, vb0c2, va5, 2);
251 vacc6x0 = vmlaq_lane_f16(vacc6x0, vb0c2, va6, 2);
252 vacc7x0 = vmlaq_lane_f16(vacc7x0, vb0c2, va7, 2);
253 vacc0x1 = vmlaq_lane_f16(vacc0x1, vb1c2, va0, 2);
254 vacc1x1 = vmlaq_lane_f16(vacc1x1, vb1c2, va1, 2);
255 vacc2x1 = vmlaq_lane_f16(vacc2x1, vb1c2, va2, 2);
256 vacc3x1 = vmlaq_lane_f16(vacc3x1, vb1c2, va3, 2);
257 vacc4x1 = vmlaq_lane_f16(vacc4x1, vb1c2, va4, 2);
258 vacc5x1 = vmlaq_lane_f16(vacc5x1, vb1c2, va5, 2);
259 vacc6x1 = vmlaq_lane_f16(vacc6x1, vb1c2, va6, 2);
260 vacc7x1 = vmlaq_lane_f16(vacc7x1, vb1c2, va7, 2);
261 #endif
262 const float16x8_t vb0c3 = vreinterpretq_f16_u16(vld1q_u16((const uint16_t*) w)); w = (const xnn_float16*) w + 8;
263 const float16x8_t vb1c3 = vreinterpretq_f16_u16(vld1q_u16((const uint16_t*) w)); w = (const xnn_float16*) w + 8;
264
265 #if XNN_ARCH_ARM64
266 vacc0x0 = vfmaq_lane_f16(vacc0x0, vb0c3, va0, 3);
267 vacc1x0 = vfmaq_lane_f16(vacc1x0, vb0c3, va1, 3);
268 vacc2x0 = vfmaq_lane_f16(vacc2x0, vb0c3, va2, 3);
269 vacc3x0 = vfmaq_lane_f16(vacc3x0, vb0c3, va3, 3);
270 vacc4x0 = vfmaq_lane_f16(vacc4x0, vb0c3, va4, 3);
271 vacc5x0 = vfmaq_lane_f16(vacc5x0, vb0c3, va5, 3);
272 vacc6x0 = vfmaq_lane_f16(vacc6x0, vb0c3, va6, 3);
273 vacc7x0 = vfmaq_lane_f16(vacc7x0, vb0c3, va7, 3);
274 vacc0x1 = vfmaq_lane_f16(vacc0x1, vb1c3, va0, 3);
275 vacc1x1 = vfmaq_lane_f16(vacc1x1, vb1c3, va1, 3);
276 vacc2x1 = vfmaq_lane_f16(vacc2x1, vb1c3, va2, 3);
277 vacc3x1 = vfmaq_lane_f16(vacc3x1, vb1c3, va3, 3);
278 vacc4x1 = vfmaq_lane_f16(vacc4x1, vb1c3, va4, 3);
279 vacc5x1 = vfmaq_lane_f16(vacc5x1, vb1c3, va5, 3);
280 vacc6x1 = vfmaq_lane_f16(vacc6x1, vb1c3, va6, 3);
281 vacc7x1 = vfmaq_lane_f16(vacc7x1, vb1c3, va7, 3);
282 #else
283 vacc0x0 = vmlaq_lane_f16(vacc0x0, vb0c3, va0, 3);
284 vacc1x0 = vmlaq_lane_f16(vacc1x0, vb0c3, va1, 3);
285 vacc2x0 = vmlaq_lane_f16(vacc2x0, vb0c3, va2, 3);
286 vacc3x0 = vmlaq_lane_f16(vacc3x0, vb0c3, va3, 3);
287 vacc4x0 = vmlaq_lane_f16(vacc4x0, vb0c3, va4, 3);
288 vacc5x0 = vmlaq_lane_f16(vacc5x0, vb0c3, va5, 3);
289 vacc6x0 = vmlaq_lane_f16(vacc6x0, vb0c3, va6, 3);
290 vacc7x0 = vmlaq_lane_f16(vacc7x0, vb0c3, va7, 3);
291 vacc0x1 = vmlaq_lane_f16(vacc0x1, vb1c3, va0, 3);
292 vacc1x1 = vmlaq_lane_f16(vacc1x1, vb1c3, va1, 3);
293 vacc2x1 = vmlaq_lane_f16(vacc2x1, vb1c3, va2, 3);
294 vacc3x1 = vmlaq_lane_f16(vacc3x1, vb1c3, va3, 3);
295 vacc4x1 = vmlaq_lane_f16(vacc4x1, vb1c3, va4, 3);
296 vacc5x1 = vmlaq_lane_f16(vacc5x1, vb1c3, va5, 3);
297 vacc6x1 = vmlaq_lane_f16(vacc6x1, vb1c3, va6, 3);
298 vacc7x1 = vmlaq_lane_f16(vacc7x1, vb1c3, va7, 3);
299 #endif
300 }
301 if XNN_UNLIKELY(k != 0) {
302 do {
303 const float16x8_t va0 = vreinterpretq_f16_u16(vld1q_dup_u16(a0)); a0 += 1;
304 const float16x8_t va1 = vreinterpretq_f16_u16(vld1q_dup_u16(a1)); a1 += 1;
305 const float16x8_t va2 = vreinterpretq_f16_u16(vld1q_dup_u16(a2)); a2 += 1;
306 const float16x8_t va3 = vreinterpretq_f16_u16(vld1q_dup_u16(a3)); a3 += 1;
307 const float16x8_t va4 = vreinterpretq_f16_u16(vld1q_dup_u16(a4)); a4 += 1;
308 const float16x8_t va5 = vreinterpretq_f16_u16(vld1q_dup_u16(a5)); a5 += 1;
309 const float16x8_t va6 = vreinterpretq_f16_u16(vld1q_dup_u16(a6)); a6 += 1;
310 const float16x8_t va7 = vreinterpretq_f16_u16(vld1q_dup_u16(a7)); a7 += 1;
311
312 const float16x8_t vb0 = vreinterpretq_f16_u16(vld1q_u16((const uint16_t*) w)); w = (const xnn_float16*) w + 8;
313 const float16x8_t vb1 = vreinterpretq_f16_u16(vld1q_u16((const uint16_t*) w)); w = (const xnn_float16*) w + 8;
314
315 vacc0x0 = vfmaq_f16(vacc0x0, va0, vb0);
316 vacc1x0 = vfmaq_f16(vacc1x0, va1, vb0);
317 vacc2x0 = vfmaq_f16(vacc2x0, va2, vb0);
318 vacc3x0 = vfmaq_f16(vacc3x0, va3, vb0);
319 vacc4x0 = vfmaq_f16(vacc4x0, va4, vb0);
320 vacc5x0 = vfmaq_f16(vacc5x0, va5, vb0);
321 vacc6x0 = vfmaq_f16(vacc6x0, va6, vb0);
322 vacc7x0 = vfmaq_f16(vacc7x0, va7, vb0);
323 vacc0x1 = vfmaq_f16(vacc0x1, va0, vb1);
324 vacc1x1 = vfmaq_f16(vacc1x1, va1, vb1);
325 vacc2x1 = vfmaq_f16(vacc2x1, va2, vb1);
326 vacc3x1 = vfmaq_f16(vacc3x1, va3, vb1);
327 vacc4x1 = vfmaq_f16(vacc4x1, va4, vb1);
328 vacc5x1 = vfmaq_f16(vacc5x1, va5, vb1);
329 vacc6x1 = vfmaq_f16(vacc6x1, va6, vb1);
330 vacc7x1 = vfmaq_f16(vacc7x1, va7, vb1);
331
332 k -= sizeof(uint16_t);
333 } while (k != 0);
334 }
335 p -= 8 * sizeof(void*);
336 } while (p != 0);
337
338
339 const float16x8_t vmin = vreinterpretq_f16_u16(vld1q_dup_u16((const uint16_t*) &params->scalar.min));
340 vacc0x0 = vmaxq_f16(vacc0x0, vmin);
341 vacc1x0 = vmaxq_f16(vacc1x0, vmin);
342 vacc2x0 = vmaxq_f16(vacc2x0, vmin);
343 vacc3x0 = vmaxq_f16(vacc3x0, vmin);
344 vacc4x0 = vmaxq_f16(vacc4x0, vmin);
345 vacc5x0 = vmaxq_f16(vacc5x0, vmin);
346 vacc6x0 = vmaxq_f16(vacc6x0, vmin);
347 vacc7x0 = vmaxq_f16(vacc7x0, vmin);
348 vacc0x1 = vmaxq_f16(vacc0x1, vmin);
349 vacc1x1 = vmaxq_f16(vacc1x1, vmin);
350 vacc2x1 = vmaxq_f16(vacc2x1, vmin);
351 vacc3x1 = vmaxq_f16(vacc3x1, vmin);
352 vacc4x1 = vmaxq_f16(vacc4x1, vmin);
353 vacc5x1 = vmaxq_f16(vacc5x1, vmin);
354 vacc6x1 = vmaxq_f16(vacc6x1, vmin);
355 vacc7x1 = vmaxq_f16(vacc7x1, vmin);
356
357 const float16x8_t vmax = vreinterpretq_f16_u16(vld1q_dup_u16((const uint16_t*) &params->scalar.max));
358 vacc0x0 = vminq_f16(vacc0x0, vmax);
359 vacc1x0 = vminq_f16(vacc1x0, vmax);
360 vacc2x0 = vminq_f16(vacc2x0, vmax);
361 vacc3x0 = vminq_f16(vacc3x0, vmax);
362 vacc4x0 = vminq_f16(vacc4x0, vmax);
363 vacc5x0 = vminq_f16(vacc5x0, vmax);
364 vacc6x0 = vminq_f16(vacc6x0, vmax);
365 vacc7x0 = vminq_f16(vacc7x0, vmax);
366 vacc0x1 = vminq_f16(vacc0x1, vmax);
367 vacc1x1 = vminq_f16(vacc1x1, vmax);
368 vacc2x1 = vminq_f16(vacc2x1, vmax);
369 vacc3x1 = vminq_f16(vacc3x1, vmax);
370 vacc4x1 = vminq_f16(vacc4x1, vmax);
371 vacc5x1 = vminq_f16(vacc5x1, vmax);
372 vacc6x1 = vminq_f16(vacc6x1, vmax);
373 vacc7x1 = vminq_f16(vacc7x1, vmax);
374
375 if XNN_LIKELY(nc >= 16) {
376 vst1q_u16(c7, vreinterpretq_u16_f16(vacc7x0));
377 vst1q_u16(c7 + 8, vreinterpretq_u16_f16(vacc7x1));
378 c7 = (uint16_t*) ((uintptr_t) c7 + cn_stride);
379 vst1q_u16(c6, vreinterpretq_u16_f16(vacc6x0));
380 vst1q_u16(c6 + 8, vreinterpretq_u16_f16(vacc6x1));
381 c6 = (uint16_t*) ((uintptr_t) c6 + cn_stride);
382 vst1q_u16(c5, vreinterpretq_u16_f16(vacc5x0));
383 vst1q_u16(c5 + 8, vreinterpretq_u16_f16(vacc5x1));
384 c5 = (uint16_t*) ((uintptr_t) c5 + cn_stride);
385 vst1q_u16(c4, vreinterpretq_u16_f16(vacc4x0));
386 vst1q_u16(c4 + 8, vreinterpretq_u16_f16(vacc4x1));
387 c4 = (uint16_t*) ((uintptr_t) c4 + cn_stride);
388 vst1q_u16(c3, vreinterpretq_u16_f16(vacc3x0));
389 vst1q_u16(c3 + 8, vreinterpretq_u16_f16(vacc3x1));
390 c3 = (uint16_t*) ((uintptr_t) c3 + cn_stride);
391 vst1q_u16(c2, vreinterpretq_u16_f16(vacc2x0));
392 vst1q_u16(c2 + 8, vreinterpretq_u16_f16(vacc2x1));
393 c2 = (uint16_t*) ((uintptr_t) c2 + cn_stride);
394 vst1q_u16(c1, vreinterpretq_u16_f16(vacc1x0));
395 vst1q_u16(c1 + 8, vreinterpretq_u16_f16(vacc1x1));
396 c1 = (uint16_t*) ((uintptr_t) c1 + cn_stride);
397 vst1q_u16(c0, vreinterpretq_u16_f16(vacc0x0));
398 vst1q_u16(c0 + 8, vreinterpretq_u16_f16(vacc0x1));
399 c0 = (uint16_t*) ((uintptr_t) c0 + cn_stride);
400
401 a = (const xnn_float16**restrict) ((uintptr_t) a - ks);
402 nc -= 16;
403 } else {
404 if (nc & 8) {
405 vst1q_u16(c7, vreinterpretq_u16_f16(vacc7x0)); c7 += 8;
406 vst1q_u16(c6, vreinterpretq_u16_f16(vacc6x0)); c6 += 8;
407 vst1q_u16(c5, vreinterpretq_u16_f16(vacc5x0)); c5 += 8;
408 vst1q_u16(c4, vreinterpretq_u16_f16(vacc4x0)); c4 += 8;
409 vst1q_u16(c3, vreinterpretq_u16_f16(vacc3x0)); c3 += 8;
410 vst1q_u16(c2, vreinterpretq_u16_f16(vacc2x0)); c2 += 8;
411 vst1q_u16(c1, vreinterpretq_u16_f16(vacc1x0)); c1 += 8;
412 vst1q_u16(c0, vreinterpretq_u16_f16(vacc0x0)); c0 += 8;
413
414 vacc7x0 = vacc7x1;
415 vacc6x0 = vacc6x1;
416 vacc5x0 = vacc5x1;
417 vacc4x0 = vacc4x1;
418 vacc3x0 = vacc3x1;
419 vacc2x0 = vacc2x1;
420 vacc1x0 = vacc1x1;
421 vacc0x0 = vacc0x1;
422 }
423 float16x4_t vacc7 = vget_low_f16(vacc7x0);
424 float16x4_t vacc6 = vget_low_f16(vacc6x0);
425 float16x4_t vacc5 = vget_low_f16(vacc5x0);
426 float16x4_t vacc4 = vget_low_f16(vacc4x0);
427 float16x4_t vacc3 = vget_low_f16(vacc3x0);
428 float16x4_t vacc2 = vget_low_f16(vacc2x0);
429 float16x4_t vacc1 = vget_low_f16(vacc1x0);
430 float16x4_t vacc0 = vget_low_f16(vacc0x0);
431 if (nc & 4) {
432 vst1_u16(c7, vreinterpret_u16_f16(vacc7)); c7 += 4;
433 vst1_u16(c6, vreinterpret_u16_f16(vacc6)); c6 += 4;
434 vst1_u16(c5, vreinterpret_u16_f16(vacc5)); c5 += 4;
435 vst1_u16(c4, vreinterpret_u16_f16(vacc4)); c4 += 4;
436 vst1_u16(c3, vreinterpret_u16_f16(vacc3)); c3 += 4;
437 vst1_u16(c2, vreinterpret_u16_f16(vacc2)); c2 += 4;
438 vst1_u16(c1, vreinterpret_u16_f16(vacc1)); c1 += 4;
439 vst1_u16(c0, vreinterpret_u16_f16(vacc0)); c0 += 4;
440
441 vacc7 = vget_high_f16(vacc7x0);
442 vacc6 = vget_high_f16(vacc6x0);
443 vacc5 = vget_high_f16(vacc5x0);
444 vacc4 = vget_high_f16(vacc4x0);
445 vacc3 = vget_high_f16(vacc3x0);
446 vacc2 = vget_high_f16(vacc2x0);
447 vacc1 = vget_high_f16(vacc1x0);
448 vacc0 = vget_high_f16(vacc0x0);
449 }
450 if (nc & 2) {
451 vst1_lane_u32((void*) c7, vreinterpret_u32_f16(vacc7), 0); c7 += 2;
452 vst1_lane_u32((void*) c6, vreinterpret_u32_f16(vacc6), 0); c6 += 2;
453 vst1_lane_u32((void*) c5, vreinterpret_u32_f16(vacc5), 0); c5 += 2;
454 vst1_lane_u32((void*) c4, vreinterpret_u32_f16(vacc4), 0); c4 += 2;
455 vst1_lane_u32((void*) c3, vreinterpret_u32_f16(vacc3), 0); c3 += 2;
456 vst1_lane_u32((void*) c2, vreinterpret_u32_f16(vacc2), 0); c2 += 2;
457 vst1_lane_u32((void*) c1, vreinterpret_u32_f16(vacc1), 0); c1 += 2;
458 vst1_lane_u32((void*) c0, vreinterpret_u32_f16(vacc0), 0); c0 += 2;
459
460 vacc7 = vext_f16(vacc7, vacc7, 2);
461 vacc6 = vext_f16(vacc6, vacc6, 2);
462 vacc5 = vext_f16(vacc5, vacc5, 2);
463 vacc4 = vext_f16(vacc4, vacc4, 2);
464 vacc3 = vext_f16(vacc3, vacc3, 2);
465 vacc2 = vext_f16(vacc2, vacc2, 2);
466 vacc1 = vext_f16(vacc1, vacc1, 2);
467 vacc0 = vext_f16(vacc0, vacc0, 2);
468 }
469 if (nc & 1) {
470 vst1_lane_u16(c7, vreinterpret_u16_f16(vacc7), 0);
471 vst1_lane_u16(c6, vreinterpret_u16_f16(vacc6), 0);
472 vst1_lane_u16(c5, vreinterpret_u16_f16(vacc5), 0);
473 vst1_lane_u16(c4, vreinterpret_u16_f16(vacc4), 0);
474 vst1_lane_u16(c3, vreinterpret_u16_f16(vacc3), 0);
475 vst1_lane_u16(c2, vreinterpret_u16_f16(vacc2), 0);
476 vst1_lane_u16(c1, vreinterpret_u16_f16(vacc1), 0);
477 vst1_lane_u16(c0, vreinterpret_u16_f16(vacc0), 0);
478 }
479
480 nc = 0;
481 }
482 } while (nc != 0);
483 }