Debian Codegraph @

src/f16-vrnd/gen/f16-vrndd-neonfp16arith-u8.c

raw symbols SCIP
1 // Auto-generated file. Do not edit!
2 // Template: src/f16-vrnd/neonfp16arith.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2022 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/math.h"
16 #include "xnnpack/vunary.h"
17
18
19 void xnn_f16_vrndd_ukernel__neonfp16arith_u8(
20 size_t batch,
21 const xnn_float16* input,
22 xnn_float16* output,
23 const struct xnn_f16_default_params params[restrict XNN_MIN_ELEMENTS(1)]) XNN_OOB_READS
24 {
25 assert(batch != 0);
26 assert(batch % sizeof(uint16_t) == 0);
27 assert(input != NULL);
28 assert(output != NULL);
29
30 const uint16_t* i = (const uint16_t*) input;
31 uint16_t* o = (uint16_t*) output;
32 for (; batch >= 8 * sizeof(uint16_t); batch -= 8 * sizeof(uint16_t)) {
33 float16x8_t vacc = vreinterpretq_f16_u16(vld1q_u16(i)); i += 8;
34 vacc = vrndmq_f16(vacc);
35 vst1q_u16(o, vreinterpretq_u16_f16(vacc)); o += 8;
36 }
37 if XNN_UNLIKELY(batch != 0) {
38 float16x8_t vacc = vreinterpretq_f16_u16(vld1q_u16(i));
39 vacc = vrndmq_f16(vacc);
40 float16x4_t vacc_lo = vget_low_f16(vacc);
41 if (batch & (4 * sizeof(uint16_t))) {
42 vst1_u16(o, vreinterpret_u16_f16(vacc_lo)); o += 4;
43 vacc_lo = vget_high_f16(vacc);
44 }
45 if (batch & (2 * sizeof(uint16_t))) {
46 vst1_lane_u32((void*) o, vreinterpret_u32_f16(vacc_lo), 0); o += 2;
47 vacc_lo = vext_f16(vacc_lo, vacc_lo, 2);
48 }
49 if (batch & (1 * sizeof(uint16_t))) {
50 vst1_lane_u16(o, vreinterpret_u16_f16(vacc_lo), 0);
51 }
52 }
53 }