Debian Codegraph @

src/f32-rminmax/gen/f32-rmax-rvv-u8v.c

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/f32-rminmax/rvv.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2023 SiFive, Inc.
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 #include <math.h>
12
13 #include <riscv_vector.h>
14
15 #include "xnnpack/common.h"
16 #include "xnnpack/intrinsics-polyfill.h"
17 #include "xnnpack/vunary.h"
18
19
20 void xnn_f32_rmax_ukernel__rvv_u8v(
21 size_t batch,
22 const float* input,
23 float* output,
24 const struct xnn_f32_default_params params[restrict XNN_MIN_ELEMENTS(1)])
25 {
26 assert(batch != 0);
27 assert(batch % sizeof(float) == 0);
28 assert(input != NULL);
29 assert(output != NULL);
30
31 size_t N = batch >> 2;
32 size_t avl;
33 size_t vl = __riscv_vsetvl_e32m8(N);
34
35 vfloat32m8_t t0 = __riscv_vle32_v_f32m8(input, vl);
36 input += vl;
37
38 for (avl = N - vl; avl; avl -= vl, input += vl) {
39 vl = __riscv_vsetvl_e32m8(avl);
40 vfloat32m8_t vec = __riscv_vle32_v_f32m8(input, vl);
41 t0 = __riscv_vfmax_vv_f32m8_tu(t0, t0, vec, vl);
42 }
43
44 vfloat32m1_t fmax = __riscv_vfmv_s_f_f32m1(-INFINITY, 1);
45 output[0] = __riscv_vfmv_f_s_f32m1_f32(__riscv_vfredmax_vs_f32m8_f32m1(t0, fmax, N));
46 }