Debian Codegraph @

src/f16-rsum/gen/f16-rsum-neonfp16arith-u24-acc3.c

raw symbols SCIP
1 // Auto-generated file. Do not edit!
2 // Template: src/f16-rsum/neonfp16arith.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_f16_rsum_ukernel__neonfp16arith_u24_acc3(
19 size_t batch,
20 const xnn_float16* input,
21 xnn_float16* output,
22 const struct xnn_f16_scale_params params[restrict XNN_MIN_ELEMENTS(1)])
23 {
24 assert(batch != 0);
25 assert(batch % sizeof(uint16_t) == 0);
26 assert(input != NULL);
27 assert(output != NULL);
28
29 const uint16_t* i = (const uint16_t*) input;
30 uint16_t* o = (uint16_t*) output;
31 float16x8_t vacc0 = vreinterpretq_f16_u16(vmovq_n_u16(0));
32 float16x8_t vacc1 = vreinterpretq_f16_u16(vmovq_n_u16(0));
33 float16x8_t vacc2 = vreinterpretq_f16_u16(vmovq_n_u16(0));
34 for (; batch >= 24 * sizeof(uint16_t); batch -= 24 * sizeof(uint16_t)) {
35 const float16x8_t vt0 = vreinterpretq_f16_u16(vld1q_u16(i)); i += 8;
36 const float16x8_t vt1 = vreinterpretq_f16_u16(vld1q_u16(i)); i += 8;
37 const float16x8_t vt2 = vreinterpretq_f16_u16(vld1q_u16(i)); i += 8;
38
39 vacc0 = vaddq_f16(vacc0, vt0);
40 vacc1 = vaddq_f16(vacc1, vt1);
41 vacc2 = vaddq_f16(vacc2, vt2);
42 }
43 vacc0 = vaddq_f16(vacc0, vacc1);
44 vacc0 = vaddq_f16(vacc0, vacc2);
45 for (; batch >= 8 * sizeof(uint16_t); batch -= 8 * sizeof(uint16_t)) {
46 const float16x8_t vt = vreinterpretq_f16_u16(vld1q_u16(i)); i += 8;
47 vacc0 = vaddq_f16(vacc0, vt);
48 }
49 const float16x4_t vscale = vreinterpret_f16_u16(vld1_dup_u16(&params->scalar.scale));
50 float16x4_t vacc = vadd_f16(vget_low_f16(vacc0), vget_high_f16(vacc0));
51 if XNN_UNLIKELY(batch & (4 * sizeof(uint16_t))) {
52 const float16x4_t vt = vreinterpret_f16_u16(vld1_u16(i)); i += 4;
53 vacc = vadd_f16(vacc, vt);
54 }
55 vacc = vpadd_f16(vacc, vacc);
56 if XNN_UNLIKELY(batch & (2 * sizeof(uint16_t))) {
57 const float16x4_t vt = vreinterpret_f16_u32(vld1_dup_u32((const void*) i)); i += 2;
58 vacc = vadd_f16(vacc, vt);
59 }
60 vacc = vpadd_f16(vacc, vacc);
61 if XNN_UNLIKELY(batch & (1 * sizeof(uint16_t))) {
62 const float16x4_t vt = vreinterpret_f16_u16(vld1_dup_u16(i));
63 vacc = vadd_f16(vacc, vt);
64 }
65 vacc = vmul_f16(vacc, vscale);
66 vst1_lane_u16(o, vreinterpret_u16_f16(vacc), 0);
67 }