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__neon_2x4_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)])18 void xnn_f32_dwconv2d_chw_ukernel_5x5s2p2__neon_2x4_acc2(
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(¶ms->neon.max);
37 const float32x4_t vmin = vld1q_dup_f32(¶ms->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 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x8ACE9BDF.val[0], vget_low_f32(vw89AB), 0);
116 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x8ACE9BDF.val[0], vget_low_f32(vw89AB), 0);
117
118 vo0p0 = vmlaq_lane_f32(vo0p0, vi2x8ACE9BDF.val[0], vget_low_f32(vwCDEF), 1);
119 vo1p0 = vmlaq_lane_f32(vo1p0, vi4x8ACE9BDF.val[0], vget_low_f32(vwCDEF), 1);
120
121 vo0p1 = vmlaq_lane_f32(vo0p1, vi3x8ACE9BDF.val[0], vget_high_f32(vwGHIJ), 0);
122 vo1p1 = vmlaq_lane_f32(vo1p1, vi5x8ACE9BDF.val[0], vget_high_f32(vwGHIJ), 0);
123
124 vo0p0 = vmlaq_lane_f32(vo0p0, vi4x8ACE9BDF.val[0], vget_high_f32(vwKLMN), 1);
125 vo1p0 = vmlaq_lane_f32(vo1p0, vi6x8ACE9BDF.val[0], vget_high_f32(vwKLMN), 1);
126
127 vo0p1 = vmlaq_lane_f32(vo0p1, vi0x8ACE9BDF.val[1], vget_low_f32(vw4567), 0);
128 vo1p1 = vmlaq_lane_f32(vo1p1, vi2x8ACE9BDF.val[1], vget_low_f32(vw4567), 0);
129
130 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x8ACE9BDF.val[1], vget_low_f32(vw89AB), 1);
131 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x8ACE9BDF.val[1], vget_low_f32(vw89AB), 1);
132
133 vo0p1 = vmlaq_lane_f32(vo0p1, vi2x8ACE9BDF.val[1], vget_high_f32(vwCDEF), 0);
134 vo1p1 = vmlaq_lane_f32(vo1p1, vi4x8ACE9BDF.val[1], vget_high_f32(vwCDEF), 0);
135
136 vo0p0 = vmlaq_lane_f32(vo0p0, vi3x8ACE9BDF.val[1], vget_high_f32(vwGHIJ), 1);
137 vo1p0 = vmlaq_lane_f32(vo1p0, vi5x8ACE9BDF.val[1], vget_high_f32(vwGHIJ), 1);
138
139 vo0p1 = vmlaq_lane_f32(vo0p1, vi4x8ACE9BDF.val[1], vwOP, 0);
140 vo1p1 = vmlaq_lane_f32(vo1p1, 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 = vmlaq_lane_f32(vo0p0, vi0x68AC, vget_low_f32(vw0123), 1);
158 vo1p0 = vmlaq_lane_f32(vo1p0, vi2x68AC, vget_low_f32(vw0123), 1);
159
160 vo0p1 = vmlaq_lane_f32(vo0p1, vi1x68AC, vget_high_f32(vw4567), 0);
161 vo1p1 = vmlaq_lane_f32(vo1p1, vi3x68AC, vget_high_f32(vw4567), 0);
162
163 vo0p0 = vmlaq_lane_f32(vo0p0, vi2x68AC, vget_high_f32(vw89AB), 1);
164 vo1p0 = vmlaq_lane_f32(vo1p0, vi4x68AC, vget_high_f32(vw89AB), 1);
165
166 vo0p1 = vmlaq_lane_f32(vo0p1, vi3x68AC, vget_low_f32(vwGHIJ), 0);
167 vo1p1 = vmlaq_lane_f32(vo1p1, vi5x68AC, vget_low_f32(vwGHIJ), 0);
168
169 vo0p0 = vmlaq_lane_f32(vo0p0, vi4x68AC, vget_low_f32(vwKLMN), 1);
170 vo1p0 = vmlaq_lane_f32(vo1p0, 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 vo0p1 = vmlaq_lane_f32(vo0p1, vi0x79BD, vget_high_f32(vw0123), 0);
196 vo1p1 = vmlaq_lane_f32(vo1p1, vi2x79BD, vget_high_f32(vw0123), 0);
197
198 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x79BD, vget_high_f32(vw4567), 1);
199 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x79BD, vget_high_f32(vw4567), 1);
200
201 vo0p1 = vmlaq_lane_f32(vo0p1, vi2x79BD, vget_low_f32(vwCDEF), 0);
202 vo1p1 = vmlaq_lane_f32(vo1p1, vi4x79BD, vget_low_f32(vwCDEF), 0);
203
204 vo0p0 = vmlaq_lane_f32(vo0p0, vi3x79BD, vget_low_f32(vwGHIJ), 1);
205 vo1p0 = vmlaq_lane_f32(vo1p0, vi5x79BD, vget_low_f32(vwGHIJ), 1);
206
207 vo0p1 = vmlaq_lane_f32(vo0p1, vi4x79BD, vget_high_f32(vwKLMN), 0);
208 vo1p1 = vmlaq_lane_f32(vo1p1, 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 vo0p0 = vmlaq_lane_f32(vo0p0, vi0xACEG, vget_low_f32(vw4567), 1);
226 vo1p0 = vmlaq_lane_f32(vo1p0, vi2xACEG, vget_low_f32(vw4567), 1);
227
228 vo0p1 = vmlaq_lane_f32(vo0p1, vi1xACEG, vget_high_f32(vw89AB), 0);
229 vo1p1 = vmlaq_lane_f32(vo1p1, vi3xACEG, vget_high_f32(vw89AB), 0);
230
231 vo0p0 = vmlaq_lane_f32(vo0p0, vi2xACEG, vget_high_f32(vwCDEF), 1);
232 vo1p0 = vmlaq_lane_f32(vo1p0, vi4xACEG, vget_high_f32(vwCDEF), 1);
233
234 vo0p1 = vmlaq_lane_f32(vo0p1, vi3xACEG, vget_low_f32(vwKLMN), 0);
235 vo1p1 = vmlaq_lane_f32(vo1p1, vi5xACEG, vget_low_f32(vwKLMN), 0);
236
237 vo0p0 = vmlaq_lane_f32(vo0p0, vi4xACEG, vwOP, 1);
238 vo1p0 = vmlaq_lane_f32(vo1p0, vi6xACEG, vwOP, 1);
239
240 vo0p0 = vaddq_f32(vo0p0, vo0p1);
241 vo1p0 = vaddq_f32(vo1p0, vo1p1);
242
243 float32x4_t vo0 = vmaxq_f32(vo0p0, vmin);
244 float32x4_t vo1 = vmaxq_f32(vo1p0, vmin);
245
246 vo0 = vminq_f32(vo0, vmax);
247 vo1 = vminq_f32(vo1, vmax);
248
249 vst1q_f32(o1, vo1); o1 += 4;
250 vst1q_f32(o0, vo0); o0 += 4;
251 }
252 // Last block has 1-8 pixels to process.
253 assert(w <= 8 * sizeof(float));
254 assert(w >= 1 * sizeof(float));
255 {
256 float32x4_t vo0p0 = vdupq_lane_f32(vget_low_f32(vw0123), 0);
257 float32x4_t vo1p0 = vdupq_lane_f32(vget_low_f32(vw0123), 0);
258
259 const float32x4_t vi0x8ACE = vreinterpretq_f32_u32(vandq_u32(vmask_even, vreinterpretq_u32_f32(vi0x8ACE9BDF.val[0])));
260 const float32x4_t vi1x8ACE = vreinterpretq_f32_u32(vandq_u32(vmask_even, vreinterpretq_u32_f32(vi1x8ACE9BDF.val[0])));
261 const float32x4_t vi2x8ACE = vreinterpretq_f32_u32(vandq_u32(vmask_even, vreinterpretq_u32_f32(vi2x8ACE9BDF.val[0])));
262 const float32x4_t vi3x8ACE = vreinterpretq_f32_u32(vandq_u32(vmask_even, vreinterpretq_u32_f32(vi3x8ACE9BDF.val[0])));
263 const float32x4_t vi4x8ACE = vreinterpretq_f32_u32(vandq_u32(vmask_even, vreinterpretq_u32_f32(vi4x8ACE9BDF.val[0])));
264 const float32x4_t vi5x8ACE = vreinterpretq_f32_u32(vandq_u32(vmask_even, vreinterpretq_u32_f32(vi5x8ACE9BDF.val[0])));
265 const float32x4_t vi6x8ACE = vreinterpretq_f32_u32(vandq_u32(vmask_even, vreinterpretq_u32_f32(vi6x8ACE9BDF.val[0])));
266
267 const float32x4_t vi0x9BDF = vreinterpretq_f32_u32(vandq_u32(vmask_odd, vreinterpretq_u32_f32(vi0x8ACE9BDF.val[1])));
268 const float32x4_t vi1x9BDF = vreinterpretq_f32_u32(vandq_u32(vmask_odd, vreinterpretq_u32_f32(vi1x8ACE9BDF.val[1])));
269 const float32x4_t vi2x9BDF = vreinterpretq_f32_u32(vandq_u32(vmask_odd, vreinterpretq_u32_f32(vi2x8ACE9BDF.val[1])));
270 const float32x4_t vi3x9BDF = vreinterpretq_f32_u32(vandq_u32(vmask_odd, vreinterpretq_u32_f32(vi3x8ACE9BDF.val[1])));
271 const float32x4_t vi4x9BDF = vreinterpretq_f32_u32(vandq_u32(vmask_odd, vreinterpretq_u32_f32(vi4x8ACE9BDF.val[1])));
272 const float32x4_t vi5x9BDF = vreinterpretq_f32_u32(vandq_u32(vmask_odd, vreinterpretq_u32_f32(vi5x8ACE9BDF.val[1])));
273 const float32x4_t vi6x9BDF = vreinterpretq_f32_u32(vandq_u32(vmask_odd, vreinterpretq_u32_f32(vi6x8ACE9BDF.val[1])));
274
275 float32x4_t vo0p1 = vmulq_lane_f32(vi0x8ACE, vget_high_f32(vw0123), 1);
276 float32x4_t vo1p1 = vmulq_lane_f32(vi2x8ACE, vget_high_f32(vw0123), 1);
277
278 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x8ACE, vget_low_f32(vw89AB), 0);
279 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x8ACE, vget_low_f32(vw89AB), 0);
280
281 vo0p0 = vmlaq_lane_f32(vo0p0, vi2x8ACE, vget_low_f32(vwCDEF), 1);
282 vo1p0 = vmlaq_lane_f32(vo1p0, vi4x8ACE, vget_low_f32(vwCDEF), 1);
283
284 vo0p1 = vmlaq_lane_f32(vo0p1, vi3x8ACE, vget_high_f32(vwGHIJ), 0);
285 vo1p1 = vmlaq_lane_f32(vo1p1, vi5x8ACE, vget_high_f32(vwGHIJ), 0);
286
287 vo0p0 = vmlaq_lane_f32(vo0p0, vi4x8ACE, vget_high_f32(vwKLMN), 1);
288 vo1p0 = vmlaq_lane_f32(vo1p0, vi6x8ACE, vget_high_f32(vwKLMN), 1);
289
290 vo0p1 = vmlaq_lane_f32(vo0p1, vi0x9BDF, vget_low_f32(vw4567), 0);
291 vo1p1 = vmlaq_lane_f32(vo1p1, vi2x9BDF, vget_low_f32(vw4567), 0);
292
293 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x9BDF, vget_low_f32(vw89AB), 1);
294 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x9BDF, vget_low_f32(vw89AB), 1);
295
296 vo0p1 = vmlaq_lane_f32(vo0p1, vi2x9BDF, vget_high_f32(vwCDEF), 0);
297 vo1p1 = vmlaq_lane_f32(vo1p1, vi4x9BDF, vget_high_f32(vwCDEF), 0);
298
299 vo0p0 = vmlaq_lane_f32(vo0p0, vi3x9BDF, vget_high_f32(vwGHIJ), 1);
300 vo1p0 = vmlaq_lane_f32(vo1p0, vi5x9BDF, vget_high_f32(vwGHIJ), 1);
301
302 vo0p1 = vmlaq_lane_f32(vo0p1, vi4x9BDF, vwOP, 0);
303 vo1p1 = vmlaq_lane_f32(vo1p1, vi6x9BDF, vwOP, 0);
304
305 const float32x4_t vi0x68AC = vextq_f32(vi0x0246, vi0x8ACE, 3);
306 const float32x4_t vi1x68AC = vextq_f32(vi1x0246, vi1x8ACE, 3);
307 const float32x4_t vi2x68AC = vextq_f32(vi2x0246, vi2x8ACE, 3);
308 const float32x4_t vi3x68AC = vextq_f32(vi3x0246, vi3x8ACE, 3);
309 const float32x4_t vi4x68AC = vextq_f32(vi4x0246, vi4x8ACE, 3);
310 const float32x4_t vi5x68AC = vextq_f32(vi5x0246, vi5x8ACE, 3);
311 const float32x4_t vi6x68AC = vextq_f32(vi6x0246, vi6x8ACE, 3);
312
313 vo0p0 = vmlaq_lane_f32(vo0p0, vi0x68AC, vget_low_f32(vw0123), 1);
314 vo1p0 = vmlaq_lane_f32(vo1p0, vi2x68AC, vget_low_f32(vw0123), 1);
315
316 vo0p1 = vmlaq_lane_f32(vo0p1, vi1x68AC, vget_high_f32(vw4567), 0);
317 vo1p1 = vmlaq_lane_f32(vo1p1, vi3x68AC, vget_high_f32(vw4567), 0);
318
319 vo0p0 = vmlaq_lane_f32(vo0p0, vi2x68AC, vget_high_f32(vw89AB), 1);
320 vo1p0 = vmlaq_lane_f32(vo1p0, vi4x68AC, vget_high_f32(vw89AB), 1);
321
322 vo0p1 = vmlaq_lane_f32(vo0p1, vi3x68AC, vget_low_f32(vwGHIJ), 0);
323 vo1p1 = vmlaq_lane_f32(vo1p1, vi5x68AC, vget_low_f32(vwGHIJ), 0);
324
325 vo0p0 = vmlaq_lane_f32(vo0p0, vi4x68AC, vget_low_f32(vwKLMN), 1);
326 vo1p0 = vmlaq_lane_f32(vo1p0, vi6x68AC, vget_low_f32(vwKLMN), 1);
327
328 const float32x4_t vi0x79BD = vextq_f32(vi0x1357, vi0x9BDF, 3);
329 const float32x4_t vi1x79BD = vextq_f32(vi1x1357, vi1x9BDF, 3);
330 const float32x4_t vi2x79BD = vextq_f32(vi2x1357, vi2x9BDF, 3);
331 const float32x4_t vi3x79BD = vextq_f32(vi3x1357, vi3x9BDF, 3);
332 const float32x4_t vi4x79BD = vextq_f32(vi4x1357, vi4x9BDF, 3);
333 const float32x4_t vi5x79BD = vextq_f32(vi5x1357, vi5x9BDF, 3);
334 const float32x4_t vi6x79BD = vextq_f32(vi6x1357, vi6x9BDF, 3);
335
336 vo0p1 = vmlaq_lane_f32(vo0p1, vi0x79BD, vget_high_f32(vw0123), 0);
337 vo1p1 = vmlaq_lane_f32(vo1p1, vi2x79BD, vget_high_f32(vw0123), 0);
338
339 vo0p0 = vmlaq_lane_f32(vo0p0, vi1x79BD, vget_high_f32(vw4567), 1);
340 vo1p0 = vmlaq_lane_f32(vo1p0, vi3x79BD, vget_high_f32(vw4567), 1);
341
342 vo0p1 = vmlaq_lane_f32(vo0p1, vi2x79BD, vget_low_f32(vwCDEF), 0);
343 vo1p1 = vmlaq_lane_f32(vo1p1, vi4x79BD, vget_low_f32(vwCDEF), 0);
344
345 vo0p0 = vmlaq_lane_f32(vo0p0, vi3x79BD, vget_low_f32(vwGHIJ), 1);
346 vo1p0 = vmlaq_lane_f32(vo1p0, vi5x79BD, vget_low_f32(vwGHIJ), 1);
347
348 vo0p1 = vmlaq_lane_f32(vo0p1, vi4x79BD, vget_high_f32(vwKLMN), 0);
349 vo1p1 = vmlaq_lane_f32(vo1p1, vi6x79BD, vget_high_f32(vwKLMN), 0);
350
351 const float32x4_t vzero = vmovq_n_f32(0.0f);
352 const float32x4_t vi0xACEG = vextq_f32(vi0x8ACE, vzero, 1);
353 const float32x4_t vi1xACEG = vextq_f32(vi1x8ACE, vzero, 1);
354 const float32x4_t vi2xACEG = vextq_f32(vi2x8ACE, vzero, 1);
355 const float32x4_t vi3xACEG = vextq_f32(vi3x8ACE, vzero, 1);
356 const float32x4_t vi4xACEG = vextq_f32(vi4x8ACE, vzero, 1);
357 const float32x4_t vi5xACEG = vextq_f32(vi5x8ACE, vzero, 1);
358 const float32x4_t vi6xACEG = vextq_f32(vi6x8ACE, vzero, 1);
359
360 vo0p0 = vmlaq_lane_f32(vo0p0, vi0xACEG, vget_low_f32(vw4567), 1);
361 vo1p0 = vmlaq_lane_f32(vo1p0, vi2xACEG, vget_low_f32(vw4567), 1);
362
363 vo0p1 = vmlaq_lane_f32(vo0p1, vi1xACEG, vget_high_f32(vw89AB), 0);
364 vo1p1 = vmlaq_lane_f32(vo1p1, vi3xACEG, vget_high_f32(vw89AB), 0);
365
366 vo0p0 = vmlaq_lane_f32(vo0p0, vi2xACEG, vget_high_f32(vwCDEF), 1);
367 vo1p0 = vmlaq_lane_f32(vo1p0, vi4xACEG, vget_high_f32(vwCDEF), 1);
368
369 vo0p1 = vmlaq_lane_f32(vo0p1, vi3xACEG, vget_low_f32(vwKLMN), 0);
370 vo1p1 = vmlaq_lane_f32(vo1p1, vi5xACEG, vget_low_f32(vwKLMN), 0);
371
372 vo0p0 = vmlaq_lane_f32(vo0p0, vi4xACEG, vwOP, 1);
373 vo1p0 = vmlaq_lane_f32(vo1p0, vi6xACEG, vwOP, 1);
374
375 vo0p0 = vaddq_f32(vo0p0, vo0p1);
376 vo1p0 = vaddq_f32(vo1p0, vo1p1);
377
378 float32x4_t vo0 = vmaxq_f32(vo0p0, vmin);
379 float32x4_t vo1 = vmaxq_f32(vo1p0, vmin);
380
381 vo0 = vminq_f32(vo0, vmax);
382 vo1 = vminq_f32(vo1, vmax);
383
384 size_t w_tmp = (w + 1 * sizeof(float)) / (2 * sizeof(float));
385 if XNN_LIKELY(w_tmp >= 4) {
386 vst1q_f32(o1, vo1); o1 += 4;
387 vst1q_f32(o0, vo0); o0 += 4;
388 } else {
389 float32x2_t vo0_lo = vget_low_f32(vo0);
390 float32x2_t vo1_lo = vget_low_f32(vo1);
391 if (w_tmp & 2) {
392 vst1_f32(o1, vo1_lo); o1 += 2;
393 vst1_f32(o0, vo0_lo); o0 += 2;
394
395 vo0_lo = vget_high_f32(vo0);
396 vo1_lo = vget_high_f32(vo1);
397 }
398 if (w_tmp & 1) {
399 vst1_lane_f32(o1, vo1_lo, 0); o1 += 1;
400 vst1_lane_f32(o0, vo0_lo, 0); o0 += 1;
401 }
402 }
403 }
404
405 i0 = (const float*) ((uintptr_t) i4 - input_decrement);
406 i1 = (const float*) ((uintptr_t) i5 - input_decrement);
407 i2 = (const float*) ((uintptr_t) i6 - input_decrement);
408 i3 = (const float*) ((uintptr_t) i2 + input_width);
409 i4 = (const float*) ((uintptr_t) i3 + input_width);
410 i5 = (const float*) ((uintptr_t) i4 + input_width);
411 i6 = (const float*) ((uintptr_t) i5 + input_width);
412
413 o0 = o1;
414 o1 = (float*) ((uintptr_t) o0 + output_width);
415
416 output_height = doz(output_height, 2);
417 padded_input_height = doz(padded_input_height, 4);
418 } while (output_height != 0);
419 }
420