mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
target/riscv: rvv-1.0: narrowing floating-point/integer type-convert
Signed-off-by: Frank Chang <frank.chang@sifive.com> Acked-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20211210075704.23951-65-frank.chang@sifive.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
75804f7131
commit
ff679b58e3
4 changed files with 97 additions and 44 deletions
|
@ -3820,31 +3820,36 @@ GEN_VEXT_V_ENV(vfwcvt_f_f_v_w, 4, 8)
|
|||
|
||||
/* Narrowing Floating-Point/Integer Type-Convert Instructions */
|
||||
/* (TD, T2, TX2) */
|
||||
#define NOP_UU_B uint8_t, uint16_t, uint32_t
|
||||
#define NOP_UU_H uint16_t, uint32_t, uint32_t
|
||||
#define NOP_UU_W uint32_t, uint64_t, uint64_t
|
||||
/* vfncvt.xu.f.v vd, vs2, vm # Convert float to unsigned integer. */
|
||||
RVVCALL(OPFVV1, vfncvt_xu_f_v_h, NOP_UU_H, H2, H4, float32_to_uint16)
|
||||
RVVCALL(OPFVV1, vfncvt_xu_f_v_w, NOP_UU_W, H4, H8, float64_to_uint32)
|
||||
GEN_VEXT_V_ENV(vfncvt_xu_f_v_h, 2, 2)
|
||||
GEN_VEXT_V_ENV(vfncvt_xu_f_v_w, 4, 4)
|
||||
RVVCALL(OPFVV1, vfncvt_xu_f_w_b, NOP_UU_B, H1, H2, float16_to_uint8)
|
||||
RVVCALL(OPFVV1, vfncvt_xu_f_w_h, NOP_UU_H, H2, H4, float32_to_uint16)
|
||||
RVVCALL(OPFVV1, vfncvt_xu_f_w_w, NOP_UU_W, H4, H8, float64_to_uint32)
|
||||
GEN_VEXT_V_ENV(vfncvt_xu_f_w_b, 1, 1)
|
||||
GEN_VEXT_V_ENV(vfncvt_xu_f_w_h, 2, 2)
|
||||
GEN_VEXT_V_ENV(vfncvt_xu_f_w_w, 4, 4)
|
||||
|
||||
/* vfncvt.x.f.v vd, vs2, vm # Convert double-width float to signed integer. */
|
||||
RVVCALL(OPFVV1, vfncvt_x_f_v_h, NOP_UU_H, H2, H4, float32_to_int16)
|
||||
RVVCALL(OPFVV1, vfncvt_x_f_v_w, NOP_UU_W, H4, H8, float64_to_int32)
|
||||
GEN_VEXT_V_ENV(vfncvt_x_f_v_h, 2, 2)
|
||||
GEN_VEXT_V_ENV(vfncvt_x_f_v_w, 4, 4)
|
||||
RVVCALL(OPFVV1, vfncvt_x_f_w_b, NOP_UU_B, H1, H2, float16_to_int8)
|
||||
RVVCALL(OPFVV1, vfncvt_x_f_w_h, NOP_UU_H, H2, H4, float32_to_int16)
|
||||
RVVCALL(OPFVV1, vfncvt_x_f_w_w, NOP_UU_W, H4, H8, float64_to_int32)
|
||||
GEN_VEXT_V_ENV(vfncvt_x_f_w_b, 1, 1)
|
||||
GEN_VEXT_V_ENV(vfncvt_x_f_w_h, 2, 2)
|
||||
GEN_VEXT_V_ENV(vfncvt_x_f_w_w, 4, 4)
|
||||
|
||||
/* vfncvt.f.xu.v vd, vs2, vm # Convert double-width unsigned integer to float */
|
||||
RVVCALL(OPFVV1, vfncvt_f_xu_v_h, NOP_UU_H, H2, H4, uint32_to_float16)
|
||||
RVVCALL(OPFVV1, vfncvt_f_xu_v_w, NOP_UU_W, H4, H8, uint64_to_float32)
|
||||
GEN_VEXT_V_ENV(vfncvt_f_xu_v_h, 2, 2)
|
||||
GEN_VEXT_V_ENV(vfncvt_f_xu_v_w, 4, 4)
|
||||
RVVCALL(OPFVV1, vfncvt_f_xu_w_h, NOP_UU_H, H2, H4, uint32_to_float16)
|
||||
RVVCALL(OPFVV1, vfncvt_f_xu_w_w, NOP_UU_W, H4, H8, uint64_to_float32)
|
||||
GEN_VEXT_V_ENV(vfncvt_f_xu_w_h, 2, 2)
|
||||
GEN_VEXT_V_ENV(vfncvt_f_xu_w_w, 4, 4)
|
||||
|
||||
/* vfncvt.f.x.v vd, vs2, vm # Convert double-width integer to float. */
|
||||
RVVCALL(OPFVV1, vfncvt_f_x_v_h, NOP_UU_H, H2, H4, int32_to_float16)
|
||||
RVVCALL(OPFVV1, vfncvt_f_x_v_w, NOP_UU_W, H4, H8, int64_to_float32)
|
||||
GEN_VEXT_V_ENV(vfncvt_f_x_v_h, 2, 2)
|
||||
GEN_VEXT_V_ENV(vfncvt_f_x_v_w, 4, 4)
|
||||
RVVCALL(OPFVV1, vfncvt_f_x_w_h, NOP_UU_H, H2, H4, int32_to_float16)
|
||||
RVVCALL(OPFVV1, vfncvt_f_x_w_w, NOP_UU_W, H4, H8, int64_to_float32)
|
||||
GEN_VEXT_V_ENV(vfncvt_f_x_w_h, 2, 2)
|
||||
GEN_VEXT_V_ENV(vfncvt_f_x_w_w, 4, 4)
|
||||
|
||||
/* vfncvt.f.f.v vd, vs2, vm # Convert double float to single-width float. */
|
||||
static uint16_t vfncvtffv16(uint32_t a, float_status *s)
|
||||
|
@ -3852,10 +3857,10 @@ static uint16_t vfncvtffv16(uint32_t a, float_status *s)
|
|||
return float32_to_float16(a, true, s);
|
||||
}
|
||||
|
||||
RVVCALL(OPFVV1, vfncvt_f_f_v_h, NOP_UU_H, H2, H4, vfncvtffv16)
|
||||
RVVCALL(OPFVV1, vfncvt_f_f_v_w, NOP_UU_W, H4, H8, float64_to_float32)
|
||||
GEN_VEXT_V_ENV(vfncvt_f_f_v_h, 2, 2)
|
||||
GEN_VEXT_V_ENV(vfncvt_f_f_v_w, 4, 4)
|
||||
RVVCALL(OPFVV1, vfncvt_f_f_w_h, NOP_UU_H, H2, H4, vfncvtffv16)
|
||||
RVVCALL(OPFVV1, vfncvt_f_f_w_w, NOP_UU_W, H4, H8, float64_to_float32)
|
||||
GEN_VEXT_V_ENV(vfncvt_f_f_w_h, 2, 2)
|
||||
GEN_VEXT_V_ENV(vfncvt_f_f_w_w, 4, 4)
|
||||
|
||||
/*
|
||||
*** Vector Reduction Operations
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue