Debian Codegraph @

src/qd8-f32-qc8w-gemm/gen/qd8-f32-qc8w-gemm-6x8c4-minmax-avxvnni-u4-acc4.c

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/qs8-gemm/MRx8c4-avxvnni.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 #include <stdint.h>
12
13 #include <immintrin.h>
14
15 #include "xnnpack/common.h"
16 #include "xnnpack/gemm.h"
17 #include "xnnpack/intrinsics-polyfill.h"
18 #include "xnnpack/math.h"
19 #include "xnnpack/unaligned.h"
20 #include "xnnpack/prefetch.h"
21
22
23 void xnn_qd8_f32_qc8w_gemm_minmax_ukernel_6x8c4__avxvnni_u4_acc4(
24 size_t mr,
25 size_t nc,
26 size_t kc,
27 const int8_t* restrict a,
28 size_t a_stride,
29 const void* restrict w,
30 float* restrict c,
31 size_t cm_stride,
32 size_t cn_stride,
33 const union xnn_f32_minmax_params params[restrict XNN_MIN_ELEMENTS(1)],
34 const struct xnn_qd8_quantization_params quantization_params[restrict XNN_MIN_ELEMENTS(1)]) XNN_OOB_READS
35 {
36 assert(mr != 0);
37 assert(mr <= 6);
38 assert(nc != 0);
39 assert(kc != 0);
40 assert(kc % 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 const int8_t* a0 = a;
47 float* c0 = c;
48 const int8_t* a1 = (const int8_t*) ((uintptr_t) a0 + a_stride);
49 float* c1 = (float*) ((uintptr_t) c0 + cm_stride);
50 if XNN_UNPREDICTABLE(mr < 2) {
51 a1 = a0;
52 c1 = c0;
53 }
54 const int8_t* a2 = (const int8_t*) ((uintptr_t) a1 + a_stride);
55 float* c2 = (float*) ((uintptr_t) c1 + cm_stride);
56 if XNN_UNPREDICTABLE(mr <= 2) {
57 a2 = a1;
58 c2 = c1;
59 }
60 const int8_t* a3 = (const int8_t*) ((uintptr_t) a2 + a_stride);
61 float* c3 = (float*) ((uintptr_t) c2 + cm_stride);
62 if XNN_UNPREDICTABLE(mr < 4) {
63 a3 = a2;
64 c3 = c2;
65 }
66 const int8_t* a4 = (const int8_t*) ((uintptr_t) a3 + a_stride);
67 float* c4 = (float*) ((uintptr_t) c3 + cm_stride);
68 if XNN_UNPREDICTABLE(mr <= 4) {
69 a4 = a3;
70 c4 = c3;
71 }
72 const int8_t* a5 = (const int8_t*) ((uintptr_t) a4 + a_stride);
73 float* c5 = (float*) ((uintptr_t) c4 + cm_stride);
74 if XNN_UNPREDICTABLE(mr != 6) {
75 a5 = a4;
76 c5 = c4;
77 }
78
79 const __m256i vsign_mask =_mm256_set1_epi8(0x80);
80 XNN_FORCE_REALIZATION(vsign_mask);
81 const __m256i vinput_zero_point0 = _mm256_set1_epi32((int) quantization_params[0].zero_point + 128);
82 const __m256i vinput_zero_point1 = _mm256_set1_epi32((int) quantization_params[1].zero_point + 128);
83 const __m256i vinput_zero_point2 = _mm256_set1_epi32((int) quantization_params[2].zero_point + 128);
84 const __m256i vinput_zero_point3 = _mm256_set1_epi32((int) quantization_params[3].zero_point + 128);
85 const __m256i vinput_zero_point4 = _mm256_set1_epi32((int) quantization_params[4].zero_point + 128);
86 const __m256i vinput_zero_point5 = _mm256_set1_epi32((int) quantization_params[5].zero_point + 128);
87 const __m256 voutput_min = _mm256_set1_ps(params->scalar.min);
88 const __m256 voutput_max = _mm256_set1_ps(params->scalar.max);
89 // XNN_FORCE_REALIZATION(voutput_min);
90 // XNN_FORCE_REALIZATION(voutput_max);
91 do {
92 const __m256i vksum01234567 = _mm256_load_si256(w);
93 __m256i vacc0x0x01234567 = _mm256_mullo_epi32(vksum01234567, vinput_zero_point0);
94 __m256i vacc0x1x01234567 = _mm256_setzero_si256();
95 __m256i vacc0x2x01234567 = _mm256_setzero_si256();
96 __m256i vacc0x3x01234567 = _mm256_setzero_si256();
97 __m256i vacc1x0x01234567 = _mm256_mullo_epi32(vksum01234567, vinput_zero_point1);
98 __m256i vacc1x1x01234567 = _mm256_setzero_si256();
99 __m256i vacc1x2x01234567 = _mm256_setzero_si256();
100 __m256i vacc1x3x01234567 = _mm256_setzero_si256();
101 __m256i vacc2x0x01234567 = _mm256_mullo_epi32(vksum01234567, vinput_zero_point2);
102 __m256i vacc2x1x01234567 = _mm256_setzero_si256();
103 __m256i vacc2x2x01234567 = _mm256_setzero_si256();
104 __m256i vacc2x3x01234567 = _mm256_setzero_si256();
105 __m256i vacc3x0x01234567 = _mm256_mullo_epi32(vksum01234567, vinput_zero_point3);
106 __m256i vacc3x1x01234567 = _mm256_setzero_si256();
107 __m256i vacc3x2x01234567 = _mm256_setzero_si256();
108 __m256i vacc3x3x01234567 = _mm256_setzero_si256();
109 __m256i vacc4x0x01234567 = _mm256_mullo_epi32(vksum01234567, vinput_zero_point4);
110 __m256i vacc4x1x01234567 = _mm256_setzero_si256();
111 __m256i vacc4x2x01234567 = _mm256_setzero_si256();
112 __m256i vacc4x3x01234567 = _mm256_setzero_si256();
113 __m256i vacc5x0x01234567 = _mm256_mullo_epi32(vksum01234567, vinput_zero_point5);
114 __m256i vacc5x1x01234567 = _mm256_setzero_si256();
115 __m256i vacc5x2x01234567 = _mm256_setzero_si256();
116 __m256i vacc5x3x01234567 = _mm256_setzero_si256();
117 w = (const int32_t*) w + 8;
118
119 size_t k = kc;
120 while (k >= 16 * sizeof(int8_t)) {
121 __m256i va0x0x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a0 + 0));
122 __m256i va0x1x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a0 + 4));
123 __m256i va0x2x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a0 + 8));
124 __m256i va0x3x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a0 + 12));
125 a0 += 16;
126 __m256i va1x0x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a1 + 0));
127 __m256i va1x1x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a1 + 4));
128 __m256i va1x2x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a1 + 8));
129 __m256i va1x3x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a1 + 12));
130 a1 += 16;
131 __m256i va2x0x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a2 + 0));
132 __m256i va2x1x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a2 + 4));
133 __m256i va2x2x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a2 + 8));
134 __m256i va2x3x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a2 + 12));
135 a2 += 16;
136 __m256i va3x0x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a3 + 0));
137 __m256i va3x1x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a3 + 4));
138 __m256i va3x2x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a3 + 8));
139 __m256i va3x3x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a3 + 12));
140 a3 += 16;
141 __m256i va4x0x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a4 + 0));
142 __m256i va4x1x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a4 + 4));
143 __m256i va4x2x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a4 + 8));
144 __m256i va4x3x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a4 + 12));
145 a4 += 16;
146 __m256i va5x0x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a5 + 0));
147 __m256i va5x1x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a5 + 4));
148 __m256i va5x2x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a5 + 8));
149 __m256i va5x3x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a5 + 12));
150 a5 += 16;
151
152 va0x0x0123 = _mm256_xor_si256(va0x0x0123, vsign_mask);
153 va0x1x0123 = _mm256_xor_si256(va0x1x0123, vsign_mask);
154 va0x2x0123 = _mm256_xor_si256(va0x2x0123, vsign_mask);
155 va0x3x0123 = _mm256_xor_si256(va0x3x0123, vsign_mask);
156 va1x0x0123 = _mm256_xor_si256(va1x0x0123, vsign_mask);
157 va1x1x0123 = _mm256_xor_si256(va1x1x0123, vsign_mask);
158 va1x2x0123 = _mm256_xor_si256(va1x2x0123, vsign_mask);
159 va1x3x0123 = _mm256_xor_si256(va1x3x0123, vsign_mask);
160 va2x0x0123 = _mm256_xor_si256(va2x0x0123, vsign_mask);
161 va2x1x0123 = _mm256_xor_si256(va2x1x0123, vsign_mask);
162 va2x2x0123 = _mm256_xor_si256(va2x2x0123, vsign_mask);
163 va2x3x0123 = _mm256_xor_si256(va2x3x0123, vsign_mask);
164 va3x0x0123 = _mm256_xor_si256(va3x0x0123, vsign_mask);
165 va3x1x0123 = _mm256_xor_si256(va3x1x0123, vsign_mask);
166 va3x2x0123 = _mm256_xor_si256(va3x2x0123, vsign_mask);
167 va3x3x0123 = _mm256_xor_si256(va3x3x0123, vsign_mask);
168 va4x0x0123 = _mm256_xor_si256(va4x0x0123, vsign_mask);
169 va4x1x0123 = _mm256_xor_si256(va4x1x0123, vsign_mask);
170 va4x2x0123 = _mm256_xor_si256(va4x2x0123, vsign_mask);
171 va4x3x0123 = _mm256_xor_si256(va4x3x0123, vsign_mask);
172 va5x0x0123 = _mm256_xor_si256(va5x0x0123, vsign_mask);
173 va5x1x0123 = _mm256_xor_si256(va5x1x0123, vsign_mask);
174 va5x2x0123 = _mm256_xor_si256(va5x2x0123, vsign_mask);
175 va5x3x0123 = _mm256_xor_si256(va5x3x0123, vsign_mask);
176
177 const __m256i vb0x01234567 = _mm256_load_si256((const __m256i*) ((const int8_t*) w + 0));
178 const __m256i vb1x01234567 = _mm256_load_si256((const __m256i*) ((const int8_t*) w + 32));
179 const __m256i vb2x01234567 = _mm256_load_si256((const __m256i*) ((const int8_t*) w + 64));
180 const __m256i vb3x01234567 = _mm256_load_si256((const __m256i*) ((const int8_t*) w + 96));
181 w = (const int8_t*) w + 128;
182
183 vacc0x0x01234567 = _mm256_dpbusd_avx_epi32(vacc0x0x01234567, va0x0x0123, vb0x01234567);
184 vacc0x1x01234567 = _mm256_dpbusd_avx_epi32(vacc0x1x01234567, va0x1x0123, vb1x01234567);
185 vacc0x2x01234567 = _mm256_dpbusd_avx_epi32(vacc0x2x01234567, va0x2x0123, vb2x01234567);
186 vacc0x3x01234567 = _mm256_dpbusd_avx_epi32(vacc0x3x01234567, va0x3x0123, vb3x01234567);
187 vacc1x0x01234567 = _mm256_dpbusd_avx_epi32(vacc1x0x01234567, va1x0x0123, vb0x01234567);
188 vacc1x1x01234567 = _mm256_dpbusd_avx_epi32(vacc1x1x01234567, va1x1x0123, vb1x01234567);
189 vacc1x2x01234567 = _mm256_dpbusd_avx_epi32(vacc1x2x01234567, va1x2x0123, vb2x01234567);
190 vacc1x3x01234567 = _mm256_dpbusd_avx_epi32(vacc1x3x01234567, va1x3x0123, vb3x01234567);
191 vacc2x0x01234567 = _mm256_dpbusd_avx_epi32(vacc2x0x01234567, va2x0x0123, vb0x01234567);
192 vacc2x1x01234567 = _mm256_dpbusd_avx_epi32(vacc2x1x01234567, va2x1x0123, vb1x01234567);
193 vacc2x2x01234567 = _mm256_dpbusd_avx_epi32(vacc2x2x01234567, va2x2x0123, vb2x01234567);
194 vacc2x3x01234567 = _mm256_dpbusd_avx_epi32(vacc2x3x01234567, va2x3x0123, vb3x01234567);
195 vacc3x0x01234567 = _mm256_dpbusd_avx_epi32(vacc3x0x01234567, va3x0x0123, vb0x01234567);
196 vacc3x1x01234567 = _mm256_dpbusd_avx_epi32(vacc3x1x01234567, va3x1x0123, vb1x01234567);
197 vacc3x2x01234567 = _mm256_dpbusd_avx_epi32(vacc3x2x01234567, va3x2x0123, vb2x01234567);
198 vacc3x3x01234567 = _mm256_dpbusd_avx_epi32(vacc3x3x01234567, va3x3x0123, vb3x01234567);
199 vacc4x0x01234567 = _mm256_dpbusd_avx_epi32(vacc4x0x01234567, va4x0x0123, vb0x01234567);
200 vacc4x1x01234567 = _mm256_dpbusd_avx_epi32(vacc4x1x01234567, va4x1x0123, vb1x01234567);
201 vacc4x2x01234567 = _mm256_dpbusd_avx_epi32(vacc4x2x01234567, va4x2x0123, vb2x01234567);
202 vacc4x3x01234567 = _mm256_dpbusd_avx_epi32(vacc4x3x01234567, va4x3x0123, vb3x01234567);
203 vacc5x0x01234567 = _mm256_dpbusd_avx_epi32(vacc5x0x01234567, va5x0x0123, vb0x01234567);
204 vacc5x1x01234567 = _mm256_dpbusd_avx_epi32(vacc5x1x01234567, va5x1x0123, vb1x01234567);
205 vacc5x2x01234567 = _mm256_dpbusd_avx_epi32(vacc5x2x01234567, va5x2x0123, vb2x01234567);
206 vacc5x3x01234567 = _mm256_dpbusd_avx_epi32(vacc5x3x01234567, va5x3x0123, vb3x01234567);
207
208 k -= 16 * sizeof(int8_t);
209 }
210 vacc0x0x01234567 = _mm256_add_epi32(vacc0x0x01234567, vacc0x1x01234567);
211 vacc1x0x01234567 = _mm256_add_epi32(vacc1x0x01234567, vacc1x1x01234567);
212 vacc2x0x01234567 = _mm256_add_epi32(vacc2x0x01234567, vacc2x1x01234567);
213 vacc3x0x01234567 = _mm256_add_epi32(vacc3x0x01234567, vacc3x1x01234567);
214 vacc4x0x01234567 = _mm256_add_epi32(vacc4x0x01234567, vacc4x1x01234567);
215 vacc5x0x01234567 = _mm256_add_epi32(vacc5x0x01234567, vacc5x1x01234567);
216 vacc0x2x01234567 = _mm256_add_epi32(vacc0x2x01234567, vacc0x3x01234567);
217 vacc1x2x01234567 = _mm256_add_epi32(vacc1x2x01234567, vacc1x3x01234567);
218 vacc2x2x01234567 = _mm256_add_epi32(vacc2x2x01234567, vacc2x3x01234567);
219 vacc3x2x01234567 = _mm256_add_epi32(vacc3x2x01234567, vacc3x3x01234567);
220 vacc4x2x01234567 = _mm256_add_epi32(vacc4x2x01234567, vacc4x3x01234567);
221 vacc5x2x01234567 = _mm256_add_epi32(vacc5x2x01234567, vacc5x3x01234567);
222 vacc0x0x01234567 = _mm256_add_epi32(vacc0x0x01234567, vacc0x2x01234567);
223 vacc1x0x01234567 = _mm256_add_epi32(vacc1x0x01234567, vacc1x2x01234567);
224 vacc2x0x01234567 = _mm256_add_epi32(vacc2x0x01234567, vacc2x2x01234567);
225 vacc3x0x01234567 = _mm256_add_epi32(vacc3x0x01234567, vacc3x2x01234567);
226 vacc4x0x01234567 = _mm256_add_epi32(vacc4x0x01234567, vacc4x2x01234567);
227 vacc5x0x01234567 = _mm256_add_epi32(vacc5x0x01234567, vacc5x2x01234567);
228 while (k != 0) {
229 __m256i va0x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a0));
230 a0 += 4;
231 __m256i va1x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a1));
232 a1 += 4;
233 __m256i va2x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a2));
234 a2 += 4;
235 __m256i va3x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a3));
236 a3 += 4;
237 __m256i va4x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a4));
238 a4 += 4;
239 __m256i va5x0123 = _mm256_set1_epi32((int) unaligned_load_u32(a5));
240 a5 += 4;
241
242 va0x0123 = _mm256_xor_si256(va0x0123, vsign_mask);
243 va1x0123 = _mm256_xor_si256(va1x0123, vsign_mask);
244 va2x0123 = _mm256_xor_si256(va2x0123, vsign_mask);
245 va3x0123 = _mm256_xor_si256(va3x0123, vsign_mask);
246 va4x0123 = _mm256_xor_si256(va4x0123, vsign_mask);
247 va5x0123 = _mm256_xor_si256(va5x0123, vsign_mask);
248
249 const __m256i vb01234567 = _mm256_load_si256(w);
250
251 vacc0x0x01234567 = _mm256_dpbusd_avx_epi32(vacc0x0x01234567, va0x0123, vb01234567);
252 vacc1x0x01234567 = _mm256_dpbusd_avx_epi32(vacc1x0x01234567, va1x0123, vb01234567);
253 vacc2x0x01234567 = _mm256_dpbusd_avx_epi32(vacc2x0x01234567, va2x0123, vb01234567);
254 vacc3x0x01234567 = _mm256_dpbusd_avx_epi32(vacc3x0x01234567, va3x0123, vb01234567);
255 vacc4x0x01234567 = _mm256_dpbusd_avx_epi32(vacc4x0x01234567, va4x0123, vb01234567);
256 vacc5x0x01234567 = _mm256_dpbusd_avx_epi32(vacc5x0x01234567, va5x0123, vb01234567);
257
258 w = (const int8_t*) w + 32;
259 k -= 4 * sizeof(int8_t);
260 }
261
262 __m256 vout0x01234567 = _mm256_cvtepi32_ps(vacc0x0x01234567);
263 __m256 vout1x01234567 = _mm256_cvtepi32_ps(vacc1x0x01234567);
264 __m256 vout2x01234567 = _mm256_cvtepi32_ps(vacc2x0x01234567);
265 __m256 vout3x01234567 = _mm256_cvtepi32_ps(vacc3x0x01234567);
266 __m256 vout4x01234567 = _mm256_cvtepi32_ps(vacc4x0x01234567);
267 __m256 vout5x01234567 = _mm256_cvtepi32_ps(vacc5x0x01234567);
268
269 vout0x01234567 = _mm256_mul_ps(vout0x01234567, _mm256_set1_ps(quantization_params[0].inv_scale));
270 vout1x01234567 = _mm256_mul_ps(vout1x01234567, _mm256_set1_ps(quantization_params[1].inv_scale));
271 vout2x01234567 = _mm256_mul_ps(vout2x01234567, _mm256_set1_ps(quantization_params[2].inv_scale));
272 vout3x01234567 = _mm256_mul_ps(vout3x01234567, _mm256_set1_ps(quantization_params[3].inv_scale));
273 vout4x01234567 = _mm256_mul_ps(vout4x01234567, _mm256_set1_ps(quantization_params[4].inv_scale));
274 vout5x01234567 = _mm256_mul_ps(vout5x01234567, _mm256_set1_ps(quantization_params[5].inv_scale));
275
276 const __m256 vfilter_output_scale01234567 = _mm256_load_ps((const float*) w);
277 const __m256 vbias01234567 = _mm256_load_ps((const float*) w + 8);
278 w = (const float*) w + 16;
279
280 vout0x01234567 = _mm256_fmadd_ps(vout0x01234567, vfilter_output_scale01234567, vbias01234567);
281 vout1x01234567 = _mm256_fmadd_ps(vout1x01234567, vfilter_output_scale01234567, vbias01234567);
282 vout2x01234567 = _mm256_fmadd_ps(vout2x01234567, vfilter_output_scale01234567, vbias01234567);
283 vout3x01234567 = _mm256_fmadd_ps(vout3x01234567, vfilter_output_scale01234567, vbias01234567);
284 vout4x01234567 = _mm256_fmadd_ps(vout4x01234567, vfilter_output_scale01234567, vbias01234567);
285 vout5x01234567 = _mm256_fmadd_ps(vout5x01234567, vfilter_output_scale01234567, vbias01234567);
286
287 vout0x01234567 = _mm256_max_ps(vout0x01234567, voutput_min);
288 vout1x01234567 = _mm256_max_ps(vout1x01234567, voutput_min);
289 vout2x01234567 = _mm256_max_ps(vout2x01234567, voutput_min);
290 vout3x01234567 = _mm256_max_ps(vout3x01234567, voutput_min);
291 vout4x01234567 = _mm256_max_ps(vout4x01234567, voutput_min);
292 vout5x01234567 = _mm256_max_ps(vout5x01234567, voutput_min);
293
294 vout0x01234567 = _mm256_min_ps(vout0x01234567, voutput_max);
295 vout1x01234567 = _mm256_min_ps(vout1x01234567, voutput_max);
296 vout2x01234567 = _mm256_min_ps(vout2x01234567, voutput_max);
297 vout3x01234567 = _mm256_min_ps(vout3x01234567, voutput_max);
298 vout4x01234567 = _mm256_min_ps(vout4x01234567, voutput_max);
299 vout5x01234567 = _mm256_min_ps(vout5x01234567, voutput_max);
300
301 if XNN_LIKELY(nc >= 8) {
302 _mm256_storeu_ps(c0, vout0x01234567);
303 a0 = (const int8_t*) ((uintptr_t) a0 - kc);
304 c0 = (float*) ((uintptr_t) c0 + cn_stride);
305 _mm256_storeu_ps(c1, vout1x01234567);
306 a1 = (const int8_t*) ((uintptr_t) a1 - kc);
307 c1 = (float*) ((uintptr_t) c1 + cn_stride);
308 _mm256_storeu_ps(c2, vout2x01234567);
309 a2 = (const int8_t*) ((uintptr_t) a2 - kc);
310 c2 = (float*) ((uintptr_t) c2 + cn_stride);
311 _mm256_storeu_ps(c3, vout3x01234567);
312 a3 = (const int8_t*) ((uintptr_t) a3 - kc);
313 c3 = (float*) ((uintptr_t) c3 + cn_stride);
314 _mm256_storeu_ps(c4, vout4x01234567);
315 a4 = (const int8_t*) ((uintptr_t) a4 - kc);
316 c4 = (float*) ((uintptr_t) c4 + cn_stride);
317 _mm256_storeu_ps(c5, vout5x01234567);
318 a5 = (const int8_t*) ((uintptr_t) a5 - kc);
319 c5 = (float*) ((uintptr_t) c5 + cn_stride);
320 nc -= 8;
321 } else {
322 __m128 vout0x0123 = _mm256_castps256_ps128(vout0x01234567);
323 __m128 vout1x0123 = _mm256_castps256_ps128(vout1x01234567);
324 __m128 vout2x0123 = _mm256_castps256_ps128(vout2x01234567);
325 __m128 vout3x0123 = _mm256_castps256_ps128(vout3x01234567);
326 __m128 vout4x0123 = _mm256_castps256_ps128(vout4x01234567);
327 __m128 vout5x0123 = _mm256_castps256_ps128(vout5x01234567);
328 if (nc & 4) {
329 _mm_storeu_ps(c0, vout0x0123);
330 c0 += 4;
331 _mm_storeu_ps(c1, vout1x0123);
332 c1 += 4;
333 _mm_storeu_ps(c2, vout2x0123);
334 c2 += 4;
335 _mm_storeu_ps(c3, vout3x0123);
336 c3 += 4;
337 _mm_storeu_ps(c4, vout4x0123);
338 c4 += 4;
339 _mm_storeu_ps(c5, vout5x0123);
340 c5 += 4;
341 vout0x0123 = _mm256_extractf128_ps(vout0x01234567, 1);
342 vout1x0123 = _mm256_extractf128_ps(vout1x01234567, 1);
343 vout2x0123 = _mm256_extractf128_ps(vout2x01234567, 1);
344 vout3x0123 = _mm256_extractf128_ps(vout3x01234567, 1);
345 vout4x0123 = _mm256_extractf128_ps(vout4x01234567, 1);
346 vout5x0123 = _mm256_extractf128_ps(vout5x01234567, 1);
347 }
348 if (nc & 2) {
349 _mm_storel_pi((__m64*) c0, vout0x0123);
350 c0 += 2;
351 _mm_storel_pi((__m64*) c1, vout1x0123);
352 c1 += 2;
353 _mm_storel_pi((__m64*) c2, vout2x0123);
354 c2 += 2;
355 _mm_storel_pi((__m64*) c3, vout3x0123);
356 c3 += 2;
357 _mm_storel_pi((__m64*) c4, vout4x0123);
358 c4 += 2;
359 _mm_storel_pi((__m64*) c5, vout5x0123);
360 c5 += 2;
361 vout0x0123 = _mm_movehl_ps(vout0x0123, vout0x0123);
362 vout1x0123 = _mm_movehl_ps(vout1x0123, vout1x0123);
363 vout2x0123 = _mm_movehl_ps(vout2x0123, vout2x0123);
364 vout3x0123 = _mm_movehl_ps(vout3x0123, vout3x0123);
365 vout4x0123 = _mm_movehl_ps(vout4x0123, vout4x0123);
366 vout5x0123 = _mm_movehl_ps(vout5x0123, vout5x0123);
367 }
368 if (nc & 1) {
369 _mm_store_ss(c0, vout0x0123);
370 _mm_store_ss(c1, vout1x0123);
371 _mm_store_ss(c2, vout2x0123);
372 _mm_store_ss(c3, vout3x0123);
373 _mm_store_ss(c4, vout4x0123);
374 _mm_store_ss(c5, vout5x0123);
375 }
376 nc = 0;
377 }
378 } while (nc != 0);
379 }