Debian Codegraph @

src/f16-rminmax/gen/f16-rmax-scalar-u2-acc2.c

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/f16-rminmax/scalar.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 "xnnpack/common.h"
13 #include "xnnpack/math.h"
14 #include "xnnpack/reduce.h"
15
16
17 void xnn_f16_rmax_ukernel__scalar_u2_acc2(
18 size_t batch,
19 const xnn_float16* input,
20 xnn_float16* output,
21 const struct xnn_f16_default_params params[restrict XNN_MIN_ELEMENTS(1)])
22 {
23 assert(batch != 0);
24 assert(batch % sizeof(uint16_t) == 0);
25 assert(input != NULL);
26 assert(output != NULL);
27
28 const uint16_t* i = (const uint16_t*) input;
29 uint16_t* o = (uint16_t*) output;
30
31 int16_t vt = math_signcomplement_f16(*i);
32 int16_t vmax0 = vt;
33 int16_t vmax1 = vt;
34 for (; batch >= 2 * sizeof(uint16_t); batch -= 2 * sizeof(uint16_t)) {
35 const int16_t vt0 = math_signcomplement_f16(i[0]);
36 const int16_t vt1 = math_signcomplement_f16(i[1]);
37 i += 2;
38
39 vmax0 = math_max_s16(vmax0, vt0);
40 vmax1 = math_max_s16(vmax1, vt1);
41 }
42 vmax0 = math_max_s16(vmax0, vmax1);
43
44 if XNN_UNLIKELY(batch != 0) {
45 vt = math_signcomplement_f16(*i);
46 vmax0 = math_max_s16(vmax0, vt);
47 }
48 o[0] = (uint16_t) math_signcomplement_f16((uint16_t) vmax0);
49 }