Debian Codegraph @

src/f32-vcmul/gen/f32-vcmul-rvv-u1v.c

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/f32-vcmul/rvv.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2024 Imagination Technologies, 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
12 #include "xnnpack/vbinary.h"
13 #include <riscv_vector.h>
14
15 void xnn_f32_vcmul_ukernel__rvv_u1v(
16 size_t batch,
17 const float* input_a,
18 const float* input_b,
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_a != NULL);
25 assert(input_b != NULL);
26 assert(output != NULL);
27
28 batch >>= XNN_LOG2_SIZEOF_FLOAT;
29
30 const float* ar = input_a;
31 const float* ai = input_a + batch;
32 const float* br = input_b;
33 const float* bi = input_b + batch;
34 float* or = output;
35 float* oi = output + batch;
36
37 for (; batch > 0; ) {
38 size_t n = __riscv_vsetvl_e32m1(batch); batch -= n;
39 vfloat32m1_t ar_f32v = __riscv_vle32_v_f32m1(ar, n); ar += n;
40 vfloat32m1_t ai_f32v = __riscv_vle32_v_f32m1(ai, n); ai += n;
41 vfloat32m1_t br_f32v = __riscv_vle32_v_f32m1(br, n); br += n;
42 vfloat32m1_t bi_f32v = __riscv_vle32_v_f32m1(bi, n); bi += n;
43 vfloat32m1_t ai_bi_f32v = __riscv_vfmul_vv_f32m1(ai_f32v, bi_f32v, n);
44 vfloat32m1_t ai_br_f32v = __riscv_vfmul_vv_f32m1(ai_f32v, br_f32v, n);
45 vfloat32m1_t ar_br_sub_ai_bi_f32v = __riscv_vfmsac_vv_f32m1(ai_bi_f32v, ar_f32v, br_f32v, n);
46 vfloat32m1_t ar_bi_plus_ai_br_f32v = __riscv_vfmacc_vv_f32m1(ai_br_f32v, ar_f32v, bi_f32v, n);
47 __riscv_vse32_v_f32m1(or, ar_br_sub_ai_bi_f32v, n); or += n;
48 __riscv_vse32_v_f32m1(oi, ar_bi_plus_ai_br_f32v, n); oi += n;
49 }
50 }