Debian Codegraph @

src/f16-rminmax/gen/f16-rmin-neonfp16arith-u64.c

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/f16-rminmax/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_rmin_ukernel__neonfp16arith_u64(
19 size_t batch,
20 const void* input,
21 void* output,
22 const struct xnn_f16_default_params params[restrict XNN_MIN_ELEMENTS(1)]) XNN_OOB_READS
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 vmin0 = vreinterpretq_f16_u16(vld1q_dup_u16(i));
32 for (; batch >= 64 * sizeof(uint16_t); batch -= 64 * sizeof(uint16_t)) {
33 const float16x8_t vt0 = vreinterpretq_f16_u16(vld1q_u16(i)); i += 8;
34 const float16x8_t vt1 = vreinterpretq_f16_u16(vld1q_u16(i)); i += 8;
35 const float16x8_t vt2 = vreinterpretq_f16_u16(vld1q_u16(i)); i += 8;
36 const float16x8_t vt3 = vreinterpretq_f16_u16(vld1q_u16(i)); i += 8;
37 const float16x8_t vt4 = vreinterpretq_f16_u16(vld1q_u16(i)); i += 8;
38 const float16x8_t vt5 = vreinterpretq_f16_u16(vld1q_u16(i)); i += 8;
39 const float16x8_t vt6 = vreinterpretq_f16_u16(vld1q_u16(i)); i += 8;
40 const float16x8_t vt7 = vreinterpretq_f16_u16(vld1q_u16(i)); i += 8;
41
42 vmin0 = vminq_f16(vmin0, vt0);
43 vmin0 = vminq_f16(vmin0, vt1);
44 vmin0 = vminq_f16(vmin0, vt2);
45 vmin0 = vminq_f16(vmin0, vt3);
46 vmin0 = vminq_f16(vmin0, vt4);
47 vmin0 = vminq_f16(vmin0, vt5);
48 vmin0 = vminq_f16(vmin0, vt6);
49 vmin0 = vminq_f16(vmin0, vt7);
50 }
51 for (; batch >= 8 * sizeof(uint16_t); batch -= 8 * sizeof(uint16_t)) {
52 const float16x8_t vt = vreinterpretq_f16_u16(vld1q_u16(i)); i += 8;
53 vmin0 = vminq_f16(vmin0, vt);
54 }
55 float16x4_t vmin_lo = vmin_f16(vget_low_f16(vmin0), vget_high_f16(vmin0));
56
57 if (XNN_UNLIKELY(batch != 0)) {
58 const float16x8_t vt = vreinterpretq_f16_u16(vld1q_u16(i));
59 float16x4_t vt_lo = vget_low_f16(vt);
60 if (batch & (4 * sizeof(uint16_t))) {
61 vmin_lo = vmin_f16(vmin_lo, vt_lo);
62 vt_lo = vget_high_f16(vt);
63 }
64 if (batch & (2 * sizeof(uint16_t))) {
65 vmin_lo = vmin_f16(vmin_lo, vext_f16(vmin_lo, vt_lo, 2));
66 vt_lo = vext_f16(vt_lo, vt_lo, 2);
67 }
68 if (batch & (1 * sizeof(uint16_t))) {
69 vmin_lo = vmin_f16(vmin_lo, vext_f16(vmin_lo, vt_lo, 1));
70 }
71 }
72 #if XNN_ARCH_ARM64 && defined(__GNUC__)
73 *((__fp16*) o) = vminv_f16(vmin_lo);
74 #else
75 vmin_lo = vpmin_f16(vmin_lo, vmin_lo);
76 vmin_lo = vpmin_f16(vmin_lo, vmin_lo);
77 vst1_lane_u16(o, vreinterpret_u16_f16(vmin_lo), 0);
78 #endif
79 }