Debian Codegraph @

src/f32-rminmax/gen/f32-rminmax-scalar-u4-acc4.c

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/f32-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 void xnn_f32_rminmax_ukernel__scalar_u4_acc4(
17 size_t batch,
18 const float* input,
19 float* output,
20 const struct xnn_f32_default_params params[restrict XNN_MIN_ELEMENTS(1)])
21 {
22 assert(batch != 0);
23 assert(batch % sizeof(float) == 0);
24 assert(input != NULL);
25 assert(output != NULL);
26
27 const float* i = input;
28
29 float vmin0 = *i;
30 float vmax0 = *i;
31 float vmin1 = vmin0;
32 float vmax1 = vmax0;
33 float vmin2 = vmin0;
34 float vmax2 = vmax0;
35 float vmin3 = vmin0;
36 float vmax3 = vmax0;
37 for (; batch >= 4 * sizeof(float); batch -= 4 * sizeof(float)) {
38 const float vt0 = i[0];
39 const float vt1 = i[1];
40 const float vt2 = i[2];
41 const float vt3 = i[3];
42 i += 4;
43
44 vmin0 = math_min_f32(vmin0, vt0);
45 vmax0 = math_max_f32(vmax0, vt0);
46 vmin1 = math_min_f32(vmin1, vt1);
47 vmax1 = math_max_f32(vmax1, vt1);
48 vmin2 = math_min_f32(vmin2, vt2);
49 vmax2 = math_max_f32(vmax2, vt2);
50 vmin3 = math_min_f32(vmin3, vt3);
51 vmax3 = math_max_f32(vmax3, vt3);
52 }
53 vmin0 = math_min_f32(vmin0, vmin1);
54 vmax0 = math_max_f32(vmax0, vmax1);
55 vmin2 = math_min_f32(vmin2, vmin3);
56 vmax2 = math_max_f32(vmax2, vmax3);
57 vmin0 = math_min_f32(vmin0, vmin2);
58 vmax0 = math_max_f32(vmax0, vmax2);
59
60 if XNN_UNLIKELY(batch != 0) {
61 do {
62 const float vt = *i++;
63 vmin0 = math_min_f32(vmin0, vt);
64 vmax0 = math_max_f32(vmax0, vt);
65 batch -= sizeof(float);
66 } while (batch != 0);
67 }
68 output[0] = vmin0;
69 output[1] = vmax0;
70 }