| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
#include <assert.h> |
| 11 |
|
| 12 |
#include <riscv_vector.h> |
| 13 |
|
| 14 |
#include "xnnpack/common.h" |
| 15 |
#include "xnnpack/vbinary.h" |
| 16 |
|
| 17 |
|
| 18 |
void xnn_f32_vrsubc_ukernel__rvv_u4v( |
| 19 |
size_t batch, |
| 20 |
const float* input_a, |
| 21 |
const float* input_b, |
| 22 |
float* output, |
| 23 |
const struct xnn_f32_default_params params[restrict XNN_MIN_ELEMENTS(1)]) |
| 24 |
{ |
| 25 |
assert(batch != 0); |
| 26 |
assert(batch % sizeof(float) == 0); |
| 27 |
assert(input_a != NULL); |
| 28 |
assert(input_b != NULL); |
| 29 |
assert(output != NULL); |
| 30 |
|
| 31 |
const float b = *input_b; |
| 32 |
size_t n = batch >> 2; |
| 33 |
|
| 34 |
do { |
| 35 |
size_t vl = __riscv_vsetvl_e32m4(n); |
| 36 |
n -= vl; |
| 37 |
vfloat32m4_t va = __riscv_vle32_v_f32m4(input_a, vl); |
| 38 |
input_a += vl; |
| 39 |
vfloat32m4_t vacc = __riscv_vfrsub_vf_f32m4(va, b, vl); |
| 40 |
__riscv_vse32_v_f32m4(output, vacc, vl); |
| 41 |
output += vl; |
| 42 |
} while (n > 0); |
| 43 |
} |