Debian Codegraph @

src/qd8-f16-qb4w-gemm/gen/qd8-f16-qb4w-gemm-3x8c8-minmax-avx2.c

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/qs8-gemm/MRx8c8-avx2.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 <immintrin.h>
13
14 #include "xnnpack/common.h"
15 #include "xnnpack/gemm.h"
16 #include "xnnpack/intrinsics-polyfill.h"
17 #include "xnnpack/math.h"
18 #include "xnnpack/unaligned.h"
19
20
21 void xnn_qd8_f16_qb4w_gemm_minmax_ukernel_3x8c8__avx2(
22 size_t mr,
23 size_t nc,
24 size_t kc,
25 const int8_t* restrict a,
26 size_t a_stride,
27 const void* restrict w,
28 xnn_float16* restrict c,
29 size_t cm_stride,
30 size_t cn_stride,
31 const struct xnn_f16_qb4w_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 <= 3);
36 assert(nc != 0);
37 assert(kc != 0);
38 assert(kc % sizeof(int8_t) == 0);
39 assert(a != NULL);
40 assert(w != NULL);
41 assert(c != NULL);
42
43 kc = round_up_po2(kc, 8 * sizeof(int8_t));
44 size_t bl = params->scalar.blocksize;
45 assert(bl <= round_up_po2(kc, 16));
46 assert(bl != 0);
47 assert(bl % 32 == 0);
48 const int8_t* a0 = a;
49 uint16_t* c0 = (uint16_t*) c;
50 const int8_t* a1 = (const int8_t*) ((uintptr_t) a0 + a_stride);
51 uint16_t* c1 = (uint16_t*) ((uintptr_t) c0 + cm_stride);
52 if XNN_UNPREDICTABLE(mr < 2) {
53 a1 = a0;
54 c1 = c0;
55 }
56 const int8_t* a2 = (const int8_t*) ((uintptr_t) a1 + a_stride);
57 uint16_t* c2 = (uint16_t*) ((uintptr_t) c1 + cm_stride);
58 if XNN_UNPREDICTABLE(mr <= 2) {
59 a2 = a1;
60 c2 = c1;
61 }
62
63 const __m128i vmask = _mm_set1_epi8(0xF0);
64 XNN_FORCE_REALIZATION(vmask);
65 const __m256 vmin = _mm256_cvtph_ps(_mm_set1_epi16(*(const uint16_t*) &params->scalar.min));
66 const __m256 vmax = _mm256_cvtph_ps(_mm_set1_epi16(*(const uint16_t*) &params->scalar.max));
67 XNN_FORCE_REALIZATION(vmin);
68 XNN_FORCE_REALIZATION(vmax);
69
70 do {
71 const __m128 vinit0 = _mm_load_ss(&((const float*) w)[0]);
72 const __m128 vinit1 = _mm_load_ss(&((const float*) w)[1]);
73 const __m256 vinit01 = _mm256_insertf128_ps(_mm256_castps128_ps256(vinit0), vinit1, 1);
74 const __m128 vinit2 = _mm_load_ss(&((const float*) w)[2]);
75 const __m128 vinit3 = _mm_load_ss(&((const float*) w)[3]);
76 const __m256 vinit23 = _mm256_insertf128_ps(_mm256_castps128_ps256(vinit2), vinit3, 1);
77 const __m128 vinit4 = _mm_load_ss(&((const float*) w)[4]);
78 const __m128 vinit5 = _mm_load_ss(&((const float*) w)[5]);
79 const __m256 vinit45 = _mm256_insertf128_ps(_mm256_castps128_ps256(vinit4), vinit5, 1);
80 const __m128 vinit6 = _mm_load_ss(&((const float*) w)[6]);
81 const __m128 vinit7 = _mm_load_ss(&((const float*) w)[7]);
82 const __m256 vinit67 = _mm256_insertf128_ps(_mm256_castps128_ps256(vinit6), vinit7, 1);
83 const __m256 vinput_zero_point0 = _mm256_set1_ps((float) quantization_params[0].zero_point);
84 __m256 vout0x01 = _mm256_mul_ps(vinit01, vinput_zero_point0);
85 __m256 vout0x23 = _mm256_mul_ps(vinit23, vinput_zero_point0);
86 __m256 vout0x45 = _mm256_mul_ps(vinit45, vinput_zero_point0);
87 __m256 vout0x67 = _mm256_mul_ps(vinit67, vinput_zero_point0);
88 const __m256 vinput_zero_point1 = _mm256_set1_ps((float) quantization_params[1].zero_point);
89 __m256 vout1x01 = _mm256_mul_ps(vinit01, vinput_zero_point1);
90 __m256 vout1x23 = _mm256_mul_ps(vinit23, vinput_zero_point1);
91 __m256 vout1x45 = _mm256_mul_ps(vinit45, vinput_zero_point1);
92 __m256 vout1x67 = _mm256_mul_ps(vinit67, vinput_zero_point1);
93 const __m256 vinput_zero_point2 = _mm256_set1_ps((float) quantization_params[2].zero_point);
94 __m256 vout2x01 = _mm256_mul_ps(vinit01, vinput_zero_point2);
95 __m256 vout2x23 = _mm256_mul_ps(vinit23, vinput_zero_point2);
96 __m256 vout2x45 = _mm256_mul_ps(vinit45, vinput_zero_point2);
97 __m256 vout2x67 = _mm256_mul_ps(vinit67, vinput_zero_point2);
98 w = (const int32_t*) w + 8;
99
100 for (size_t kb=0; kb < kc; kb += bl) {
101 __m256i vacc0x01 = _mm256_setzero_si256();
102 __m256i vacc0x23 = _mm256_setzero_si256();
103 __m256i vacc0x45 = _mm256_setzero_si256();
104 __m256i vacc0x67 = _mm256_setzero_si256();
105 __m256i vacc1x01 = _mm256_setzero_si256();
106 __m256i vacc1x23 = _mm256_setzero_si256();
107 __m256i vacc1x45 = _mm256_setzero_si256();
108 __m256i vacc1x67 = _mm256_setzero_si256();
109 __m256i vacc2x01 = _mm256_setzero_si256();
110 __m256i vacc2x23 = _mm256_setzero_si256();
111 __m256i vacc2x45 = _mm256_setzero_si256();
112 __m256i vacc2x67 = _mm256_setzero_si256();
113
114 size_t k = bl;
115 while (k >= 16 * sizeof(int8_t)) {
116 __m128i va0 = _mm_broadcastq_epi64(_mm_loadl_epi64((const __m128i*) a0));
117 __m256i vxa0 = _mm256_cvtepi8_epi16(va0);
118 a0 += 8;
119 __m128i va1 = _mm_broadcastq_epi64(_mm_loadl_epi64((const __m128i*) a1));
120 __m256i vxa1 = _mm256_cvtepi8_epi16(va1);
121 a1 += 8;
122 __m128i va2 = _mm_broadcastq_epi64(_mm_loadl_epi64((const __m128i*) a2));
123 __m256i vxa2 = _mm256_cvtepi8_epi16(va2);
124 a2 += 8;
125
126 __m128i vb01 = _mm_load_si128((const __m128i*) w);
127 __m128i vbs01 = _mm_slli_epi32(vb01, 4);
128 __m128i vbm01 = _mm_and_si128(vbs01, vmask);
129 __m256i vxb01 = _mm256_cvtepi8_epi16(vbm01);
130
131 vacc0x01 = _mm256_add_epi32(vacc0x01, _mm256_madd_epi16(vxa0, vxb01));
132 vacc1x01 = _mm256_add_epi32(vacc1x01, _mm256_madd_epi16(vxa1, vxb01));
133 vacc2x01 = _mm256_add_epi32(vacc2x01, _mm256_madd_epi16(vxa2, vxb01));
134 __m128i vb23 = _mm_load_si128((const __m128i*) ((const int8_t*) w + 16));
135 __m128i vbs23 = _mm_slli_epi32(vb23, 4);
136 __m128i vbm23 = _mm_and_si128(vbs23, vmask);
137 __m256i vxb23 = _mm256_cvtepi8_epi16(vbm23);
138
139 vacc0x23 = _mm256_add_epi32(vacc0x23, _mm256_madd_epi16(vxa0, vxb23));
140 vacc1x23 = _mm256_add_epi32(vacc1x23, _mm256_madd_epi16(vxa1, vxb23));
141 vacc2x23 = _mm256_add_epi32(vacc2x23, _mm256_madd_epi16(vxa2, vxb23));
142 __m128i vb45 = _mm_load_si128((const __m128i*) ((const int8_t*) w + 32));
143 __m128i vbs45 = _mm_slli_epi32(vb45, 4);
144 __m128i vbm45 = _mm_and_si128(vbs45, vmask);
145 __m256i vxb45 = _mm256_cvtepi8_epi16(vbm45);
146
147 vacc0x45 = _mm256_add_epi32(vacc0x45, _mm256_madd_epi16(vxa0, vxb45));
148 vacc1x45 = _mm256_add_epi32(vacc1x45, _mm256_madd_epi16(vxa1, vxb45));
149 vacc2x45 = _mm256_add_epi32(vacc2x45, _mm256_madd_epi16(vxa2, vxb45));
150 __m128i vb67 = _mm_load_si128((const __m128i*) ((const int8_t*) w + 48));
151 __m128i vbs67 = _mm_slli_epi32(vb67, 4);
152 __m128i vbm67 = _mm_and_si128(vbs67, vmask);
153 __m256i vxb67 = _mm256_cvtepi8_epi16(vbm67);
154
155 vacc0x67 = _mm256_add_epi32(vacc0x67, _mm256_madd_epi16(vxa0, vxb67));
156 vacc1x67 = _mm256_add_epi32(vacc1x67, _mm256_madd_epi16(vxa1, vxb67));
157 vacc2x67 = _mm256_add_epi32(vacc2x67, _mm256_madd_epi16(vxa2, vxb67));
158
159 va0 = _mm_broadcastq_epi64(_mm_loadl_epi64((const __m128i*) a0));
160 vxa0 = _mm256_cvtepi8_epi16(va0);
161 a0 += 8;
162 va1 = _mm_broadcastq_epi64(_mm_loadl_epi64((const __m128i*) a1));
163 vxa1 = _mm256_cvtepi8_epi16(va1);
164 a1 += 8;
165 va2 = _mm_broadcastq_epi64(_mm_loadl_epi64((const __m128i*) a2));
166 vxa2 = _mm256_cvtepi8_epi16(va2);
167 a2 += 8;
168
169 vbm01 = _mm_and_si128(vb01, vmask);
170 vxb01 = _mm256_cvtepi8_epi16(vbm01);
171
172 vacc0x01 = _mm256_add_epi32(vacc0x01, _mm256_madd_epi16(vxa0, vxb01));
173 vacc1x01 = _mm256_add_epi32(vacc1x01, _mm256_madd_epi16(vxa1, vxb01));
174 vacc2x01 = _mm256_add_epi32(vacc2x01, _mm256_madd_epi16(vxa2, vxb01));
175 vbm23 = _mm_and_si128(vb23, vmask);
176 vxb23 = _mm256_cvtepi8_epi16(vbm23);
177
178 vacc0x23 = _mm256_add_epi32(vacc0x23, _mm256_madd_epi16(vxa0, vxb23));
179 vacc1x23 = _mm256_add_epi32(vacc1x23, _mm256_madd_epi16(vxa1, vxb23));
180 vacc2x23 = _mm256_add_epi32(vacc2x23, _mm256_madd_epi16(vxa2, vxb23));
181 vbm45 = _mm_and_si128(vb45, vmask);
182 vxb45 = _mm256_cvtepi8_epi16(vbm45);
183
184 vacc0x45 = _mm256_add_epi32(vacc0x45, _mm256_madd_epi16(vxa0, vxb45));
185 vacc1x45 = _mm256_add_epi32(vacc1x45, _mm256_madd_epi16(vxa1, vxb45));
186 vacc2x45 = _mm256_add_epi32(vacc2x45, _mm256_madd_epi16(vxa2, vxb45));
187 vbm67 = _mm_and_si128(vb67, vmask);
188 vxb67 = _mm256_cvtepi8_epi16(vbm67);
189
190 vacc0x67 = _mm256_add_epi32(vacc0x67, _mm256_madd_epi16(vxa0, vxb67));
191 vacc1x67 = _mm256_add_epi32(vacc1x67, _mm256_madd_epi16(vxa1, vxb67));
192 vacc2x67 = _mm256_add_epi32(vacc2x67, _mm256_madd_epi16(vxa2, vxb67));
193
194 w = (const int8_t*) w + 64;
195 k -= 16 * sizeof(int8_t);
196 }
197
198 while (k >= 8 * sizeof(int8_t)) {
199 const __m128i va0 = _mm_broadcastq_epi64(_mm_loadl_epi64((const __m128i*) a0));
200 const __m256i vxa0 = _mm256_cvtepi8_epi16(va0);
201 a0 += 8;
202 const __m128i va1 = _mm_broadcastq_epi64(_mm_loadl_epi64((const __m128i*) a1));
203 const __m256i vxa1 = _mm256_cvtepi8_epi16(va1);
204 a1 += 8;
205 const __m128i va2 = _mm_broadcastq_epi64(_mm_loadl_epi64((const __m128i*) a2));
206 const __m256i vxa2 = _mm256_cvtepi8_epi16(va2);
207 a2 += 8;
208
209 const __m128i vb01 = _mm_load_si128((const __m128i*) w);
210 const __m128i vbs01 = _mm_slli_epi32(vb01, 4);
211 const __m128i vbm01 = _mm_and_si128(vbs01, vmask);
212 const __m256i vxb01 = _mm256_cvtepi8_epi16(vbm01);
213
214 vacc0x01 = _mm256_add_epi32(vacc0x01, _mm256_madd_epi16(vxa0, vxb01));
215 vacc1x01 = _mm256_add_epi32(vacc1x01, _mm256_madd_epi16(vxa1, vxb01));
216 vacc2x01 = _mm256_add_epi32(vacc2x01, _mm256_madd_epi16(vxa2, vxb01));
217 const __m128i vb23 = _mm_load_si128((const __m128i*) ((const int8_t*) w + 16));
218 const __m128i vbs23 = _mm_slli_epi32(vb23, 4);
219 const __m128i vbm23 = _mm_and_si128(vbs23, vmask);
220 const __m256i vxb23 = _mm256_cvtepi8_epi16(vbm23);
221
222 vacc0x23 = _mm256_add_epi32(vacc0x23, _mm256_madd_epi16(vxa0, vxb23));
223 vacc1x23 = _mm256_add_epi32(vacc1x23, _mm256_madd_epi16(vxa1, vxb23));
224 vacc2x23 = _mm256_add_epi32(vacc2x23, _mm256_madd_epi16(vxa2, vxb23));
225 const __m128i vb45 = _mm_load_si128((const __m128i*) ((const int8_t*) w + 32));
226 const __m128i vbs45 = _mm_slli_epi32(vb45, 4);
227 const __m128i vbm45 = _mm_and_si128(vbs45, vmask);
228 const __m256i vxb45 = _mm256_cvtepi8_epi16(vbm45);
229
230 vacc0x45 = _mm256_add_epi32(vacc0x45, _mm256_madd_epi16(vxa0, vxb45));
231 vacc1x45 = _mm256_add_epi32(vacc1x45, _mm256_madd_epi16(vxa1, vxb45));
232 vacc2x45 = _mm256_add_epi32(vacc2x45, _mm256_madd_epi16(vxa2, vxb45));
233 const __m128i vb67 = _mm_load_si128((const __m128i*) ((const int8_t*) w + 48));
234 const __m128i vbs67 = _mm_slli_epi32(vb67, 4);
235 const __m128i vbm67 = _mm_and_si128(vbs67, vmask);
236 const __m256i vxb67 = _mm256_cvtepi8_epi16(vbm67);
237
238 vacc0x67 = _mm256_add_epi32(vacc0x67, _mm256_madd_epi16(vxa0, vxb67));
239 vacc1x67 = _mm256_add_epi32(vacc1x67, _mm256_madd_epi16(vxa1, vxb67));
240 vacc2x67 = _mm256_add_epi32(vacc2x67, _mm256_madd_epi16(vxa2, vxb67));
241
242 w = (const int8_t*) w + 64;
243 k -= 8 * sizeof(int8_t);
244 }
245
246 const __m128 vfilter_output_scale0 = _mm_castsi128_ps(_mm_set1_epi32((uint32_t) ((const uint16_t*) w)[0] << 16));
247 const __m128 vfilter_output_scale1 = _mm_castsi128_ps(_mm_set1_epi32((uint32_t) ((const uint16_t*) w)[1] << 16));
248 const __m256 vfilter_output_scale01 = _mm256_insertf128_ps(
249 _mm256_castps128_ps256(vfilter_output_scale0), vfilter_output_scale1, 1);
250 vout0x01 = _mm256_fmadd_ps(_mm256_cvtepi32_ps(vacc0x01), vfilter_output_scale01, vout0x01);
251 vout1x01 = _mm256_fmadd_ps(_mm256_cvtepi32_ps(vacc1x01), vfilter_output_scale01, vout1x01);
252 vout2x01 = _mm256_fmadd_ps(_mm256_cvtepi32_ps(vacc2x01), vfilter_output_scale01, vout2x01);
253 const __m128 vfilter_output_scale2 = _mm_castsi128_ps(_mm_set1_epi32((uint32_t) ((const uint16_t*) w)[2] << 16));
254 const __m128 vfilter_output_scale3 = _mm_castsi128_ps(_mm_set1_epi32((uint32_t) ((const uint16_t*) w)[3] << 16));
255 const __m256 vfilter_output_scale23 = _mm256_insertf128_ps(
256 _mm256_castps128_ps256(vfilter_output_scale2), vfilter_output_scale3, 1);
257 vout0x23 = _mm256_fmadd_ps(_mm256_cvtepi32_ps(vacc0x23), vfilter_output_scale23, vout0x23);
258 vout1x23 = _mm256_fmadd_ps(_mm256_cvtepi32_ps(vacc1x23), vfilter_output_scale23, vout1x23);
259 vout2x23 = _mm256_fmadd_ps(_mm256_cvtepi32_ps(vacc2x23), vfilter_output_scale23, vout2x23);
260 const __m128 vfilter_output_scale4 = _mm_castsi128_ps(_mm_set1_epi32((uint32_t) ((const uint16_t*) w)[4] << 16));
261 const __m128 vfilter_output_scale5 = _mm_castsi128_ps(_mm_set1_epi32((uint32_t) ((const uint16_t*) w)[5] << 16));
262 const __m256 vfilter_output_scale45 = _mm256_insertf128_ps(
263 _mm256_castps128_ps256(vfilter_output_scale4), vfilter_output_scale5, 1);
264 vout0x45 = _mm256_fmadd_ps(_mm256_cvtepi32_ps(vacc0x45), vfilter_output_scale45, vout0x45);
265 vout1x45 = _mm256_fmadd_ps(_mm256_cvtepi32_ps(vacc1x45), vfilter_output_scale45, vout1x45);
266 vout2x45 = _mm256_fmadd_ps(_mm256_cvtepi32_ps(vacc2x45), vfilter_output_scale45, vout2x45);
267 const __m128 vfilter_output_scale6 = _mm_castsi128_ps(_mm_set1_epi32((uint32_t) ((const uint16_t*) w)[6] << 16));
268 const __m128 vfilter_output_scale7 = _mm_castsi128_ps(_mm_set1_epi32((uint32_t) ((const uint16_t*) w)[7] << 16));
269 const __m256 vfilter_output_scale67 = _mm256_insertf128_ps(
270 _mm256_castps128_ps256(vfilter_output_scale6), vfilter_output_scale7, 1);
271 vout0x67 = _mm256_fmadd_ps(_mm256_cvtepi32_ps(vacc0x67), vfilter_output_scale67, vout0x67);
272 vout1x67 = _mm256_fmadd_ps(_mm256_cvtepi32_ps(vacc1x67), vfilter_output_scale67, vout1x67);
273 vout2x67 = _mm256_fmadd_ps(_mm256_cvtepi32_ps(vacc2x67), vfilter_output_scale67, vout2x67);
274
275 w = (const uint16_t*) w + 8;
276 }
277
278 const __m256 vout0x0213 = _mm256_hadd_ps(vout0x01, vout0x23);
279 const __m256 vout0x4657 = _mm256_hadd_ps(vout0x45, vout0x67);
280 const __m256 vout1x0213 = _mm256_hadd_ps(vout1x01, vout1x23);
281 const __m256 vout1x4657 = _mm256_hadd_ps(vout1x45, vout1x67);
282 const __m256 vout2x0213 = _mm256_hadd_ps(vout2x01, vout2x23);
283 const __m256 vout2x4657 = _mm256_hadd_ps(vout2x45, vout2x67);
284
285 const __m256 vout0x02461357 = _mm256_hadd_ps(vout0x0213, vout0x4657);
286 const __m256 vout1x02461357 = _mm256_hadd_ps(vout1x0213, vout1x4657);
287 const __m256 vout2x02461357 = _mm256_hadd_ps(vout2x0213, vout2x4657);
288
289 const __m256i vpermute_mask = _mm256_set_epi32(7, 3, 6, 2, 5, 1, 4, 0);
290 __m256 vout0x01234567 = _mm256_permutevar8x32_ps(vout0x02461357, vpermute_mask);
291 __m256 vout1x01234567 = _mm256_permutevar8x32_ps(vout1x02461357, vpermute_mask);
292 __m256 vout2x01234567 = _mm256_permutevar8x32_ps(vout2x02461357, vpermute_mask);
293
294 const __m256 vinput_scale0 = _mm256_broadcast_ss(&quantization_params[0].inv_scale);
295 const __m256 vinput_scale1 = _mm256_broadcast_ss(&quantization_params[1].inv_scale);
296 const __m256 vinput_scale2 = _mm256_broadcast_ss(&quantization_params[2].inv_scale);
297
298 const __m256 vbias01234567 = _mm256_loadu_ps((const float*) w);
299 w = (const float*) w + 8;
300 vout0x01234567 = _mm256_fmadd_ps(vout0x01234567, vinput_scale0, vbias01234567);
301 vout1x01234567 = _mm256_fmadd_ps(vout1x01234567, vinput_scale1, vbias01234567);
302 vout2x01234567 = _mm256_fmadd_ps(vout2x01234567, vinput_scale2, vbias01234567);
303
304
305
306 vout0x01234567 = _mm256_max_ps(vout0x01234567, vmin);
307 vout1x01234567 = _mm256_max_ps(vout1x01234567, vmin);
308 vout2x01234567 = _mm256_max_ps(vout2x01234567, vmin);
309
310 vout0x01234567 = _mm256_min_ps(vout0x01234567, vmax);
311 vout1x01234567 = _mm256_min_ps(vout1x01234567, vmax);
312 vout2x01234567 = _mm256_min_ps(vout2x01234567, vmax);
313 __m128i vfp16out0x01234567 = _mm256_cvtps_ph(vout0x01234567, _MM_FROUND_TO_NEAREST_INT);
314 __m128i vfp16out1x01234567 = _mm256_cvtps_ph(vout1x01234567, _MM_FROUND_TO_NEAREST_INT);
315 __m128i vfp16out2x01234567 = _mm256_cvtps_ph(vout2x01234567, _MM_FROUND_TO_NEAREST_INT);
316 if XNN_LIKELY(nc >= 8) {
317 _mm_storeu_si128((__m128i*) c0, vfp16out0x01234567);
318 c0 = (uint16_t*) ((uintptr_t) c0 + cn_stride);
319 _mm_storeu_si128((__m128i*) c1, vfp16out1x01234567);
320 c1 = (uint16_t*) ((uintptr_t) c1 + cn_stride);
321 _mm_storeu_si128((__m128i*) c2, vfp16out2x01234567);
322 c2 = (uint16_t*) ((uintptr_t) c2 + cn_stride);
323
324 a0 = (const int8_t*) ((uintptr_t) a0 - kc);
325 a1 = (const int8_t*) ((uintptr_t) a1 - kc);
326 a2 = (const int8_t*) ((uintptr_t) a2 - kc);
327
328 nc -= 8;
329 } else {
330 if (nc & 4) {
331 _mm_storel_epi64((__m128i*) c0, vfp16out0x01234567);
332 _mm_storel_epi64((__m128i*) c1, vfp16out1x01234567);
333 _mm_storel_epi64((__m128i*) c2, vfp16out2x01234567);
334
335 vfp16out0x01234567 = _mm_unpackhi_epi64(vfp16out0x01234567, vfp16out0x01234567);
336 vfp16out1x01234567 = _mm_unpackhi_epi64(vfp16out1x01234567, vfp16out1x01234567);
337 vfp16out2x01234567 = _mm_unpackhi_epi64(vfp16out2x01234567, vfp16out2x01234567);
338
339 c0 += 4;
340 c1 += 4;
341 c2 += 4;
342 }
343 if (nc & 2) {
344 _mm_storeu_si32(c0, vfp16out0x01234567);
345 _mm_storeu_si32(c1, vfp16out1x01234567);
346 _mm_storeu_si32(c2, vfp16out2x01234567);
347
348 vfp16out0x01234567 = _mm_srli_epi64(vfp16out0x01234567, 32);
349 vfp16out1x01234567 = _mm_srli_epi64(vfp16out1x01234567, 32);
350 vfp16out2x01234567 = _mm_srli_epi64(vfp16out2x01234567, 32);
351
352 c0 += 2;
353 c1 += 2;
354 c2 += 2;
355 }
356 if (nc & 1) {
357 *c0 = (uint16_t) _mm_extract_epi16(vfp16out0x01234567, 0);
358 *c1 = (uint16_t) _mm_extract_epi16(vfp16out1x01234567, 0);
359 *c2 = (uint16_t) _mm_extract_epi16(vfp16out2x01234567, 0);
360 }
361 nc = 0;
362 }
363 } while (nc != 0);
364 }