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