1 // Auto-generated file. Do not edit!
2 //   Template: src/f32-dwconv2d-chw/5x5s2p2-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_5x5s2p2__neonfma_2x4_acc3(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_5x5s2p2__neonfma_2x4_acc3(
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 >= 1);
32   assert(padding_top <= 2);
33 
34   const uint32x4_t vmask_even = vld1q_u32(params->neon.mask_even);
35   const uint32x4_t vmask_odd = vld1q_u32(params->neon.mask_odd);
36   const float32x4_t vmax = vld1q_dup_f32(&params->neon.max);
37   const float32x4_t vmin = vld1q_dup_f32(&params->neon.min);
38 
39   const float32x4_t vw0123 = vld1q_f32(weights);
40   const float32x4_t vw4567 = vld1q_f32(weights + 4);
41   const float32x4_t vw89AB = vld1q_f32(weights + 8);
42   const float32x4_t vwCDEF = vld1q_f32(weights + 12);
43   const float32x4_t vwGHIJ = vld1q_f32(weights + 16);
44   const float32x4_t vwKLMN = vld1q_f32(weights + 20);
45   const float32x2_t vwOP   = vld1_f32(weights + 24);
46 
47   const uint32_t padding_top_less_1 = padding_top - 1;
48   const size_t input_decrement = round_up_po2(input_width, 8 * sizeof(float));
49 
50   const float* i0 = zero;
51   const float* i1 = (const float*) ((uintptr_t) input - ((-padding_top_less_1) & input_width));
52   const float* i2 = (const float*) ((uintptr_t) i1 + input_width);
53   if XNN_UNPREDICTABLE(padding_top_less_1 != 0) {
54     i1 = zero;
55   }
56   const float* i3 = (const float*) ((uintptr_t) i2 + input_width);
57   const float* i4 = (const float*) ((uintptr_t) i3 + input_width);
58   const float* i5 = (const float*) ((uintptr_t) i4 + input_width);
59   const float* i6 = (const float*) ((uintptr_t) i5 + input_width);
60 
61   const size_t output_width = round_down_po2((input_width + (2 /* padding */ - 3 /* kernel size */ + 2 /* subsampling */) * sizeof(float)) / 2, sizeof(float));
62 
63   float* o0 = output;
64   float* o1 = (float*) ((uintptr_t) o0 + output_width);
65 
66   size_t padded_input_height = input_height + (padding_top_less_1 + 1) + 2 /* padding bottom */;
67   size_t output_height = (padded_input_height - 5 /* kernel size */ + 2 /* subsampling */) / 2;
68   do {
69     if XNN_UNPREDICTABLE(padded_input_height < 6) {
70       i3 = zero;
71     }
72     if XNN_UNPREDICTABLE(padded_input_height < 7) {
73       i4 = zero;
74       o1 = o0;
75     }
76     if XNN_UNPREDICTABLE(padded_input_height < 8) {
77       i5 = zero;
78     }
79     if XNN_UNPREDICTABLE(padded_input_height < 9) {
80       i6 = zero;
81     }
82 
83     float32x4_t vi0x0246 = vmovq_n_f32(0.0f);
84     float32x4_t vi1x0246 = vmovq_n_f32(0.0f);
85     float32x4_t vi2x0246 = vmovq_n_f32(0.0f);
86     float32x4_t vi3x0246 = vmovq_n_f32(0.0f);
87     float32x4_t vi4x0246 = vmovq_n_f32(0.0f);
88     float32x4_t vi5x0246 = vmovq_n_f32(0.0f);
89     float32x4_t vi6x0246 = vmovq_n_f32(0.0f);
90 
91     float32x4_t vi0x1357 = vmovq_n_f32(0.0f);
92     float32x4_t vi1x1357 = vmovq_n_f32(0.0f);
93     float32x4_t vi2x1357 = vmovq_n_f32(0.0f);
94     float32x4_t vi3x1357 = vmovq_n_f32(0.0f);
95     float32x4_t vi4x1357 = vmovq_n_f32(0.0f);
96     float32x4_t vi5x1357 = vmovq_n_f32(0.0f);
97     float32x4_t vi6x1357 = vmovq_n_f32(0.0f);
98 
99     float32x4x2_t vi0x8ACE9BDF = vld2q_f32(i0); i0 += 8;
100     float32x4x2_t vi1x8ACE9BDF = vld2q_f32(i1); i1 += 8;
101     float32x4x2_t vi2x8ACE9BDF = vld2q_f32(i2); i2 += 8;
102     float32x4x2_t vi3x8ACE9BDF = vld2q_f32(i3); i3 += 8;
103     float32x4x2_t vi4x8ACE9BDF = vld2q_f32(i4); i4 += 8;
104     float32x4x2_t vi5x8ACE9BDF = vld2q_f32(i5); i5 += 8;
105     float32x4x2_t vi6x8ACE9BDF = vld2q_f32(i6); i6 += 8;
106 
107     size_t w = input_width;
108     for (; w > 8 * sizeof(float); w -= 8 * sizeof(float)) {
109       float32x4_t vo0p0 = vdupq_lane_f32(vget_low_f32(vw0123), 0);
110       float32x4_t vo1p0 = vdupq_lane_f32(vget_low_f32(vw0123), 0);
111 
112       float32x4_t vo0p1 = vmulq_lane_f32(vi0x8ACE9BDF.val[0], vget_high_f32(vw0123), 1);
113       float32x4_t vo1p1 = vmulq_lane_f32(vi2x8ACE9BDF.val[0], vget_high_f32(vw0123), 1);
114 
115       float32x4_t vo0p2 = vmulq_lane_f32(vi1x8ACE9BDF.val[0], vget_low_f32(vw89AB), 0);
116       float32x4_t vo1p2 = vmulq_lane_f32(vi3x8ACE9BDF.val[0], vget_low_f32(vw89AB), 0);
117 
118       vo0p1 = vfmaq_lane_f32(vo0p1, vi2x8ACE9BDF.val[0], vget_low_f32(vwCDEF), 1);
119       vo1p1 = vfmaq_lane_f32(vo1p1, vi4x8ACE9BDF.val[0], vget_low_f32(vwCDEF), 1);
120 
121       vo0p2 = vfmaq_lane_f32(vo0p2, vi3x8ACE9BDF.val[0], vget_high_f32(vwGHIJ), 0);
122       vo1p2 = vfmaq_lane_f32(vo1p2, vi5x8ACE9BDF.val[0], vget_high_f32(vwGHIJ), 0);
123 
124       vo0p0 = vfmaq_lane_f32(vo0p0, vi4x8ACE9BDF.val[0], vget_high_f32(vwKLMN), 1);
125       vo1p0 = vfmaq_lane_f32(vo1p0, vi6x8ACE9BDF.val[0], vget_high_f32(vwKLMN), 1);
126 
127       vo0p1 = vfmaq_lane_f32(vo0p1, vi0x8ACE9BDF.val[1], vget_low_f32(vw4567), 0);
128       vo1p1 = vfmaq_lane_f32(vo1p1, vi2x8ACE9BDF.val[1], vget_low_f32(vw4567), 0);
129 
130       vo0p2 = vfmaq_lane_f32(vo0p2, vi1x8ACE9BDF.val[1], vget_low_f32(vw89AB), 1);
131       vo1p2 = vfmaq_lane_f32(vo1p2, vi3x8ACE9BDF.val[1], vget_low_f32(vw89AB), 1);
132 
133       vo0p0 = vfmaq_lane_f32(vo0p0, vi2x8ACE9BDF.val[1], vget_high_f32(vwCDEF), 0);
134       vo1p0 = vfmaq_lane_f32(vo1p0, vi4x8ACE9BDF.val[1], vget_high_f32(vwCDEF), 0);
135 
136       vo0p1 = vfmaq_lane_f32(vo0p1, vi3x8ACE9BDF.val[1], vget_high_f32(vwGHIJ), 1);
137       vo1p1 = vfmaq_lane_f32(vo1p1, vi5x8ACE9BDF.val[1], vget_high_f32(vwGHIJ), 1);
138 
139       vo0p2 = vfmaq_lane_f32(vo0p2, vi4x8ACE9BDF.val[1], vwOP, 0);
140       vo1p2 = vfmaq_lane_f32(vo1p2, vi6x8ACE9BDF.val[1], vwOP, 0);
141 
142       const float32x4_t vi0x68AC = vextq_f32(vi0x0246, vi0x8ACE9BDF.val[0], 3);
143       vi0x0246 = vi0x8ACE9BDF.val[0];
144       const float32x4_t vi1x68AC = vextq_f32(vi1x0246, vi1x8ACE9BDF.val[0], 3);
145       vi1x0246 = vi1x8ACE9BDF.val[0];
146       const float32x4_t vi2x68AC = vextq_f32(vi2x0246, vi2x8ACE9BDF.val[0], 3);
147       vi2x0246 = vi2x8ACE9BDF.val[0];
148       const float32x4_t vi3x68AC = vextq_f32(vi3x0246, vi3x8ACE9BDF.val[0], 3);
149       vi3x0246 = vi3x8ACE9BDF.val[0];
150       const float32x4_t vi4x68AC = vextq_f32(vi4x0246, vi4x8ACE9BDF.val[0], 3);
151       vi4x0246 = vi4x8ACE9BDF.val[0];
152       const float32x4_t vi5x68AC = vextq_f32(vi5x0246, vi5x8ACE9BDF.val[0], 3);
153       vi5x0246 = vi5x8ACE9BDF.val[0];
154       const float32x4_t vi6x68AC = vextq_f32(vi6x0246, vi6x8ACE9BDF.val[0], 3);
155       vi6x0246 = vi6x8ACE9BDF.val[0];
156 
157       vo0p0 = vfmaq_lane_f32(vo0p0, vi0x68AC, vget_low_f32(vw0123), 1);
158       vo1p0 = vfmaq_lane_f32(vo1p0, vi2x68AC, vget_low_f32(vw0123), 1);
159 
160       vo0p1 = vfmaq_lane_f32(vo0p1, vi1x68AC, vget_high_f32(vw4567), 0);
161       vo1p1 = vfmaq_lane_f32(vo1p1, vi3x68AC, vget_high_f32(vw4567), 0);
162 
163       vo0p2 = vfmaq_lane_f32(vo0p2, vi2x68AC, vget_high_f32(vw89AB), 1);
164       vo1p2 = vfmaq_lane_f32(vo1p2, vi4x68AC, vget_high_f32(vw89AB), 1);
165 
166       vo0p0 = vfmaq_lane_f32(vo0p0, vi3x68AC, vget_low_f32(vwGHIJ), 0);
167       vo1p0 = vfmaq_lane_f32(vo1p0, vi5x68AC, vget_low_f32(vwGHIJ), 0);
168 
169       vo0p1 = vfmaq_lane_f32(vo0p1, vi4x68AC, vget_low_f32(vwKLMN), 1);
170       vo1p1 = vfmaq_lane_f32(vo1p1, vi6x68AC, vget_low_f32(vwKLMN), 1);
171 
172       const float32x4_t vi0x79BD = vextq_f32(vi0x1357, vi0x8ACE9BDF.val[1], 3);
173       vi0x1357 = vi0x8ACE9BDF.val[1];
174       const float32x4_t vi1x79BD = vextq_f32(vi1x1357, vi1x8ACE9BDF.val[1], 3);
175       vi1x1357 = vi1x8ACE9BDF.val[1];
176       const float32x4_t vi2x79BD = vextq_f32(vi2x1357, vi2x8ACE9BDF.val[1], 3);
177       vi2x1357 = vi2x8ACE9BDF.val[1];
178       const float32x4_t vi3x79BD = vextq_f32(vi3x1357, vi3x8ACE9BDF.val[1], 3);
179       vi3x1357 = vi3x8ACE9BDF.val[1];
180       const float32x4_t vi4x79BD = vextq_f32(vi4x1357, vi4x8ACE9BDF.val[1], 3);
181       vi4x1357 = vi4x8ACE9BDF.val[1];
182       const float32x4_t vi5x79BD = vextq_f32(vi5x1357, vi5x8ACE9BDF.val[1], 3);
183       vi5x1357 = vi5x8ACE9BDF.val[1];
184       const float32x4_t vi6x79BD = vextq_f32(vi6x1357, vi6x8ACE9BDF.val[1], 3);
185       vi6x1357 = vi6x8ACE9BDF.val[1];
186 
187       const float32x4x2_t vi0xGIKMHJLN = vld2q_f32(i0); i0 += 8;
188       const float32x4x2_t vi1xGIKMHJLN = vld2q_f32(i1); i1 += 8;
189       const float32x4x2_t vi2xGIKMHJLN = vld2q_f32(i2); i2 += 8;
190       const float32x4x2_t vi3xGIKMHJLN = vld2q_f32(i3); i3 += 8;
191       const float32x4x2_t vi4xGIKMHJLN = vld2q_f32(i4); i4 += 8;
192       const float32x4x2_t vi5xGIKMHJLN = vld2q_f32(i5); i5 += 8;
193       const float32x4x2_t vi6xGIKMHJLN = vld2q_f32(i6); i6 += 8;
194 
195       vo0p2 = vfmaq_lane_f32(vo0p2, vi0x79BD, vget_high_f32(vw0123), 0);
196       vo1p2 = vfmaq_lane_f32(vo1p2, vi2x79BD, vget_high_f32(vw0123), 0);
197 
198       vo0p0 = vfmaq_lane_f32(vo0p0, vi1x79BD, vget_high_f32(vw4567), 1);
199       vo1p0 = vfmaq_lane_f32(vo1p0, vi3x79BD, vget_high_f32(vw4567), 1);
200 
201       vo0p1 = vfmaq_lane_f32(vo0p1, vi2x79BD, vget_low_f32(vwCDEF), 0);
202       vo1p1 = vfmaq_lane_f32(vo1p1, vi4x79BD, vget_low_f32(vwCDEF), 0);
203 
204       vo0p2 = vfmaq_lane_f32(vo0p2, vi3x79BD, vget_low_f32(vwGHIJ), 1);
205       vo1p2 = vfmaq_lane_f32(vo1p2, vi5x79BD, vget_low_f32(vwGHIJ), 1);
206 
207       vo0p0 = vfmaq_lane_f32(vo0p0, vi4x79BD, vget_high_f32(vwKLMN), 0);
208       vo1p0 = vfmaq_lane_f32(vo1p0, vi6x79BD, vget_high_f32(vwKLMN), 0);
209 
210       const float32x4_t vi0xACEG = vextq_f32(vi0x8ACE9BDF.val[0], vi0xGIKMHJLN.val[0], 1);
211       vi0x8ACE9BDF = vi0xGIKMHJLN;
212       const float32x4_t vi1xACEG = vextq_f32(vi1x8ACE9BDF.val[0], vi1xGIKMHJLN.val[0], 1);
213       vi1x8ACE9BDF = vi1xGIKMHJLN;
214       const float32x4_t vi2xACEG = vextq_f32(vi2x8ACE9BDF.val[0], vi2xGIKMHJLN.val[0], 1);
215       vi2x8ACE9BDF = vi2xGIKMHJLN;
216       const float32x4_t vi3xACEG = vextq_f32(vi3x8ACE9BDF.val[0], vi3xGIKMHJLN.val[0], 1);
217       vi3x8ACE9BDF = vi3xGIKMHJLN;
218       const float32x4_t vi4xACEG = vextq_f32(vi4x8ACE9BDF.val[0], vi4xGIKMHJLN.val[0], 1);
219       vi4x8ACE9BDF = vi4xGIKMHJLN;
220       const float32x4_t vi5xACEG = vextq_f32(vi5x8ACE9BDF.val[0], vi5xGIKMHJLN.val[0], 1);
221       vi5x8ACE9BDF = vi5xGIKMHJLN;
222       const float32x4_t vi6xACEG = vextq_f32(vi6x8ACE9BDF.val[0], vi6xGIKMHJLN.val[0], 1);
223       vi6x8ACE9BDF = vi6xGIKMHJLN;
224 
225       vo0p1 = vfmaq_lane_f32(vo0p1, vi0xACEG, vget_low_f32(vw4567), 1);
226       vo1p1 = vfmaq_lane_f32(vo1p1, vi2xACEG, vget_low_f32(vw4567), 1);
227 
228       vo0p2 = vfmaq_lane_f32(vo0p2, vi1xACEG, vget_high_f32(vw89AB), 0);
229       vo1p2 = vfmaq_lane_f32(vo1p2, vi3xACEG, vget_high_f32(vw89AB), 0);
230 
231       vo0p0 = vfmaq_lane_f32(vo0p0, vi2xACEG, vget_high_f32(vwCDEF), 1);
232       vo1p0 = vfmaq_lane_f32(vo1p0, vi4xACEG, vget_high_f32(vwCDEF), 1);
233 
234       vo0p1 = vfmaq_lane_f32(vo0p1, vi3xACEG, vget_low_f32(vwKLMN), 0);
235       vo1p1 = vfmaq_lane_f32(vo1p1, vi5xACEG, vget_low_f32(vwKLMN), 0);
236 
237       vo0p2 = vfmaq_lane_f32(vo0p2, vi4xACEG, vwOP, 1);
238       vo1p2 = vfmaq_lane_f32(vo1p2, vi6xACEG, vwOP, 1);
239 
240       vo0p0 = vaddq_f32(vo0p0, vo0p1);
241       vo1p0 = vaddq_f32(vo1p0, vo1p1);
242       vo0p0 = vaddq_f32(vo0p0, vo0p2);
243       vo1p0 = vaddq_f32(vo1p0, vo1p2);
244 
245       float32x4_t vo0 = vmaxq_f32(vo0p0, vmin);
246       float32x4_t vo1 = vmaxq_f32(vo1p0, vmin);
247 
248       vo0 = vminq_f32(vo0, vmax);
249       vo1 = vminq_f32(vo1, vmax);
250 
251       vst1q_f32(o1, vo1); o1 += 4;
252       vst1q_f32(o0, vo0); o0 += 4;
253     }
254     // Last block has 1-8 pixels to process.
255     assert(w <= 8 * sizeof(float));
256     assert(w >= 1 * sizeof(float));
257     {
258       float32x4_t vo0p0 = vdupq_lane_f32(vget_low_f32(vw0123), 0);
259       float32x4_t vo1p0 = vdupq_lane_f32(vget_low_f32(vw0123), 0);
260 
261       const float32x4_t vi0x8ACE = vreinterpretq_f32_u32(vandq_u32(vmask_even, vreinterpretq_u32_f32(vi0x8ACE9BDF.val[0])));
262       const float32x4_t vi1x8ACE = vreinterpretq_f32_u32(vandq_u32(vmask_even, vreinterpretq_u32_f32(vi1x8ACE9BDF.val[0])));
263       const float32x4_t vi2x8ACE = vreinterpretq_f32_u32(vandq_u32(vmask_even, vreinterpretq_u32_f32(vi2x8ACE9BDF.val[0])));
264       const float32x4_t vi3x8ACE = vreinterpretq_f32_u32(vandq_u32(vmask_even, vreinterpretq_u32_f32(vi3x8ACE9BDF.val[0])));
265       const float32x4_t vi4x8ACE = vreinterpretq_f32_u32(vandq_u32(vmask_even, vreinterpretq_u32_f32(vi4x8ACE9BDF.val[0])));
266       const float32x4_t vi5x8ACE = vreinterpretq_f32_u32(vandq_u32(vmask_even, vreinterpretq_u32_f32(vi5x8ACE9BDF.val[0])));
267       const float32x4_t vi6x8ACE = vreinterpretq_f32_u32(vandq_u32(vmask_even, vreinterpretq_u32_f32(vi6x8ACE9BDF.val[0])));
268 
269       const float32x4_t vi0x9BDF = vreinterpretq_f32_u32(vandq_u32(vmask_odd, vreinterpretq_u32_f32(vi0x8ACE9BDF.val[1])));
270       const float32x4_t vi1x9BDF = vreinterpretq_f32_u32(vandq_u32(vmask_odd, vreinterpretq_u32_f32(vi1x8ACE9BDF.val[1])));
271       const float32x4_t vi2x9BDF = vreinterpretq_f32_u32(vandq_u32(vmask_odd, vreinterpretq_u32_f32(vi2x8ACE9BDF.val[1])));
272       const float32x4_t vi3x9BDF = vreinterpretq_f32_u32(vandq_u32(vmask_odd, vreinterpretq_u32_f32(vi3x8ACE9BDF.val[1])));
273       const float32x4_t vi4x9BDF = vreinterpretq_f32_u32(vandq_u32(vmask_odd, vreinterpretq_u32_f32(vi4x8ACE9BDF.val[1])));
274       const float32x4_t vi5x9BDF = vreinterpretq_f32_u32(vandq_u32(vmask_odd, vreinterpretq_u32_f32(vi5x8ACE9BDF.val[1])));
275       const float32x4_t vi6x9BDF = vreinterpretq_f32_u32(vandq_u32(vmask_odd, vreinterpretq_u32_f32(vi6x8ACE9BDF.val[1])));
276 
277       float32x4_t vo0p1 = vmulq_lane_f32(vi0x8ACE, vget_high_f32(vw0123), 1);
278       float32x4_t vo1p1 = vmulq_lane_f32(vi2x8ACE, vget_high_f32(vw0123), 1);
279 
280       float32x4_t vo0p2 = vmulq_lane_f32(vi1x8ACE, vget_low_f32(vw89AB), 0);
281       float32x4_t vo1p2 = vmulq_lane_f32(vi3x8ACE, vget_low_f32(vw89AB), 0);
282 
283       vo0p1 = vfmaq_lane_f32(vo0p1, vi2x8ACE, vget_low_f32(vwCDEF), 1);
284       vo1p1 = vfmaq_lane_f32(vo1p1, vi4x8ACE, vget_low_f32(vwCDEF), 1);
285 
286       vo0p2 = vfmaq_lane_f32(vo0p2, vi3x8ACE, vget_high_f32(vwGHIJ), 0);
287       vo1p2 = vfmaq_lane_f32(vo1p2, vi5x8ACE, vget_high_f32(vwGHIJ), 0);
288 
289       vo0p0 = vfmaq_lane_f32(vo0p0, vi4x8ACE, vget_high_f32(vwKLMN), 1);
290       vo1p0 = vfmaq_lane_f32(vo1p0, vi6x8ACE, vget_high_f32(vwKLMN), 1);
291 
292       vo0p1 = vfmaq_lane_f32(vo0p1, vi0x9BDF, vget_low_f32(vw4567), 0);
293       vo1p1 = vfmaq_lane_f32(vo1p1, vi2x9BDF, vget_low_f32(vw4567), 0);
294 
295       vo0p2 = vfmaq_lane_f32(vo0p2, vi1x9BDF, vget_low_f32(vw89AB), 1);
296       vo1p2 = vfmaq_lane_f32(vo1p2, vi3x9BDF, vget_low_f32(vw89AB), 1);
297 
298       vo0p0 = vfmaq_lane_f32(vo0p0, vi2x9BDF, vget_high_f32(vwCDEF), 0);
299       vo1p0 = vfmaq_lane_f32(vo1p0, vi4x9BDF, vget_high_f32(vwCDEF), 0);
300 
301       vo0p1 = vfmaq_lane_f32(vo0p1, vi3x9BDF, vget_high_f32(vwGHIJ), 1);
302       vo1p1 = vfmaq_lane_f32(vo1p1, vi5x9BDF, vget_high_f32(vwGHIJ), 1);
303 
304       vo0p2 = vfmaq_lane_f32(vo0p2, vi4x9BDF, vwOP, 0);
305       vo1p2 = vfmaq_lane_f32(vo1p2, vi6x9BDF, vwOP, 0);
306 
307       const float32x4_t vi0x68AC = vextq_f32(vi0x0246, vi0x8ACE, 3);
308       const float32x4_t vi1x68AC = vextq_f32(vi1x0246, vi1x8ACE, 3);
309       const float32x4_t vi2x68AC = vextq_f32(vi2x0246, vi2x8ACE, 3);
310       const float32x4_t vi3x68AC = vextq_f32(vi3x0246, vi3x8ACE, 3);
311       const float32x4_t vi4x68AC = vextq_f32(vi4x0246, vi4x8ACE, 3);
312       const float32x4_t vi5x68AC = vextq_f32(vi5x0246, vi5x8ACE, 3);
313       const float32x4_t vi6x68AC = vextq_f32(vi6x0246, vi6x8ACE, 3);
314 
315       vo0p0 = vfmaq_lane_f32(vo0p0, vi0x68AC, vget_low_f32(vw0123), 1);
316       vo1p0 = vfmaq_lane_f32(vo1p0, vi2x68AC, vget_low_f32(vw0123), 1);
317 
318       vo0p1 = vfmaq_lane_f32(vo0p1, vi1x68AC, vget_high_f32(vw4567), 0);
319       vo1p1 = vfmaq_lane_f32(vo1p1, vi3x68AC, vget_high_f32(vw4567), 0);
320 
321       vo0p2 = vfmaq_lane_f32(vo0p2, vi2x68AC, vget_high_f32(vw89AB), 1);
322       vo1p2 = vfmaq_lane_f32(vo1p2, vi4x68AC, vget_high_f32(vw89AB), 1);
323 
324       vo0p0 = vfmaq_lane_f32(vo0p0, vi3x68AC, vget_low_f32(vwGHIJ), 0);
325       vo1p0 = vfmaq_lane_f32(vo1p0, vi5x68AC, vget_low_f32(vwGHIJ), 0);
326 
327       vo0p1 = vfmaq_lane_f32(vo0p1, vi4x68AC, vget_low_f32(vwKLMN), 1);
328       vo1p1 = vfmaq_lane_f32(vo1p1, vi6x68AC, vget_low_f32(vwKLMN), 1);
329 
330       const float32x4_t vi0x79BD = vextq_f32(vi0x1357, vi0x9BDF, 3);
331       const float32x4_t vi1x79BD = vextq_f32(vi1x1357, vi1x9BDF, 3);
332       const float32x4_t vi2x79BD = vextq_f32(vi2x1357, vi2x9BDF, 3);
333       const float32x4_t vi3x79BD = vextq_f32(vi3x1357, vi3x9BDF, 3);
334       const float32x4_t vi4x79BD = vextq_f32(vi4x1357, vi4x9BDF, 3);
335       const float32x4_t vi5x79BD = vextq_f32(vi5x1357, vi5x9BDF, 3);
336       const float32x4_t vi6x79BD = vextq_f32(vi6x1357, vi6x9BDF, 3);
337 
338       vo0p2 = vfmaq_lane_f32(vo0p2, vi0x79BD, vget_high_f32(vw0123), 0);
339       vo1p2 = vfmaq_lane_f32(vo1p2, vi2x79BD, vget_high_f32(vw0123), 0);
340 
341       vo0p0 = vfmaq_lane_f32(vo0p0, vi1x79BD, vget_high_f32(vw4567), 1);
342       vo1p0 = vfmaq_lane_f32(vo1p0, vi3x79BD, vget_high_f32(vw4567), 1);
343 
344       vo0p1 = vfmaq_lane_f32(vo0p1, vi2x79BD, vget_low_f32(vwCDEF), 0);
345       vo1p1 = vfmaq_lane_f32(vo1p1, vi4x79BD, vget_low_f32(vwCDEF), 0);
346 
347       vo0p2 = vfmaq_lane_f32(vo0p2, vi3x79BD, vget_low_f32(vwGHIJ), 1);
348       vo1p2 = vfmaq_lane_f32(vo1p2, vi5x79BD, vget_low_f32(vwGHIJ), 1);
349 
350       vo0p0 = vfmaq_lane_f32(vo0p0, vi4x79BD, vget_high_f32(vwKLMN), 0);
351       vo1p0 = vfmaq_lane_f32(vo1p0, vi6x79BD, vget_high_f32(vwKLMN), 0);
352 
353       const float32x4_t vzero = vmovq_n_f32(0.0f);
354       const float32x4_t vi0xACEG = vextq_f32(vi0x8ACE, vzero, 1);
355       const float32x4_t vi1xACEG = vextq_f32(vi1x8ACE, vzero, 1);
356       const float32x4_t vi2xACEG = vextq_f32(vi2x8ACE, vzero, 1);
357       const float32x4_t vi3xACEG = vextq_f32(vi3x8ACE, vzero, 1);
358       const float32x4_t vi4xACEG = vextq_f32(vi4x8ACE, vzero, 1);
359       const float32x4_t vi5xACEG = vextq_f32(vi5x8ACE, vzero, 1);
360       const float32x4_t vi6xACEG = vextq_f32(vi6x8ACE, vzero, 1);
361 
362       vo0p1 = vfmaq_lane_f32(vo0p1, vi0xACEG, vget_low_f32(vw4567), 1);
363       vo1p1 = vfmaq_lane_f32(vo1p1, vi2xACEG, vget_low_f32(vw4567), 1);
364 
365       vo0p2 = vfmaq_lane_f32(vo0p2, vi1xACEG, vget_high_f32(vw89AB), 0);
366       vo1p2 = vfmaq_lane_f32(vo1p2, vi3xACEG, vget_high_f32(vw89AB), 0);
367 
368       vo0p0 = vfmaq_lane_f32(vo0p0, vi2xACEG, vget_high_f32(vwCDEF), 1);
369       vo1p0 = vfmaq_lane_f32(vo1p0, vi4xACEG, vget_high_f32(vwCDEF), 1);
370 
371       vo0p1 = vfmaq_lane_f32(vo0p1, vi3xACEG, vget_low_f32(vwKLMN), 0);
372       vo1p1 = vfmaq_lane_f32(vo1p1, vi5xACEG, vget_low_f32(vwKLMN), 0);
373 
374       vo0p2 = vfmaq_lane_f32(vo0p2, vi4xACEG, vwOP, 1);
375       vo1p2 = vfmaq_lane_f32(vo1p2, vi6xACEG, vwOP, 1);
376 
377       vo0p0 = vaddq_f32(vo0p0, vo0p1);
378       vo1p0 = vaddq_f32(vo1p0, vo1p1);
379       vo0p0 = vaddq_f32(vo0p0, vo0p2);
380       vo1p0 = vaddq_f32(vo1p0, vo1p2);
381 
382       float32x4_t vo0 = vmaxq_f32(vo0p0, vmin);
383       float32x4_t vo1 = vmaxq_f32(vo1p0, vmin);
384 
385       vo0 = vminq_f32(vo0, vmax);
386       vo1 = vminq_f32(vo1, vmax);
387 
388       size_t w_tmp = (w + 1 * sizeof(float)) / (2 * sizeof(float));
389       if XNN_LIKELY(w_tmp >= 4) {
390         vst1q_f32(o1, vo1); o1 += 4;
391         vst1q_f32(o0, vo0); o0 += 4;
392       } else {
393         float32x2_t vo0_lo = vget_low_f32(vo0);
394         float32x2_t vo1_lo = vget_low_f32(vo1);
395         if (w_tmp & 2) {
396           vst1_f32(o1, vo1_lo); o1 += 2;
397           vst1_f32(o0, vo0_lo); o0 += 2;
398 
399           vo0_lo = vget_high_f32(vo0);
400           vo1_lo = vget_high_f32(vo1);
401         }
402         if (w_tmp & 1) {
403           vst1_lane_f32(o1, vo1_lo, 0); o1 += 1;
404           vst1_lane_f32(o0, vo0_lo, 0); o0 += 1;
405         }
406       }
407     }
408 
409     i0 = (const float*) ((uintptr_t) i4 - input_decrement);
410     i1 = (const float*) ((uintptr_t) i5 - input_decrement);
411     i2 = (const float*) ((uintptr_t) i6 - input_decrement);
412     i3 = (const float*) ((uintptr_t) i2 + input_width);
413     i4 = (const float*) ((uintptr_t) i3 + input_width);
414     i5 = (const float*) ((uintptr_t) i4 + input_width);
415     i6 = (const float*) ((uintptr_t) i5 + input_width);
416 
417     o0 = o1;
418     o1 = (float*) ((uintptr_t) o0 + output_width);
419 
420     output_height = doz(output_height, 2);
421     padded_input_height = doz(padded_input_height, 4);
422   } while (output_height != 0);
423 }
424