1 // Auto-generated file. Do not edit!
2 // Template: src/f32-dwconv2d-chw/5x5s2p2-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_5x5s2p2__wasmsimd_arm_splat_3x4_acc2(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_5x5s2p2__wasmsimd_arm_splat_3x4_acc2(
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)])
28 {
29 assert(input_height != 0);
30 assert(input_width != 0);
31 assert(input_width % sizeof(float) == 0);
32 assert(padding_top >= 1);
33 assert(padding_top <= 2);
34
35 const v128_t vmask_even = wasm_v128_load(params->scalar.mask_even);
36 const v128_t vmask_odd = wasm_v128_load(params->scalar.mask_odd);
37 const v128_t vmax = wasm_v32x4_load_splat(¶ms->scalar.max);
38 const v128_t vmin = wasm_v32x4_load_splat(¶ms->scalar.min);
39
40 const v128_t vw0123 = wasm_v128_load(weights);
41 const v128_t vw4567 = wasm_v128_load(weights + 4);
42 const v128_t vw89AB = wasm_v128_load(weights + 8);
43 const v128_t vwCDEF = wasm_v128_load(weights + 12);
44 const v128_t vwGHIJ = wasm_v128_load(weights + 16);
45 const v128_t vwKLMN = wasm_v128_load(weights + 20);
46 const v128_t vwOP = wasm_v64x2_load_splat(weights + 24);
47
48 const v128_t vzero = wasm_f32x4_splat(0.0f);
49
50 const uint32_t padding_top_less_1 = padding_top - 1;
51 const size_t input_decrement = round_up_po2(input_width, 8 * sizeof(float));
52
53 const float* i0 = zero;
54 const float* i1 = (const float*) ((uintptr_t) input - ((-padding_top_less_1) & input_width));
55 const float* i2 = (const float*) ((uintptr_t) i1 + input_width);
56 if XNN_UNPREDICTABLE(padding_top_less_1 != 0) {
57 i1 = zero;
58 }
59 const float* i3 = (const float*) ((uintptr_t) i2 + input_width);
60 const float* i4 = (const float*) ((uintptr_t) i3 + input_width);
61 const float* i5 = (const float*) ((uintptr_t) i4 + input_width);
62 const float* i6 = (const float*) ((uintptr_t) i5 + input_width);
63 const float* i7 = (const float*) ((uintptr_t) i6 + input_width);
64 const float* i8 = (const float*) ((uintptr_t) i7 + input_width);
65
66 const size_t output_width = round_down_po2((input_width + (2 /* padding */ - 3 /* kernel size */ + 2 /* subsampling */) * sizeof(float)) / 2, sizeof(float));
67
68 float* o0 = output;
69 float* o1 = (float*) ((uintptr_t) o0 + output_width);
70 float* o2 = (float*) ((uintptr_t) o1 + output_width);
71
72 size_t padded_input_height = input_height + (padding_top_less_1 + 1) + 2 /* padding bottom */;
73 size_t output_height = (padded_input_height - 5 /* kernel size */ + 2 /* subsampling */) / 2;
74 do {
75 if XNN_UNPREDICTABLE(padded_input_height < 6) {
76 i3 = zero;
77 }
78 if XNN_UNPREDICTABLE(padded_input_height < 7) {
79 i4 = zero;
80 o1 = o0;
81 }
82 if XNN_UNPREDICTABLE(padded_input_height < 8) {
83 i5 = zero;
84 }
85 if XNN_UNPREDICTABLE(padded_input_height < 9) {
86 i6 = zero;
87 o2 = o1;
88 }
89 if XNN_UNPREDICTABLE(padded_input_height < 10) {
90 i7 = zero;
91 }
92 if XNN_UNPREDICTABLE(padded_input_height < 11) {
93 i8 = zero;
94 }
95
96 v128_t vi0x0246 = vzero;
97 v128_t vi1x0246 = vzero;
98 v128_t vi2x0246 = vzero;
99 v128_t vi3x0246 = vzero;
100 v128_t vi4x0246 = vzero;
101 v128_t vi5x0246 = vzero;
102 v128_t vi6x0246 = vzero;
103 v128_t vi7x0246 = vzero;
104 v128_t vi8x0246 = vzero;
105
106 v128_t vi0x1357 = vzero;
107 v128_t vi1x1357 = vzero;
108 v128_t vi2x1357 = vzero;
109 v128_t vi3x1357 = vzero;
110 v128_t vi4x1357 = vzero;
111 v128_t vi5x1357 = vzero;
112 v128_t vi6x1357 = vzero;
113 v128_t vi7x1357 = vzero;
114 v128_t vi8x1357 = vzero;
115
116 const v128_t vi0x89AB = wasm_v128_load(i0);
117 const v128_t vi0xCDEF = wasm_v128_load(i0 + 4);
118 i0 += 8;
119 const v128_t vi1x89AB = wasm_v128_load(i1);
120 const v128_t vi1xCDEF = wasm_v128_load(i1 + 4);
121 i1 += 8;
122 const v128_t vi2x89AB = wasm_v128_load(i2);
123 const v128_t vi2xCDEF = wasm_v128_load(i2 + 4);
124 i2 += 8;
125 const v128_t vi3x89AB = wasm_v128_load(i3);
126 const v128_t vi3xCDEF = wasm_v128_load(i3 + 4);
127 i3 += 8;
128 const v128_t vi4x89AB = wasm_v128_load(i4);
129 const v128_t vi4xCDEF = wasm_v128_load(i4 + 4);
130 i4 += 8;
131 const v128_t vi5x89AB = wasm_v128_load(i5);
132 const v128_t vi5xCDEF = wasm_v128_load(i5 + 4);
133 i5 += 8;
134 const v128_t vi6x89AB = wasm_v128_load(i6);
135 const v128_t vi6xCDEF = wasm_v128_load(i6 + 4);
136 i6 += 8;
137 const v128_t vi7x89AB = wasm_v128_load(i7);
138 const v128_t vi7xCDEF = wasm_v128_load(i7 + 4);
139 i7 += 8;
140 const v128_t vi8x89AB = wasm_v128_load(i8);
141 const v128_t vi8xCDEF = wasm_v128_load(i8 + 4);
142 i8 += 8;
143
144 v128_t vi0x8ACE = wasm_v32x4_shuffle(vi0x89AB, vi0xCDEF, 0, 2, 4, 6);
145 v128_t vi0x9BDF = wasm_v32x4_shuffle(vi0x89AB, vi0xCDEF, 1, 3, 5, 7);
146 v128_t vi1x8ACE = wasm_v32x4_shuffle(vi1x89AB, vi1xCDEF, 0, 2, 4, 6);
147 v128_t vi1x9BDF = wasm_v32x4_shuffle(vi1x89AB, vi1xCDEF, 1, 3, 5, 7);
148 v128_t vi2x8ACE = wasm_v32x4_shuffle(vi2x89AB, vi2xCDEF, 0, 2, 4, 6);
149 v128_t vi2x9BDF = wasm_v32x4_shuffle(vi2x89AB, vi2xCDEF, 1, 3, 5, 7);
150 v128_t vi3x8ACE = wasm_v32x4_shuffle(vi3x89AB, vi3xCDEF, 0, 2, 4, 6);
151 v128_t vi3x9BDF = wasm_v32x4_shuffle(vi3x89AB, vi3xCDEF, 1, 3, 5, 7);
152 v128_t vi4x8ACE = wasm_v32x4_shuffle(vi4x89AB, vi4xCDEF, 0, 2, 4, 6);
153 v128_t vi4x9BDF = wasm_v32x4_shuffle(vi4x89AB, vi4xCDEF, 1, 3, 5, 7);
154 v128_t vi5x8ACE = wasm_v32x4_shuffle(vi5x89AB, vi5xCDEF, 0, 2, 4, 6);
155 v128_t vi5x9BDF = wasm_v32x4_shuffle(vi5x89AB, vi5xCDEF, 1, 3, 5, 7);
156 v128_t vi6x8ACE = wasm_v32x4_shuffle(vi6x89AB, vi6xCDEF, 0, 2, 4, 6);
157 v128_t vi6x9BDF = wasm_v32x4_shuffle(vi6x89AB, vi6xCDEF, 1, 3, 5, 7);
158 v128_t vi7x8ACE = wasm_v32x4_shuffle(vi7x89AB, vi7xCDEF, 0, 2, 4, 6);
159 v128_t vi7x9BDF = wasm_v32x4_shuffle(vi7x89AB, vi7xCDEF, 1, 3, 5, 7);
160 v128_t vi8x8ACE = wasm_v32x4_shuffle(vi8x89AB, vi8xCDEF, 0, 2, 4, 6);
161 v128_t vi8x9BDF = wasm_v32x4_shuffle(vi8x89AB, vi8xCDEF, 1, 3, 5, 7);
162
163 size_t w = input_width;
164 for (; w > 8 * sizeof(float); w -= 8 * sizeof(float)) {
165 v128_t vo0p0 = wasm_v32x4_shuffle(vw0123, vw0123, 0, 0, 0, 0);
166 v128_t vo1p0 = wasm_v32x4_shuffle(vw0123, vw0123, 0, 0, 0, 0);
167 v128_t vo2p0 = wasm_v32x4_shuffle(vw0123, vw0123, 0, 0, 0, 0);
168
169 v128_t vo0p1 = wasm_f32x4_mul(vi0x8ACE, wasm_v32x4_shuffle(vw0123, vw0123, 3, 3, 3, 3));
170 v128_t vo1p1 = wasm_f32x4_mul(vi2x8ACE, wasm_v32x4_shuffle(vw0123, vw0123, 3, 3, 3, 3));
171 v128_t vo2p1 = wasm_f32x4_mul(vi4x8ACE, wasm_v32x4_shuffle(vw0123, vw0123, 3, 3, 3, 3));
172
173 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi1x8ACE, wasm_v32x4_shuffle(vw89AB, vw89AB, 0, 0, 0, 0)));
174 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi3x8ACE, wasm_v32x4_shuffle(vw89AB, vw89AB, 0, 0, 0, 0)));
175 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi5x8ACE, wasm_v32x4_shuffle(vw89AB, vw89AB, 0, 0, 0, 0)));
176
177 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi2x8ACE, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 1, 1, 1, 1)));
178 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi4x8ACE, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 1, 1, 1, 1)));
179 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi6x8ACE, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 1, 1, 1, 1)));
180
181 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi3x8ACE, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 2, 2, 2, 2)));
182 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi5x8ACE, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 2, 2, 2, 2)));
183 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi7x8ACE, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 2, 2, 2, 2)));
184
185 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi4x8ACE, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 3, 3, 3, 3)));
186 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi6x8ACE, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 3, 3, 3, 3)));
187 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi8x8ACE, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 3, 3, 3, 3)));
188
189 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi0x9BDF, wasm_v32x4_shuffle(vw4567, vw4567, 0, 0, 0, 0)));
190 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi2x9BDF, wasm_v32x4_shuffle(vw4567, vw4567, 0, 0, 0, 0)));
191 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi4x9BDF, wasm_v32x4_shuffle(vw4567, vw4567, 0, 0, 0, 0)));
192
193 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi1x9BDF, wasm_v32x4_shuffle(vw89AB, vw89AB, 1, 1, 1, 1)));
194 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi3x9BDF, wasm_v32x4_shuffle(vw89AB, vw89AB, 1, 1, 1, 1)));
195 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi5x9BDF, wasm_v32x4_shuffle(vw89AB, vw89AB, 1, 1, 1, 1)));
196
197 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi2x9BDF, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 2, 2, 2, 2)));
198 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi4x9BDF, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 2, 2, 2, 2)));
199 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi6x9BDF, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 2, 2, 2, 2)));
200
201 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi3x9BDF, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 3, 3, 3, 3)));
202 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi5x9BDF, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 3, 3, 3, 3)));
203 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi7x9BDF, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 3, 3, 3, 3)));
204
205 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi4x9BDF, wasm_v32x4_shuffle(vwOP, vwOP, 0, 0, 0, 0)));
206 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi6x9BDF, wasm_v32x4_shuffle(vwOP, vwOP, 0, 0, 0, 0)));
207 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi8x9BDF, wasm_v32x4_shuffle(vwOP, vwOP, 0, 0, 0, 0)));
208
209 const v128_t vi0x68AC = wasm_v32x4_shuffle(vi0x0246, vi0x8ACE, 3, 4, 5, 6);
210 vi0x0246 = vi0x8ACE;
211 const v128_t vi1x68AC = wasm_v32x4_shuffle(vi1x0246, vi1x8ACE, 3, 4, 5, 6);
212 vi1x0246 = vi1x8ACE;
213 const v128_t vi2x68AC = wasm_v32x4_shuffle(vi2x0246, vi2x8ACE, 3, 4, 5, 6);
214 vi2x0246 = vi2x8ACE;
215 const v128_t vi3x68AC = wasm_v32x4_shuffle(vi3x0246, vi3x8ACE, 3, 4, 5, 6);
216 vi3x0246 = vi3x8ACE;
217 const v128_t vi4x68AC = wasm_v32x4_shuffle(vi4x0246, vi4x8ACE, 3, 4, 5, 6);
218 vi4x0246 = vi4x8ACE;
219 const v128_t vi5x68AC = wasm_v32x4_shuffle(vi5x0246, vi5x8ACE, 3, 4, 5, 6);
220 vi5x0246 = vi5x8ACE;
221 const v128_t vi6x68AC = wasm_v32x4_shuffle(vi6x0246, vi6x8ACE, 3, 4, 5, 6);
222 vi6x0246 = vi6x8ACE;
223 const v128_t vi7x68AC = wasm_v32x4_shuffle(vi7x0246, vi7x8ACE, 3, 4, 5, 6);
224 vi7x0246 = vi7x8ACE;
225 const v128_t vi8x68AC = wasm_v32x4_shuffle(vi8x0246, vi8x8ACE, 3, 4, 5, 6);
226 vi8x0246 = vi8x8ACE;
227
228 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi0x68AC, wasm_v32x4_shuffle(vw0123, vw0123, 1, 1, 1, 1)));
229 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi2x68AC, wasm_v32x4_shuffle(vw0123, vw0123, 1, 1, 1, 1)));
230 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi4x68AC, wasm_v32x4_shuffle(vw0123, vw0123, 1, 1, 1, 1)));
231
232 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi1x68AC, wasm_v32x4_shuffle(vw4567, vw4567, 2, 2, 2, 2)));
233 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi3x68AC, wasm_v32x4_shuffle(vw4567, vw4567, 2, 2, 2, 2)));
234 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi5x68AC, wasm_v32x4_shuffle(vw4567, vw4567, 2, 2, 2, 2)));
235
236 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi2x68AC, wasm_v32x4_shuffle(vw89AB, vw89AB, 3, 3, 3, 3)));
237 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi4x68AC, wasm_v32x4_shuffle(vw89AB, vw89AB, 3, 3, 3, 3)));
238 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi6x68AC, wasm_v32x4_shuffle(vw89AB, vw89AB, 3, 3, 3, 3)));
239
240 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi3x68AC, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 0, 0, 0, 0)));
241 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi5x68AC, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 0, 0, 0, 0)));
242 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi7x68AC, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 0, 0, 0, 0)));
243
244 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi4x68AC, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 1, 1, 1, 1)));
245 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi6x68AC, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 1, 1, 1, 1)));
246 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi8x68AC, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 1, 1, 1, 1)));
247
248 const v128_t vi0x79BD = wasm_v32x4_shuffle(vi0x1357, vi0x9BDF, 3, 4, 5, 6);
249 vi0x1357 = vi0x9BDF;
250 const v128_t vi1x79BD = wasm_v32x4_shuffle(vi1x1357, vi1x9BDF, 3, 4, 5, 6);
251 vi1x1357 = vi1x9BDF;
252 const v128_t vi2x79BD = wasm_v32x4_shuffle(vi2x1357, vi2x9BDF, 3, 4, 5, 6);
253 vi2x1357 = vi2x9BDF;
254 const v128_t vi3x79BD = wasm_v32x4_shuffle(vi3x1357, vi3x9BDF, 3, 4, 5, 6);
255 vi3x1357 = vi3x9BDF;
256 const v128_t vi4x79BD = wasm_v32x4_shuffle(vi4x1357, vi4x9BDF, 3, 4, 5, 6);
257 vi4x1357 = vi4x9BDF;
258 const v128_t vi5x79BD = wasm_v32x4_shuffle(vi5x1357, vi5x9BDF, 3, 4, 5, 6);
259 vi5x1357 = vi5x9BDF;
260 const v128_t vi6x79BD = wasm_v32x4_shuffle(vi6x1357, vi6x9BDF, 3, 4, 5, 6);
261 vi6x1357 = vi6x9BDF;
262 const v128_t vi7x79BD = wasm_v32x4_shuffle(vi7x1357, vi7x9BDF, 3, 4, 5, 6);
263 vi7x1357 = vi7x9BDF;
264 const v128_t vi8x79BD = wasm_v32x4_shuffle(vi8x1357, vi8x9BDF, 3, 4, 5, 6);
265 vi8x1357 = vi8x9BDF;
266
267 const v128_t vi0xGHIJ = wasm_v128_load(i0);
268 const v128_t vi0xKLMN = wasm_v128_load(i0 + 4);
269 i0 += 8;
270 const v128_t vi1xGHIJ = wasm_v128_load(i1);
271 const v128_t vi1xKLMN = wasm_v128_load(i1 + 4);
272 i1 += 8;
273 const v128_t vi2xGHIJ = wasm_v128_load(i2);
274 const v128_t vi2xKLMN = wasm_v128_load(i2 + 4);
275 i2 += 8;
276 const v128_t vi3xGHIJ = wasm_v128_load(i3);
277 const v128_t vi3xKLMN = wasm_v128_load(i3 + 4);
278 i3 += 8;
279 const v128_t vi4xGHIJ = wasm_v128_load(i4);
280 const v128_t vi4xKLMN = wasm_v128_load(i4 + 4);
281 i4 += 8;
282 const v128_t vi5xGHIJ = wasm_v128_load(i5);
283 const v128_t vi5xKLMN = wasm_v128_load(i5 + 4);
284 i5 += 8;
285 const v128_t vi6xGHIJ = wasm_v128_load(i6);
286 const v128_t vi6xKLMN = wasm_v128_load(i6 + 4);
287 i6 += 8;
288 const v128_t vi7xGHIJ = wasm_v128_load(i7);
289 const v128_t vi7xKLMN = wasm_v128_load(i7 + 4);
290 i7 += 8;
291 const v128_t vi8xGHIJ = wasm_v128_load(i8);
292 const v128_t vi8xKLMN = wasm_v128_load(i8 + 4);
293 i8 += 8;
294
295 const v128_t vi0xGIKM = wasm_v32x4_shuffle(vi0xGHIJ, vi0xKLMN, 0, 2, 4, 6);
296 const v128_t vi0xHJLN = wasm_v32x4_shuffle(vi0xGHIJ, vi0xKLMN, 1, 3, 5, 7);
297 const v128_t vi1xGIKM = wasm_v32x4_shuffle(vi1xGHIJ, vi1xKLMN, 0, 2, 4, 6);
298 const v128_t vi1xHJLN = wasm_v32x4_shuffle(vi1xGHIJ, vi1xKLMN, 1, 3, 5, 7);
299 const v128_t vi2xGIKM = wasm_v32x4_shuffle(vi2xGHIJ, vi2xKLMN, 0, 2, 4, 6);
300 const v128_t vi2xHJLN = wasm_v32x4_shuffle(vi2xGHIJ, vi2xKLMN, 1, 3, 5, 7);
301 const v128_t vi3xGIKM = wasm_v32x4_shuffle(vi3xGHIJ, vi3xKLMN, 0, 2, 4, 6);
302 const v128_t vi3xHJLN = wasm_v32x4_shuffle(vi3xGHIJ, vi3xKLMN, 1, 3, 5, 7);
303 const v128_t vi4xGIKM = wasm_v32x4_shuffle(vi4xGHIJ, vi4xKLMN, 0, 2, 4, 6);
304 const v128_t vi4xHJLN = wasm_v32x4_shuffle(vi4xGHIJ, vi4xKLMN, 1, 3, 5, 7);
305 const v128_t vi5xGIKM = wasm_v32x4_shuffle(vi5xGHIJ, vi5xKLMN, 0, 2, 4, 6);
306 const v128_t vi5xHJLN = wasm_v32x4_shuffle(vi5xGHIJ, vi5xKLMN, 1, 3, 5, 7);
307 const v128_t vi6xGIKM = wasm_v32x4_shuffle(vi6xGHIJ, vi6xKLMN, 0, 2, 4, 6);
308 const v128_t vi6xHJLN = wasm_v32x4_shuffle(vi6xGHIJ, vi6xKLMN, 1, 3, 5, 7);
309 const v128_t vi7xGIKM = wasm_v32x4_shuffle(vi7xGHIJ, vi7xKLMN, 0, 2, 4, 6);
310 const v128_t vi7xHJLN = wasm_v32x4_shuffle(vi7xGHIJ, vi7xKLMN, 1, 3, 5, 7);
311 const v128_t vi8xGIKM = wasm_v32x4_shuffle(vi8xGHIJ, vi8xKLMN, 0, 2, 4, 6);
312 const v128_t vi8xHJLN = wasm_v32x4_shuffle(vi8xGHIJ, vi8xKLMN, 1, 3, 5, 7);
313
314 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi0x79BD, wasm_v32x4_shuffle(vw0123, vw0123, 2, 2, 2, 2)));
315 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi2x79BD, wasm_v32x4_shuffle(vw0123, vw0123, 2, 2, 2, 2)));
316 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi4x79BD, wasm_v32x4_shuffle(vw0123, vw0123, 2, 2, 2, 2)));
317
318 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi1x79BD, wasm_v32x4_shuffle(vw4567, vw4567, 3, 3, 3, 3)));
319 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi3x79BD, wasm_v32x4_shuffle(vw4567, vw4567, 3, 3, 3, 3)));
320 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi5x79BD, wasm_v32x4_shuffle(vw4567, vw4567, 3, 3, 3, 3)));
321
322 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi2x79BD, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 0, 0, 0, 0)));
323 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi4x79BD, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 0, 0, 0, 0)));
324 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi6x79BD, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 0, 0, 0, 0)));
325
326 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi3x79BD, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 1, 1, 1, 1)));
327 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi5x79BD, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 1, 1, 1, 1)));
328 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi7x79BD, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 1, 1, 1, 1)));
329
330 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi4x79BD, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 2, 2, 2, 2)));
331 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi6x79BD, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 2, 2, 2, 2)));
332 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi8x79BD, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 2, 2, 2, 2)));
333
334 const v128_t vi0xACEG = wasm_v32x4_shuffle(vi0x8ACE, vi0xGIKM, 1, 2, 3, 4);
335 vi0x8ACE = vi0xGIKM;
336 vi0x9BDF = vi0xHJLN;
337 const v128_t vi1xACEG = wasm_v32x4_shuffle(vi1x8ACE, vi1xGIKM, 1, 2, 3, 4);
338 vi1x8ACE = vi1xGIKM;
339 vi1x9BDF = vi1xHJLN;
340 const v128_t vi2xACEG = wasm_v32x4_shuffle(vi2x8ACE, vi2xGIKM, 1, 2, 3, 4);
341 vi2x8ACE = vi2xGIKM;
342 vi2x9BDF = vi2xHJLN;
343 const v128_t vi3xACEG = wasm_v32x4_shuffle(vi3x8ACE, vi3xGIKM, 1, 2, 3, 4);
344 vi3x8ACE = vi3xGIKM;
345 vi3x9BDF = vi3xHJLN;
346 const v128_t vi4xACEG = wasm_v32x4_shuffle(vi4x8ACE, vi4xGIKM, 1, 2, 3, 4);
347 vi4x8ACE = vi4xGIKM;
348 vi4x9BDF = vi4xHJLN;
349 const v128_t vi5xACEG = wasm_v32x4_shuffle(vi5x8ACE, vi5xGIKM, 1, 2, 3, 4);
350 vi5x8ACE = vi5xGIKM;
351 vi5x9BDF = vi5xHJLN;
352 const v128_t vi6xACEG = wasm_v32x4_shuffle(vi6x8ACE, vi6xGIKM, 1, 2, 3, 4);
353 vi6x8ACE = vi6xGIKM;
354 vi6x9BDF = vi6xHJLN;
355 const v128_t vi7xACEG = wasm_v32x4_shuffle(vi7x8ACE, vi7xGIKM, 1, 2, 3, 4);
356 vi7x8ACE = vi7xGIKM;
357 vi7x9BDF = vi7xHJLN;
358 const v128_t vi8xACEG = wasm_v32x4_shuffle(vi8x8ACE, vi8xGIKM, 1, 2, 3, 4);
359 vi8x8ACE = vi8xGIKM;
360 vi8x9BDF = vi8xHJLN;
361
362 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi0xACEG, wasm_v32x4_shuffle(vw4567, vw4567, 1, 1, 1, 1)));
363 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi2xACEG, wasm_v32x4_shuffle(vw4567, vw4567, 1, 1, 1, 1)));
364 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi4xACEG, wasm_v32x4_shuffle(vw4567, vw4567, 1, 1, 1, 1)));
365
366 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi1xACEG, wasm_v32x4_shuffle(vw89AB, vw89AB, 2, 2, 2, 2)));
367 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi3xACEG, wasm_v32x4_shuffle(vw89AB, vw89AB, 2, 2, 2, 2)));
368 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi5xACEG, wasm_v32x4_shuffle(vw89AB, vw89AB, 2, 2, 2, 2)));
369
370 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi2xACEG, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 3, 3, 3, 3)));
371 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi4xACEG, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 3, 3, 3, 3)));
372 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi6xACEG, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 3, 3, 3, 3)));
373
374 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi3xACEG, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 0, 0, 0, 0)));
375 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi5xACEG, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 0, 0, 0, 0)));
376 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi7xACEG, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 0, 0, 0, 0)));
377
378 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi4xACEG, wasm_v32x4_shuffle(vwOP, vwOP, 1, 1, 1, 1)));
379 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi6xACEG, wasm_v32x4_shuffle(vwOP, vwOP, 1, 1, 1, 1)));
380 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi8xACEG, wasm_v32x4_shuffle(vwOP, vwOP, 1, 1, 1, 1)));
381
382 vo0p0 = wasm_f32x4_add(vo0p0, vo0p1);
383 vo1p0 = wasm_f32x4_add(vo1p0, vo1p1);
384 vo2p0 = wasm_f32x4_add(vo2p0, vo2p1);
385
386 v128_t vo0 = wasm_f32x4_max(vo0p0, vmin);
387 v128_t vo1 = wasm_f32x4_max(vo1p0, vmin);
388 v128_t vo2 = wasm_f32x4_max(vo2p0, vmin);
389 vo0 = wasm_f32x4_min(vo0, vmax);
390 vo1 = wasm_f32x4_min(vo1, vmax);
391 vo2 = wasm_f32x4_min(vo2, vmax);
392
393 wasm_v128_store(o2, vo2); o2 += 4;
394 wasm_v128_store(o1, vo1); o1 += 4;
395 wasm_v128_store(o0, vo0); o0 += 4;
396 }
397 // Last block has 1-8 pixels to process.
398 assert(w <= 8 * sizeof(float));
399 assert(w >= 1 * sizeof(float));
400 {
401 v128_t vo0p0 = wasm_v32x4_shuffle(vw0123, vw0123, 0, 0, 0, 0);
402 v128_t vo1p0 = wasm_v32x4_shuffle(vw0123, vw0123, 0, 0, 0, 0);
403 v128_t vo2p0 = wasm_v32x4_shuffle(vw0123, vw0123, 0, 0, 0, 0);
404
405 vi0x8ACE = wasm_v128_and(vmask_even, vi0x8ACE);
406 vi1x8ACE = wasm_v128_and(vmask_even, vi1x8ACE);
407 vi2x8ACE = wasm_v128_and(vmask_even, vi2x8ACE);
408 vi3x8ACE = wasm_v128_and(vmask_even, vi3x8ACE);
409 vi4x8ACE = wasm_v128_and(vmask_even, vi4x8ACE);
410 vi5x8ACE = wasm_v128_and(vmask_even, vi5x8ACE);
411 vi6x8ACE = wasm_v128_and(vmask_even, vi6x8ACE);
412 vi7x8ACE = wasm_v128_and(vmask_even, vi7x8ACE);
413 vi8x8ACE = wasm_v128_and(vmask_even, vi8x8ACE);
414
415 vi0x9BDF = wasm_v128_and(vmask_odd, vi0x9BDF);
416 vi1x9BDF = wasm_v128_and(vmask_odd, vi1x9BDF);
417 vi2x9BDF = wasm_v128_and(vmask_odd, vi2x9BDF);
418 vi3x9BDF = wasm_v128_and(vmask_odd, vi3x9BDF);
419 vi4x9BDF = wasm_v128_and(vmask_odd, vi4x9BDF);
420 vi5x9BDF = wasm_v128_and(vmask_odd, vi5x9BDF);
421 vi6x9BDF = wasm_v128_and(vmask_odd, vi6x9BDF);
422 vi7x9BDF = wasm_v128_and(vmask_odd, vi7x9BDF);
423 vi8x9BDF = wasm_v128_and(vmask_odd, vi8x9BDF);
424
425 v128_t vo0p1 = wasm_f32x4_mul(vi0x8ACE, wasm_v32x4_shuffle(vw0123, vw0123, 3, 3, 3, 3));
426 v128_t vo1p1 = wasm_f32x4_mul(vi2x8ACE, wasm_v32x4_shuffle(vw0123, vw0123, 3, 3, 3, 3));
427 v128_t vo2p1 = wasm_f32x4_mul(vi4x8ACE, wasm_v32x4_shuffle(vw0123, vw0123, 3, 3, 3, 3));
428
429 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi1x8ACE, wasm_v32x4_shuffle(vw89AB, vw89AB, 0, 0, 0, 0)));
430 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi3x8ACE, wasm_v32x4_shuffle(vw89AB, vw89AB, 0, 0, 0, 0)));
431 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi5x8ACE, wasm_v32x4_shuffle(vw89AB, vw89AB, 0, 0, 0, 0)));
432
433 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi2x8ACE, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 1, 1, 1, 1)));
434 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi4x8ACE, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 1, 1, 1, 1)));
435 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi6x8ACE, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 1, 1, 1, 1)));
436
437 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi3x8ACE, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 2, 2, 2, 2)));
438 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi5x8ACE, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 2, 2, 2, 2)));
439 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi7x8ACE, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 2, 2, 2, 2)));
440
441 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi4x8ACE, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 3, 3, 3, 3)));
442 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi6x8ACE, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 3, 3, 3, 3)));
443 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi8x8ACE, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 3, 3, 3, 3)));
444
445 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi0x9BDF, wasm_v32x4_shuffle(vw4567, vw4567, 0, 0, 0, 0)));
446 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi2x9BDF, wasm_v32x4_shuffle(vw4567, vw4567, 0, 0, 0, 0)));
447 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi4x9BDF, wasm_v32x4_shuffle(vw4567, vw4567, 0, 0, 0, 0)));
448
449 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi1x9BDF, wasm_v32x4_shuffle(vw89AB, vw89AB, 1, 1, 1, 1)));
450 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi3x9BDF, wasm_v32x4_shuffle(vw89AB, vw89AB, 1, 1, 1, 1)));
451 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi5x9BDF, wasm_v32x4_shuffle(vw89AB, vw89AB, 1, 1, 1, 1)));
452
453 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi2x9BDF, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 2, 2, 2, 2)));
454 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi4x9BDF, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 2, 2, 2, 2)));
455 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi6x9BDF, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 2, 2, 2, 2)));
456
457 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi3x9BDF, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 3, 3, 3, 3)));
458 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi5x9BDF, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 3, 3, 3, 3)));
459 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi7x9BDF, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 3, 3, 3, 3)));
460
461 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi4x9BDF, wasm_v32x4_shuffle(vwOP, vwOP, 0, 0, 0, 0)));
462 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi6x9BDF, wasm_v32x4_shuffle(vwOP, vwOP, 0, 0, 0, 0)));
463 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi8x9BDF, wasm_v32x4_shuffle(vwOP, vwOP, 0, 0, 0, 0)));
464
465 const v128_t vi0x68AC = wasm_v32x4_shuffle(vi0x0246, vi0x8ACE, 3, 4, 5, 6);
466 const v128_t vi1x68AC = wasm_v32x4_shuffle(vi1x0246, vi1x8ACE, 3, 4, 5, 6);
467 const v128_t vi2x68AC = wasm_v32x4_shuffle(vi2x0246, vi2x8ACE, 3, 4, 5, 6);
468 const v128_t vi3x68AC = wasm_v32x4_shuffle(vi3x0246, vi3x8ACE, 3, 4, 5, 6);
469 const v128_t vi4x68AC = wasm_v32x4_shuffle(vi4x0246, vi4x8ACE, 3, 4, 5, 6);
470 const v128_t vi5x68AC = wasm_v32x4_shuffle(vi5x0246, vi5x8ACE, 3, 4, 5, 6);
471 const v128_t vi6x68AC = wasm_v32x4_shuffle(vi6x0246, vi6x8ACE, 3, 4, 5, 6);
472 const v128_t vi7x68AC = wasm_v32x4_shuffle(vi7x0246, vi7x8ACE, 3, 4, 5, 6);
473 const v128_t vi8x68AC = wasm_v32x4_shuffle(vi8x0246, vi8x8ACE, 3, 4, 5, 6);
474
475 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi0x68AC, wasm_v32x4_shuffle(vw0123, vw0123, 1, 1, 1, 1)));
476 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi2x68AC, wasm_v32x4_shuffle(vw0123, vw0123, 1, 1, 1, 1)));
477 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi4x68AC, wasm_v32x4_shuffle(vw0123, vw0123, 1, 1, 1, 1)));
478
479 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi1x68AC, wasm_v32x4_shuffle(vw4567, vw4567, 2, 2, 2, 2)));
480 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi3x68AC, wasm_v32x4_shuffle(vw4567, vw4567, 2, 2, 2, 2)));
481 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi5x68AC, wasm_v32x4_shuffle(vw4567, vw4567, 2, 2, 2, 2)));
482
483 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi2x68AC, wasm_v32x4_shuffle(vw89AB, vw89AB, 3, 3, 3, 3)));
484 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi4x68AC, wasm_v32x4_shuffle(vw89AB, vw89AB, 3, 3, 3, 3)));
485 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi6x68AC, wasm_v32x4_shuffle(vw89AB, vw89AB, 3, 3, 3, 3)));
486
487 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi3x68AC, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 0, 0, 0, 0)));
488 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi5x68AC, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 0, 0, 0, 0)));
489 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi7x68AC, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 0, 0, 0, 0)));
490
491 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi4x68AC, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 1, 1, 1, 1)));
492 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi6x68AC, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 1, 1, 1, 1)));
493 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi8x68AC, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 1, 1, 1, 1)));
494
495 const v128_t vi0x79BD = wasm_v32x4_shuffle(vi0x1357, vi0x9BDF, 3, 4, 5, 6);
496 const v128_t vi1x79BD = wasm_v32x4_shuffle(vi1x1357, vi1x9BDF, 3, 4, 5, 6);
497 const v128_t vi2x79BD = wasm_v32x4_shuffle(vi2x1357, vi2x9BDF, 3, 4, 5, 6);
498 const v128_t vi3x79BD = wasm_v32x4_shuffle(vi3x1357, vi3x9BDF, 3, 4, 5, 6);
499 const v128_t vi4x79BD = wasm_v32x4_shuffle(vi4x1357, vi4x9BDF, 3, 4, 5, 6);
500 const v128_t vi5x79BD = wasm_v32x4_shuffle(vi5x1357, vi5x9BDF, 3, 4, 5, 6);
501 const v128_t vi6x79BD = wasm_v32x4_shuffle(vi6x1357, vi6x9BDF, 3, 4, 5, 6);
502 const v128_t vi7x79BD = wasm_v32x4_shuffle(vi7x1357, vi7x9BDF, 3, 4, 5, 6);
503 const v128_t vi8x79BD = wasm_v32x4_shuffle(vi8x1357, vi8x9BDF, 3, 4, 5, 6);
504
505 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi0x79BD, wasm_v32x4_shuffle(vw0123, vw0123, 2, 2, 2, 2)));
506 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi2x79BD, wasm_v32x4_shuffle(vw0123, vw0123, 2, 2, 2, 2)));
507 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi4x79BD, wasm_v32x4_shuffle(vw0123, vw0123, 2, 2, 2, 2)));
508
509 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi1x79BD, wasm_v32x4_shuffle(vw4567, vw4567, 3, 3, 3, 3)));
510 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi3x79BD, wasm_v32x4_shuffle(vw4567, vw4567, 3, 3, 3, 3)));
511 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi5x79BD, wasm_v32x4_shuffle(vw4567, vw4567, 3, 3, 3, 3)));
512
513 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi2x79BD, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 0, 0, 0, 0)));
514 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi4x79BD, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 0, 0, 0, 0)));
515 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi6x79BD, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 0, 0, 0, 0)));
516
517 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi3x79BD, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 1, 1, 1, 1)));
518 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi5x79BD, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 1, 1, 1, 1)));
519 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi7x79BD, wasm_v32x4_shuffle(vwGHIJ, vwGHIJ, 1, 1, 1, 1)));
520
521 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi4x79BD, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 2, 2, 2, 2)));
522 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi6x79BD, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 2, 2, 2, 2)));
523 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi8x79BD, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 2, 2, 2, 2)));
524
525 const v128_t vi0xACEG = wasm_v32x4_shuffle(vi0x8ACE, vzero, 1, 2, 3, 4);
526 const v128_t vi1xACEG = wasm_v32x4_shuffle(vi1x8ACE, vzero, 1, 2, 3, 4);
527 const v128_t vi2xACEG = wasm_v32x4_shuffle(vi2x8ACE, vzero, 1, 2, 3, 4);
528 const v128_t vi3xACEG = wasm_v32x4_shuffle(vi3x8ACE, vzero, 1, 2, 3, 4);
529 const v128_t vi4xACEG = wasm_v32x4_shuffle(vi4x8ACE, vzero, 1, 2, 3, 4);
530 const v128_t vi5xACEG = wasm_v32x4_shuffle(vi5x8ACE, vzero, 1, 2, 3, 4);
531 const v128_t vi6xACEG = wasm_v32x4_shuffle(vi6x8ACE, vzero, 1, 2, 3, 4);
532 const v128_t vi7xACEG = wasm_v32x4_shuffle(vi7x8ACE, vzero, 1, 2, 3, 4);
533 const v128_t vi8xACEG = wasm_v32x4_shuffle(vi8x8ACE, vzero, 1, 2, 3, 4);
534
535 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi0xACEG, wasm_v32x4_shuffle(vw4567, vw4567, 1, 1, 1, 1)));
536 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi2xACEG, wasm_v32x4_shuffle(vw4567, vw4567, 1, 1, 1, 1)));
537 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi4xACEG, wasm_v32x4_shuffle(vw4567, vw4567, 1, 1, 1, 1)));
538
539 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi1xACEG, wasm_v32x4_shuffle(vw89AB, vw89AB, 2, 2, 2, 2)));
540 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi3xACEG, wasm_v32x4_shuffle(vw89AB, vw89AB, 2, 2, 2, 2)));
541 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi5xACEG, wasm_v32x4_shuffle(vw89AB, vw89AB, 2, 2, 2, 2)));
542
543 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi2xACEG, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 3, 3, 3, 3)));
544 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi4xACEG, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 3, 3, 3, 3)));
545 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi6xACEG, wasm_v32x4_shuffle(vwCDEF, vwCDEF, 3, 3, 3, 3)));
546
547 vo0p1 = wasm_f32x4_add(vo0p1, wasm_f32x4_mul(vi3xACEG, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 0, 0, 0, 0)));
548 vo1p1 = wasm_f32x4_add(vo1p1, wasm_f32x4_mul(vi5xACEG, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 0, 0, 0, 0)));
549 vo2p1 = wasm_f32x4_add(vo2p1, wasm_f32x4_mul(vi7xACEG, wasm_v32x4_shuffle(vwKLMN, vwKLMN, 0, 0, 0, 0)));
550
551 vo0p0 = wasm_f32x4_add(vo0p0, wasm_f32x4_mul(vi4xACEG, wasm_v32x4_shuffle(vwOP, vwOP, 1, 1, 1, 1)));
552 vo1p0 = wasm_f32x4_add(vo1p0, wasm_f32x4_mul(vi6xACEG, wasm_v32x4_shuffle(vwOP, vwOP, 1, 1, 1, 1)));
553 vo2p0 = wasm_f32x4_add(vo2p0, wasm_f32x4_mul(vi8xACEG, wasm_v32x4_shuffle(vwOP, vwOP, 1, 1, 1, 1)));
554
555 vo0p0 = wasm_f32x4_add(vo0p0, vo0p1);
556 vo1p0 = wasm_f32x4_add(vo1p0, vo1p1);
557 vo2p0 = wasm_f32x4_add(vo2p0, vo2p1);
558
559 v128_t vo0 = wasm_f32x4_max(vo0p0, vmin);
560 v128_t vo1 = wasm_f32x4_max(vo1p0, vmin);
561 v128_t vo2 = wasm_f32x4_max(vo2p0, vmin);
562 vo0 = wasm_f32x4_min(vo0, vmax);
563 vo1 = wasm_f32x4_min(vo1, vmax);
564 vo2 = wasm_f32x4_min(vo2, vmax);
565
566 size_t w_tmp = (w + 1 * sizeof(float)) / (2 * sizeof(float));
567 if XNN_LIKELY(w_tmp >= 4) {
568 wasm_v128_store(o2, vo2); o2 += 4;
569 wasm_v128_store(o1, vo1); o1 += 4;
570 wasm_v128_store(o0, vo0); o0 += 4;
571 } else {
572 if (w_tmp & 2) {
573 *((double*) o2) = wasm_f64x2_extract_lane(vo2, 0); o2 += 2;
574 *((double*) o1) = wasm_f64x2_extract_lane(vo1, 0); o1 += 2;
575 *((double*) o0) = wasm_f64x2_extract_lane(vo0, 0); o0 += 2;
576
577 vo0 = wasm_v32x4_shuffle(vo0, vo0, 2, 3, 0, 1);
578 vo1 = wasm_v32x4_shuffle(vo1, vo1, 2, 3, 0, 1);
579 vo2 = wasm_v32x4_shuffle(vo2, vo2, 2, 3, 0, 1);
580 }
581 if (w_tmp & 1) {
582 *o2 = wasm_f32x4_extract_lane(vo2, 0); o2 += 1;
583 *o1 = wasm_f32x4_extract_lane(vo1, 0); o1 += 1;
584 *o0 = wasm_f32x4_extract_lane(vo0, 0); o0 += 1;
585 }
586 }
587 }
588
589 i0 = (const float*) ((uintptr_t) i6 - input_decrement);
590 i1 = (const float*) ((uintptr_t) i7 - input_decrement);
591 i2 = (const float*) ((uintptr_t) i8 - input_decrement);
592 i3 = (const float*) ((uintptr_t) i2 + input_width);
593 i4 = (const float*) ((uintptr_t) i3 + input_width);
594 i5 = (const float*) ((uintptr_t) i4 + input_width);
595 i6 = (const float*) ((uintptr_t) i5 + input_width);
596 i7 = (const float*) ((uintptr_t) i6 + input_width);
597 i8 = (const float*) ((uintptr_t) i7 + input_width);
598
599 o0 = o2;
600 o1 = (float*) ((uintptr_t) o0 + output_width);
601 o2 = (float*) ((uintptr_t) o1 + output_width);
602
603 output_height = doz(output_height, 3);
604 padded_input_height = doz(padded_input_height, 6);
605 } while (output_height != 0);
606 }
607