Debian Codegraph @

src/qd8-f16-qc4w-gemm/gen/qd8-f16-qc4w-gemm-6x16c8-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_f16_qc4w_gemm_minmax_ukernel_6x16c8__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 xnn_float16* restrict c,
26 size_t cm_stride,
27 size_t cn_stride,
28 const struct xnn_f16_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 <= 6);
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 uint16_t* c0 = (uint16_t*) c;
43 const int8_t* a1 = (const int8_t*) ((uintptr_t) a0 + a_stride);
44 uint16_t* c1 = (uint16_t*) ((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 uint16_t* c2 = (uint16_t*) ((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 uint16_t* c3 = (uint16_t*) ((uintptr_t) c2 + cm_stride);
57 if XNN_UNPREDICTABLE(mr < 4) {
58 a3 = a2;
59 c3 = c2;
60 }
61 const int8_t* a4 = (const int8_t*) ((uintptr_t) a3 + a_stride);
62 uint16_t* c4 = (uint16_t*) ((uintptr_t) c3 + cm_stride);
63 if XNN_UNPREDICTABLE(mr <= 4) {
64 a4 = a3;
65 c4 = c3;
66 }
67 const int8_t* a5 = (const int8_t*) ((uintptr_t) a4 + a_stride);
68 uint16_t* c5 = (uint16_t*) ((uintptr_t) c4 + cm_stride);
69 if XNN_UNPREDICTABLE(mr != 6) {
70 a5 = a4;
71 c5 = c4;
72 }
73 const int8x16_t vmask = vmovq_n_s8(INT8_C(0xF0));
74
75 // Loop over groups of 16 columns.
76 do {
77 // Initialize accumulators with bias. 16 bias values are loaded from the
78 // weight matrix, at the start of the group of 16 columns.
79 const int32x4_t vinput_zero_point01 = vld1q_s32(&quantization_params[0].zero_point);
80 const int32x4_t vksum0123 = vld1q_s32(w); w = (const int32_t*) w + 4;
81 const int32x4_t vksumzp0x0123 = vmulq_lane_s32(vksum0123, vget_low_s32(vinput_zero_point01), 0);
82 const int32x4_t vksumzp1x0123 = vmulq_lane_s32(vksum0123, vget_high_s32(vinput_zero_point01), 0);
83 const int32x4_t vksum4567 = vld1q_s32(w); w = (const int32_t*) w + 4;
84 const int32x4_t vksumzp0x4567 = vmulq_lane_s32(vksum4567, vget_low_s32(vinput_zero_point01), 0);
85 const int32x4_t vksumzp1x4567 = vmulq_lane_s32(vksum4567, vget_high_s32(vinput_zero_point01), 0);
86 const int32x4_t vksum89AB = vld1q_s32(w); w = (const int32_t*) w + 4;
87 const int32x4_t vksumzp0x89AB = vmulq_lane_s32(vksum89AB, vget_low_s32(vinput_zero_point01), 0);
88 const int32x4_t vksumzp1x89AB = vmulq_lane_s32(vksum89AB, vget_high_s32(vinput_zero_point01), 0);
89 const int32x4_t vksumCDEF = vld1q_s32(w); w = (const int32_t*) w + 4;
90 const int32x4_t vksumzp0xCDEF = vmulq_lane_s32(vksumCDEF, vget_low_s32(vinput_zero_point01), 0);
91 const int32x4_t vksumzp1xCDEF = vmulq_lane_s32(vksumCDEF, vget_high_s32(vinput_zero_point01), 0);
92 const int32x4_t vinput_zero_point23 = vld1q_s32(&quantization_params[2].zero_point);
93 const int32x4_t vksumzp2x0123 = vmulq_lane_s32(vksum0123, vget_low_s32(vinput_zero_point23), 0);
94 const int32x4_t vksumzp3x0123 = vmulq_lane_s32(vksum0123, vget_high_s32(vinput_zero_point23), 0);
95 const int32x4_t vksumzp2x4567 = vmulq_lane_s32(vksum4567, vget_low_s32(vinput_zero_point23), 0);
96 const int32x4_t vksumzp3x4567 = vmulq_lane_s32(vksum4567, vget_high_s32(vinput_zero_point23), 0);
97 const int32x4_t vksumzp2x89AB = vmulq_lane_s32(vksum89AB, vget_low_s32(vinput_zero_point23), 0);
98 const int32x4_t vksumzp3x89AB = vmulq_lane_s32(vksum89AB, vget_high_s32(vinput_zero_point23), 0);
99 const int32x4_t vksumzp2xCDEF = vmulq_lane_s32(vksumCDEF, vget_low_s32(vinput_zero_point23), 0);
100 const int32x4_t vksumzp3xCDEF = vmulq_lane_s32(vksumCDEF, vget_high_s32(vinput_zero_point23), 0);
101 const int32x4_t vinput_zero_point45 = vld1q_s32(&quantization_params[4].zero_point);
102 const int32x4_t vksumzp4x0123 = vmulq_lane_s32(vksum0123, vget_low_s32(vinput_zero_point45), 0);
103 const int32x4_t vksumzp5x0123 = vmulq_lane_s32(vksum0123, vget_high_s32(vinput_zero_point45), 0);
104 const int32x4_t vksumzp4x4567 = vmulq_lane_s32(vksum4567, vget_low_s32(vinput_zero_point45), 0);
105 const int32x4_t vksumzp5x4567 = vmulq_lane_s32(vksum4567, vget_high_s32(vinput_zero_point45), 0);
106 const int32x4_t vksumzp4x89AB = vmulq_lane_s32(vksum89AB, vget_low_s32(vinput_zero_point45), 0);
107 const int32x4_t vksumzp5x89AB = vmulq_lane_s32(vksum89AB, vget_high_s32(vinput_zero_point45), 0);
108 const int32x4_t vksumzp4xCDEF = vmulq_lane_s32(vksumCDEF, vget_low_s32(vinput_zero_point45), 0);
109 const int32x4_t vksumzp5xCDEF = vmulq_lane_s32(vksumCDEF, vget_high_s32(vinput_zero_point45), 0);
110
111 int32x4_t vacc01x01 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp0x0123), vreinterpretq_u64_s32(vksumzp1x0123)));
112 int32x4_t vacc01x23 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp0x0123), vreinterpretq_u64_s32(vksumzp1x0123)));
113 int32x4_t vacc01x45 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp0x4567), vreinterpretq_u64_s32(vksumzp1x4567)));
114 int32x4_t vacc01x67 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp0x4567), vreinterpretq_u64_s32(vksumzp1x4567)));
115 int32x4_t vacc01x89 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp0x89AB), vreinterpretq_u64_s32(vksumzp1x89AB)));
116 int32x4_t vacc01xAB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp0x89AB), vreinterpretq_u64_s32(vksumzp1x89AB)));
117 int32x4_t vacc01xCD = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp0xCDEF), vreinterpretq_u64_s32(vksumzp1xCDEF)));
118 int32x4_t vacc01xEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp0xCDEF), vreinterpretq_u64_s32(vksumzp1xCDEF)));
119 int32x4_t vacc23x01 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp2x0123), vreinterpretq_u64_s32(vksumzp3x0123)));
120 int32x4_t vacc23x23 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp2x0123), vreinterpretq_u64_s32(vksumzp3x0123)));
121 int32x4_t vacc23x45 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp2x4567), vreinterpretq_u64_s32(vksumzp3x4567)));
122 int32x4_t vacc23x67 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp2x4567), vreinterpretq_u64_s32(vksumzp3x4567)));
123 int32x4_t vacc23x89 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp2x89AB), vreinterpretq_u64_s32(vksumzp3x89AB)));
124 int32x4_t vacc23xAB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp2x89AB), vreinterpretq_u64_s32(vksumzp3x89AB)));
125 int32x4_t vacc23xCD = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp2xCDEF), vreinterpretq_u64_s32(vksumzp3xCDEF)));
126 int32x4_t vacc23xEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp2xCDEF), vreinterpretq_u64_s32(vksumzp3xCDEF)));
127 int32x4_t vacc45x01 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp4x0123), vreinterpretq_u64_s32(vksumzp5x0123)));
128 int32x4_t vacc45x23 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp4x0123), vreinterpretq_u64_s32(vksumzp5x0123)));
129 int32x4_t vacc45x45 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp4x4567), vreinterpretq_u64_s32(vksumzp5x4567)));
130 int32x4_t vacc45x67 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp4x4567), vreinterpretq_u64_s32(vksumzp5x4567)));
131 int32x4_t vacc45x89 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp4x89AB), vreinterpretq_u64_s32(vksumzp5x89AB)));
132 int32x4_t vacc45xAB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp4x89AB), vreinterpretq_u64_s32(vksumzp5x89AB)));
133 int32x4_t vacc45xCD = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp4xCDEF), vreinterpretq_u64_s32(vksumzp5xCDEF)));
134 int32x4_t vacc45xEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp4xCDEF), vreinterpretq_u64_s32(vksumzp5xCDEF)));
135
136 // Inner accumulation loop along the 16 columns.
137 size_t k = kc;
138 // 2x partial unrolled loop to load 8 bytes at a time.
139
140 uint64x2x2_t va01x0123456789ABCDEF;
141 va01x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
142 va01x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
143 uint64x2x2_t va23x0123456789ABCDEF;
144 va23x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
145 va23x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
146 uint64x2x2_t va45x0123456789ABCDEF;
147 va45x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
148 va45x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
149
150 while (k >= 16 * sizeof(int8_t)) {
151 // Load a 6x16 block of activations.
152 va01x0123456789ABCDEF = vld2q_lane_u64((const void*) a0, va01x0123456789ABCDEF, 0); a0 += 16;
153 va23x0123456789ABCDEF = vld2q_lane_u64((const void*) a2, va23x0123456789ABCDEF, 0); a2 += 16;
154 va45x0123456789ABCDEF = vld2q_lane_u64((const void*) a4, va45x0123456789ABCDEF, 0); a4 += 16;
155 va01x0123456789ABCDEF = vld2q_lane_u64((const void*) a1, va01x0123456789ABCDEF, 1); a1 += 16;
156 va23x0123456789ABCDEF = vld2q_lane_u64((const void*) a3, va23x0123456789ABCDEF, 1); a3 += 16;
157 va45x0123456789ABCDEF = vld2q_lane_u64((const void*) a5, va45x0123456789ABCDEF, 1); a5 += 16;
158
159 const int8x16_t va01x01234567 = vreinterpretq_s8_u64(va01x0123456789ABCDEF.val[0]);
160 const int8x16_t va01x89ABCDEF = vreinterpretq_s8_u64(va01x0123456789ABCDEF.val[1]);
161 const int8x16_t va23x01234567 = vreinterpretq_s8_u64(va23x0123456789ABCDEF.val[0]);
162 const int8x16_t va23x89ABCDEF = vreinterpretq_s8_u64(va23x0123456789ABCDEF.val[1]);
163 const int8x16_t va45x01234567 = vreinterpretq_s8_u64(va45x0123456789ABCDEF.val[0]);
164 const int8x16_t va45x89ABCDEF = vreinterpretq_s8_u64(va45x0123456789ABCDEF.val[1]);
165
166 // Load a 16x16 block of weights.
167 const int8x16_t vb01x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
168 const int8x16_t vb23x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
169 const int8x16_t vb45x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
170 const int8x16_t vb67x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
171 const int8x16_t vb89x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
172 const int8x16_t vbABx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
173 const int8x16_t vbCDx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
174 const int8x16_t vbEFx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
175 const int8x16_t vb01x01234567 = vshlq_n_s8(vb01x0123456789ABCDEF, 4);
176 const int8x16_t vb23x01234567 = vshlq_n_s8(vb23x0123456789ABCDEF, 4);
177 const int8x16_t vb45x01234567 = vshlq_n_s8(vb45x0123456789ABCDEF, 4);
178 const int8x16_t vb67x01234567 = vshlq_n_s8(vb67x0123456789ABCDEF, 4);
179 const int8x16_t vb89x01234567 = vshlq_n_s8(vb89x0123456789ABCDEF, 4);
180 const int8x16_t vbABx01234567 = vshlq_n_s8(vbABx0123456789ABCDEF, 4);
181 const int8x16_t vbCDx01234567 = vshlq_n_s8(vbCDx0123456789ABCDEF, 4);
182 const int8x16_t vbEFx01234567 = vshlq_n_s8(vbEFx0123456789ABCDEF, 4);
183 const int8x16_t vb01x89ABCDEF = vandq_s8(vb01x0123456789ABCDEF, vmask);
184 const int8x16_t vb23x89ABCDEF = vandq_s8(vb23x0123456789ABCDEF, vmask);
185 const int8x16_t vb45x89ABCDEF = vandq_s8(vb45x0123456789ABCDEF, vmask);
186 const int8x16_t vb67x89ABCDEF = vandq_s8(vb67x0123456789ABCDEF, vmask);
187 const int8x16_t vb89x89ABCDEF = vandq_s8(vb89x0123456789ABCDEF, vmask);
188 const int8x16_t vbABx89ABCDEF = vandq_s8(vbABx0123456789ABCDEF, vmask);
189 const int8x16_t vbCDx89ABCDEF = vandq_s8(vbCDx0123456789ABCDEF, vmask);
190 const int8x16_t vbEFx89ABCDEF = vandq_s8(vbEFx0123456789ABCDEF, vmask);
191
192 // Multiply-accumulate: 6x8 * 8x16 --> 6x16.
193 vacc01x01 = vmmlaq_s32(vacc01x01, va01x01234567, vb01x01234567);
194 vacc01x23 = vmmlaq_s32(vacc01x23, va01x01234567, vb23x01234567);
195 vacc01x45 = vmmlaq_s32(vacc01x45, va01x01234567, vb45x01234567);
196 vacc01x67 = vmmlaq_s32(vacc01x67, va01x01234567, vb67x01234567);
197 vacc01x89 = vmmlaq_s32(vacc01x89, va01x01234567, vb89x01234567);
198 vacc01xAB = vmmlaq_s32(vacc01xAB, va01x01234567, vbABx01234567);
199 vacc01xCD = vmmlaq_s32(vacc01xCD, va01x01234567, vbCDx01234567);
200 vacc01xEF = vmmlaq_s32(vacc01xEF, va01x01234567, vbEFx01234567);
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 vacc45x01 = vmmlaq_s32(vacc45x01, va45x01234567, vb01x01234567);
210 vacc45x23 = vmmlaq_s32(vacc45x23, va45x01234567, vb23x01234567);
211 vacc45x45 = vmmlaq_s32(vacc45x45, va45x01234567, vb45x01234567);
212 vacc45x67 = vmmlaq_s32(vacc45x67, va45x01234567, vb67x01234567);
213 vacc45x89 = vmmlaq_s32(vacc45x89, va45x01234567, vb89x01234567);
214 vacc45xAB = vmmlaq_s32(vacc45xAB, va45x01234567, vbABx01234567);
215 vacc45xCD = vmmlaq_s32(vacc45xCD, va45x01234567, vbCDx01234567);
216 vacc45xEF = vmmlaq_s32(vacc45xEF, va45x01234567, vbEFx01234567);
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 vacc23x01 = vmmlaq_s32(vacc23x01, va23x89ABCDEF, vb01x89ABCDEF);
226 vacc23x23 = vmmlaq_s32(vacc23x23, va23x89ABCDEF, vb23x89ABCDEF);
227 vacc23x45 = vmmlaq_s32(vacc23x45, va23x89ABCDEF, vb45x89ABCDEF);
228 vacc23x67 = vmmlaq_s32(vacc23x67, va23x89ABCDEF, vb67x89ABCDEF);
229 vacc23x89 = vmmlaq_s32(vacc23x89, va23x89ABCDEF, vb89x89ABCDEF);
230 vacc23xAB = vmmlaq_s32(vacc23xAB, va23x89ABCDEF, vbABx89ABCDEF);
231 vacc23xCD = vmmlaq_s32(vacc23xCD, va23x89ABCDEF, vbCDx89ABCDEF);
232 vacc23xEF = vmmlaq_s32(vacc23xEF, va23x89ABCDEF, vbEFx89ABCDEF);
233 vacc45x01 = vmmlaq_s32(vacc45x01, va45x89ABCDEF, vb01x89ABCDEF);
234 vacc45x23 = vmmlaq_s32(vacc45x23, va45x89ABCDEF, vb23x89ABCDEF);
235 vacc45x45 = vmmlaq_s32(vacc45x45, va45x89ABCDEF, vb45x89ABCDEF);
236 vacc45x67 = vmmlaq_s32(vacc45x67, va45x89ABCDEF, vb67x89ABCDEF);
237 vacc45x89 = vmmlaq_s32(vacc45x89, va45x89ABCDEF, vb89x89ABCDEF);
238 vacc45xAB = vmmlaq_s32(vacc45xAB, va45x89ABCDEF, vbABx89ABCDEF);
239 vacc45xCD = vmmlaq_s32(vacc45xCD, va45x89ABCDEF, vbCDx89ABCDEF);
240 vacc45xEF = vmmlaq_s32(vacc45xEF, va45x89ABCDEF, vbEFx89ABCDEF);
241
242 k -= 16 * sizeof(int8_t);
243 }
244 // Handle up to 8 final positions of `k`
245 if XNN_UNLIKELY(k != 0) {
246 // Load a 6x8 block of activations.
247 uint64x2_t va01x01234567 = vld1q_dup_u64((const void*) a0); a0 += 8;
248 uint64x2_t va23x01234567 = vld1q_dup_u64((const void*) a2); a2 += 8;
249 uint64x2_t va45x01234567 = vld1q_dup_u64((const void*) a4); a4 += 8;
250 va01x01234567 = vld1q_lane_u64((const void*) a1, va01x01234567, 1); a1 += 8;
251 va23x01234567 = vld1q_lane_u64((const void*) a3, va23x01234567, 1); a3 += 8;
252 va45x01234567 = vld1q_lane_u64((const void*) a5, va45x01234567, 1); a5 += 8;
253
254 // Load a 16x16 block of weights.
255 const int8x16_t vb01x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
256 const int8x16_t vb23x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
257 const int8x16_t vb45x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
258 const int8x16_t vb67x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
259 const int8x16_t vb89x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
260 const int8x16_t vbABx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
261 const int8x16_t vbCDx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
262 const int8x16_t vbEFx0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
263 const int8x16_t vb01x01234567 = vshlq_n_s8(vb01x0123456789ABCDEF, 4);
264 const int8x16_t vb23x01234567 = vshlq_n_s8(vb23x0123456789ABCDEF, 4);
265 const int8x16_t vb45x01234567 = vshlq_n_s8(vb45x0123456789ABCDEF, 4);
266 const int8x16_t vb67x01234567 = vshlq_n_s8(vb67x0123456789ABCDEF, 4);
267 const int8x16_t vb89x01234567 = vshlq_n_s8(vb89x0123456789ABCDEF, 4);
268 const int8x16_t vbABx01234567 = vshlq_n_s8(vbABx0123456789ABCDEF, 4);
269 const int8x16_t vbCDx01234567 = vshlq_n_s8(vbCDx0123456789ABCDEF, 4);
270 const int8x16_t vbEFx01234567 = vshlq_n_s8(vbEFx0123456789ABCDEF, 4);
271
272 // Multiply-accumulate: 6x4 * 4x16 --> 6x16.
273 vacc01x01 = vmmlaq_s32(vacc01x01, vreinterpretq_s8_u64(va01x01234567), vb01x01234567);
274 vacc01x23 = vmmlaq_s32(vacc01x23, vreinterpretq_s8_u64(va01x01234567), vb23x01234567);
275 vacc01x45 = vmmlaq_s32(vacc01x45, vreinterpretq_s8_u64(va01x01234567), vb45x01234567);
276 vacc01x67 = vmmlaq_s32(vacc01x67, vreinterpretq_s8_u64(va01x01234567), vb67x01234567);
277 vacc01x89 = vmmlaq_s32(vacc01x89, vreinterpretq_s8_u64(va01x01234567), vb89x01234567);
278 vacc01xAB = vmmlaq_s32(vacc01xAB, vreinterpretq_s8_u64(va01x01234567), vbABx01234567);
279 vacc01xCD = vmmlaq_s32(vacc01xCD, vreinterpretq_s8_u64(va01x01234567), vbCDx01234567);
280 vacc01xEF = vmmlaq_s32(vacc01xEF, vreinterpretq_s8_u64(va01x01234567), vbEFx01234567);
281 vacc23x01 = vmmlaq_s32(vacc23x01, vreinterpretq_s8_u64(va23x01234567), vb01x01234567);
282 vacc23x23 = vmmlaq_s32(vacc23x23, vreinterpretq_s8_u64(va23x01234567), vb23x01234567);
283 vacc23x45 = vmmlaq_s32(vacc23x45, vreinterpretq_s8_u64(va23x01234567), vb45x01234567);
284 vacc23x67 = vmmlaq_s32(vacc23x67, vreinterpretq_s8_u64(va23x01234567), vb67x01234567);
285 vacc23x89 = vmmlaq_s32(vacc23x89, vreinterpretq_s8_u64(va23x01234567), vb89x01234567);
286 vacc23xAB = vmmlaq_s32(vacc23xAB, vreinterpretq_s8_u64(va23x01234567), vbABx01234567);
287 vacc23xCD = vmmlaq_s32(vacc23xCD, vreinterpretq_s8_u64(va23x01234567), vbCDx01234567);
288 vacc23xEF = vmmlaq_s32(vacc23xEF, vreinterpretq_s8_u64(va23x01234567), vbEFx01234567);
289 vacc45x01 = vmmlaq_s32(vacc45x01, vreinterpretq_s8_u64(va45x01234567), vb01x01234567);
290 vacc45x23 = vmmlaq_s32(vacc45x23, vreinterpretq_s8_u64(va45x01234567), vb23x01234567);
291 vacc45x45 = vmmlaq_s32(vacc45x45, vreinterpretq_s8_u64(va45x01234567), vb45x01234567);
292 vacc45x67 = vmmlaq_s32(vacc45x67, vreinterpretq_s8_u64(va45x01234567), vb67x01234567);
293 vacc45x89 = vmmlaq_s32(vacc45x89, vreinterpretq_s8_u64(va45x01234567), vb89x01234567);
294 vacc45xAB = vmmlaq_s32(vacc45xAB, vreinterpretq_s8_u64(va45x01234567), vbABx01234567);
295 vacc45xCD = vmmlaq_s32(vacc45xCD, vreinterpretq_s8_u64(va45x01234567), vbCDx01234567);
296 vacc45xEF = vmmlaq_s32(vacc45xEF, vreinterpretq_s8_u64(va45x01234567), vbEFx01234567);
297 }
298
299 int32x4_t vacc0x0123 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01x01), vreinterpretq_u64_s32(vacc01x23)));
300 int32x4_t vacc1x0123 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01x01), vreinterpretq_u64_s32(vacc01x23)));
301 int32x4_t vacc0x4567 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01x45), vreinterpretq_u64_s32(vacc01x67)));
302 int32x4_t vacc1x4567 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01x45), vreinterpretq_u64_s32(vacc01x67)));
303 int32x4_t vacc0x89AB = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01x89), vreinterpretq_u64_s32(vacc01xAB)));
304 int32x4_t vacc1x89AB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01x89), vreinterpretq_u64_s32(vacc01xAB)));
305 int32x4_t vacc0xCDEF = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01xCD), vreinterpretq_u64_s32(vacc01xEF)));
306 int32x4_t vacc1xCDEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01xCD), vreinterpretq_u64_s32(vacc01xEF)));
307 int32x4_t vacc2x0123 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23x01), vreinterpretq_u64_s32(vacc23x23)));
308 int32x4_t vacc3x0123 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23x01), vreinterpretq_u64_s32(vacc23x23)));
309 int32x4_t vacc2x4567 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23x45), vreinterpretq_u64_s32(vacc23x67)));
310 int32x4_t vacc3x4567 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23x45), vreinterpretq_u64_s32(vacc23x67)));
311 int32x4_t vacc2x89AB = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23x89), vreinterpretq_u64_s32(vacc23xAB)));
312 int32x4_t vacc3x89AB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23x89), vreinterpretq_u64_s32(vacc23xAB)));
313 int32x4_t vacc2xCDEF = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23xCD), vreinterpretq_u64_s32(vacc23xEF)));
314 int32x4_t vacc3xCDEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23xCD), vreinterpretq_u64_s32(vacc23xEF)));
315 int32x4_t vacc4x0123 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45x01), vreinterpretq_u64_s32(vacc45x23)));
316 int32x4_t vacc5x0123 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc45x01), vreinterpretq_u64_s32(vacc45x23)));
317 int32x4_t vacc4x4567 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45x45), vreinterpretq_u64_s32(vacc45x67)));
318 int32x4_t vacc5x4567 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc45x45), vreinterpretq_u64_s32(vacc45x67)));
319 int32x4_t vacc4x89AB = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45x89), vreinterpretq_u64_s32(vacc45xAB)));
320 int32x4_t vacc5x89AB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc45x89), vreinterpretq_u64_s32(vacc45xAB)));
321 int32x4_t vacc4xCDEF = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45xCD), vreinterpretq_u64_s32(vacc45xEF)));
322 int32x4_t vacc5xCDEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc45xCD), vreinterpretq_u64_s32(vacc45xEF)));
323 float32x4_t vout0x0123 = vcvtq_n_f32_s32(vacc0x0123, 4);
324 float32x4_t vout0x4567 = vcvtq_n_f32_s32(vacc0x4567, 4);
325 float32x4_t vout0x89AB = vcvtq_n_f32_s32(vacc0x89AB, 4);
326 float32x4_t vout0xCDEF = vcvtq_n_f32_s32(vacc0xCDEF, 4);
327 float32x4_t vout1x0123 = vcvtq_n_f32_s32(vacc1x0123, 4);
328 float32x4_t vout1x4567 = vcvtq_n_f32_s32(vacc1x4567, 4);
329 float32x4_t vout1x89AB = vcvtq_n_f32_s32(vacc1x89AB, 4);
330 float32x4_t vout1xCDEF = vcvtq_n_f32_s32(vacc1xCDEF, 4);
331 float32x4_t vout2x0123 = vcvtq_n_f32_s32(vacc2x0123, 4);
332 float32x4_t vout2x4567 = vcvtq_n_f32_s32(vacc2x4567, 4);
333 float32x4_t vout2x89AB = vcvtq_n_f32_s32(vacc2x89AB, 4);
334 float32x4_t vout2xCDEF = vcvtq_n_f32_s32(vacc2xCDEF, 4);
335 float32x4_t vout3x0123 = vcvtq_n_f32_s32(vacc3x0123, 4);
336 float32x4_t vout3x4567 = vcvtq_n_f32_s32(vacc3x4567, 4);
337 float32x4_t vout3x89AB = vcvtq_n_f32_s32(vacc3x89AB, 4);
338 float32x4_t vout3xCDEF = vcvtq_n_f32_s32(vacc3xCDEF, 4);
339 float32x4_t vout4x0123 = vcvtq_n_f32_s32(vacc4x0123, 4);
340 float32x4_t vout4x4567 = vcvtq_n_f32_s32(vacc4x4567, 4);
341 float32x4_t vout4x89AB = vcvtq_n_f32_s32(vacc4x89AB, 4);
342 float32x4_t vout4xCDEF = vcvtq_n_f32_s32(vacc4xCDEF, 4);
343 float32x4_t vout5x0123 = vcvtq_n_f32_s32(vacc5x0123, 4);
344 float32x4_t vout5x4567 = vcvtq_n_f32_s32(vacc5x4567, 4);
345 float32x4_t vout5x89AB = vcvtq_n_f32_s32(vacc5x89AB, 4);
346 float32x4_t vout5xCDEF = vcvtq_n_f32_s32(vacc5xCDEF, 4);
347
348 const float32x4_t vinput_scale01 = vreinterpretq_f32_s32(vld1q_s32(&quantization_params[0].zero_point));
349 vout0x0123 = vmulq_lane_f32(vout0x0123, vget_low_f32(vinput_scale01), 1);
350 vout1x0123 = vmulq_lane_f32(vout1x0123, vget_high_f32(vinput_scale01), 1);
351 vout0x4567 = vmulq_lane_f32(vout0x4567, vget_low_f32(vinput_scale01), 1);
352 vout1x4567 = vmulq_lane_f32(vout1x4567, vget_high_f32(vinput_scale01), 1);
353 vout0x89AB = vmulq_lane_f32(vout0x89AB, vget_low_f32(vinput_scale01), 1);
354 vout1x89AB = vmulq_lane_f32(vout1x89AB, vget_high_f32(vinput_scale01), 1);
355 vout0xCDEF = vmulq_lane_f32(vout0xCDEF, vget_low_f32(vinput_scale01), 1);
356 vout1xCDEF = vmulq_lane_f32(vout1xCDEF, vget_high_f32(vinput_scale01), 1);
357 const float32x4_t vinput_scale23 = vreinterpretq_f32_s32(vld1q_s32(&quantization_params[2].zero_point));
358 vout2x0123 = vmulq_lane_f32(vout2x0123, vget_low_f32(vinput_scale23), 1);
359 vout3x0123 = vmulq_lane_f32(vout3x0123, vget_high_f32(vinput_scale23), 1);
360 vout2x4567 = vmulq_lane_f32(vout2x4567, vget_low_f32(vinput_scale23), 1);
361 vout3x4567 = vmulq_lane_f32(vout3x4567, vget_high_f32(vinput_scale23), 1);
362 vout2x89AB = vmulq_lane_f32(vout2x89AB, vget_low_f32(vinput_scale23), 1);
363 vout3x89AB = vmulq_lane_f32(vout3x89AB, vget_high_f32(vinput_scale23), 1);
364 vout2xCDEF = vmulq_lane_f32(vout2xCDEF, vget_low_f32(vinput_scale23), 1);
365 vout3xCDEF = vmulq_lane_f32(vout3xCDEF, vget_high_f32(vinput_scale23), 1);
366 const float32x4_t vinput_scale45 = vreinterpretq_f32_s32(vld1q_s32(&quantization_params[4].zero_point));
367 vout4x0123 = vmulq_lane_f32(vout4x0123, vget_low_f32(vinput_scale45), 1);
368 vout5x0123 = vmulq_lane_f32(vout5x0123, vget_high_f32(vinput_scale45), 1);
369 vout4x4567 = vmulq_lane_f32(vout4x4567, vget_low_f32(vinput_scale45), 1);
370 vout5x4567 = vmulq_lane_f32(vout5x4567, vget_high_f32(vinput_scale45), 1);
371 vout4x89AB = vmulq_lane_f32(vout4x89AB, vget_low_f32(vinput_scale45), 1);
372 vout5x89AB = vmulq_lane_f32(vout5x89AB, vget_high_f32(vinput_scale45), 1);
373 vout4xCDEF = vmulq_lane_f32(vout4xCDEF, vget_low_f32(vinput_scale45), 1);
374 vout5xCDEF = vmulq_lane_f32(vout5xCDEF, vget_high_f32(vinput_scale45), 1);
375
376 const float32x4_t vfilter_output_scale0123 = vld1q_f32(w); w = (const float*) w + 4;
377 const float32x4_t vfilter_output_scale4567 = vld1q_f32(w); w = (const float*) w + 4;
378 const float32x4_t vfilter_output_scale89AB = vld1q_f32(w); w = (const float*) w + 4;
379 const float32x4_t vfilter_output_scaleCDEF = vld1q_f32(w); w = (const float*) w + 4;
380
381 const float32x4_t vbias0123 = vld1q_f32(w); w = (const float*) w + 4;
382 vout0x0123 = vfmaq_f32(vbias0123, vout0x0123, vfilter_output_scale0123);
383 vout1x0123 = vfmaq_f32(vbias0123, vout1x0123, vfilter_output_scale0123);
384 vout2x0123 = vfmaq_f32(vbias0123, vout2x0123, vfilter_output_scale0123);
385 vout3x0123 = vfmaq_f32(vbias0123, vout3x0123, vfilter_output_scale0123);
386 vout4x0123 = vfmaq_f32(vbias0123, vout4x0123, vfilter_output_scale0123);
387 vout5x0123 = vfmaq_f32(vbias0123, vout5x0123, vfilter_output_scale0123);
388 const float32x4_t vbias4567 = vld1q_f32(w); w = (const float*) w + 4;
389 vout0x4567 = vfmaq_f32(vbias4567, vout0x4567, vfilter_output_scale4567);
390 vout1x4567 = vfmaq_f32(vbias4567, vout1x4567, vfilter_output_scale4567);
391 vout2x4567 = vfmaq_f32(vbias4567, vout2x4567, vfilter_output_scale4567);
392 vout3x4567 = vfmaq_f32(vbias4567, vout3x4567, vfilter_output_scale4567);
393 vout4x4567 = vfmaq_f32(vbias4567, vout4x4567, vfilter_output_scale4567);
394 vout5x4567 = vfmaq_f32(vbias4567, vout5x4567, vfilter_output_scale4567);
395 const float32x4_t vbias89AB = vld1q_f32(w); w = (const float*) w + 4;
396 vout0x89AB = vfmaq_f32(vbias89AB, vout0x89AB, vfilter_output_scale89AB);
397 vout1x89AB = vfmaq_f32(vbias89AB, vout1x89AB, vfilter_output_scale89AB);
398 vout2x89AB = vfmaq_f32(vbias89AB, vout2x89AB, vfilter_output_scale89AB);
399 vout3x89AB = vfmaq_f32(vbias89AB, vout3x89AB, vfilter_output_scale89AB);
400 vout4x89AB = vfmaq_f32(vbias89AB, vout4x89AB, vfilter_output_scale89AB);
401 vout5x89AB = vfmaq_f32(vbias89AB, vout5x89AB, vfilter_output_scale89AB);
402 const float32x4_t vbiasCDEF = vld1q_f32(w); w = (const float*) w + 4;
403 vout0xCDEF = vfmaq_f32(vbiasCDEF, vout0xCDEF, vfilter_output_scaleCDEF);
404 vout1xCDEF = vfmaq_f32(vbiasCDEF, vout1xCDEF, vfilter_output_scaleCDEF);
405 vout2xCDEF = vfmaq_f32(vbiasCDEF, vout2xCDEF, vfilter_output_scaleCDEF);
406 vout3xCDEF = vfmaq_f32(vbiasCDEF, vout3xCDEF, vfilter_output_scaleCDEF);
407 vout4xCDEF = vfmaq_f32(vbiasCDEF, vout4xCDEF, vfilter_output_scaleCDEF);
408 vout5xCDEF = vfmaq_f32(vbiasCDEF, vout5xCDEF, vfilter_output_scaleCDEF);
409
410 float16x8_t vfp16out0x01234567 = vcombine_f16(vcvt_f16_f32(vout0x0123), vcvt_f16_f32(vout0x4567));
411 float16x8_t vfp16out0x89ABCDEF = vcombine_f16(vcvt_f16_f32(vout0x89AB), vcvt_f16_f32(vout0xCDEF));
412 float16x8_t vfp16out1x01234567 = vcombine_f16(vcvt_f16_f32(vout1x0123), vcvt_f16_f32(vout1x4567));
413 float16x8_t vfp16out1x89ABCDEF = vcombine_f16(vcvt_f16_f32(vout1x89AB), vcvt_f16_f32(vout1xCDEF));
414 float16x8_t vfp16out2x01234567 = vcombine_f16(vcvt_f16_f32(vout2x0123), vcvt_f16_f32(vout2x4567));
415 float16x8_t vfp16out2x89ABCDEF = vcombine_f16(vcvt_f16_f32(vout2x89AB), vcvt_f16_f32(vout2xCDEF));
416 float16x8_t vfp16out3x01234567 = vcombine_f16(vcvt_f16_f32(vout3x0123), vcvt_f16_f32(vout3x4567));
417 float16x8_t vfp16out3x89ABCDEF = vcombine_f16(vcvt_f16_f32(vout3x89AB), vcvt_f16_f32(vout3xCDEF));
418 float16x8_t vfp16out4x01234567 = vcombine_f16(vcvt_f16_f32(vout4x0123), vcvt_f16_f32(vout4x4567));
419 float16x8_t vfp16out4x89ABCDEF = vcombine_f16(vcvt_f16_f32(vout4x89AB), vcvt_f16_f32(vout4xCDEF));
420 float16x8_t vfp16out5x01234567 = vcombine_f16(vcvt_f16_f32(vout5x0123), vcvt_f16_f32(vout5x4567));
421 float16x8_t vfp16out5x89ABCDEF = vcombine_f16(vcvt_f16_f32(vout5x89AB), vcvt_f16_f32(vout5xCDEF));
422
423 const float16x8_t voutput_min = vreinterpretq_f16_u16(vld1q_dup_u16((const uint16_t*) &params->scalar.min));
424 vfp16out0x01234567 = vmaxq_f16(vfp16out0x01234567, voutput_min);
425 vfp16out0x89ABCDEF = vmaxq_f16(vfp16out0x89ABCDEF, voutput_min);
426 vfp16out1x01234567 = vmaxq_f16(vfp16out1x01234567, voutput_min);
427 vfp16out1x89ABCDEF = vmaxq_f16(vfp16out1x89ABCDEF, voutput_min);
428 vfp16out2x01234567 = vmaxq_f16(vfp16out2x01234567, voutput_min);
429 vfp16out2x89ABCDEF = vmaxq_f16(vfp16out2x89ABCDEF, voutput_min);
430 vfp16out3x01234567 = vmaxq_f16(vfp16out3x01234567, voutput_min);
431 vfp16out3x89ABCDEF = vmaxq_f16(vfp16out3x89ABCDEF, voutput_min);
432 vfp16out4x01234567 = vmaxq_f16(vfp16out4x01234567, voutput_min);
433 vfp16out4x89ABCDEF = vmaxq_f16(vfp16out4x89ABCDEF, voutput_min);
434 vfp16out5x01234567 = vmaxq_f16(vfp16out5x01234567, voutput_min);
435 vfp16out5x89ABCDEF = vmaxq_f16(vfp16out5x89ABCDEF, voutput_min);
436 const float16x8_t voutput_max = vreinterpretq_f16_u16(vld1q_dup_u16((const uint16_t*) &params->scalar.max));
437 vfp16out0x01234567 = vminq_f16(vfp16out0x01234567, voutput_max);
438 vfp16out0x89ABCDEF = vminq_f16(vfp16out0x89ABCDEF, voutput_max);
439 vfp16out1x01234567 = vminq_f16(vfp16out1x01234567, voutput_max);
440 vfp16out1x89ABCDEF = vminq_f16(vfp16out1x89ABCDEF, voutput_max);
441 vfp16out2x01234567 = vminq_f16(vfp16out2x01234567, voutput_max);
442 vfp16out2x89ABCDEF = vminq_f16(vfp16out2x89ABCDEF, voutput_max);
443 vfp16out3x01234567 = vminq_f16(vfp16out3x01234567, voutput_max);
444 vfp16out3x89ABCDEF = vminq_f16(vfp16out3x89ABCDEF, voutput_max);
445 vfp16out4x01234567 = vminq_f16(vfp16out4x01234567, voutput_max);
446 vfp16out4x89ABCDEF = vminq_f16(vfp16out4x89ABCDEF, voutput_max);
447 vfp16out5x01234567 = vminq_f16(vfp16out5x01234567, voutput_max);
448 vfp16out5x89ABCDEF = vminq_f16(vfp16out5x89ABCDEF, voutput_max);
449 if XNN_LIKELY(nc >= 16) {
450 vst1q_u16(c0, vreinterpretq_u16_f16(vfp16out0x01234567));
451 vst1q_u16(c0 + 8, vreinterpretq_u16_f16(vfp16out0x89ABCDEF));
452 vst1q_u16(c1, vreinterpretq_u16_f16(vfp16out1x01234567));
453 vst1q_u16(c1 + 8, vreinterpretq_u16_f16(vfp16out1x89ABCDEF));
454 vst1q_u16(c2, vreinterpretq_u16_f16(vfp16out2x01234567));
455 vst1q_u16(c2 + 8, vreinterpretq_u16_f16(vfp16out2x89ABCDEF));
456 vst1q_u16(c3, vreinterpretq_u16_f16(vfp16out3x01234567));
457 vst1q_u16(c3 + 8, vreinterpretq_u16_f16(vfp16out3x89ABCDEF));
458 vst1q_u16(c4, vreinterpretq_u16_f16(vfp16out4x01234567));
459 vst1q_u16(c4 + 8, vreinterpretq_u16_f16(vfp16out4x89ABCDEF));
460 vst1q_u16(c5, vreinterpretq_u16_f16(vfp16out5x01234567));
461 vst1q_u16(c5 + 8, vreinterpretq_u16_f16(vfp16out5x89ABCDEF));
462
463 a0 = (const int8_t*) ((uintptr_t) a0 - kc);
464 a1 = (const int8_t*) ((uintptr_t) a1 - kc);
465 a2 = (const int8_t*) ((uintptr_t) a2 - kc);
466 a3 = (const int8_t*) ((uintptr_t) a3 - kc);
467 a4 = (const int8_t*) ((uintptr_t) a4 - kc);
468 a5 = (const int8_t*) ((uintptr_t) a5 - kc);
469
470 c0 = (uint16_t*) ((uintptr_t) c0 + cn_stride);
471 c1 = (uint16_t*) ((uintptr_t) c1 + cn_stride);
472 c2 = (uint16_t*) ((uintptr_t) c2 + cn_stride);
473 c3 = (uint16_t*) ((uintptr_t) c3 + cn_stride);
474 c4 = (uint16_t*) ((uintptr_t) c4 + cn_stride);
475 c5 = (uint16_t*) ((uintptr_t) c5 + cn_stride);
476
477 nc -= 16;
478 } else {
479 if (nc & 8) {
480 vst1q_u16(c0, vreinterpretq_u16_f16(vfp16out0x01234567)); c0 += 8;
481 vfp16out0x01234567 = vfp16out0x89ABCDEF;
482 vst1q_u16(c1, vreinterpretq_u16_f16(vfp16out1x01234567)); c1 += 8;
483 vfp16out1x01234567 = vfp16out1x89ABCDEF;
484 vst1q_u16(c2, vreinterpretq_u16_f16(vfp16out2x01234567)); c2 += 8;
485 vfp16out2x01234567 = vfp16out2x89ABCDEF;
486 vst1q_u16(c3, vreinterpretq_u16_f16(vfp16out3x01234567)); c3 += 8;
487 vfp16out3x01234567 = vfp16out3x89ABCDEF;
488 vst1q_u16(c4, vreinterpretq_u16_f16(vfp16out4x01234567)); c4 += 8;
489 vfp16out4x01234567 = vfp16out4x89ABCDEF;
490 vst1q_u16(c5, vreinterpretq_u16_f16(vfp16out5x01234567)); c5 += 8;
491 vfp16out5x01234567 = vfp16out5x89ABCDEF;
492 }
493 float16x4_t vfp16out0x0123 = vget_low_f16(vfp16out0x01234567);
494 float16x4_t vfp16out1x0123 = vget_low_f16(vfp16out1x01234567);
495 float16x4_t vfp16out2x0123 = vget_low_f16(vfp16out2x01234567);
496 float16x4_t vfp16out3x0123 = vget_low_f16(vfp16out3x01234567);
497 float16x4_t vfp16out4x0123 = vget_low_f16(vfp16out4x01234567);
498 float16x4_t vfp16out5x0123 = vget_low_f16(vfp16out5x01234567);
499 if (nc & 4) {
500 vst1_u16(c0, vreinterpret_u16_f16(vfp16out0x0123)); c0 += 4;
501 vst1_u16(c1, vreinterpret_u16_f16(vfp16out1x0123)); c1 += 4;
502 vst1_u16(c2, vreinterpret_u16_f16(vfp16out2x0123)); c2 += 4;
503 vst1_u16(c3, vreinterpret_u16_f16(vfp16out3x0123)); c3 += 4;
504 vst1_u16(c4, vreinterpret_u16_f16(vfp16out4x0123)); c4 += 4;
505 vst1_u16(c5, vreinterpret_u16_f16(vfp16out5x0123)); c5 += 4;
506 vfp16out0x0123 = vget_high_f16(vfp16out0x01234567);
507 vfp16out1x0123 = vget_high_f16(vfp16out1x01234567);
508 vfp16out2x0123 = vget_high_f16(vfp16out2x01234567);
509 vfp16out3x0123 = vget_high_f16(vfp16out3x01234567);
510 vfp16out4x0123 = vget_high_f16(vfp16out4x01234567);
511 vfp16out5x0123 = vget_high_f16(vfp16out5x01234567);
512 }
513 if (nc & 2) {
514 vst1_lane_u32((void*) c0, vreinterpret_u32_f16(vfp16out0x0123), 0); c0 += 2;
515 vst1_lane_u32((void*) c1, vreinterpret_u32_f16(vfp16out1x0123), 0); c1 += 2;
516 vst1_lane_u32((void*) c2, vreinterpret_u32_f16(vfp16out2x0123), 0); c2 += 2;
517 vst1_lane_u32((void*) c3, vreinterpret_u32_f16(vfp16out3x0123), 0); c3 += 2;
518 vst1_lane_u32((void*) c4, vreinterpret_u32_f16(vfp16out4x0123), 0); c4 += 2;
519 vst1_lane_u32((void*) c5, vreinterpret_u32_f16(vfp16out5x0123), 0); c5 += 2;
520 vfp16out0x0123 = vext_f16(vfp16out0x0123, vfp16out0x0123, 2);
521 vfp16out1x0123 = vext_f16(vfp16out1x0123, vfp16out1x0123, 2);
522 vfp16out2x0123 = vext_f16(vfp16out2x0123, vfp16out2x0123, 2);
523 vfp16out3x0123 = vext_f16(vfp16out3x0123, vfp16out3x0123, 2);
524 vfp16out4x0123 = vext_f16(vfp16out4x0123, vfp16out4x0123, 2);
525 vfp16out5x0123 = vext_f16(vfp16out5x0123, vfp16out5x0123, 2);
526 }
527 if (nc & 1) {
528 vst1_lane_u16(c0, vreinterpret_u16_f16(vfp16out0x0123), 0);
529 vst1_lane_u16(c1, vreinterpret_u16_f16(vfp16out1x0123), 0);
530 vst1_lane_u16(c2, vreinterpret_u16_f16(vfp16out2x0123), 0);
531 vst1_lane_u16(c3, vreinterpret_u16_f16(vfp16out3x0123), 0);
532 vst1_lane_u16(c4, vreinterpret_u16_f16(vfp16out4x0123), 0);
533 vst1_lane_u16(c5, vreinterpret_u16_f16(vfp16out5x0123), 0);
534 }
535 nc = 0;
536 }
537 } while (nc != 0);
538 }