• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Auto-generated file. Do not edit!
2 //   Template: src/f32-dwconv2d-chw/5x5p2-wasmsimd-splat.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 <wasm_simd128.h>
13 
14 #include <xnnpack/dwconv.h>
15 #include <xnnpack/math.h>
16 
17 
18 
xnn_f32_dwconv2d_chw_ukernel_5x5p2__wasmsimd_x86_splat_1x4_acc5(size_t input_height,size_t input_width,const float * input,const float * weights,const float * zero,float * output,uint32_t padding_top,const union xnn_f32_chw_params params[restrict XNN_MIN_ELEMENTS (1)])19 void xnn_f32_dwconv2d_chw_ukernel_5x5p2__wasmsimd_x86_splat_1x4_acc5(
20     size_t input_height,
21     size_t input_width,
22     const float* input,
23     const float* weights,
24     const float* zero,
25     float* output,
26     uint32_t padding_top,
27     const union xnn_f32_chw_params params[restrict XNN_MIN_ELEMENTS(1)]) XNN_OOB_READS
28 {
29   assert(input_height != 0);
30   assert(input_width != 0);
31   assert(input_width % sizeof(float) == 0);
32   assert(padding_top == 2);
33 
34   const v128_t vmask = wasm_v128_load(params->scalar.mask);
35   const v128_t vmax = wasm_v128_load32_splat(&params->scalar.max);
36   const v128_t vmin = wasm_v128_load32_splat(&params->scalar.min);
37 
38   const v128_t vw0123 = wasm_v128_load(weights);
39   const v128_t vw4567 = wasm_v128_load(weights + 4);
40   const v128_t vw89AB = wasm_v128_load(weights + 8);
41   const v128_t vwCDEF = wasm_v128_load(weights + 12);
42   const v128_t vwGHIJ = wasm_v128_load(weights + 16);
43   const v128_t vwKLMN = wasm_v128_load(weights + 20);
44   const v128_t vwOP = wasm_v128_load64_splat(weights + 24);
45 
46   const size_t input_decrement = round_up_po2(input_width, 4 * sizeof(float));
47 
48   const float* i0 = zero;
49   const float* i1 = zero;
50   const float* i2 = input;
51   const float* i3 = (const float*) ((uintptr_t) i2 + input_width);
52   const float* i4 = (const float*) ((uintptr_t) i3 + input_width);
53 
54   float* o0 = output;
55 
56   size_t output_height = input_height;
57   do {
58     if XNN_UNPREDICTABLE(output_height < 2) {
59       i3 = zero;
60     }
61     if XNN_UNPREDICTABLE(output_height < 3) {
62       i4 = zero;
63     }
64 
65     v128_t vi0x0123 = wasm_f32x4_const_splat(0.0f);
66     v128_t vi1x0123 = wasm_f32x4_const_splat(0.0f);
67     v128_t vi2x0123 = wasm_f32x4_const_splat(0.0f);
68     v128_t vi3x0123 = wasm_f32x4_const_splat(0.0f);
69     v128_t vi4x0123 = wasm_f32x4_const_splat(0.0f);
70 
71     v128_t vi0x4567 = wasm_v128_load(i0); i0 += 4;
72     v128_t vi1x4567 = wasm_v128_load(i1); i1 += 4;
73     v128_t vi2x4567 = wasm_v128_load(i2); i2 += 4;
74     v128_t vi3x4567 = wasm_v128_load(i3); i3 += 4;
75     v128_t vi4x4567 = wasm_v128_load(i4); i4 += 4;
76 
77     size_t w = input_width;
78     for (; w > 8 * sizeof(float); w -= 4 * sizeof(float)) {
79       v128_t vo0p0 = wasm_v32x4_shuffle(vw0123, vw0123, 0, 0, 0, 0);
80 
81       const v128_t vi0x89AB = wasm_v128_load(i0); i0 += 4;
82       const v128_t vi1x89AB = wasm_v128_load(i1); i1 += 4;
83       const v128_t vi2x89AB = wasm_v128_load(i2); i2 += 4;
84       const v128_t vi3x89AB = wasm_v128_load(i3); i3 += 4;
85       const v128_t vi4x89AB = wasm_v128_load(i4); i4 += 4;
86 
87       v128_t vo0p1 = wasm_f32x4_mul(vi0x4567, wasm_v32x4_shuffle(vw0123, vw0123, 3, 3, 3, 3));
88 
89       v128_t vo0p2 = wasm_f32x4_mul(vi1x4567, wasm_v32x4_shuffle(vw89AB, vw89AB, 0, 0, 0, 0));
90 
91       v128_t vo0p3 = wasm_f32x4_mul(vi2x4567, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 1, 1, 1, 1));
92 
93       v128_t vo0p4 = wasm_f32x4_mul(vi3x4567, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 2, 2, 2, 2));
94 
95       vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi4x4567, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 3, 3, 3, 3)));
96 
97       const v128_t vi0x3456 = wasm_v32x4_shuffle(vi0x0123, vi0x4567, 3, 4, 5, 6);
98       const v128_t vi1x3456 = wasm_v32x4_shuffle(vi1x0123, vi1x4567, 3, 4, 5, 6);
99       const v128_t vi2x3456 = wasm_v32x4_shuffle(vi2x0123, vi2x4567, 3, 4, 5, 6);
100       const v128_t vi3x3456 = wasm_v32x4_shuffle(vi3x0123, vi3x4567, 3, 4, 5, 6);
101       const v128_t vi4x3456 = wasm_v32x4_shuffle(vi4x0123, vi4x4567, 3, 4, 5, 6);
102 
103       vo0p2 = wasm_f32x4_add(vo0p2, wasm_f32x4_mul(vi0x3456, wasm_v32x4_shuffle(vw0123, vw0123, 2, 2, 2, 2)));
104 
105       vo0p3 = wasm_f32x4_add(vo0p3, wasm_f32x4_mul(vi1x3456, wasm_v32x4_shuffle(vw4567, vw4567, 3, 3, 3, 3)));
106 
107       vo0p4 = wasm_f32x4_add(vo0p4, wasm_f32x4_mul(vi2x3456, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 0, 0, 0, 0)));
108 
109       vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi3x3456, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 1, 1, 1, 1)));
110 
111       vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi4x3456, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 2, 2, 2, 2)));
112 
113       const v128_t vi0x2345 = wasm_v32x4_shuffle(vi0x0123, vi0x4567, 2, 3, 4, 5);
114       vi0x0123 = vi0x4567;
115       const v128_t vi1x2345 = wasm_v32x4_shuffle(vi1x0123, vi1x4567, 2, 3, 4, 5);
116       vi1x0123 = vi1x4567;
117       const v128_t vi2x2345 = wasm_v32x4_shuffle(vi2x0123, vi2x4567, 2, 3, 4, 5);
118       vi2x0123 = vi2x4567;
119       const v128_t vi3x2345 = wasm_v32x4_shuffle(vi3x0123, vi3x4567, 2, 3, 4, 5);
120       vi3x0123 = vi3x4567;
121       const v128_t vi4x2345 = wasm_v32x4_shuffle(vi4x0123, vi4x4567, 2, 3, 4, 5);
122       vi4x0123 = vi4x4567;
123 
124       vo0p2 = wasm_f32x4_add(vo0p2, wasm_f32x4_mul(vi0x2345, wasm_v32x4_shuffle(vw0123, vw0123, 1, 1, 1, 1)));
125 
126       vo0p3 = wasm_f32x4_add(vo0p3, wasm_f32x4_mul(vi1x2345, wasm_v32x4_shuffle(vw4567, vw4567, 2, 2, 2, 2)));
127 
128       vo0p4 = wasm_f32x4_add(vo0p4, wasm_f32x4_mul(vi2x2345, wasm_v32x4_shuffle(vw89AB, vw89AB, 3, 3, 3, 3)));
129 
130       vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi3x2345, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 0, 0, 0, 0)));
131 
132       vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi4x2345, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 1, 1, 1, 1)));
133 
134       const v128_t vi0x5678 = wasm_v32x4_shuffle(vi0x4567, vi0x89AB, 1, 2, 3, 4);
135       const v128_t vi1x5678 = wasm_v32x4_shuffle(vi1x4567, vi1x89AB, 1, 2, 3, 4);
136       const v128_t vi2x5678 = wasm_v32x4_shuffle(vi2x4567, vi2x89AB, 1, 2, 3, 4);
137       const v128_t vi3x5678 = wasm_v32x4_shuffle(vi3x4567, vi3x89AB, 1, 2, 3, 4);
138       const v128_t vi4x5678 = wasm_v32x4_shuffle(vi4x4567, vi4x89AB, 1, 2, 3, 4);
139 
140       vo0p2 = wasm_f32x4_add(vo0p2, wasm_f32x4_mul(vi0x5678, wasm_v32x4_shuffle(vw4567, vw4567, 0, 0, 0, 0)));
141 
142       vo0p3 = wasm_f32x4_add(vo0p3, wasm_f32x4_mul(vi1x5678, wasm_v32x4_shuffle(vw89AB, vw89AB, 1, 1, 1, 1)));
143 
144       vo0p4 = wasm_f32x4_add(vo0p4, wasm_f32x4_mul(vi2x5678, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 2, 2, 2, 2)));
145 
146       vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi3x5678, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 3, 3, 3, 3)));
147 
148       vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi4x5678, wasm_v32x4_shuffle(vwOP, vwOP, 0, 0, 0, 0)));
149 
150       const v128_t vi0x6789 = wasm_v32x4_shuffle(vi0x4567, vi0x89AB, 2, 3, 4, 5);
151       vi0x4567 = vi0x89AB;
152       const v128_t vi1x6789 = wasm_v32x4_shuffle(vi1x4567, vi1x89AB, 2, 3, 4, 5);
153       vi1x4567 = vi1x89AB;
154       const v128_t vi2x6789 = wasm_v32x4_shuffle(vi2x4567, vi2x89AB, 2, 3, 4, 5);
155       vi2x4567 = vi2x89AB;
156       const v128_t vi3x6789 = wasm_v32x4_shuffle(vi3x4567, vi3x89AB, 2, 3, 4, 5);
157       vi3x4567 = vi3x89AB;
158       const v128_t vi4x6789 = wasm_v32x4_shuffle(vi4x4567, vi4x89AB, 2, 3, 4, 5);
159       vi4x4567 = vi4x89AB;
160 
161       vo0p2 = wasm_f32x4_add(vo0p2, wasm_f32x4_mul(vi0x6789, wasm_v32x4_shuffle(vw4567, vw4567, 1, 1, 1, 1)));
162 
163       vo0p3 = wasm_f32x4_add(vo0p3, wasm_f32x4_mul(vi1x6789, wasm_v32x4_shuffle(vw89AB, vw89AB, 2, 2, 2, 2)));
164 
165       vo0p4 = wasm_f32x4_add(vo0p4, wasm_f32x4_mul(vi2x6789, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 3, 3, 3, 3)));
166 
167       vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi3x6789, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 0, 0, 0, 0)));
168 
169       vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi4x6789, wasm_v32x4_shuffle(vwOP, vwOP, 1, 1, 1, 1)));
170 
171       vo0p0 = wasm_f32x4_add(vo0p0, vo0p1);
172       vo0p2 = wasm_f32x4_add(vo0p2, vo0p3);
173       vo0p0 = wasm_f32x4_add(vo0p0, vo0p2);
174       vo0p0 = wasm_f32x4_add(vo0p0, vo0p4);
175 
176       v128_t vo0 = wasm_f32x4_pmax(vmin, vo0p0);
177       vo0 = wasm_f32x4_pmin(vmax, vo0);
178 
179       wasm_v128_store(o0, vo0); o0 += 4;
180     }
181     // Always process the last block of 5..8 pixels.
182     if XNN_LIKELY(w > 4 * sizeof(float)) {
183       v128_t vo0p0 = wasm_v32x4_shuffle(vw0123, vw0123, 0, 0, 0, 0);
184 
185       v128_t vi0x89AB = wasm_v128_load(i0); i0 += 4;
186       v128_t vi1x89AB = wasm_v128_load(i1); i1 += 4;
187       v128_t vi2x89AB = wasm_v128_load(i2); i2 += 4;
188       v128_t vi3x89AB = wasm_v128_load(i3); i3 += 4;
189       v128_t vi4x89AB = wasm_v128_load(i4); i4 += 4;
190 
191       vi0x89AB = wasm_v128_and(vmask, vi0x89AB);
192       vi1x89AB = wasm_v128_and(vmask, vi1x89AB);
193       vi2x89AB = wasm_v128_and(vmask, vi2x89AB);
194       vi3x89AB = wasm_v128_and(vmask, vi3x89AB);
195       vi4x89AB = wasm_v128_and(vmask, vi4x89AB);
196 
197       v128_t vo0p1 = wasm_f32x4_mul(vi0x4567, wasm_v32x4_shuffle(vw0123, vw0123, 3, 3, 3, 3));
198 
199       v128_t vo0p2 = wasm_f32x4_mul(vi1x4567, wasm_v32x4_shuffle(vw89AB, vw89AB, 0, 0, 0, 0));
200 
201       v128_t vo0p3 = wasm_f32x4_mul(vi2x4567, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 1, 1, 1, 1));
202 
203       v128_t vo0p4 = wasm_f32x4_mul(vi3x4567, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 2, 2, 2, 2));
204 
205       vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi4x4567, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 3, 3, 3, 3)));
206 
207       const v128_t vi0x3456 = wasm_v32x4_shuffle(vi0x0123, vi0x4567, 3, 4, 5, 6);
208       const v128_t vi1x3456 = wasm_v32x4_shuffle(vi1x0123, vi1x4567, 3, 4, 5, 6);
209       const v128_t vi2x3456 = wasm_v32x4_shuffle(vi2x0123, vi2x4567, 3, 4, 5, 6);
210       const v128_t vi3x3456 = wasm_v32x4_shuffle(vi3x0123, vi3x4567, 3, 4, 5, 6);
211       const v128_t vi4x3456 = wasm_v32x4_shuffle(vi4x0123, vi4x4567, 3, 4, 5, 6);
212 
213       vo0p2 = wasm_f32x4_add(vo0p2, wasm_f32x4_mul(vi0x3456, wasm_v32x4_shuffle(vw0123, vw0123, 2, 2, 2, 2)));
214 
215       vo0p3 = wasm_f32x4_add(vo0p3, wasm_f32x4_mul(vi1x3456, wasm_v32x4_shuffle(vw4567, vw4567, 3, 3, 3, 3)));
216 
217       vo0p4 = wasm_f32x4_add(vo0p4, wasm_f32x4_mul(vi2x3456, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 0, 0, 0, 0)));
218 
219       vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi3x3456, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 1, 1, 1, 1)));
220 
221       vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi4x3456, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 2, 2, 2, 2)));
222 
223       const v128_t vi0x2345 = wasm_v32x4_shuffle(vi0x0123, vi0x4567, 2, 3, 4, 5);
224       vi0x0123 = vi0x4567;
225       const v128_t vi1x2345 = wasm_v32x4_shuffle(vi1x0123, vi1x4567, 2, 3, 4, 5);
226       vi1x0123 = vi1x4567;
227       const v128_t vi2x2345 = wasm_v32x4_shuffle(vi2x0123, vi2x4567, 2, 3, 4, 5);
228       vi2x0123 = vi2x4567;
229       const v128_t vi3x2345 = wasm_v32x4_shuffle(vi3x0123, vi3x4567, 2, 3, 4, 5);
230       vi3x0123 = vi3x4567;
231       const v128_t vi4x2345 = wasm_v32x4_shuffle(vi4x0123, vi4x4567, 2, 3, 4, 5);
232       vi4x0123 = vi4x4567;
233 
234       vo0p2 = wasm_f32x4_add(vo0p2, wasm_f32x4_mul(vi0x2345, wasm_v32x4_shuffle(vw0123, vw0123, 1, 1, 1, 1)));
235 
236       vo0p3 = wasm_f32x4_add(vo0p3, wasm_f32x4_mul(vi1x2345, wasm_v32x4_shuffle(vw4567, vw4567, 2, 2, 2, 2)));
237 
238       vo0p4 = wasm_f32x4_add(vo0p4, wasm_f32x4_mul(vi2x2345, wasm_v32x4_shuffle(vw89AB, vw89AB, 3, 3, 3, 3)));
239 
240       vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi3x2345, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 0, 0, 0, 0)));
241 
242       vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi4x2345, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 1, 1, 1, 1)));
243 
244       const v128_t vi0x5678 = wasm_v32x4_shuffle(vi0x4567, vi0x89AB, 1, 2, 3, 4);
245       const v128_t vi1x5678 = wasm_v32x4_shuffle(vi1x4567, vi1x89AB, 1, 2, 3, 4);
246       const v128_t vi2x5678 = wasm_v32x4_shuffle(vi2x4567, vi2x89AB, 1, 2, 3, 4);
247       const v128_t vi3x5678 = wasm_v32x4_shuffle(vi3x4567, vi3x89AB, 1, 2, 3, 4);
248       const v128_t vi4x5678 = wasm_v32x4_shuffle(vi4x4567, vi4x89AB, 1, 2, 3, 4);
249 
250       vo0p2 = wasm_f32x4_add(vo0p2, wasm_f32x4_mul(vi0x5678, wasm_v32x4_shuffle(vw4567, vw4567, 0, 0, 0, 0)));
251 
252       vo0p3 = wasm_f32x4_add(vo0p3, wasm_f32x4_mul(vi1x5678, wasm_v32x4_shuffle(vw89AB, vw89AB, 1, 1, 1, 1)));
253 
254       vo0p4 = wasm_f32x4_add(vo0p4, wasm_f32x4_mul(vi2x5678, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 2, 2, 2, 2)));
255 
256       vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi3x5678, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 3, 3, 3, 3)));
257 
258       vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi4x5678, wasm_v32x4_shuffle(vwOP, vwOP, 0, 0, 0, 0)));
259 
260       const v128_t vi0x6789 = wasm_v32x4_shuffle(vi0x4567, vi0x89AB, 2, 3, 4, 5);
261       vi0x4567 = vi0x89AB;
262       const v128_t vi1x6789 = wasm_v32x4_shuffle(vi1x4567, vi1x89AB, 2, 3, 4, 5);
263       vi1x4567 = vi1x89AB;
264       const v128_t vi2x6789 = wasm_v32x4_shuffle(vi2x4567, vi2x89AB, 2, 3, 4, 5);
265       vi2x4567 = vi2x89AB;
266       const v128_t vi3x6789 = wasm_v32x4_shuffle(vi3x4567, vi3x89AB, 2, 3, 4, 5);
267       vi3x4567 = vi3x89AB;
268       const v128_t vi4x6789 = wasm_v32x4_shuffle(vi4x4567, vi4x89AB, 2, 3, 4, 5);
269       vi4x4567 = vi4x89AB;
270 
271       vo0p2 = wasm_f32x4_add(vo0p2, wasm_f32x4_mul(vi0x6789, wasm_v32x4_shuffle(vw4567, vw4567, 1, 1, 1, 1)));
272 
273       vo0p3 = wasm_f32x4_add(vo0p3, wasm_f32x4_mul(vi1x6789, wasm_v32x4_shuffle(vw89AB, vw89AB, 2, 2, 2, 2)));
274 
275       vo0p4 = wasm_f32x4_add(vo0p4, wasm_f32x4_mul(vi2x6789, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 3, 3, 3, 3)));
276 
277       vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi3x6789, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 0, 0, 0, 0)));
278 
279       vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi4x6789, wasm_v32x4_shuffle(vwOP, vwOP, 1, 1, 1, 1)));
280 
281       vo0p0 = wasm_f32x4_add(vo0p0, vo0p1);
282       vo0p2 = wasm_f32x4_add(vo0p2, vo0p3);
283       vo0p0 = wasm_f32x4_add(vo0p0, vo0p2);
284       vo0p0 = wasm_f32x4_add(vo0p0, vo0p4);
285 
286       v128_t vo0 = wasm_f32x4_pmax(vmin, vo0p0);
287       vo0 = wasm_f32x4_pmin(vmax, vo0);
288 
289       wasm_v128_store(o0, vo0); o0 += 4;
290 
291       w -= 4 * sizeof(float);
292     }
293     assert(w >= 1 * sizeof(float));
294     assert(w <= 4 * sizeof(float));
295     {
296       v128_t vo0p0 = wasm_v32x4_shuffle(vw0123, vw0123, 0, 0, 0, 0);
297 
298       vi0x4567 = wasm_v128_and(vmask, vi0x4567);
299       vi1x4567 = wasm_v128_and(vmask, vi1x4567);
300       vi2x4567 = wasm_v128_and(vmask, vi2x4567);
301       vi3x4567 = wasm_v128_and(vmask, vi3x4567);
302       vi4x4567 = wasm_v128_and(vmask, vi4x4567);
303 
304       v128_t vo0p1 = wasm_f32x4_mul(vi0x4567, wasm_v32x4_shuffle(vw0123, vw0123, 3, 3, 3, 3));
305 
306       v128_t vo0p2 = wasm_f32x4_mul(vi1x4567, wasm_v32x4_shuffle(vw89AB, vw89AB, 0, 0, 0, 0));
307 
308       v128_t vo0p3 = wasm_f32x4_mul(vi2x4567, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 1, 1, 1, 1));
309 
310       v128_t vo0p4 = wasm_f32x4_mul(vi3x4567, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 2, 2, 2, 2));
311 
312       vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi4x4567, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 3, 3, 3, 3)));
313 
314       const v128_t vi0x3456 = wasm_v32x4_shuffle(vi0x0123, vi0x4567, 3, 4, 5, 6);
315       const v128_t vi1x3456 = wasm_v32x4_shuffle(vi1x0123, vi1x4567, 3, 4, 5, 6);
316       const v128_t vi2x3456 = wasm_v32x4_shuffle(vi2x0123, vi2x4567, 3, 4, 5, 6);
317       const v128_t vi3x3456 = wasm_v32x4_shuffle(vi3x0123, vi3x4567, 3, 4, 5, 6);
318       const v128_t vi4x3456 = wasm_v32x4_shuffle(vi4x0123, vi4x4567, 3, 4, 5, 6);
319 
320       vo0p2 = wasm_f32x4_add(vo0p2, wasm_f32x4_mul(vi0x3456, wasm_v32x4_shuffle(vw0123, vw0123, 2, 2, 2, 2)));
321 
322       vo0p3 = wasm_f32x4_add(vo0p3, wasm_f32x4_mul(vi1x3456, wasm_v32x4_shuffle(vw4567, vw4567, 3, 3, 3, 3)));
323 
324       vo0p4 = wasm_f32x4_add(vo0p4, wasm_f32x4_mul(vi2x3456, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 0, 0, 0, 0)));
325 
326       vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi3x3456, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 1, 1, 1, 1)));
327 
328       vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi4x3456, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 2, 2, 2, 2)));
329 
330       const v128_t vi0x2345 = wasm_v32x4_shuffle(vi0x0123, vi0x4567, 2, 3, 4, 5);
331       const v128_t vi1x2345 = wasm_v32x4_shuffle(vi1x0123, vi1x4567, 2, 3, 4, 5);
332       const v128_t vi2x2345 = wasm_v32x4_shuffle(vi2x0123, vi2x4567, 2, 3, 4, 5);
333       const v128_t vi3x2345 = wasm_v32x4_shuffle(vi3x0123, vi3x4567, 2, 3, 4, 5);
334       const v128_t vi4x2345 = wasm_v32x4_shuffle(vi4x0123, vi4x4567, 2, 3, 4, 5);
335 
336       vo0p2 = wasm_f32x4_add(vo0p2, wasm_f32x4_mul(vi0x2345, wasm_v32x4_shuffle(vw0123, vw0123, 1, 1, 1, 1)));
337 
338       vo0p3 = wasm_f32x4_add(vo0p3, wasm_f32x4_mul(vi1x2345, wasm_v32x4_shuffle(vw4567, vw4567, 2, 2, 2, 2)));
339 
340       vo0p4 = wasm_f32x4_add(vo0p4, wasm_f32x4_mul(vi2x2345, wasm_v32x4_shuffle(vw89AB, vw89AB, 3, 3, 3, 3)));
341 
342       vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi3x2345, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 0, 0, 0, 0)));
343 
344       vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi4x2345, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 1, 1, 1, 1)));
345 
346       const v128_t vzero = wasm_f32x4_const_splat(0.0f);
347       const v128_t vi0x5678 = wasm_v32x4_shuffle(vi0x4567, vzero, 1, 2, 3, 4);
348       const v128_t vi1x5678 = wasm_v32x4_shuffle(vi1x4567, vzero, 1, 2, 3, 4);
349       const v128_t vi2x5678 = wasm_v32x4_shuffle(vi2x4567, vzero, 1, 2, 3, 4);
350       const v128_t vi3x5678 = wasm_v32x4_shuffle(vi3x4567, vzero, 1, 2, 3, 4);
351       const v128_t vi4x5678 = wasm_v32x4_shuffle(vi4x4567, vzero, 1, 2, 3, 4);
352 
353       vo0p2 = wasm_f32x4_add(vo0p2, wasm_f32x4_mul(vi0x5678, wasm_v32x4_shuffle(vw4567, vw4567, 0, 0, 0, 0)));
354 
355       vo0p3 = wasm_f32x4_add(vo0p3, wasm_f32x4_mul(vi1x5678, wasm_v32x4_shuffle(vw89AB, vw89AB, 1, 1, 1, 1)));
356 
357       vo0p4 = wasm_f32x4_add(vo0p4, wasm_f32x4_mul(vi2x5678, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 2, 2, 2, 2)));
358 
359       vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi3x5678, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 3, 3, 3, 3)));
360 
361       vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi4x5678, wasm_v32x4_shuffle(vwOP, vwOP, 0, 0, 0, 0)));
362 
363       const v128_t vi0x6789 = wasm_v32x4_shuffle(vi0x5678, vzero, 1, 2, 3, 4);
364       const v128_t vi1x6789 = wasm_v32x4_shuffle(vi1x5678, vzero, 1, 2, 3, 4);
365       const v128_t vi2x6789 = wasm_v32x4_shuffle(vi2x5678, vzero, 1, 2, 3, 4);
366       const v128_t vi3x6789 = wasm_v32x4_shuffle(vi3x5678, vzero, 1, 2, 3, 4);
367       const v128_t vi4x6789 = wasm_v32x4_shuffle(vi4x5678, vzero, 1, 2, 3, 4);
368 
369       vo0p2 = wasm_f32x4_add(vo0p2, wasm_f32x4_mul(vi0x6789, wasm_v32x4_shuffle(vw4567, vw4567, 1, 1, 1, 1)));
370 
371       vo0p3 = wasm_f32x4_add(vo0p3, wasm_f32x4_mul(vi1x6789, wasm_v32x4_shuffle(vw89AB, vw89AB, 2, 2, 2, 2)));
372 
373       vo0p4 = wasm_f32x4_add(vo0p4, wasm_f32x4_mul(vi2x6789, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 3, 3, 3, 3)));
374 
375       vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi3x6789, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 0, 0, 0, 0)));
376 
377       vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi4x6789, wasm_v32x4_shuffle(vwOP, vwOP, 1, 1, 1, 1)));
378 
379       vo0p0 = wasm_f32x4_add(vo0p0, vo0p1);
380       vo0p2 = wasm_f32x4_add(vo0p2, vo0p3);
381       vo0p0 = wasm_f32x4_add(vo0p0, vo0p2);
382       vo0p0 = wasm_f32x4_add(vo0p0, vo0p4);
383 
384       v128_t vo0 = wasm_f32x4_pmax(vmin, vo0p0);
385       vo0 = wasm_f32x4_pmin(vmax, vo0);
386 
387       if XNN_LIKELY(w & (4 * sizeof(float))) {
388         wasm_v128_store(o0, vo0); o0 += 4;
389       } else {
390         if (w & (2 * sizeof(float))) {
391           *((double*) o0) = wasm_f64x2_extract_lane(vo0, 0); o0 += 2;
392 
393           vo0 = wasm_v32x4_shuffle(vo0, vo0, 2, 3, 0, 1);
394         }
395         if (w & (1 * sizeof(float))) {
396           *o0 = wasm_f32x4_extract_lane(vo0, 0); o0 += 1;
397         }
398       }
399     }
400 
401     i0 = (const float*) ((uintptr_t) i1 - input_decrement);
402     i1 = (const float*) ((uintptr_t) i2 - input_decrement);
403     i2 = (const float*) ((uintptr_t) i1 + input_width);
404     i3 = (const float*) ((uintptr_t) i2 + input_width);
405     i4 = (const float*) ((uintptr_t) i3 + input_width);
406 
407 
408   } while (--output_height != 0);
409 }
410