Debian Codegraph @

src/f32-rminmax/gen/f32-rminmax-neon-u12-acc3.c

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/f32-rminmax/neon.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2023 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/common.h"
15 #include "xnnpack/reduce.h"
16
17
18 void xnn_f32_rminmax_ukernel__neon_u12_acc3(
19 size_t batch,
20 const float* input,
21 float* output,
22 const struct xnn_f32_default_params params[restrict XNN_MIN_ELEMENTS(1)])
23 {
24 assert(batch != 0);
25 assert(batch % sizeof(float) == 0);
26 assert(input != NULL);
27 assert(output != NULL);
28
29 float32x4_t vmin0 = vld1q_dup_f32(input);
30 float32x4_t vmax0 = vmin0;
31 float32x4_t vmin1 = vmin0;
32 float32x4_t vmax1 = vmax0;
33 float32x4_t vmin2 = vmin0;
34 float32x4_t vmax2 = vmax0;
35 for (; batch >= 12 * sizeof(float); batch -= 12 * sizeof(float)) {
36 const float32x4_t vt0 = vld1q_f32(input); input += 4;
37 const float32x4_t vt1 = vld1q_f32(input); input += 4;
38 const float32x4_t vt2 = vld1q_f32(input); input += 4;
39
40 vmin0 = vminq_f32(vmin0, vt0);
41 vmax0 = vmaxq_f32(vmax0, vt0);
42 vmin1 = vminq_f32(vmin1, vt1);
43 vmax1 = vmaxq_f32(vmax1, vt1);
44 vmin2 = vminq_f32(vmin2, vt2);
45 vmax2 = vmaxq_f32(vmax2, vt2);
46 }
47 vmin0 = vminq_f32(vmin0, vmin1);
48 vmax0 = vmaxq_f32(vmax0, vmax1);
49 vmin0 = vminq_f32(vmin0, vmin2);
50 vmax0 = vmaxq_f32(vmax0, vmax2);
51 for (; batch >= 4 * sizeof(float); batch -= 4 * sizeof(float)) {
52 const float32x4_t vt = vld1q_f32(input); input += 4;
53 vmin0 = vminq_f32(vmin0, vt);
54 vmax0 = vmaxq_f32(vmax0, vt);
55 }
56 float32x2_t vmin = vmin_f32(vget_low_f32(vmin0), vget_high_f32(vmin0));
57 float32x2_t vmax = vmax_f32(vget_low_f32(vmax0), vget_high_f32(vmax0));
58 if XNN_UNLIKELY(batch & (2 * sizeof(float))) {
59 const float32x2_t vt = vld1_f32(input); input += 2;
60 vmin = vmin_f32(vmin, vt);
61 vmax = vmax_f32(vmax, vt);
62 }
63 vmin = vpmin_f32(vmin, vmin);
64 vmax = vpmax_f32(vmax, vmax);
65 if XNN_UNLIKELY(batch & (1 * sizeof(float))) {
66 const float32x2_t vt = vld1_dup_f32(input);
67 vmin = vmin_f32(vmin, vt);
68 vmax = vmax_f32(vmax, vt);
69 }
70 vst1_lane_f32(output, vmin, 0);
71 vst1_lane_f32(output + 1, vmax, 0);
72 }