| 1 |
// Auto-generated file. Do not edit! |
| 2 |
// Template: src/f32-f16-vcvt/rvvfp16arith.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 <riscv_vector.h> |
| 13 |
|
| 14 |
#include "xnnpack/vcvt.h" |
| 15 |
|
| 16 |
|
| 17 |
void xnn_f32_f16_vcvt_ukernel__rvvfp16arith_u2v( |
| 18 |
size_t batch, |
| 19 |
const float* input, |
| 20 |
xnn_float16* output, |
| 21 |
const void* params) |
| 22 |
{ |
| 23 |
assert(batch != 0); |
| 24 |
assert(batch % sizeof(float) == 0); |
| 25 |
assert(input != NULL); |
| 26 |
assert(output != NULL); |
| 27 |
|
| 28 |
batch >>= XNN_LOG2_SIZEOF_FLOAT; |
| 29 |
|
| 30 |
_Float16* o = (_Float16*) output; |
| 31 |
for (; batch > 0;) { |
| 32 |
const int32_t n = __riscv_vsetvl_e32m2(batch); batch -= n; |
| 33 |
|
| 34 |
vfloat32m2_t x_f32v = __riscv_vle32_v_f32m2(input, n); input += n; |
| 35 |
|
| 36 |
vfloat16m1_t y_f16v = __riscv_vfncvt_f_f_w_f16m1(x_f32v, n); |
| 37 |
|
| 38 |
__riscv_vse16_v_f16m1(o, y_f16v, n); o += n; |
| 39 |
} |
| 40 |
} |