mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
target/riscv: rvv-1.0: widening floating-point/integer type-convert
Add the following instructions: * vfwcvt.rtz.xu.f.v * vfwcvt.rtz.x.f.v Also adjust GEN_OPFV_WIDEN_TRANS() to accept multiple floating-point rounding modes. Signed-off-by: Frank Chang <frank.chang@sifive.com> Acked-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20211210075704.23951-63-frank.chang@sifive.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
900da87ab9
commit
3ce4c09df7
4 changed files with 64 additions and 15 deletions
|
@ -2536,17 +2536,17 @@ static bool opfv_widen_check(DisasContext *s, arg_rmr *a)
|
|||
vext_check_ds(s, a->rd, a->rs2, a->vm);
|
||||
}
|
||||
|
||||
#define GEN_OPFV_WIDEN_TRANS(NAME) \
|
||||
#define GEN_OPFV_WIDEN_TRANS(NAME, HELPER, FRM) \
|
||||
static bool trans_##NAME(DisasContext *s, arg_rmr *a) \
|
||||
{ \
|
||||
if (opfv_widen_check(s, a)) { \
|
||||
uint32_t data = 0; \
|
||||
static gen_helper_gvec_3_ptr * const fns[2] = { \
|
||||
gen_helper_##NAME##_h, \
|
||||
gen_helper_##NAME##_w, \
|
||||
gen_helper_##HELPER##_h, \
|
||||
gen_helper_##HELPER##_w, \
|
||||
}; \
|
||||
TCGLabel *over = gen_new_label(); \
|
||||
gen_set_rm(s, RISCV_FRM_DYN); \
|
||||
gen_set_rm(s, FRM); \
|
||||
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over); \
|
||||
\
|
||||
data = FIELD_DP32(data, VDATA, VM, a->vm); \
|
||||
|
@ -2562,11 +2562,50 @@ static bool trans_##NAME(DisasContext *s, arg_rmr *a) \
|
|||
return false; \
|
||||
}
|
||||
|
||||
GEN_OPFV_WIDEN_TRANS(vfwcvt_xu_f_v)
|
||||
GEN_OPFV_WIDEN_TRANS(vfwcvt_x_f_v)
|
||||
GEN_OPFV_WIDEN_TRANS(vfwcvt_f_xu_v)
|
||||
GEN_OPFV_WIDEN_TRANS(vfwcvt_f_x_v)
|
||||
GEN_OPFV_WIDEN_TRANS(vfwcvt_f_f_v)
|
||||
GEN_OPFV_WIDEN_TRANS(vfwcvt_xu_f_v, vfwcvt_xu_f_v, RISCV_FRM_DYN)
|
||||
GEN_OPFV_WIDEN_TRANS(vfwcvt_x_f_v, vfwcvt_x_f_v, RISCV_FRM_DYN)
|
||||
GEN_OPFV_WIDEN_TRANS(vfwcvt_f_f_v, vfwcvt_f_f_v, RISCV_FRM_DYN)
|
||||
/* Reuse the helper functions from vfwcvt.xu.f.v and vfwcvt.x.f.v */
|
||||
GEN_OPFV_WIDEN_TRANS(vfwcvt_rtz_xu_f_v, vfwcvt_xu_f_v, RISCV_FRM_RTZ)
|
||||
GEN_OPFV_WIDEN_TRANS(vfwcvt_rtz_x_f_v, vfwcvt_x_f_v, RISCV_FRM_RTZ)
|
||||
|
||||
static bool opfxv_widen_check(DisasContext *s, arg_rmr *a)
|
||||
{
|
||||
return require_rvv(s) &&
|
||||
require_scale_rvf(s) &&
|
||||
vext_check_isa_ill(s) &&
|
||||
/* OPFV widening instructions ignore vs1 check */
|
||||
vext_check_ds(s, a->rd, a->rs2, a->vm);
|
||||
}
|
||||
|
||||
#define GEN_OPFXV_WIDEN_TRANS(NAME) \
|
||||
static bool trans_##NAME(DisasContext *s, arg_rmr *a) \
|
||||
{ \
|
||||
if (opfxv_widen_check(s, a)) { \
|
||||
uint32_t data = 0; \
|
||||
static gen_helper_gvec_3_ptr * const fns[3] = { \
|
||||
gen_helper_##NAME##_b, \
|
||||
gen_helper_##NAME##_h, \
|
||||
gen_helper_##NAME##_w, \
|
||||
}; \
|
||||
TCGLabel *over = gen_new_label(); \
|
||||
gen_set_rm(s, RISCV_FRM_DYN); \
|
||||
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over); \
|
||||
\
|
||||
data = FIELD_DP32(data, VDATA, VM, a->vm); \
|
||||
tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \
|
||||
vreg_ofs(s, a->rs2), cpu_env, \
|
||||
s->vlen / 8, s->vlen / 8, data, \
|
||||
fns[s->sew]); \
|
||||
mark_vs_dirty(s); \
|
||||
gen_set_label(over); \
|
||||
return true; \
|
||||
} \
|
||||
return false; \
|
||||
}
|
||||
|
||||
GEN_OPFXV_WIDEN_TRANS(vfwcvt_f_xu_v)
|
||||
GEN_OPFXV_WIDEN_TRANS(vfwcvt_f_x_v)
|
||||
|
||||
/* Narrowing Floating-Point/Integer Type-Convert Instructions */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue