Debian Codegraph @

src/f32-rsum/gen/f32-rsum-neon-u16-acc4.c

raw symbols SCIP
1 // Auto-generated file. Do not edit!
2 // Template: src/f32-rsum/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_rsum_ukernel__neon_u16_acc4(
19 size_t batch,
20 const float* input,
21 float* output,
22 const struct xnn_f32_scale_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 vacc0 = vmovq_n_f32(0.0f);
30 float32x4_t vacc1 = vmovq_n_f32(0.0f);
31 float32x4_t vacc2 = vmovq_n_f32(0.0f);
32 float32x4_t vacc3 = vmovq_n_f32(0.0f);
33 for (; batch >= 16 * sizeof(float); batch -= 16 * sizeof(float)) {
34 const float32x4_t vt0 = vld1q_f32(input); input += 4;
35 const float32x4_t vt1 = vld1q_f32(input); input += 4;
36 const float32x4_t vt2 = vld1q_f32(input); input += 4;
37 const float32x4_t vt3 = vld1q_f32(input); input += 4;
38
39 vacc0 = vaddq_f32(vacc0, vt0);
40 vacc1 = vaddq_f32(vacc1, vt1);
41 vacc2 = vaddq_f32(vacc2, vt2);
42 vacc3 = vaddq_f32(vacc3, vt3);
43 }
44 vacc0 = vaddq_f32(vacc0, vacc1);
45 vacc2 = vaddq_f32(vacc2, vacc3);
46 vacc0 = vaddq_f32(vacc0, vacc2);
47 for (; batch >= 4 * sizeof(float); batch -= 4 * sizeof(float)) {
48 const float32x4_t vt = vld1q_f32(input); input += 4;
49 vacc0 = vaddq_f32(vacc0, vt);
50 }
51 const float32x2_t vscale = vld1_dup_f32(&params->scalar.scale);
52 float32x2_t vacc = vadd_f32(vget_low_f32(vacc0), vget_high_f32(vacc0));
53 if XNN_UNLIKELY(batch & (2 * sizeof(float))) {
54 const float32x2_t vt = vld1_f32(input); input += 2;
55 vacc = vadd_f32(vacc, vt);
56 }
57 vacc = vpadd_f32(vacc, vacc);
58 if XNN_UNLIKELY(batch & (1 * sizeof(float))) {
59 const float32x2_t vt = vld1_dup_f32(input);
60 vacc = vadd_f32(vacc, vt);
61 }
62 vacc = vmul_f32(vacc, vscale);
63 *output += vget_lane_f32(vacc, 0);
64 }