1 // Auto-generated file. Do not edit!
2 // Template: src/f32-dwconv2d-chw/5x5p2-neon.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 <arm_neon.h>
13
14 #include <xnnpack/dwconv.h>
15 #include <xnnpack/math.h>
16
17
xnn_f32_dwconv2d_chw_ukernel_5x5p2__neon_2x4(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)])18 void xnn_f32_dwconv2d_chw_ukernel_5x5p2__neon_2x4(
19 size_t input_height,
20 size_t input_width,
21 const float* input,
22 const float* weights,
23 const float* zero,
24 float* output,
25 uint32_t padding_top,
26 const union xnn_f32_chw_params params[restrict XNN_MIN_ELEMENTS(1)])
27 {
28 assert(input_height != 0);
29 assert(input_width != 0);
30 assert(input_width % sizeof(float) == 0);
31 assert(padding_top == 2);
32
33 const uint32x4_t vmask = vld1q_u32(params->neon.mask);
34 const float32x4_t vmax = vld1q_dup_f32(¶ms->neon.max);
35 const float32x4_t vmin = vld1q_dup_f32(¶ms->neon.min);
36
37 const float32x4_t vw0123 = vld1q_f32(weights);
38 const float32x4_t vw4567 = vld1q_f32(weights + 4);
39 const float32x4_t vw89AB = vld1q_f32(weights + 8);
40 const float32x4_t vwCDEF = vld1q_f32(weights + 12);
41 const float32x4_t vwGHIJ = vld1q_f32(weights + 16);
42 const float32x4_t vwKLMN = vld1q_f32(weights + 20);
43 const float32x2_t vwOP = vld1_f32(weights + 24);
44
45 const size_t input_decrement = round_up_po2(input_width, 4 * sizeof(float));
46
47 const float* i0 = zero;
48 const float* i1 = zero;
49 const float* i2 = input;
50 const float* i3 = (const float*) ((uintptr_t) i2 + input_width);
51 const float* i4 = (const float*) ((uintptr_t) i3 + input_width);
52 const float* i5 = (const float*) ((uintptr_t) i4 + input_width);
53
54 float* o0 = output;
55 float* o1 = (float*) ((uintptr_t) o0 + input_width);
56
57 size_t output_height = input_height;
58 do {
59 if XNN_UNPREDICTABLE(output_height < 2) {
60 i3 = zero;
61 o1 = o0;
62 }
63 if XNN_UNPREDICTABLE(output_height < 3) {
64 i4 = zero;
65 }
66 if XNN_UNPREDICTABLE(output_height < 4) {
67 i5 = zero;
68 }
69
70 float32x4_t vi0x0123 = vmovq_n_f32(0.0f);
71 float32x4_t vi1x0123 = vmovq_n_f32(0.0f);
72 float32x4_t vi2x0123 = vmovq_n_f32(0.0f);
73 float32x4_t vi3x0123 = vmovq_n_f32(0.0f);
74 float32x4_t vi4x0123 = vmovq_n_f32(0.0f);
75 float32x4_t vi5x0123 = vmovq_n_f32(0.0f);
76
77 float32x4_t vi0x4567 = vld1q_f32(i0); i0 += 4;
78 float32x4_t vi1x4567 = vld1q_f32(i1); i1 += 4;
79 float32x4_t vi2x4567 = vld1q_f32(i2); i2 += 4;
80 float32x4_t vi3x4567 = vld1q_f32(i3); i3 += 4;
81 float32x4_t vi4x4567 = vld1q_f32(i4); i4 += 4;
82 float32x4_t vi5x4567 = vld1q_f32(i5); i5 += 4;
83
84 size_t w = input_width;
85 for (; w > 8 * sizeof(float); w -= 4 * sizeof(float)) {
86 float32x4_t vo0p0 = vdupq_lane_f32(vget_low_f32(vw0123), 0);
87 float32x4_t vo1p0 = vdupq_lane_f32(vget_low_f32(vw0123), 0);
88
89 const float32x4_t vi0x89AB = vld1q_f32(i0); i0 += 4;
90 const float32x4_t vi1x89AB = vld1q_f32(i1); i1 += 4;
91 const float32x4_t vi2x89AB = vld1q_f32(i2); i2 += 4;
92 const float32x4_t vi3x89AB = vld1q_f32(i3); i3 += 4;
93 const float32x4_t vi4x89AB = vld1q_f32(i4); i4 += 4;
94 const float32x4_t vi5x89AB = vld1q_f32(i5); i5 += 4;
95
96 vo0p0 = vmlaq_lane_f32(vo0p0, vi0x4567, vget_high_f32(vw0123), 1);
97 vo1p0 = vmlaq_lane_f32(vo1p0, vi1x4567, vget_high_f32(vw0123), 1);
98
99 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x4567, vget_low_f32(vw89AB), 0);
100 vo1p0 = vmlaq_lane_f32(vo1p0, vi2x4567, vget_low_f32(vw89AB), 0);
101
102 vo0p0 = vmlaq_lane_f32(vo0p0, vi2x4567, vget_low_f32(vwCDEF), 1);
103 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x4567, vget_low_f32(vwCDEF), 1);
104
105 vo0p0 = vmlaq_lane_f32(vo0p0, vi3x4567, vget_high_f32(vwGHIJ), 0);
106 vo1p0 = vmlaq_lane_f32(vo1p0, vi4x4567, vget_high_f32(vwGHIJ), 0);
107
108 vo0p0 = vmlaq_lane_f32(vo0p0, vi4x4567, vget_high_f32(vwKLMN), 1);
109 vo1p0 = vmlaq_lane_f32(vo1p0, vi5x4567, vget_high_f32(vwKLMN), 1);
110
111 const float32x4_t vi0x3456 = vextq_f32(vi0x0123, vi0x4567, 3);
112 const float32x4_t vi1x3456 = vextq_f32(vi1x0123, vi1x4567, 3);
113 const float32x4_t vi2x3456 = vextq_f32(vi2x0123, vi2x4567, 3);
114 const float32x4_t vi3x3456 = vextq_f32(vi3x0123, vi3x4567, 3);
115 const float32x4_t vi4x3456 = vextq_f32(vi4x0123, vi4x4567, 3);
116 const float32x4_t vi5x3456 = vextq_f32(vi5x0123, vi5x4567, 3);
117
118 vo0p0 = vmlaq_lane_f32(vo0p0, vi0x3456, vget_high_f32(vw0123), 0);
119 vo1p0 = vmlaq_lane_f32(vo1p0, vi1x3456, vget_high_f32(vw0123), 0);
120
121 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x3456, vget_high_f32(vw4567), 1);
122 vo1p0 = vmlaq_lane_f32(vo1p0, vi2x3456, vget_high_f32(vw4567), 1);
123
124 vo0p0 = vmlaq_lane_f32(vo0p0, vi2x3456, vget_low_f32(vwCDEF), 0);
125 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x3456, vget_low_f32(vwCDEF), 0);
126
127 vo0p0 = vmlaq_lane_f32(vo0p0, vi3x3456, vget_low_f32(vwGHIJ), 1);
128 vo1p0 = vmlaq_lane_f32(vo1p0, vi4x3456, vget_low_f32(vwGHIJ), 1);
129
130 vo0p0 = vmlaq_lane_f32(vo0p0, vi4x3456, vget_high_f32(vwKLMN), 0);
131 vo1p0 = vmlaq_lane_f32(vo1p0, vi5x3456, vget_high_f32(vwKLMN), 0);
132
133 const float32x4_t vi0x2345 = vextq_f32(vi0x0123, vi0x4567, 2);
134 vi0x0123 = vi0x4567;
135 const float32x4_t vi1x2345 = vextq_f32(vi1x0123, vi1x4567, 2);
136 vi1x0123 = vi1x4567;
137 const float32x4_t vi2x2345 = vextq_f32(vi2x0123, vi2x4567, 2);
138 vi2x0123 = vi2x4567;
139 const float32x4_t vi3x2345 = vextq_f32(vi3x0123, vi3x4567, 2);
140 vi3x0123 = vi3x4567;
141 const float32x4_t vi4x2345 = vextq_f32(vi4x0123, vi4x4567, 2);
142 vi4x0123 = vi4x4567;
143 const float32x4_t vi5x2345 = vextq_f32(vi5x0123, vi5x4567, 2);
144 vi5x0123 = vi5x4567;
145
146 vo0p0 = vmlaq_lane_f32(vo0p0, vi0x2345, vget_low_f32(vw0123), 1);
147 vo1p0 = vmlaq_lane_f32(vo1p0, vi1x2345, vget_low_f32(vw0123), 1);
148
149 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x2345, vget_high_f32(vw4567), 0);
150 vo1p0 = vmlaq_lane_f32(vo1p0, vi2x2345, vget_high_f32(vw4567), 0);
151
152 vo0p0 = vmlaq_lane_f32(vo0p0, vi2x2345, vget_high_f32(vw89AB), 1);
153 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x2345, vget_high_f32(vw89AB), 1);
154
155 vo0p0 = vmlaq_lane_f32(vo0p0, vi3x2345, vget_low_f32(vwGHIJ), 0);
156 vo1p0 = vmlaq_lane_f32(vo1p0, vi4x2345, vget_low_f32(vwGHIJ), 0);
157
158 vo0p0 = vmlaq_lane_f32(vo0p0, vi4x2345, vget_low_f32(vwKLMN), 1);
159 vo1p0 = vmlaq_lane_f32(vo1p0, vi5x2345, vget_low_f32(vwKLMN), 1);
160
161 const float32x4_t vi0x5678 = vextq_f32(vi0x4567, vi0x89AB, 1);
162 const float32x4_t vi1x5678 = vextq_f32(vi1x4567, vi1x89AB, 1);
163 const float32x4_t vi2x5678 = vextq_f32(vi2x4567, vi2x89AB, 1);
164 const float32x4_t vi3x5678 = vextq_f32(vi3x4567, vi3x89AB, 1);
165 const float32x4_t vi4x5678 = vextq_f32(vi4x4567, vi4x89AB, 1);
166 const float32x4_t vi5x5678 = vextq_f32(vi5x4567, vi5x89AB, 1);
167
168 vo0p0 = vmlaq_lane_f32(vo0p0, vi0x5678, vget_low_f32(vw4567), 0);
169 vo1p0 = vmlaq_lane_f32(vo1p0, vi1x5678, vget_low_f32(vw4567), 0);
170
171 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x5678, vget_low_f32(vw89AB), 1);
172 vo1p0 = vmlaq_lane_f32(vo1p0, vi2x5678, vget_low_f32(vw89AB), 1);
173
174 vo0p0 = vmlaq_lane_f32(vo0p0, vi2x5678, vget_high_f32(vwCDEF), 0);
175 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x5678, vget_high_f32(vwCDEF), 0);
176
177 vo0p0 = vmlaq_lane_f32(vo0p0, vi3x5678, vget_high_f32(vwGHIJ), 1);
178 vo1p0 = vmlaq_lane_f32(vo1p0, vi4x5678, vget_high_f32(vwGHIJ), 1);
179
180 vo0p0 = vmlaq_lane_f32(vo0p0, vi4x5678, vwOP, 0);
181 vo1p0 = vmlaq_lane_f32(vo1p0, vi5x5678, vwOP, 0);
182
183 const float32x4_t vi0x6789 = vextq_f32(vi0x4567, vi0x89AB, 2);
184 vi0x4567 = vi0x89AB;
185 const float32x4_t vi1x6789 = vextq_f32(vi1x4567, vi1x89AB, 2);
186 vi1x4567 = vi1x89AB;
187 const float32x4_t vi2x6789 = vextq_f32(vi2x4567, vi2x89AB, 2);
188 vi2x4567 = vi2x89AB;
189 const float32x4_t vi3x6789 = vextq_f32(vi3x4567, vi3x89AB, 2);
190 vi3x4567 = vi3x89AB;
191 const float32x4_t vi4x6789 = vextq_f32(vi4x4567, vi4x89AB, 2);
192 vi4x4567 = vi4x89AB;
193 const float32x4_t vi5x6789 = vextq_f32(vi5x4567, vi5x89AB, 2);
194 vi5x4567 = vi5x89AB;
195
196 vo0p0 = vmlaq_lane_f32(vo0p0, vi0x6789, vget_low_f32(vw4567), 1);
197 vo1p0 = vmlaq_lane_f32(vo1p0, vi1x6789, vget_low_f32(vw4567), 1);
198
199 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x6789, vget_high_f32(vw89AB), 0);
200 vo1p0 = vmlaq_lane_f32(vo1p0, vi2x6789, vget_high_f32(vw89AB), 0);
201
202 vo0p0 = vmlaq_lane_f32(vo0p0, vi2x6789, vget_high_f32(vwCDEF), 1);
203 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x6789, vget_high_f32(vwCDEF), 1);
204
205 vo0p0 = vmlaq_lane_f32(vo0p0, vi3x6789, vget_low_f32(vwKLMN), 0);
206 vo1p0 = vmlaq_lane_f32(vo1p0, vi4x6789, vget_low_f32(vwKLMN), 0);
207
208 vo0p0 = vmlaq_lane_f32(vo0p0, vi4x6789, vwOP, 1);
209 vo1p0 = vmlaq_lane_f32(vo1p0, vi5x6789, vwOP, 1);
210
211
212 float32x4_t vo0 = vmaxq_f32(vo0p0, vmin);
213 float32x4_t vo1 = vmaxq_f32(vo1p0, vmin);
214
215 vo0 = vminq_f32(vo0, vmax);
216 vo1 = vminq_f32(vo1, vmax);
217
218 vst1q_f32(o1, vo1); o1 += 4;
219 vst1q_f32(o0, vo0); o0 += 4;
220 }
221 // Always process the last block of 5..8 pixels.
222 if XNN_LIKELY(w > 4 * sizeof(float)) {
223 float32x4_t vo0p0 = vdupq_lane_f32(vget_low_f32(vw0123), 0);
224 float32x4_t vo1p0 = vdupq_lane_f32(vget_low_f32(vw0123), 0);
225
226 float32x4_t vi0x89AB = vld1q_f32(i0); i0 += 4;
227 float32x4_t vi1x89AB = vld1q_f32(i1); i1 += 4;
228 float32x4_t vi2x89AB = vld1q_f32(i2); i2 += 4;
229 float32x4_t vi3x89AB = vld1q_f32(i3); i3 += 4;
230 float32x4_t vi4x89AB = vld1q_f32(i4); i4 += 4;
231 float32x4_t vi5x89AB = vld1q_f32(i5); i5 += 4;
232
233 vi0x89AB = vreinterpretq_f32_u32(vandq_u32(vmask, vreinterpretq_u32_f32(vi0x89AB)));
234 vi1x89AB = vreinterpretq_f32_u32(vandq_u32(vmask, vreinterpretq_u32_f32(vi1x89AB)));
235 vi2x89AB = vreinterpretq_f32_u32(vandq_u32(vmask, vreinterpretq_u32_f32(vi2x89AB)));
236 vi3x89AB = vreinterpretq_f32_u32(vandq_u32(vmask, vreinterpretq_u32_f32(vi3x89AB)));
237 vi4x89AB = vreinterpretq_f32_u32(vandq_u32(vmask, vreinterpretq_u32_f32(vi4x89AB)));
238 vi5x89AB = vreinterpretq_f32_u32(vandq_u32(vmask, vreinterpretq_u32_f32(vi5x89AB)));
239
240 vo0p0 = vmlaq_lane_f32(vo0p0, vi0x4567, vget_high_f32(vw0123), 1);
241 vo1p0 = vmlaq_lane_f32(vo1p0, vi1x4567, vget_high_f32(vw0123), 1);
242
243 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x4567, vget_low_f32(vw89AB), 0);
244 vo1p0 = vmlaq_lane_f32(vo1p0, vi2x4567, vget_low_f32(vw89AB), 0);
245
246 vo0p0 = vmlaq_lane_f32(vo0p0, vi2x4567, vget_low_f32(vwCDEF), 1);
247 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x4567, vget_low_f32(vwCDEF), 1);
248
249 vo0p0 = vmlaq_lane_f32(vo0p0, vi3x4567, vget_high_f32(vwGHIJ), 0);
250 vo1p0 = vmlaq_lane_f32(vo1p0, vi4x4567, vget_high_f32(vwGHIJ), 0);
251
252 vo0p0 = vmlaq_lane_f32(vo0p0, vi4x4567, vget_high_f32(vwKLMN), 1);
253 vo1p0 = vmlaq_lane_f32(vo1p0, vi5x4567, vget_high_f32(vwKLMN), 1);
254
255 const float32x4_t vi0x3456 = vextq_f32(vi0x0123, vi0x4567, 3);
256 const float32x4_t vi1x3456 = vextq_f32(vi1x0123, vi1x4567, 3);
257 const float32x4_t vi2x3456 = vextq_f32(vi2x0123, vi2x4567, 3);
258 const float32x4_t vi3x3456 = vextq_f32(vi3x0123, vi3x4567, 3);
259 const float32x4_t vi4x3456 = vextq_f32(vi4x0123, vi4x4567, 3);
260 const float32x4_t vi5x3456 = vextq_f32(vi5x0123, vi5x4567, 3);
261
262 vo0p0 = vmlaq_lane_f32(vo0p0, vi0x3456, vget_high_f32(vw0123), 0);
263 vo1p0 = vmlaq_lane_f32(vo1p0, vi1x3456, vget_high_f32(vw0123), 0);
264
265 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x3456, vget_high_f32(vw4567), 1);
266 vo1p0 = vmlaq_lane_f32(vo1p0, vi2x3456, vget_high_f32(vw4567), 1);
267
268 vo0p0 = vmlaq_lane_f32(vo0p0, vi2x3456, vget_low_f32(vwCDEF), 0);
269 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x3456, vget_low_f32(vwCDEF), 0);
270
271 vo0p0 = vmlaq_lane_f32(vo0p0, vi3x3456, vget_low_f32(vwGHIJ), 1);
272 vo1p0 = vmlaq_lane_f32(vo1p0, vi4x3456, vget_low_f32(vwGHIJ), 1);
273
274 vo0p0 = vmlaq_lane_f32(vo0p0, vi4x3456, vget_high_f32(vwKLMN), 0);
275 vo1p0 = vmlaq_lane_f32(vo1p0, vi5x3456, vget_high_f32(vwKLMN), 0);
276
277 const float32x4_t vi0x2345 = vextq_f32(vi0x0123, vi0x4567, 2);
278 vi0x0123 = vi0x4567;
279 const float32x4_t vi1x2345 = vextq_f32(vi1x0123, vi1x4567, 2);
280 vi1x0123 = vi1x4567;
281 const float32x4_t vi2x2345 = vextq_f32(vi2x0123, vi2x4567, 2);
282 vi2x0123 = vi2x4567;
283 const float32x4_t vi3x2345 = vextq_f32(vi3x0123, vi3x4567, 2);
284 vi3x0123 = vi3x4567;
285 const float32x4_t vi4x2345 = vextq_f32(vi4x0123, vi4x4567, 2);
286 vi4x0123 = vi4x4567;
287 const float32x4_t vi5x2345 = vextq_f32(vi5x0123, vi5x4567, 2);
288 vi5x0123 = vi5x4567;
289
290 vo0p0 = vmlaq_lane_f32(vo0p0, vi0x2345, vget_low_f32(vw0123), 1);
291 vo1p0 = vmlaq_lane_f32(vo1p0, vi1x2345, vget_low_f32(vw0123), 1);
292
293 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x2345, vget_high_f32(vw4567), 0);
294 vo1p0 = vmlaq_lane_f32(vo1p0, vi2x2345, vget_high_f32(vw4567), 0);
295
296 vo0p0 = vmlaq_lane_f32(vo0p0, vi2x2345, vget_high_f32(vw89AB), 1);
297 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x2345, vget_high_f32(vw89AB), 1);
298
299 vo0p0 = vmlaq_lane_f32(vo0p0, vi3x2345, vget_low_f32(vwGHIJ), 0);
300 vo1p0 = vmlaq_lane_f32(vo1p0, vi4x2345, vget_low_f32(vwGHIJ), 0);
301
302 vo0p0 = vmlaq_lane_f32(vo0p0, vi4x2345, vget_low_f32(vwKLMN), 1);
303 vo1p0 = vmlaq_lane_f32(vo1p0, vi5x2345, vget_low_f32(vwKLMN), 1);
304
305 const float32x4_t vi0x5678 = vextq_f32(vi0x4567, vi0x89AB, 1);
306 const float32x4_t vi1x5678 = vextq_f32(vi1x4567, vi1x89AB, 1);
307 const float32x4_t vi2x5678 = vextq_f32(vi2x4567, vi2x89AB, 1);
308 const float32x4_t vi3x5678 = vextq_f32(vi3x4567, vi3x89AB, 1);
309 const float32x4_t vi4x5678 = vextq_f32(vi4x4567, vi4x89AB, 1);
310 const float32x4_t vi5x5678 = vextq_f32(vi5x4567, vi5x89AB, 1);
311
312 vo0p0 = vmlaq_lane_f32(vo0p0, vi0x5678, vget_low_f32(vw4567), 0);
313 vo1p0 = vmlaq_lane_f32(vo1p0, vi1x5678, vget_low_f32(vw4567), 0);
314
315 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x5678, vget_low_f32(vw89AB), 1);
316 vo1p0 = vmlaq_lane_f32(vo1p0, vi2x5678, vget_low_f32(vw89AB), 1);
317
318 vo0p0 = vmlaq_lane_f32(vo0p0, vi2x5678, vget_high_f32(vwCDEF), 0);
319 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x5678, vget_high_f32(vwCDEF), 0);
320
321 vo0p0 = vmlaq_lane_f32(vo0p0, vi3x5678, vget_high_f32(vwGHIJ), 1);
322 vo1p0 = vmlaq_lane_f32(vo1p0, vi4x5678, vget_high_f32(vwGHIJ), 1);
323
324 vo0p0 = vmlaq_lane_f32(vo0p0, vi4x5678, vwOP, 0);
325 vo1p0 = vmlaq_lane_f32(vo1p0, vi5x5678, vwOP, 0);
326
327 const float32x4_t vi0x6789 = vextq_f32(vi0x4567, vi0x89AB, 2);
328 vi0x4567 = vi0x89AB;
329 const float32x4_t vi1x6789 = vextq_f32(vi1x4567, vi1x89AB, 2);
330 vi1x4567 = vi1x89AB;
331 const float32x4_t vi2x6789 = vextq_f32(vi2x4567, vi2x89AB, 2);
332 vi2x4567 = vi2x89AB;
333 const float32x4_t vi3x6789 = vextq_f32(vi3x4567, vi3x89AB, 2);
334 vi3x4567 = vi3x89AB;
335 const float32x4_t vi4x6789 = vextq_f32(vi4x4567, vi4x89AB, 2);
336 vi4x4567 = vi4x89AB;
337 const float32x4_t vi5x6789 = vextq_f32(vi5x4567, vi5x89AB, 2);
338 vi5x4567 = vi5x89AB;
339
340 vo0p0 = vmlaq_lane_f32(vo0p0, vi0x6789, vget_low_f32(vw4567), 1);
341 vo1p0 = vmlaq_lane_f32(vo1p0, vi1x6789, vget_low_f32(vw4567), 1);
342
343 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x6789, vget_high_f32(vw89AB), 0);
344 vo1p0 = vmlaq_lane_f32(vo1p0, vi2x6789, vget_high_f32(vw89AB), 0);
345
346 vo0p0 = vmlaq_lane_f32(vo0p0, vi2x6789, vget_high_f32(vwCDEF), 1);
347 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x6789, vget_high_f32(vwCDEF), 1);
348
349 vo0p0 = vmlaq_lane_f32(vo0p0, vi3x6789, vget_low_f32(vwKLMN), 0);
350 vo1p0 = vmlaq_lane_f32(vo1p0, vi4x6789, vget_low_f32(vwKLMN), 0);
351
352 vo0p0 = vmlaq_lane_f32(vo0p0, vi4x6789, vwOP, 1);
353 vo1p0 = vmlaq_lane_f32(vo1p0, vi5x6789, vwOP, 1);
354
355
356 float32x4_t vo0 = vmaxq_f32(vo0p0, vmin);
357 float32x4_t vo1 = vmaxq_f32(vo1p0, vmin);
358
359 vo0 = vminq_f32(vo0, vmax);
360 vo1 = vminq_f32(vo1, vmax);
361
362 vst1q_f32(o1, vo1); o1 += 4;
363 vst1q_f32(o0, vo0); o0 += 4;
364
365 w -= 4 * sizeof(float);
366 }
367 assert(w >= 1 * sizeof(float));
368 assert(w <= 4 * sizeof(float));
369 {
370 float32x4_t vo0p0 = vdupq_lane_f32(vget_low_f32(vw0123), 0);
371 float32x4_t vo1p0 = vdupq_lane_f32(vget_low_f32(vw0123), 0);
372
373 vi0x4567 = vreinterpretq_f32_u32(vandq_u32(vmask, vreinterpretq_u32_f32(vi0x4567)));
374 vi1x4567 = vreinterpretq_f32_u32(vandq_u32(vmask, vreinterpretq_u32_f32(vi1x4567)));
375 vi2x4567 = vreinterpretq_f32_u32(vandq_u32(vmask, vreinterpretq_u32_f32(vi2x4567)));
376 vi3x4567 = vreinterpretq_f32_u32(vandq_u32(vmask, vreinterpretq_u32_f32(vi3x4567)));
377 vi4x4567 = vreinterpretq_f32_u32(vandq_u32(vmask, vreinterpretq_u32_f32(vi4x4567)));
378 vi5x4567 = vreinterpretq_f32_u32(vandq_u32(vmask, vreinterpretq_u32_f32(vi5x4567)));
379
380 vo0p0 = vmlaq_lane_f32(vo0p0, vi0x4567, vget_high_f32(vw0123), 1);
381 vo1p0 = vmlaq_lane_f32(vo1p0, vi1x4567, vget_high_f32(vw0123), 1);
382
383 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x4567, vget_low_f32(vw89AB), 0);
384 vo1p0 = vmlaq_lane_f32(vo1p0, vi2x4567, vget_low_f32(vw89AB), 0);
385
386 vo0p0 = vmlaq_lane_f32(vo0p0, vi2x4567, vget_low_f32(vwCDEF), 1);
387 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x4567, vget_low_f32(vwCDEF), 1);
388
389 vo0p0 = vmlaq_lane_f32(vo0p0, vi3x4567, vget_high_f32(vwGHIJ), 0);
390 vo1p0 = vmlaq_lane_f32(vo1p0, vi4x4567, vget_high_f32(vwGHIJ), 0);
391
392 vo0p0 = vmlaq_lane_f32(vo0p0, vi4x4567, vget_high_f32(vwKLMN), 1);
393 vo1p0 = vmlaq_lane_f32(vo1p0, vi5x4567, vget_high_f32(vwKLMN), 1);
394
395 const float32x4_t vi0x3456 = vextq_f32(vi0x0123, vi0x4567, 3);
396 const float32x4_t vi1x3456 = vextq_f32(vi1x0123, vi1x4567, 3);
397 const float32x4_t vi2x3456 = vextq_f32(vi2x0123, vi2x4567, 3);
398 const float32x4_t vi3x3456 = vextq_f32(vi3x0123, vi3x4567, 3);
399 const float32x4_t vi4x3456 = vextq_f32(vi4x0123, vi4x4567, 3);
400 const float32x4_t vi5x3456 = vextq_f32(vi5x0123, vi5x4567, 3);
401
402 vo0p0 = vmlaq_lane_f32(vo0p0, vi0x3456, vget_high_f32(vw0123), 0);
403 vo1p0 = vmlaq_lane_f32(vo1p0, vi1x3456, vget_high_f32(vw0123), 0);
404
405 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x3456, vget_high_f32(vw4567), 1);
406 vo1p0 = vmlaq_lane_f32(vo1p0, vi2x3456, vget_high_f32(vw4567), 1);
407
408 vo0p0 = vmlaq_lane_f32(vo0p0, vi2x3456, vget_low_f32(vwCDEF), 0);
409 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x3456, vget_low_f32(vwCDEF), 0);
410
411 vo0p0 = vmlaq_lane_f32(vo0p0, vi3x3456, vget_low_f32(vwGHIJ), 1);
412 vo1p0 = vmlaq_lane_f32(vo1p0, vi4x3456, vget_low_f32(vwGHIJ), 1);
413
414 vo0p0 = vmlaq_lane_f32(vo0p0, vi4x3456, vget_high_f32(vwKLMN), 0);
415 vo1p0 = vmlaq_lane_f32(vo1p0, vi5x3456, vget_high_f32(vwKLMN), 0);
416
417 const float32x4_t vi0x2345 = vextq_f32(vi0x0123, vi0x4567, 2);
418 const float32x4_t vi1x2345 = vextq_f32(vi1x0123, vi1x4567, 2);
419 const float32x4_t vi2x2345 = vextq_f32(vi2x0123, vi2x4567, 2);
420 const float32x4_t vi3x2345 = vextq_f32(vi3x0123, vi3x4567, 2);
421 const float32x4_t vi4x2345 = vextq_f32(vi4x0123, vi4x4567, 2);
422 const float32x4_t vi5x2345 = vextq_f32(vi5x0123, vi5x4567, 2);
423
424 vo0p0 = vmlaq_lane_f32(vo0p0, vi0x2345, vget_low_f32(vw0123), 1);
425 vo1p0 = vmlaq_lane_f32(vo1p0, vi1x2345, vget_low_f32(vw0123), 1);
426
427 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x2345, vget_high_f32(vw4567), 0);
428 vo1p0 = vmlaq_lane_f32(vo1p0, vi2x2345, vget_high_f32(vw4567), 0);
429
430 vo0p0 = vmlaq_lane_f32(vo0p0, vi2x2345, vget_high_f32(vw89AB), 1);
431 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x2345, vget_high_f32(vw89AB), 1);
432
433 vo0p0 = vmlaq_lane_f32(vo0p0, vi3x2345, vget_low_f32(vwGHIJ), 0);
434 vo1p0 = vmlaq_lane_f32(vo1p0, vi4x2345, vget_low_f32(vwGHIJ), 0);
435
436 vo0p0 = vmlaq_lane_f32(vo0p0, vi4x2345, vget_low_f32(vwKLMN), 1);
437 vo1p0 = vmlaq_lane_f32(vo1p0, vi5x2345, vget_low_f32(vwKLMN), 1);
438
439 const float32x4_t vzero = vmovq_n_f32(0.0f);
440 const float32x4_t vi0x5678 = vextq_f32(vi0x4567, vzero, 1);
441 const float32x4_t vi1x5678 = vextq_f32(vi1x4567, vzero, 1);
442 const float32x4_t vi2x5678 = vextq_f32(vi2x4567, vzero, 1);
443 const float32x4_t vi3x5678 = vextq_f32(vi3x4567, vzero, 1);
444 const float32x4_t vi4x5678 = vextq_f32(vi4x4567, vzero, 1);
445 const float32x4_t vi5x5678 = vextq_f32(vi5x4567, vzero, 1);
446
447 vo0p0 = vmlaq_lane_f32(vo0p0, vi0x5678, vget_low_f32(vw4567), 0);
448 vo1p0 = vmlaq_lane_f32(vo1p0, vi1x5678, vget_low_f32(vw4567), 0);
449
450 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x5678, vget_low_f32(vw89AB), 1);
451 vo1p0 = vmlaq_lane_f32(vo1p0, vi2x5678, vget_low_f32(vw89AB), 1);
452
453 vo0p0 = vmlaq_lane_f32(vo0p0, vi2x5678, vget_high_f32(vwCDEF), 0);
454 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x5678, vget_high_f32(vwCDEF), 0);
455
456 vo0p0 = vmlaq_lane_f32(vo0p0, vi3x5678, vget_high_f32(vwGHIJ), 1);
457 vo1p0 = vmlaq_lane_f32(vo1p0, vi4x5678, vget_high_f32(vwGHIJ), 1);
458
459 vo0p0 = vmlaq_lane_f32(vo0p0, vi4x5678, vwOP, 0);
460 vo1p0 = vmlaq_lane_f32(vo1p0, vi5x5678, vwOP, 0);
461
462 const float32x4_t vi0x6789 = vextq_f32(vi0x5678, vzero, 1);
463 const float32x4_t vi1x6789 = vextq_f32(vi1x5678, vzero, 1);
464 const float32x4_t vi2x6789 = vextq_f32(vi2x5678, vzero, 1);
465 const float32x4_t vi3x6789 = vextq_f32(vi3x5678, vzero, 1);
466 const float32x4_t vi4x6789 = vextq_f32(vi4x5678, vzero, 1);
467 const float32x4_t vi5x6789 = vextq_f32(vi5x5678, vzero, 1);
468
469 vo0p0 = vmlaq_lane_f32(vo0p0, vi0x6789, vget_low_f32(vw4567), 1);
470 vo1p0 = vmlaq_lane_f32(vo1p0, vi1x6789, vget_low_f32(vw4567), 1);
471
472 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x6789, vget_high_f32(vw89AB), 0);
473 vo1p0 = vmlaq_lane_f32(vo1p0, vi2x6789, vget_high_f32(vw89AB), 0);
474
475 vo0p0 = vmlaq_lane_f32(vo0p0, vi2x6789, vget_high_f32(vwCDEF), 1);
476 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x6789, vget_high_f32(vwCDEF), 1);
477
478 vo0p0 = vmlaq_lane_f32(vo0p0, vi3x6789, vget_low_f32(vwKLMN), 0);
479 vo1p0 = vmlaq_lane_f32(vo1p0, vi4x6789, vget_low_f32(vwKLMN), 0);
480
481 vo0p0 = vmlaq_lane_f32(vo0p0, vi4x6789, vwOP, 1);
482 vo1p0 = vmlaq_lane_f32(vo1p0, vi5x6789, vwOP, 1);
483
484
485 float32x4_t vo0 = vmaxq_f32(vo0p0, vmin);
486 float32x4_t vo1 = vmaxq_f32(vo1p0, vmin);
487
488 vo0 = vminq_f32(vo0, vmax);
489 vo1 = vminq_f32(vo1, vmax);
490
491 if XNN_LIKELY(w & (4 * sizeof(float))) {
492 vst1q_f32(o1, vo1); o1 += 4;
493 vst1q_f32(o0, vo0); o0 += 4;
494 } else {
495 float32x2_t vo0_lo = vget_low_f32(vo0);
496 float32x2_t vo1_lo = vget_low_f32(vo1);
497 if (w & (2 * sizeof(float))) {
498 vst1_f32(o1, vo1_lo); o1 += 2;
499 vst1_f32(o0, vo0_lo); o0 += 2;
500
501 vo0_lo = vget_high_f32(vo0);
502 vo1_lo = vget_high_f32(vo1);
503 }
504 if (w & (1 * sizeof(float))) {
505 vst1_lane_f32(o1, vo1_lo, 0); o1 += 1;
506 vst1_lane_f32(o0, vo0_lo, 0); o0 += 1;
507 }
508 }
509 }
510
511 i0 = (const float*) ((uintptr_t) i2 - input_decrement);
512 i1 = (const float*) ((uintptr_t) i3 - input_decrement);
513 i2 = (const float*) ((uintptr_t) i1 + input_width);
514 i3 = (const float*) ((uintptr_t) i2 + input_width);
515 i4 = (const float*) ((uintptr_t) i3 + input_width);
516 i5 = (const float*) ((uintptr_t) i4 + input_width);
517
518 o0 = o1;
519 o1 = (float*) ((uintptr_t) o0 + input_width);
520
521 output_height = doz(output_height, 2);
522 } while (output_height != 0);
523 }
524