Add RISC-V RVV Zve32f and Zve64f extensions
cover Add RISC-V RVV Zve32f and Zve64f extensions
From: Frank Chang <[email protected]>
In RVV v1.0 spec, several Zve* vector extensions for embedded processors are defined in Chapter 18.2:
https://github.com/riscv/riscv-v-spec/blob/v1.0/v-spec.adoc#zve-vector-extensions-for-embedded-processors
This patchset implements Zve32f and Zve64f extensions.
The port is available at:
https://github.com/sifive/qemu/tree/rvv-zve32f-zve64f-upstream
Zve32f can be enabled with -cpu option: Zve32f=true and Zve64f can be enabled with -cpu option: Zve64f=true. V is not required to be enabled explicitly.
Quote from the inclusion diagram for the six standard vector extensions from Nick Knight <[email protected]>:
V
|
Zve64d
|
Zve64f
/ \
Zve64x Zve32f
\ /
Zve32xNote: This patchset depends on other patchsets listed in Based-on
section below so it is not able to be built unless those patchsets are applied.
Based-on: <[email protected]>
Frank Chang (17):
target/riscv: rvv-1.0: Add Zve64f extension into RISC-V target/riscv: rvv-1.0: Add Zve64f support for configuration insns target/riscv: rvv-1.0: Add Zve64f support for load and store insns target/riscv: rvv-1.0: Add Zve64f support for vmulh variant insns target/riscv: rvv-1.0: Add Zve64f support for vsmul.vv and vsmul.vx
insns
target/riscv: rvv-1.0: Add Zve64f support for scalar fp insns target/riscv: rvv-1.0: Add Zve64f support for single-width fp
reduction insns
target/riscv: rvv-1.0: Add Zve64f support for widening type-convert
insns
target/riscv: rvv-1.0: Add Zve64f support for narrowing type-convert
insns
target/riscv: rvv-1.0: Allow Zve64f extension to be turned on target/riscv: rvv-1.0: Add Zve32f extension into RISC-V target/riscv: rvv-1.0: Add Zve32f support for configuration insns target/riscv: rvv-1.0: Add Zve32f support for scalar fp insns target/riscv: rvv-1.0: Add Zve32f support for single-width fp
reduction insns
target/riscv: rvv-1.0: Add Zve32f support for widening type-convert
insns
target/riscv: rvv-1.0: Add Zve32f support for narrowing type-convert
insns
target/riscv: rvv-1.0: Allow Zve32f extension to be turned on
target/riscv/cpu.c | 6 + target/riscv/cpu.h | 2 + target/riscv/cpu_helper.c | 5 +- target/riscv/csr.c | 6 +- target/riscv/insn_trans/trans_rvv.c.inc | 217 ++++++++++++++++++++---- target/riscv/translate.c | 4 + 6 files changed, 203 insertions(+), 37 deletions(-)
--
2.31.1
PATCH 1/17 target/riscv: rvv-1.0: Add Zve64f extension into RISC-V
From: Frank Chang <[email protected]>
--- target/riscv/cpu.c | 4 ++++ target/riscv/cpu.h | 1 + target/riscv/cpu_helper.c | 5 ++++- target/riscv/csr.c | 6 +++++- target/riscv/translate.c | 2 ++ 5 files changed, 16 insertions(+), 2 deletions(-)
target/riscv/cpu.c +4 -0
@@ -562,6 +562,10 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) }set_vext_version (env, vext_version); } +if (cpu->cfg.ext_zve64f && !cpu->cfg.ext_f) { +error_setg (errp,"Zve64f extension depends upon RVF." ); +return ; + }if (cpu->cfg.ext_j) { ext |=RVJ ; }
target/riscv/cpu.h +1 -0
@@ -317,6 +317,7 @@ struct RISCVCPU {bool ext_icsr;bool ext_zfh;bool ext_zfhmin; +bool ext_zve64f;char *priv_spec;char *user_spec;
target/riscv/cpu_helper.c +4 -1
@@ -69,12 +69,15 @@ static RISCVMXL cpu_get_xl(CPURISCVState *env)void cpu_get_tb_cpu_state (CPURISCVState *env,target_ulong *pc,target_ulong *cs_base,uint32_t *pflags) { +CPUState *cs =env_cpu (env); +RISCVCPU *cpu =RISCV_CPU (cs); +uint32_t flags =0 ; *pc = env->pc; *cs_base =0 ; -if (riscv_has_ext (env,RVV )) { +if (riscv_has_ext (env,RVV ) || cpu->cfg.ext_zve64f) {/* * If env->vl equals to VLMAX, we can use generic vector operation * expanders (GVEC) to accerlate the vector operations.
target/riscv/csr.c +5 -1
@@ -47,7 +47,11 @@ static RISCVException fs(CPURISCVState *env, int csrno)static RISCVException vs (CPURISCVState *env,int csrno) { -if (env->misa_ext &RVV ) { +CPUState *cs =env_cpu (env); +RISCVCPU *cpu =RISCV_CPU (cs); + +if (env->misa_ext &RVV || + cpu->cfg.ext_zve64f) {#if !defined(CONFIG_USER_ONLY )if (!env->debugger && !riscv_cpu_vector_enabled (env)) {return RISCV_EXCP_ILLEGAL_INST ;
target/riscv/translate.c +2 -0
@@ -78,6 +78,7 @@ typedef struct DisasContext {bool ext_ifencei;bool ext_zfh;bool ext_zfhmin; +bool ext_zve64f;bool hlsx;/* vector extension */ bool vill;
@@ -705,6 +706,7 @@ static void riscv_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) ctx->ext_ifencei = cpu->cfg.ext_ifencei; ctx->ext_zfh = cpu->cfg.ext_zfh; ctx->ext_zfhmin = cpu->cfg.ext_zfhmin; + ctx->ext_zve64f = cpu->cfg.ext_zve64f; ctx->vlen = cpu->cfg.vlen; ctx->elen = cpu->cfg.elen; ctx->mstatus_hs_fs =FIELD_EX32 (tb_flags,TB_FLAGS ,MSTATUS_HS_FS );
Signature · 1 line
2.31.1
Re: [PATCH 01/17] target/riscv: rvv-1.0: Add Zve64f extension into RISC-V
Quoted 4 lines · On Wed, Dec 29, 2021 at 12:34 PM <[email protected]> wrote:
From: Frank Chang <[email protected]>
Signed-off-by Frank Chang <[email protected]>
Alistair
Quoted 97 lines
--- target/riscv/cpu.c | 4 ++++ target/riscv/cpu.h | 1 + target/riscv/cpu_helper.c | 5 ++++- target/riscv/csr.c | 6 +++++- target/riscv/translate.c | 2 ++ 5 files changed, 16 insertions(+), 2 deletions(-)target/riscv/cpu.c +4
-0@@ -562,6 +562,10 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) }set_vext_version (env, vext_version); } +if (cpu->cfg.ext_zve64f && !cpu->cfg.ext_f) { +error_setg (errp,"Zve64f extension depends upon RVF." ); +return ; + }if (cpu->cfg.ext_j) { ext |=RVJ ; }target/riscv/cpu.h +1
-0@@ -317,6 +317,7 @@ struct RISCVCPU {bool ext_icsr;bool ext_zfh;bool ext_zfhmin; +bool ext_zve64f;char *priv_spec;char *user_spec;target/riscv/cpu_helper.c +4
-1@@ -69,12 +69,15 @@ static RISCVMXL cpu_get_xl(CPURISCVState *env)void cpu_get_tb_cpu_state (CPURISCVState *env,target_ulong *pc,target_ulong *cs_base,uint32_t *pflags) { +CPUState *cs =env_cpu (env); +RISCVCPU *cpu =RISCV_CPU (cs); +uint32_t flags =0 ; *pc = env->pc; *cs_base =0 ; -if (riscv_has_ext (env,RVV )) { +if (riscv_has_ext (env,RVV ) || cpu->cfg.ext_zve64f) {/* * If env->vl equals to VLMAX, we can use generic vector operation * expanders (GVEC) to accerlate the vector operations. target/riscv/csr.c +5
-1@@ -47,7 +47,11 @@ static RISCVException fs(CPURISCVState *env, int csrno)static RISCVException vs (CPURISCVState *env,int csrno) { -if (env->misa_ext &RVV ) { +CPUState *cs =env_cpu (env); +RISCVCPU *cpu =RISCV_CPU (cs); + +if (env->misa_ext &RVV || + cpu->cfg.ext_zve64f) {#if !defined(CONFIG_USER_ONLY )if (!env->debugger && !riscv_cpu_vector_enabled (env)) {return RISCV_EXCP_ILLEGAL_INST ;target/riscv/translate.c +2
-1@@ -78,6 +78,7 @@ typedef struct DisasContext {bool ext_ifencei;bool ext_zfh;bool ext_zfhmin; +bool ext_zve64f;bool hlsx;/* vector extension */ bool vill;@@ -705,6 +706,7 @@ static void riscv_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) ctx->ext_ifencei = cpu->cfg.ext_ifencei; ctx->ext_zfh = cpu->cfg.ext_zfh; ctx->ext_zfhmin = cpu->cfg.ext_zfhmin; + ctx->ext_zve64f = cpu->cfg.ext_zve64f; ctx->vlen = cpu->cfg.vlen; ctx->elen = cpu->cfg.elen; ctx->mstatus_hs_fs =FIELD_EX32 (tb_flags,TB_FLAGS ,MSTATUS_HS_FS ); --2.31.1
PATCH 2/17 target/riscv: rvv-1.0: Add Zve64f support for configuration insns
In reply to [email protected]From: Frank Chang <[email protected]>
All Zve* extensions support the vector configuration instructions.
--- target/riscv/insn_trans/trans_rvv.c.inc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
target/riscv/insn_trans/trans_rvv.c.inc +4 -2
@@ -129,7 +129,8 @@ static bool do_vsetvl(DisasContext *s, int rd, int rs1, TCGv s2) { TCGv s1, dst; - if (!require_rvv(s) || !has_ext(s, RVV)) { + if (!require_rvv(s) || + !(has_ext(s, RVV) || s->ext_zve64f)) { return false; }
@@ -164,7 +165,8 @@ static bool do_vsetivli(DisasContext *s, int rd, TCGv s1, TCGv s2) { TCGv dst; - if (!require_rvv(s) || !has_ext(s, RVV)) { + if (!require_rvv(s) || + !(has_ext(s, RVV) || s->ext_zve64f)) { return false; }
Signature · 1 line
2.31.1
Re: [PATCH 02/17] target/riscv: rvv-1.0: Add Zve64f support for configuration insns
Quoted 6 lines · On Wed, Dec 29, 2021 at 12:36 PM <[email protected]> wrote:
From: Frank Chang <[email protected]>
All Zve* extensions support the vector configuration instructions.
Signed-off-by Frank Chang <[email protected]>
Alistair
Quoted 32 lines
--- target/riscv/insn_trans/trans_rvv.c.inc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)target/riscv/insn_trans/trans_rvv.c.inc +4
-3@@ -129,7 +129,8 @@ static bool do_vsetvl(DisasContext *s, int rd, int rs1, TCGv s2) { TCGv s1, dst; - if (!require_rvv(s) || !has_ext(s, RVV)) { + if (!require_rvv(s) || + !(has_ext(s, RVV) || s->ext_zve64f)) { return false; }@@ -164,7 +165,8 @@ static bool do_vsetivli(DisasContext *s, int rd, TCGv s1, TCGv s2) { TCGv dst; - if (!require_rvv(s) || !has_ext(s, RVV)) { + if (!require_rvv(s) || + !(has_ext(s, RVV) || s->ext_zve64f)) { return false; } --2.31.1
PATCH 3/17 target/riscv: rvv-1.0: Add Zve64f support for load and store insns
In reply to [email protected]From: Frank Chang <[email protected]>
All Zve* extensions support all vector load and store instructions, except Zve64* extensions do not support EEW=64 for index values when XLEN=32.
--- target/riscv/insn_trans/trans_rvv.c.inc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
target/riscv/insn_trans/trans_rvv.c.inc +13 -4
@@ -263,10 +263,19 @@ static bool vext_check_st_index(DisasContext *s, int vd, int vs2, int nf, uint8_t eew) { int8_t emul = eew - s->sew + s->lmul; - return (emul >= -3 && emul <= 3) && - require_align(vs2, emul) && - require_align(vd, s->lmul) && - require_nf(vd, nf, s->lmul); + bool ret = (emul >= -3 && emul <= 3) && + require_align(vs2, emul) && + require_align(vd, s->lmul) && + require_nf(vd, nf, s->lmul); +#ifdef TARGET_RISCV32 + /* + * All Zve* extensions support all vector load and store instructions, + * except Zve64* extensions do not support EEW=64 for index values + * when XLEN=32. (Section 18.2) + */ + ret &= (!has_ext(s, RVV) && s->ext_zve64f ? eew != MO_64 : true); +#endif + return ret; } /*
Signature · 1 line
2.31.1
Re: [PATCH 03/17] target/riscv: rvv-1.0: Add Zve64f support for load and store insns
Quoted 19 lines · On Wed, Dec 29, 2021 at 12:34 PM <[email protected]> wrote:
From: Frank Chang <[email protected]>
All Zve* extensions support all vector load and store instructions, except Zve64* extensions do not support EEW=64 for index values when XLEN=32.
Signed-off-by Frank Chang <[email protected]>--- target/riscv/insn_trans/trans_rvv.c.inc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)target/riscv/insn_trans/trans_rvv.c.inc +0
-0@@ -263,10 +263,19 @@ static bool vext_check_st_index(DisasContext *s, int vd, int vs2, int nf, uint8_t eew) {
target/riscv/insn_trans/trans_rvv.c.inc static bool vext_check_st_index(DisasContext *s, int vd, int vs2, int nf, · line 270
Quoted 10 lines
target/riscv/insn_trans/trans_rvv.c.inc +5
-4int8_t emul = eew - s->sew + s->lmul; - return (emul >= -3 && emul <= 3) && - require_align(vs2, emul) && - require_align(vd, s->lmul) && - require_nf(vd, nf, s->lmul); + bool ret = (emul >= -3 && emul <= 3) && + require_align(vs2, emul) && + require_align(vd, s->lmul) && + require_nf(vd, nf, s->lmul); +#ifdef TARGET_RISCV32
Don't use hardcoded macros for this, instead use get_xl()
Alistair
Quoted 15 lines
target/riscv/insn_trans/trans_rvv.c.inc +8
-1+ /* + * All Zve* extensions support all vector load and store instructions, + * except Zve64* extensions do not support EEW=64 for index values + * when XLEN=32. (Section 18.2) + */ + ret &= (!has_ext(s, RVV) && s->ext_zve64f ? eew != MO_64 : true); +#endif + return ret; } /* --2.31.1
Re: [PATCH 03/17] target/riscv: rvv-1.0: Add Zve64f support for load and store insns
Quoted 33 lines · Alistair Francis
Quoted 7 lines · On Wed, Dec 29, 2021 at 12:34 PM <[email protected]> wrote:
From: Frank Chang <[email protected]>
All Zve* extensions support all vector load and store instructions, except Zve64* extensions do not support EEW=64 for index values when XLEN=32.
Review
Quoted 6 lines
Signed-off-by Frank Chang <[email protected]>--- target/riscv/insn_trans/trans_rvv.c.inc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)(quoted diff) +0
-0b/target/riscv/insn_trans/trans_rvv.c.inc
target/riscv/insn_trans/trans_rvv.c.inc static bool vext_check_st_index(DisasContext *s,
Quoted 4 lines
index
5b47729a21..820a3387db100644target/riscv/insn_trans/trans_rvv.c.inc +0
-0@@ -263,10 +263,19 @@ static bool vext_check_st_index(DisasContext *s,int vd, int vs2, int nf,
target/riscv/insn_trans/trans_rvv.c.inc static bool vext_check_st_index(DisasContext *s, int vd, int vs2, int nf, · line 270
Quoted 12 lines
target/riscv/insn_trans/trans_rvv.c.inc +5
-4uint8_t eew) { int8_t emul = eew - s->sew + s->lmul; - return (emul >= -3 && emul <= 3) && - require_align(vs2, emul) && - require_align(vd, s->lmul) && - require_nf(vd, nf, s->lmul); + bool ret = (emul >= -3 && emul <= 3) && + require_align(vs2, emul) && + require_align(vd, s->lmul) && + require_nf(vd, nf, s->lmul); +#ifdef TARGET_RISCV32
Quoted 4 lines
Don't use hardcoded macros for this, instead use
get_xl()Alistair
Thanks for the review.
I'll fix it in my next revision patchset.
Regards,
Frank Chang
Quoted 18 lines
target/riscv/insn_trans/trans_rvv.c.inc static bool vext_check_st_index(DisasContext *s, · line 272
Quoted 3 lines
target/riscv/insn_trans/trans_rvv.c.inc +2
-0+ /* + * All Zve* extensions support all vector load and storeinstructions,
Quoted 13 lines
target/riscv/insn_trans/trans_rvv.c.inc +6
-1+ * except Zve64* extensions do not support EEW=64 for index values + * when XLEN=32. (Section 18.2) + */ + ret &= (!has_ext(s, RVV) && s->ext_zve64f ? eew != MO_64 : true); +#endif + return ret; } /* --2.31.1
PATCH 4/17 target/riscv: rvv-1.0: Add Zve64f support for vmulh variant insns
In reply to [email protected]From: Frank Chang <[email protected]>
All Zve* extensions support all vector integer instructions, except that the vmulh integer multiply variants that return the high word of the product (vmulh.vv, vmulh.vx, vmulhu.vv, vmulhu.vx, vmulhsu.vv, vmulhsu.vx) are not included for EEW=64 in Zve64*.
--- target/riscv/insn_trans/trans_rvv.c.inc | 39 +++++++++++++++++++++---- 1 file changed, 33 insertions(+), 6 deletions(-)
target/riscv/insn_trans/trans_rvv.c.inc +33 -6
@@ -1906,14 +1906,41 @@ GEN_OPIVX_TRANS(vmaxu_vx, opivx_check) GEN_OPIVX_TRANS(vmax_vx, opivx_check) /* Vector Single-Width Integer Multiply Instructions */ + +static bool vmulh_vv_check(DisasContext *s, arg_rmrr *a) +{ + /* + * All Zve* extensions support all vector integer instructions, + * except that the vmulh integer multiply variants + * that return the high word of the product + * (vmulh.vv, vmulh.vx, vmulhu.vv, vmulhu.vx, vmulhsu.vv, vmulhsu.vx) + * are not included for EEW=64 in Zve64*. (Section 18.2) + */ + return opivv_check(s, a) && + (!has_ext(s, RVV) && s->ext_zve64f ? s->sew != MO_64 : true); +} + +static bool vmulh_vx_check(DisasContext *s, arg_rmrr *a) +{ + /* + * All Zve* extensions support all vector integer instructions, + * except that the vmulh integer multiply variants + * that return the high word of the product + * (vmulh.vv, vmulh.vx, vmulhu.vv, vmulhu.vx, vmulhsu.vv, vmulhsu.vx) + * are not included for EEW=64 in Zve64*. (Section 18.2) + */ + return opivx_check(s, a) && + (!has_ext(s, RVV) && s->ext_zve64f ? s->sew != MO_64 : true); +} + GEN_OPIVV_GVEC_TRANS(vmul_vv, mul) -GEN_OPIVV_TRANS(vmulh_vv, opivv_check) -GEN_OPIVV_TRANS(vmulhu_vv, opivv_check) -GEN_OPIVV_TRANS(vmulhsu_vv, opivv_check) +GEN_OPIVV_TRANS(vmulh_vv, vmulh_vv_check) +GEN_OPIVV_TRANS(vmulhu_vv, vmulh_vv_check) +GEN_OPIVV_TRANS(vmulhsu_vv, vmulh_vv_check) GEN_OPIVX_GVEC_TRANS(vmul_vx, muls) -GEN_OPIVX_TRANS(vmulh_vx, opivx_check) -GEN_OPIVX_TRANS(vmulhu_vx, opivx_check) -GEN_OPIVX_TRANS(vmulhsu_vx, opivx_check) +GEN_OPIVX_TRANS(vmulh_vx, vmulh_vx_check) +GEN_OPIVX_TRANS(vmulhu_vx, vmulh_vx_check) +GEN_OPIVX_TRANS(vmulhsu_vx, vmulh_vx_check) /* Vector Integer Divide Instructions */ GEN_OPIVV_TRANS(vdivu_vv, opivv_check)
Signature · 1 line
2.31.1
Re: [PATCH 04/17] target/riscv: rvv-1.0: Add Zve64f support for vmulh variant insns
Quoted 9 lines · On Wed, Dec 29, 2021 at 12:36 PM <[email protected]> wrote:
From: Frank Chang <[email protected]>
All Zve* extensions support all vector integer instructions, except that the vmulh integer multiply variants that return the high word of the product (vmulh.vv, vmulh.vx, vmulhu.vv, vmulhu.vx, vmulhsu.vv, vmulhsu.vx) are not included for EEW=64 in Zve64*.
Signed-off-by Frank Chang <[email protected]>
Alistair
Quoted 60 lines
--- target/riscv/insn_trans/trans_rvv.c.inc | 39 +++++++++++++++++++++---- 1 file changed, 33 insertions(+), 6 deletions(-)target/riscv/insn_trans/trans_rvv.c.inc +33
-7@@ -1906,14 +1906,41 @@ GEN_OPIVX_TRANS(vmaxu_vx, opivx_check) GEN_OPIVX_TRANS(vmax_vx, opivx_check) /* Vector Single-Width Integer Multiply Instructions */ + +static bool vmulh_vv_check(DisasContext *s, arg_rmrr *a) +{ + /* + * All Zve* extensions support all vector integer instructions, + * except that the vmulh integer multiply variants + * that return the high word of the product + * (vmulh.vv, vmulh.vx, vmulhu.vv, vmulhu.vx, vmulhsu.vv, vmulhsu.vx) + * are not included for EEW=64 in Zve64*. (Section 18.2) + */ + return opivv_check(s, a) && + (!has_ext(s, RVV) && s->ext_zve64f ? s->sew != MO_64 : true); +} + +static bool vmulh_vx_check(DisasContext *s, arg_rmrr *a) +{ + /* + * All Zve* extensions support all vector integer instructions, + * except that the vmulh integer multiply variants + * that return the high word of the product + * (vmulh.vv, vmulh.vx, vmulhu.vv, vmulhu.vx, vmulhsu.vv, vmulhsu.vx) + * are not included for EEW=64 in Zve64*. (Section 18.2) + */ + return opivx_check(s, a) && + (!has_ext(s, RVV) && s->ext_zve64f ? s->sew != MO_64 : true); +} + GEN_OPIVV_GVEC_TRANS(vmul_vv, mul) -GEN_OPIVV_TRANS(vmulh_vv, opivv_check) -GEN_OPIVV_TRANS(vmulhu_vv, opivv_check) -GEN_OPIVV_TRANS(vmulhsu_vv, opivv_check) +GEN_OPIVV_TRANS(vmulh_vv, vmulh_vv_check) +GEN_OPIVV_TRANS(vmulhu_vv, vmulh_vv_check) +GEN_OPIVV_TRANS(vmulhsu_vv, vmulh_vv_check) GEN_OPIVX_GVEC_TRANS(vmul_vx, muls) -GEN_OPIVX_TRANS(vmulh_vx, opivx_check) -GEN_OPIVX_TRANS(vmulhu_vx, opivx_check) -GEN_OPIVX_TRANS(vmulhsu_vx, opivx_check) +GEN_OPIVX_TRANS(vmulh_vx, vmulh_vx_check) +GEN_OPIVX_TRANS(vmulhu_vx, vmulh_vx_check) +GEN_OPIVX_TRANS(vmulhsu_vx, vmulh_vx_check) /* Vector Integer Divide Instructions */ GEN_OPIVV_TRANS(vdivu_vv, opivv_check) --2.31.1
PATCH 5/17 target/riscv: rvv-1.0: Add Zve64f support for vsmul.vv and vsmul.vx insns
In reply to [email protected]From: Frank Chang <[email protected]>
All Zve* extensions support all vector fixed-point arithmetic instructions, except that vsmul.vv and vsmul.vx are not supported for EEW=64 in Zve64*.
--- target/riscv/insn_trans/trans_rvv.c.inc | 27 +++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)
target/riscv/insn_trans/trans_rvv.c.inc +25 -2
@@ -2121,8 +2121,31 @@ GEN_OPIVX_TRANS(vasub_vx, opivx_check) GEN_OPIVX_TRANS(vasubu_vx, opivx_check) /* Vector Single-Width Fractional Multiply with Rounding and Saturation */ -GEN_OPIVV_TRANS(vsmul_vv, opivv_check) -GEN_OPIVX_TRANS(vsmul_vx, opivx_check) + +static bool vsmul_vv_check(DisasContext *s, arg_rmrr *a) +{ + /* + * All Zve* extensions support all vector fixed-point arithmetic + * instructions, except that vsmul.vv and vsmul.vx are not supported + * for EEW=64 in Zve64*. (Section 18.2) + */ + return opivv_check(s, a) && + (!has_ext(s, RVV) && s->ext_zve64f ? s->sew != MO_64 : true); +} + +static bool vsmul_vx_check(DisasContext *s, arg_rmrr *a) +{ + /* + * All Zve* extensions support all vector fixed-point arithmetic + * instructions, except that vsmul.vv and vsmul.vx are not supported + * for EEW=64 in Zve64*. (Section 18.2) + */ + return opivx_check(s, a) && + (!has_ext(s, RVV) && s->ext_zve64f ? s->sew != MO_64 : true); +} + +GEN_OPIVV_TRANS(vsmul_vv, vsmul_vv_check) +GEN_OPIVX_TRANS(vsmul_vx, vsmul_vx_check) /* Vector Single-Width Scaling Shift Instructions */ GEN_OPIVV_TRANS(vssrl_vv, opivv_check)
Signature · 1 line
2.31.1
Re: [PATCH 05/17] target/riscv: rvv-1.0: Add Zve64f support for vsmul.vv and vsmul.vx insns
Quoted 8 lines · On Wed, Dec 29, 2021 at 12:37 PM <[email protected]> wrote:
From: Frank Chang <[email protected]>
All Zve* extensions support all vector fixed-point arithmetic instructions, except that vsmul.vv and vsmul.vx are not supported for EEW=64 in Zve64*.
Signed-off-by Frank Chang <[email protected]>
Alistair
Quoted 46 lines
--- target/riscv/insn_trans/trans_rvv.c.inc | 27 +++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)target/riscv/insn_trans/trans_rvv.c.inc +25
-3@@ -2121,8 +2121,31 @@ GEN_OPIVX_TRANS(vasub_vx, opivx_check) GEN_OPIVX_TRANS(vasubu_vx, opivx_check) /* Vector Single-Width Fractional Multiply with Rounding and Saturation */ -GEN_OPIVV_TRANS(vsmul_vv, opivv_check) -GEN_OPIVX_TRANS(vsmul_vx, opivx_check) + +static bool vsmul_vv_check(DisasContext *s, arg_rmrr *a) +{ + /* + * All Zve* extensions support all vector fixed-point arithmetic + * instructions, except that vsmul.vv and vsmul.vx are not supported + * for EEW=64 in Zve64*. (Section 18.2) + */ + return opivv_check(s, a) && + (!has_ext(s, RVV) && s->ext_zve64f ? s->sew != MO_64 : true); +} + +static bool vsmul_vx_check(DisasContext *s, arg_rmrr *a) +{ + /* + * All Zve* extensions support all vector fixed-point arithmetic + * instructions, except that vsmul.vv and vsmul.vx are not supported + * for EEW=64 in Zve64*. (Section 18.2) + */ + return opivx_check(s, a) && + (!has_ext(s, RVV) && s->ext_zve64f ? s->sew != MO_64 : true); +} + +GEN_OPIVV_TRANS(vsmul_vv, vsmul_vv_check) +GEN_OPIVX_TRANS(vsmul_vx, vsmul_vx_check) /* Vector Single-Width Scaling Shift Instructions */ GEN_OPIVV_TRANS(vssrl_vv, opivv_check) --2.31.1
PATCH 6/17 target/riscv: rvv-1.0: Add Zve64f support for scalar fp insns
In reply to [email protected]From: Frank Chang <[email protected]>
Zve64f extension requires the scalar processor to implement the F extension and implement all vector floating-point instructions for floating-point operands with EEW=32 (i.e., no widening floating-point operations).
--- target/riscv/insn_trans/trans_rvv.c.inc | 41 +++++++++++++++++++------ 1 file changed, 31 insertions(+), 10 deletions(-)
target/riscv/insn_trans/trans_rvv.c.inc +31 -10
@@ -66,6 +66,17 @@ static bool require_scale_rvf(DisasContext *s) } } +static bool require_zve64f(DisasContext *s) +{ + /* RVV + Zve64f = RVV. */ + if (has_ext(s, RVV)) { + return true; + } + + /* Zve64f doesn't support FP64. (Section 18.2) */ + return s->ext_zve64f ? s->sew <= MO_32 : true; +} + /* Destination vector register group cannot overlap source mask register. */ static bool require_vm(int vm, int vd) {
@@ -2204,7 +2215,8 @@ static bool opfvv_check(DisasContext *s, arg_rmrr *a) return require_rvv(s) && require_rvf(s) && vext_check_isa_ill(s) && - vext_check_sss(s, a->rd, a->rs1, a->rs2, a->vm); + vext_check_sss(s, a->rd, a->rs1, a->rs2, a->vm) && + require_zve64f(s); } /* OPFVV without GVEC IR */
@@ -2284,7 +2296,8 @@ static bool opfvf_check(DisasContext *s, arg_rmrr *a) return require_rvv(s) && require_rvf(s) && vext_check_isa_ill(s) && - vext_check_ss(s, a->rd, a->rs2, a->vm); + vext_check_ss(s, a->rd, a->rs2, a->vm) && + require_zve64f(s); } /* OPFVF without GVEC IR */
@@ -2501,7 +2514,8 @@ static bool opfv_check(DisasContext *s, arg_rmr *a) require_rvf(s) && vext_check_isa_ill(s) && /* OPFV instructions ignore vs1 check */ - vext_check_ss(s, a->rd, a->rs2, a->vm); + vext_check_ss(s, a->rd, a->rs2, a->vm) && + require_zve64f(s); } static bool do_opfv(DisasContext *s, arg_rmr *a,
@@ -2566,7 +2580,8 @@ static bool opfvv_cmp_check(DisasContext *s, arg_rmrr *a) return require_rvv(s) && require_rvf(s) && vext_check_isa_ill(s) && - vext_check_mss(s, a->rd, a->rs1, a->rs2); + vext_check_mss(s, a->rd, a->rs1, a->rs2) && + require_zve64f(s); } GEN_OPFVV_TRANS(vmfeq_vv, opfvv_cmp_check)
@@ -2579,7 +2594,8 @@ static bool opfvf_cmp_check(DisasContext *s, arg_rmrr *a) return require_rvv(s) && require_rvf(s) && vext_check_isa_ill(s) && - vext_check_ms(s, a->rd, a->rs2); + vext_check_ms(s, a->rd, a->rs2) && + require_zve64f(s); } GEN_OPFVF_TRANS(vmfeq_vf, opfvf_cmp_check)
@@ -2600,7 +2616,8 @@ static bool trans_vfmv_v_f(DisasContext *s, arg_vfmv_v_f *a) if (require_rvv(s) && require_rvf(s) && vext_check_isa_ill(s) && - require_align(a->rd, s->lmul)) { + require_align(a->rd, s->lmul) && + require_zve64f(s)) { gen_set_rm(s, RISCV_FRM_DYN); TCGv_i64 t1;
@@ -3326,7 +3343,8 @@ static bool trans_vfmv_f_s(DisasContext *s, arg_vfmv_f_s *a) { if (require_rvv(s) && require_rvf(s) && - vext_check_isa_ill(s)) { + vext_check_isa_ill(s) && + require_zve64f(s)) { gen_set_rm(s, RISCV_FRM_DYN); unsigned int ofs = (8 << s->sew);
@@ -3352,7 +3370,8 @@ static bool trans_vfmv_s_f(DisasContext *s, arg_vfmv_s_f *a) { if (require_rvv(s) && require_rvf(s) && - vext_check_isa_ill(s)) { + vext_check_isa_ill(s) && + require_zve64f(s)) { gen_set_rm(s, RISCV_FRM_DYN); /* The instructions ignore LMUL and vector register group. */
@@ -3403,13 +3422,15 @@ GEN_OPIVI_TRANS(vslidedown_vi, IMM_ZX, vslidedown_vx, slidedown_check) static bool fslideup_check(DisasContext *s, arg_rmrr *a) { return slideup_check(s, a) && - require_rvf(s); + require_rvf(s) && + require_zve64f(s); } static bool fslidedown_check(DisasContext *s, arg_rmrr *a) { return slidedown_check(s, a) && - require_rvf(s); + require_rvf(s) && + require_zve64f(s); } GEN_OPFVF_TRANS(vfslide1up_vf, fslideup_check)
Signature · 1 line
2.31.1
Re: [PATCH 06/17] target/riscv: rvv-1.0: Add Zve64f support for scalar fp insns
Quoted 9 lines · On Wed, Dec 29, 2021 at 12:43 PM <[email protected]> wrote:
From: Frank Chang <[email protected]>
Zve64f extension requires the scalar processor to implement the F extension and implement all vector floating-point instructions for floating-point operands with EEW=32 (i.e., no widening floating-point operations).
Signed-off-by Frank Chang <[email protected]>
Alistair
Quoted 128 lines
--- target/riscv/insn_trans/trans_rvv.c.inc | 41 +++++++++++++++++++------ 1 file changed, 31 insertions(+), 10 deletions(-)target/riscv/insn_trans/trans_rvv.c.inc +31
-11@@ -66,6 +66,17 @@ static bool require_scale_rvf(DisasContext *s) } } +static bool require_zve64f(DisasContext *s) +{ + /* RVV + Zve64f = RVV. */ + if (has_ext(s, RVV)) { + return true; + } + + /* Zve64f doesn't support FP64. (Section 18.2) */ + return s->ext_zve64f ? s->sew <= MO_32 : true; +} + /* Destination vector register group cannot overlap source mask register. */ static bool require_vm(int vm, int vd) {@@ -2204,7 +2215,8 @@ static bool opfvv_check(DisasContext *s, arg_rmrr *a) return require_rvv(s) && require_rvf(s) && vext_check_isa_ill(s) && - vext_check_sss(s, a->rd, a->rs1, a->rs2, a->vm); + vext_check_sss(s, a->rd, a->rs1, a->rs2, a->vm) && + require_zve64f(s); } /* OPFVV without GVEC IR */@@ -2284,7 +2296,8 @@ static bool opfvf_check(DisasContext *s, arg_rmrr *a) return require_rvv(s) && require_rvf(s) && vext_check_isa_ill(s) && - vext_check_ss(s, a->rd, a->rs2, a->vm); + vext_check_ss(s, a->rd, a->rs2, a->vm) && + require_zve64f(s); } /* OPFVF without GVEC IR */@@ -2501,7 +2514,8 @@ static bool opfv_check(DisasContext *s, arg_rmr *a) require_rvf(s) && vext_check_isa_ill(s) && /* OPFV instructions ignore vs1 check */ - vext_check_ss(s, a->rd, a->rs2, a->vm); + vext_check_ss(s, a->rd, a->rs2, a->vm) && + require_zve64f(s); } static bool do_opfv(DisasContext *s, arg_rmr *a,@@ -2566,7 +2580,8 @@ static bool opfvv_cmp_check(DisasContext *s, arg_rmrr *a) return require_rvv(s) && require_rvf(s) && vext_check_isa_ill(s) && - vext_check_mss(s, a->rd, a->rs1, a->rs2); + vext_check_mss(s, a->rd, a->rs1, a->rs2) && + require_zve64f(s); } GEN_OPFVV_TRANS(vmfeq_vv, opfvv_cmp_check)@@ -2579,7 +2594,8 @@ static bool opfvf_cmp_check(DisasContext *s, arg_rmrr *a) return require_rvv(s) && require_rvf(s) && vext_check_isa_ill(s) && - vext_check_ms(s, a->rd, a->rs2); + vext_check_ms(s, a->rd, a->rs2) && + require_zve64f(s); } GEN_OPFVF_TRANS(vmfeq_vf, opfvf_cmp_check)@@ -2600,7 +2616,8 @@ static bool trans_vfmv_v_f(DisasContext *s, arg_vfmv_v_f *a) if (require_rvv(s) && require_rvf(s) && vext_check_isa_ill(s) && - require_align(a->rd, s->lmul)) { + require_align(a->rd, s->lmul) && + require_zve64f(s)) { gen_set_rm(s, RISCV_FRM_DYN); TCGv_i64 t1;@@ -3326,7 +3343,8 @@ static bool trans_vfmv_f_s(DisasContext *s, arg_vfmv_f_s *a) { if (require_rvv(s) && require_rvf(s) && - vext_check_isa_ill(s)) { + vext_check_isa_ill(s) && + require_zve64f(s)) { gen_set_rm(s, RISCV_FRM_DYN); unsigned int ofs = (8 << s->sew);@@ -3352,7 +3370,8 @@ static bool trans_vfmv_s_f(DisasContext *s, arg_vfmv_s_f *a) { if (require_rvv(s) && require_rvf(s) && - vext_check_isa_ill(s)) { + vext_check_isa_ill(s) && + require_zve64f(s)) { gen_set_rm(s, RISCV_FRM_DYN); /* The instructions ignore LMUL and vector register group. */@@ -3403,13 +3422,15 @@ GEN_OPIVI_TRANS(vslidedown_vi, IMM_ZX, vslidedown_vx, slidedown_check) static bool fslideup_check(DisasContext *s, arg_rmrr *a) { return slideup_check(s, a) && - require_rvf(s); + require_rvf(s) && + require_zve64f(s); } static bool fslidedown_check(DisasContext *s, arg_rmrr *a) { return slidedown_check(s, a) && - require_rvf(s); + require_rvf(s) && + require_zve64f(s); } GEN_OPFVF_TRANS(vfslide1up_vf, fslideup_check) --2.31.1
PATCH 7/17 target/riscv: rvv-1.0: Add Zve64f support for single-width fp reduction insns
In reply to [email protected]From: Frank Chang <[email protected]>
Vector single-width floating-point reduction operations for EEW=32 are supported for Zve64f extension.
--- target/riscv/insn_trans/trans_rvv.c.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/riscv/insn_trans/trans_rvv.c.inc +2 -1
@@ -2935,7 +2935,8 @@ GEN_OPIVV_WIDEN_TRANS(vwredsumu_vs, reduction_widen_check) static bool freduction_check(DisasContext *s, arg_rmrr *a) { return reduction_check(s, a) && - require_rvf(s); + require_rvf(s) && + require_zve64f(s); } GEN_OPFVV_TRANS(vfredsum_vs, freduction_check)
Signature · 1 line
2.31.1
Re: [PATCH 07/17] target/riscv: rvv-1.0: Add Zve64f support for single-width fp reduction insns
Quoted 7 lines · On Wed, Dec 29, 2021 at 12:41 PM <[email protected]> wrote:
From: Frank Chang <[email protected]>
Vector single-width floating-point reduction operations for EEW=32 are supported for Zve64f extension.
Signed-off-by Frank Chang <[email protected]>
Alistair
Quoted 22 lines
--- target/riscv/insn_trans/trans_rvv.c.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)target/riscv/insn_trans/trans_rvv.c.inc +2
-2@@ -2935,7 +2935,8 @@ GEN_OPIVV_WIDEN_TRANS(vwredsumu_vs, reduction_widen_check) static bool freduction_check(DisasContext *s, arg_rmrr *a) { return reduction_check(s, a) && - require_rvf(s); + require_rvf(s) && + require_zve64f(s); } GEN_OPFVV_TRANS(vfredsum_vs, freduction_check) --2.31.1
PATCH 8/17 target/riscv: rvv-1.0: Add Zve64f support for widening type-convert insns
In reply to [email protected]From: Frank Chang <[email protected]>
Vector widening conversion instructions are provided to and from all supported integer EEWs for Zve64f extension.
--- target/riscv/insn_trans/trans_rvv.c.inc | 32 +++++++++++++++++++------ 1 file changed, 25 insertions(+), 7 deletions(-)
target/riscv/insn_trans/trans_rvv.c.inc +25 -7
@@ -77,6 +77,17 @@ static bool require_zve64f(DisasContext *s) return s->ext_zve64f ? s->sew <= MO_32 : true; } +static bool require_scale_zve64f(DisasContext *s) +{ + /* RVV + Zve64f = RVV. */ + if (has_ext(s, RVV)) { + return true; + } + + /* Zve64f doesn't support FP64. (Section 18.2) */ + return s->ext_zve64f ? s->sew <= MO_16 : true; +} + /* Destination vector register group cannot overlap source mask register. */ static bool require_vm(int vm, int vd) {
@@ -2331,7 +2342,8 @@ static bool opfvv_widen_check(DisasContext *s, arg_rmrr *a) require_scale_rvf(s) && (s->sew != MO_8) && vext_check_isa_ill(s) && - vext_check_dss(s, a->rd, a->rs1, a->rs2, a->vm); + vext_check_dss(s, a->rd, a->rs1, a->rs2, a->vm) && + require_scale_zve64f(s); } /* OPFVV with WIDEN */
@@ -2370,7 +2382,8 @@ static bool opfvf_widen_check(DisasContext *s, arg_rmrr *a) require_scale_rvf(s) && (s->sew != MO_8) && vext_check_isa_ill(s) && - vext_check_ds(s, a->rd, a->rs2, a->vm); + vext_check_ds(s, a->rd, a->rs2, a->vm) && + require_scale_zve64f(s); } /* OPFVF with WIDEN */
@@ -2400,7 +2413,8 @@ static bool opfwv_widen_check(DisasContext *s, arg_rmrr *a) require_scale_rvf(s) && (s->sew != MO_8) && vext_check_isa_ill(s) && - vext_check_dds(s, a->rd, a->rs1, a->rs2, a->vm); + vext_check_dds(s, a->rd, a->rs1, a->rs2, a->vm) && + require_scale_zve64f(s); } /* WIDEN OPFVV with WIDEN */
@@ -2439,7 +2453,8 @@ static bool opfwf_widen_check(DisasContext *s, arg_rmrr *a) require_scale_rvf(s) && (s->sew != MO_8) && vext_check_isa_ill(s) && - vext_check_dd(s, a->rd, a->rs2, a->vm); + vext_check_dd(s, a->rd, a->rs2, a->vm) && + require_scale_zve64f(s); } /* WIDEN OPFVF with WIDEN */
@@ -2698,14 +2713,16 @@ static bool opfv_widen_check(DisasContext *s, arg_rmr *a) static bool opxfv_widen_check(DisasContext *s, arg_rmr *a) { return opfv_widen_check(s, a) && - require_rvf(s); + require_rvf(s) && + require_zve64f(s); } static bool opffv_widen_check(DisasContext *s, arg_rmr *a) { return opfv_widen_check(s, a) && require_scale_rvf(s) && - (s->sew != MO_8); + (s->sew != MO_8) && + require_scale_zve64f(s); } #define GEN_OPFV_WIDEN_TRANS(NAME, CHECK, HELPER, FRM) \
@@ -2756,7 +2773,8 @@ static bool opfxv_widen_check(DisasContext *s, arg_rmr *a) 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); + vext_check_ds(s, a->rd, a->rs2, a->vm) && + require_scale_zve64f(s); } #define GEN_OPFXV_WIDEN_TRANS(NAME) \
Signature · 1 line
2.31.1
Re: [PATCH 08/17] target/riscv: rvv-1.0: Add Zve64f support for widening type-convert insns
Quoted 7 lines · On Wed, Dec 29, 2021 at 12:42 PM <[email protected]> wrote:
From: Frank Chang <[email protected]>
Vector widening conversion instructions are provided to and from all supported integer EEWs for Zve64f extension.
Signed-off-by Frank Chang <[email protected]>
Alistair
Quoted 99 lines
--- target/riscv/insn_trans/trans_rvv.c.inc | 32 +++++++++++++++++++------ 1 file changed, 25 insertions(+), 7 deletions(-)target/riscv/insn_trans/trans_rvv.c.inc +25
-8@@ -77,6 +77,17 @@ static bool require_zve64f(DisasContext *s) return s->ext_zve64f ? s->sew <= MO_32 : true; } +static bool require_scale_zve64f(DisasContext *s) +{ + /* RVV + Zve64f = RVV. */ + if (has_ext(s, RVV)) { + return true; + } + + /* Zve64f doesn't support FP64. (Section 18.2) */ + return s->ext_zve64f ? s->sew <= MO_16 : true; +} + /* Destination vector register group cannot overlap source mask register. */ static bool require_vm(int vm, int vd) {@@ -2331,7 +2342,8 @@ static bool opfvv_widen_check(DisasContext *s, arg_rmrr *a) require_scale_rvf(s) && (s->sew != MO_8) && vext_check_isa_ill(s) && - vext_check_dss(s, a->rd, a->rs1, a->rs2, a->vm); + vext_check_dss(s, a->rd, a->rs1, a->rs2, a->vm) && + require_scale_zve64f(s); } /* OPFVV with WIDEN */@@ -2370,7 +2382,8 @@ static bool opfvf_widen_check(DisasContext *s, arg_rmrr *a) require_scale_rvf(s) && (s->sew != MO_8) && vext_check_isa_ill(s) && - vext_check_ds(s, a->rd, a->rs2, a->vm); + vext_check_ds(s, a->rd, a->rs2, a->vm) && + require_scale_zve64f(s); } /* OPFVF with WIDEN */@@ -2400,7 +2413,8 @@ static bool opfwv_widen_check(DisasContext *s, arg_rmrr *a) require_scale_rvf(s) && (s->sew != MO_8) && vext_check_isa_ill(s) && - vext_check_dds(s, a->rd, a->rs1, a->rs2, a->vm); + vext_check_dds(s, a->rd, a->rs1, a->rs2, a->vm) && + require_scale_zve64f(s); } /* WIDEN OPFVV with WIDEN */@@ -2439,7 +2453,8 @@ static bool opfwf_widen_check(DisasContext *s, arg_rmrr *a) require_scale_rvf(s) && (s->sew != MO_8) && vext_check_isa_ill(s) && - vext_check_dd(s, a->rd, a->rs2, a->vm); + vext_check_dd(s, a->rd, a->rs2, a->vm) && + require_scale_zve64f(s); } /* WIDEN OPFVF with WIDEN */@@ -2698,14 +2713,16 @@ static bool opfv_widen_check(DisasContext *s, arg_rmr *a) static bool opxfv_widen_check(DisasContext *s, arg_rmr *a) { return opfv_widen_check(s, a) && - require_rvf(s); + require_rvf(s) && + require_zve64f(s); } static bool opffv_widen_check(DisasContext *s, arg_rmr *a) { return opfv_widen_check(s, a) && require_scale_rvf(s) && - (s->sew != MO_8); + (s->sew != MO_8) && + require_scale_zve64f(s); } #define GEN_OPFV_WIDEN_TRANS(NAME, CHECK, HELPER, FRM) \@@ -2756,7 +2773,8 @@ static bool opfxv_widen_check(DisasContext *s, arg_rmr *a) 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); + vext_check_ds(s, a->rd, a->rs2, a->vm) && + require_scale_zve64f(s); } #define GEN_OPFXV_WIDEN_TRANS(NAME) \ --2.31.1
PATCH 9/17 target/riscv: rvv-1.0: Add Zve64f support for narrowing type-convert insns
In reply to [email protected]From: Frank Chang <[email protected]>
Vector narrowing conversion instructions are provided to and from all supported integer EEWs for Zve64f extension.
--- target/riscv/insn_trans/trans_rvv.c.inc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
target/riscv/insn_trans/trans_rvv.c.inc +6 -3
@@ -2824,14 +2824,16 @@ static bool opfxv_narrow_check(DisasContext *s, arg_rmr *a) { return opfv_narrow_check(s, a) && require_rvf(s) && - (s->sew != MO_64); + (s->sew != MO_64) && + require_zve64f(s); } static bool opffv_narrow_check(DisasContext *s, arg_rmr *a) { return opfv_narrow_check(s, a) && require_scale_rvf(s) && - (s->sew != MO_8); + (s->sew != MO_8) && + require_scale_zve64f(s); } #define GEN_OPFV_NARROW_TRANS(NAME, CHECK, HELPER, FRM) \
@@ -2880,7 +2882,8 @@ static bool opxfv_narrow_check(DisasContext *s, arg_rmr *a) require_scale_rvf(s) && vext_check_isa_ill(s) && /* OPFV narrowing instructions ignore vs1 check */ - vext_check_sd(s, a->rd, a->rs2, a->vm); + vext_check_sd(s, a->rd, a->rs2, a->vm) && + require_scale_zve64f(s); } #define GEN_OPXFV_NARROW_TRANS(NAME, HELPER, FRM) \
Signature · 1 line
2.31.1
Re: [PATCH 09/17] target/riscv: rvv-1.0: Add Zve64f support for narrowing type-convert insns
Quoted 7 lines · On Wed, Dec 29, 2021 at 12:45 PM <[email protected]> wrote:
From: Frank Chang <[email protected]>
Vector narrowing conversion instructions are provided to and from all supported integer EEWs for Zve64f extension.
Signed-off-by Frank Chang <[email protected]>
Alistair
Quoted 41 lines
--- target/riscv/insn_trans/trans_rvv.c.inc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)target/riscv/insn_trans/trans_rvv.c.inc +6
-4@@ -2824,14 +2824,16 @@ static bool opfxv_narrow_check(DisasContext *s, arg_rmr *a) { return opfv_narrow_check(s, a) && require_rvf(s) && - (s->sew != MO_64); + (s->sew != MO_64) && + require_zve64f(s); } static bool opffv_narrow_check(DisasContext *s, arg_rmr *a) { return opfv_narrow_check(s, a) && require_scale_rvf(s) && - (s->sew != MO_8); + (s->sew != MO_8) && + require_scale_zve64f(s); } #define GEN_OPFV_NARROW_TRANS(NAME, CHECK, HELPER, FRM) \@@ -2880,7 +2882,8 @@ static bool opxfv_narrow_check(DisasContext *s, arg_rmr *a) require_scale_rvf(s) && vext_check_isa_ill(s) && /* OPFV narrowing instructions ignore vs1 check */ - vext_check_sd(s, a->rd, a->rs2, a->vm); + vext_check_sd(s, a->rd, a->rs2, a->vm) && + require_scale_zve64f(s); } #define GEN_OPXFV_NARROW_TRANS(NAME, HELPER, FRM) \ --2.31.1
PATCH 10/17 target/riscv: rvv-1.0: Allow Zve64f extension to be turned on
In reply to [email protected]From: Frank Chang <[email protected]>
--- target/riscv/cpu.c | 1 + 1 file changed, 1 insertion(+)
target/riscv/cpu.c +1 -0
@@ -636,6 +636,7 @@ static Property riscv_cpu_properties[] = {DEFINE_PROP_BOOL ("Zicsr" ,RISCVCPU , cfg.ext_icsr, true),DEFINE_PROP_BOOL ("Zfh" ,RISCVCPU , cfg.ext_zfh, false),DEFINE_PROP_BOOL ("Zfhmin" ,RISCVCPU , cfg.ext_zfhmin, false), +DEFINE_PROP_BOOL ("Zve64f" ,RISCVCPU , cfg.ext_zve64f, false),DEFINE_PROP_BOOL ("mmu" ,RISCVCPU , cfg.mmu, true), DEFINE_PROP_BOOL("pmp", RISCVCPU, cfg.pmp, true),
Signature · 1 line
2.31.1
Re: [PATCH 10/17] target/riscv: rvv-1.0: Allow Zve64f extension to be turned on
Quoted 4 lines · On Wed, Dec 29, 2021 at 12:44 PM <[email protected]> wrote:
From: Frank Chang <[email protected]>
Signed-off-by Frank Chang <[email protected]>
Alistair
Quoted 20 lines
--- target/riscv/cpu.c | 1 + 1 file changed, 1 insertion(+)target/riscv/cpu.c +1
-1@@ -636,6 +636,7 @@ static Property riscv_cpu_properties[] = {DEFINE_PROP_BOOL ("Zicsr" ,RISCVCPU , cfg.ext_icsr, true),DEFINE_PROP_BOOL ("Zfh" ,RISCVCPU , cfg.ext_zfh, false),DEFINE_PROP_BOOL ("Zfhmin" ,RISCVCPU , cfg.ext_zfhmin, false), +DEFINE_PROP_BOOL ("Zve64f" ,RISCVCPU , cfg.ext_zve64f, false),DEFINE_PROP_BOOL ("mmu" ,RISCVCPU , cfg.mmu, true), DEFINE_PROP_BOOL("pmp", RISCVCPU, cfg.pmp, true), --2.31.1
PATCH 11/17 target/riscv: rvv-1.0: Add Zve32f extension into RISC-V
In reply to [email protected]From: Frank Chang <[email protected]>
--- target/riscv/cpu.c | 4 ++-- target/riscv/cpu.h | 1 + target/riscv/cpu_helper.c | 2 +- target/riscv/csr.c | 2 +- target/riscv/translate.c | 2 ++ 5 files changed, 7 insertions(+), 4 deletions(-)
target/riscv/cpu.c +2 -2
@@ -562,8 +562,8 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) }set_vext_version (env, vext_version); } -if (cpu->cfg.ext_zve64f && !cpu->cfg.ext_f) { -error_setg (errp,"Zve64f extension depends upon RVF." ); +if ((cpu->cfg.ext_zve32f || cpu->cfg.ext_zve64f) && !cpu->cfg.ext_f) { +error_setg (errp,"Zve32f/Zve64f extension depends upon RVF." );return ; }if (cpu->cfg.ext_j) {
target/riscv/cpu.h +1 -0
@@ -317,6 +317,7 @@ struct RISCVCPU {bool ext_icsr;bool ext_zfh;bool ext_zfhmin; +bool ext_zve32f;bool ext_zve64f;char *priv_spec;
target/riscv/cpu_helper.c +1 -1
@@ -77,7 +77,7 @@ void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc, *pc = env->pc; *cs_base =0 ; -if (riscv_has_ext (env,RVV ) || cpu->cfg.ext_zve64f) { +if (riscv_has_ext (env,RVV ) || cpu->cfg.ext_zve32f || cpu->cfg.ext_zve64f) {/* * If env->vl equals to VLMAX, we can use generic vector operation * expanders (GVEC) to accerlate the vector operations.
target/riscv/csr.c +1 -1
@@ -51,7 +51,7 @@ static RISCVException vs(CPURISCVState *env, int csrno)RISCVCPU *cpu =RISCV_CPU (cs);if (env->misa_ext &RVV || - cpu->cfg.ext_zve64f) { + cpu->cfg.ext_zve32f || cpu->cfg.ext_zve64f) {#if !defined(CONFIG_USER_ONLY )if (!env->debugger && !riscv_cpu_vector_enabled (env)) {return RISCV_EXCP_ILLEGAL_INST ;
target/riscv/translate.c +2 -0
@@ -78,6 +78,7 @@ typedef struct DisasContext {bool ext_ifencei;bool ext_zfh;bool ext_zfhmin; +bool ext_zve32f;bool ext_zve64f;bool hlsx;/* vector extension */
@@ -706,6 +707,7 @@ static void riscv_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) ctx->ext_ifencei = cpu->cfg.ext_ifencei; ctx->ext_zfh = cpu->cfg.ext_zfh; ctx->ext_zfhmin = cpu->cfg.ext_zfhmin; + ctx->ext_zve32f = cpu->cfg.ext_zve32f; ctx->ext_zve64f = cpu->cfg.ext_zve64f; ctx->vlen = cpu->cfg.vlen; ctx->elen = cpu->cfg.elen;
Signature · 1 line
2.31.1
Re: [PATCH 11/17] target/riscv: rvv-1.0: Add Zve32f extension into RISC-V
Quoted 4 lines · On Wed, Dec 29, 2021 at 12:34 PM <[email protected]> wrote:
From: Frank Chang <[email protected]>
Signed-off-by Frank Chang <[email protected]>
Alistair
Quoted 85 lines
--- target/riscv/cpu.c | 4 ++-- target/riscv/cpu.h | 1 + target/riscv/cpu_helper.c | 2 +- target/riscv/csr.c | 2 +- target/riscv/translate.c | 2 ++ 5 files changed, 7 insertions(+), 4 deletions(-)target/riscv/cpu.c +2
-2@@ -562,8 +562,8 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp) }set_vext_version (env, vext_version); } -if (cpu->cfg.ext_zve64f && !cpu->cfg.ext_f) { -error_setg (errp,"Zve64f extension depends upon RVF." ); +if ((cpu->cfg.ext_zve32f || cpu->cfg.ext_zve64f) && !cpu->cfg.ext_f) { +error_setg (errp,"Zve32f/Zve64f extension depends upon RVF." );return ; }if (cpu->cfg.ext_j) {target/riscv/cpu.h +1
-0@@ -317,6 +317,7 @@ struct RISCVCPU {bool ext_icsr;bool ext_zfh;bool ext_zfhmin; +bool ext_zve32f;bool ext_zve64f;char *priv_spec;target/riscv/cpu_helper.c +1
-1@@ -77,7 +77,7 @@ void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc, *pc = env->pc; *cs_base =0 ; -if (riscv_has_ext (env,RVV ) || cpu->cfg.ext_zve64f) { +if (riscv_has_ext (env,RVV ) || cpu->cfg.ext_zve32f || cpu->cfg.ext_zve64f) {/* * If env->vl equals to VLMAX, we can use generic vector operation * expanders (GVEC) to accerlate the vector operations. target/riscv/csr.c +1
-1@@ -51,7 +51,7 @@ static RISCVException vs(CPURISCVState *env, int csrno)RISCVCPU *cpu =RISCV_CPU (cs);if (env->misa_ext &RVV || - cpu->cfg.ext_zve64f) { + cpu->cfg.ext_zve32f || cpu->cfg.ext_zve64f) {#if !defined(CONFIG_USER_ONLY )if (!env->debugger && !riscv_cpu_vector_enabled (env)) {return RISCV_EXCP_ILLEGAL_INST ;target/riscv/translate.c +2
-1@@ -78,6 +78,7 @@ typedef struct DisasContext {bool ext_ifencei;bool ext_zfh;bool ext_zfhmin; +bool ext_zve32f;bool ext_zve64f;bool hlsx;/* vector extension */ @@ -706,6 +707,7 @@ static void riscv_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) ctx->ext_ifencei = cpu->cfg.ext_ifencei; ctx->ext_zfh = cpu->cfg.ext_zfh; ctx->ext_zfhmin = cpu->cfg.ext_zfhmin; + ctx->ext_zve32f = cpu->cfg.ext_zve32f; ctx->ext_zve64f = cpu->cfg.ext_zve64f; ctx->vlen = cpu->cfg.vlen; ctx->elen = cpu->cfg.elen; --2.31.1
PATCH 12/17 target/riscv: rvv-1.0: Add Zve32f support for configuration insns
In reply to [email protected]From: Frank Chang <[email protected]>
All Zve* extensions support the vector configuration instructions.
--- target/riscv/insn_trans/trans_rvv.c.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/riscv/insn_trans/trans_rvv.c.inc +2 -2
@@ -152,7 +152,7 @@ static bool do_vsetvl(DisasContext *s, int rd, int rs1, TCGv s2) TCGv s1, dst; if (!require_rvv(s) || - !(has_ext(s, RVV) || s->ext_zve64f)) { + !(has_ext(s, RVV) || s->ext_zve32f || s->ext_zve64f)) { return false; }
@@ -188,7 +188,7 @@ static bool do_vsetivli(DisasContext *s, int rd, TCGv s1, TCGv s2) TCGv dst; if (!require_rvv(s) || - !(has_ext(s, RVV) || s->ext_zve64f)) { + !(has_ext(s, RVV) || s->ext_zve32f || s->ext_zve64f)) { return false; }
Signature · 1 line
2.31.1
Re: [PATCH 12/17] target/riscv: rvv-1.0: Add Zve32f support for configuration insns
Quoted 6 lines · On Wed, Dec 29, 2021 at 12:39 PM <[email protected]> wrote:
From: Frank Chang <[email protected]>
All Zve* extensions support the vector configuration instructions.
Signed-off-by Frank Chang <[email protected]>
Alistair
Quoted 30 lines
--- target/riscv/insn_trans/trans_rvv.c.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/riscv/insn_trans/trans_rvv.c.inc +2
-3@@ -152,7 +152,7 @@ static bool do_vsetvl(DisasContext *s, int rd, int rs1, TCGv s2) TCGv s1, dst; if (!require_rvv(s) || - !(has_ext(s, RVV) || s->ext_zve64f)) { + !(has_ext(s, RVV) || s->ext_zve32f || s->ext_zve64f)) { return false; }@@ -188,7 +188,7 @@ static bool do_vsetivli(DisasContext *s, int rd, TCGv s1, TCGv s2) TCGv dst; if (!require_rvv(s) || - !(has_ext(s, RVV) || s->ext_zve64f)) { + !(has_ext(s, RVV) || s->ext_zve32f || s->ext_zve64f)) { return false; } --2.31.1
PATCH 13/17 target/riscv: rvv-1.0: Add Zve32f support for scalar fp insns
In reply to [email protected]From: Frank Chang <[email protected]>
Zve32f extension requires the scalar processor to implement the F extension and implement all vector floating-point instructions for floating-point operands with EEW=32 (i.e., no widening floating-point operations).
--- target/riscv/insn_trans/trans_rvv.c.inc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
target/riscv/insn_trans/trans_rvv.c.inc +21 -0
@@ -66,6 +66,17 @@ static bool require_scale_rvf(DisasContext *s) } } +static bool require_zve32f(DisasContext *s) +{ + /* RVV + Zve32f = RVV. */ + if (has_ext(s, RVV)) { + return true; + } + + /* Zve32f doesn't support FP64. (Section 18.2) */ + return s->ext_zve32f ? s->sew <= MO_32 : true; +} + static bool require_zve64f(DisasContext *s) { /* RVV + Zve64f = RVV. */
@@ -2227,6 +2238,7 @@ static bool opfvv_check(DisasContext *s, arg_rmrr *a) require_rvf(s) && vext_check_isa_ill(s) && vext_check_sss(s, a->rd, a->rs1, a->rs2, a->vm) && + require_zve32f(s) && require_zve64f(s); }
@@ -2308,6 +2320,7 @@ static bool opfvf_check(DisasContext *s, arg_rmrr *a) require_rvf(s) && vext_check_isa_ill(s) && vext_check_ss(s, a->rd, a->rs2, a->vm) && + require_zve32f(s) && require_zve64f(s); }
@@ -2530,6 +2543,7 @@ static bool opfv_check(DisasContext *s, arg_rmr *a) vext_check_isa_ill(s) && /* OPFV instructions ignore vs1 check */ vext_check_ss(s, a->rd, a->rs2, a->vm) && + require_zve32f(s) && require_zve64f(s); }
@@ -2596,6 +2610,7 @@ static bool opfvv_cmp_check(DisasContext *s, arg_rmrr *a) require_rvf(s) && vext_check_isa_ill(s) && vext_check_mss(s, a->rd, a->rs1, a->rs2) && + require_zve32f(s) && require_zve64f(s); }
@@ -2610,6 +2625,7 @@ static bool opfvf_cmp_check(DisasContext *s, arg_rmrr *a) require_rvf(s) && vext_check_isa_ill(s) && vext_check_ms(s, a->rd, a->rs2) && + require_zve32f(s) && require_zve64f(s); }
@@ -2632,6 +2648,7 @@ static bool trans_vfmv_v_f(DisasContext *s, arg_vfmv_v_f *a) require_rvf(s) && vext_check_isa_ill(s) && require_align(a->rd, s->lmul) && + require_zve32f(s) && require_zve64f(s)) { gen_set_rm(s, RISCV_FRM_DYN);
@@ -3366,6 +3383,7 @@ static bool trans_vfmv_f_s(DisasContext *s, arg_vfmv_f_s *a) if (require_rvv(s) && require_rvf(s) && vext_check_isa_ill(s) && + require_zve32f(s) && require_zve64f(s)) { gen_set_rm(s, RISCV_FRM_DYN);
@@ -3393,6 +3411,7 @@ static bool trans_vfmv_s_f(DisasContext *s, arg_vfmv_s_f *a) if (require_rvv(s) && require_rvf(s) && vext_check_isa_ill(s) && + require_zve32f(s) && require_zve64f(s)) { gen_set_rm(s, RISCV_FRM_DYN);
@@ -3445,6 +3464,7 @@ static bool fslideup_check(DisasContext *s, arg_rmrr *a) { return slideup_check(s, a) && require_rvf(s) && + require_zve32f(s) && require_zve64f(s); }
@@ -3452,6 +3472,7 @@ static bool fslidedown_check(DisasContext *s, arg_rmrr *a) { return slidedown_check(s, a) && require_rvf(s) && + require_zve32f(s) && require_zve64f(s); }
Signature · 1 line
2.31.1
Re: [PATCH 13/17] target/riscv: rvv-1.0: Add Zve32f support for scalar fp insns
Quoted 9 lines · On Wed, Dec 29, 2021 at 12:48 PM <[email protected]> wrote:
From: Frank Chang <[email protected]>
Zve32f extension requires the scalar processor to implement the F extension and implement all vector floating-point instructions for floating-point operands with EEW=32 (i.e., no widening floating-point operations).
Signed-off-by Frank Chang <[email protected]>
Alistair
Quoted 110 lines
--- target/riscv/insn_trans/trans_rvv.c.inc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)target/riscv/insn_trans/trans_rvv.c.inc +21
-1@@ -66,6 +66,17 @@ static bool require_scale_rvf(DisasContext *s) } } +static bool require_zve32f(DisasContext *s) +{ + /* RVV + Zve32f = RVV. */ + if (has_ext(s, RVV)) { + return true; + } + + /* Zve32f doesn't support FP64. (Section 18.2) */ + return s->ext_zve32f ? s->sew <= MO_32 : true; +} + static bool require_zve64f(DisasContext *s) { /* RVV + Zve64f = RVV. */@@ -2227,6 +2238,7 @@ static bool opfvv_check(DisasContext *s, arg_rmrr *a) require_rvf(s) && vext_check_isa_ill(s) && vext_check_sss(s, a->rd, a->rs1, a->rs2, a->vm) && + require_zve32f(s) && require_zve64f(s); }@@ -2308,6 +2320,7 @@ static bool opfvf_check(DisasContext *s, arg_rmrr *a) require_rvf(s) && vext_check_isa_ill(s) && vext_check_ss(s, a->rd, a->rs2, a->vm) && + require_zve32f(s) && require_zve64f(s); }@@ -2530,6 +2543,7 @@ static bool opfv_check(DisasContext *s, arg_rmr *a) vext_check_isa_ill(s) && /* OPFV instructions ignore vs1 check */ vext_check_ss(s, a->rd, a->rs2, a->vm) && + require_zve32f(s) && require_zve64f(s); }@@ -2596,6 +2610,7 @@ static bool opfvv_cmp_check(DisasContext *s, arg_rmrr *a) require_rvf(s) && vext_check_isa_ill(s) && vext_check_mss(s, a->rd, a->rs1, a->rs2) && + require_zve32f(s) && require_zve64f(s); }@@ -2610,6 +2625,7 @@ static bool opfvf_cmp_check(DisasContext *s, arg_rmrr *a) require_rvf(s) && vext_check_isa_ill(s) && vext_check_ms(s, a->rd, a->rs2) && + require_zve32f(s) && require_zve64f(s); }@@ -2632,6 +2648,7 @@ static bool trans_vfmv_v_f(DisasContext *s, arg_vfmv_v_f *a) require_rvf(s) && vext_check_isa_ill(s) && require_align(a->rd, s->lmul) && + require_zve32f(s) && require_zve64f(s)) { gen_set_rm(s, RISCV_FRM_DYN);@@ -3366,6 +3383,7 @@ static bool trans_vfmv_f_s(DisasContext *s, arg_vfmv_f_s *a) if (require_rvv(s) && require_rvf(s) && vext_check_isa_ill(s) && + require_zve32f(s) && require_zve64f(s)) { gen_set_rm(s, RISCV_FRM_DYN);@@ -3393,6 +3411,7 @@ static bool trans_vfmv_s_f(DisasContext *s, arg_vfmv_s_f *a) if (require_rvv(s) && require_rvf(s) && vext_check_isa_ill(s) && + require_zve32f(s) && require_zve64f(s)) { gen_set_rm(s, RISCV_FRM_DYN);@@ -3445,6 +3464,7 @@ static bool fslideup_check(DisasContext *s, arg_rmrr *a) { return slideup_check(s, a) && require_rvf(s) && + require_zve32f(s) && require_zve64f(s); }@@ -3452,6 +3472,7 @@ static bool fslidedown_check(DisasContext *s, arg_rmrr *a) { return slidedown_check(s, a) && require_rvf(s) && + require_zve32f(s) && require_zve64f(s); } --2.31.1
PATCH 14/17 target/riscv: rvv-1.0: Add Zve32f support for single-width fp reduction insns
In reply to [email protected]From: Frank Chang <[email protected]>
Vector single-width floating-point reduction operations for EEW=32 are supported for Zve32f extension.
--- target/riscv/insn_trans/trans_rvv.c.inc | 1 + 1 file changed, 1 insertion(+)
target/riscv/insn_trans/trans_rvv.c.inc +1 -0
@@ -2974,6 +2974,7 @@ static bool freduction_check(DisasContext *s, arg_rmrr *a) { return reduction_check(s, a) && require_rvf(s) && + require_zve32f(s) && require_zve64f(s); }
Signature · 1 line
2.31.1
Re: [PATCH 14/17] target/riscv: rvv-1.0: Add Zve32f support for single-width fp reduction insns
Quoted 7 lines · On Wed, Dec 29, 2021 at 12:48 PM <[email protected]> wrote:
From: Frank Chang <[email protected]>
Vector single-width floating-point reduction operations for EEW=32 are supported for Zve32f extension.
Signed-off-by Frank Chang <[email protected]>
Alistair
Quoted 20 lines
--- target/riscv/insn_trans/trans_rvv.c.inc | 1 + 1 file changed, 1 insertion(+)target/riscv/insn_trans/trans_rvv.c.inc +1
-1@@ -2974,6 +2974,7 @@ static bool freduction_check(DisasContext *s, arg_rmrr *a) { return reduction_check(s, a) && require_rvf(s) && + require_zve32f(s) && require_zve64f(s); } --2.31.1
PATCH 15/17 target/riscv: rvv-1.0: Add Zve32f support for widening type-convert insns
In reply to [email protected]From: Frank Chang <[email protected]>
Vector widening conversion instructions are provided to and from all supported integer EEWs for Zve32f extension.
--- target/riscv/insn_trans/trans_rvv.c.inc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
target/riscv/insn_trans/trans_rvv.c.inc +18 -0
@@ -77,6 +77,17 @@ static bool require_zve32f(DisasContext *s) return s->ext_zve32f ? s->sew <= MO_32 : true; } +static bool require_scale_zve32f(DisasContext *s) +{ + /* RVV + Zve32f = RVV. */ + if (has_ext(s, RVV)) { + return true; + } + + /* Zve32f doesn't support FP64. (Section 18.2) */ + return s->ext_zve64f ? s->sew <= MO_16 : true; +} + static bool require_zve64f(DisasContext *s) { /* RVV + Zve64f = RVV. */
@@ -2356,6 +2367,7 @@ static bool opfvv_widen_check(DisasContext *s, arg_rmrr *a) (s->sew != MO_8) && vext_check_isa_ill(s) && vext_check_dss(s, a->rd, a->rs1, a->rs2, a->vm) && + require_scale_zve32f(s) && require_scale_zve64f(s); }
@@ -2396,6 +2408,7 @@ static bool opfvf_widen_check(DisasContext *s, arg_rmrr *a) (s->sew != MO_8) && vext_check_isa_ill(s) && vext_check_ds(s, a->rd, a->rs2, a->vm) && + require_scale_zve32f(s) && require_scale_zve64f(s); }
@@ -2427,6 +2440,7 @@ static bool opfwv_widen_check(DisasContext *s, arg_rmrr *a) (s->sew != MO_8) && vext_check_isa_ill(s) && vext_check_dds(s, a->rd, a->rs1, a->rs2, a->vm) && + require_scale_zve32f(s) && require_scale_zve64f(s); }
@@ -2467,6 +2481,7 @@ static bool opfwf_widen_check(DisasContext *s, arg_rmrr *a) (s->sew != MO_8) && vext_check_isa_ill(s) && vext_check_dd(s, a->rd, a->rs2, a->vm) && + require_scale_zve32f(s) && require_scale_zve64f(s); }
@@ -2731,6 +2746,7 @@ static bool opxfv_widen_check(DisasContext *s, arg_rmr *a) { return opfv_widen_check(s, a) && require_rvf(s) && + require_zve32f(s) && require_zve64f(s); }
@@ -2739,6 +2755,7 @@ static bool opffv_widen_check(DisasContext *s, arg_rmr *a) return opfv_widen_check(s, a) && require_scale_rvf(s) && (s->sew != MO_8) && + require_scale_zve32f(s) && require_scale_zve64f(s); }
@@ -2791,6 +2808,7 @@ static bool opfxv_widen_check(DisasContext *s, arg_rmr *a) vext_check_isa_ill(s) && /* OPFV widening instructions ignore vs1 check */ vext_check_ds(s, a->rd, a->rs2, a->vm) && + require_scale_zve32f(s) && require_scale_zve64f(s); }
Signature · 1 line
2.31.1
Re: [PATCH 15/17] target/riscv: rvv-1.0: Add Zve32f support for widening type-convert insns
Quoted 7 lines · On Wed, Dec 29, 2021 at 12:50 PM <[email protected]> wrote:
From: Frank Chang <[email protected]>
Vector widening conversion instructions are provided to and from all supported integer EEWs for Zve32f extension.
Signed-off-by Frank Chang <[email protected]>
Alistair
Quoted 86 lines
--- target/riscv/insn_trans/trans_rvv.c.inc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)target/riscv/insn_trans/trans_rvv.c.inc +18
-1@@ -77,6 +77,17 @@ static bool require_zve32f(DisasContext *s) return s->ext_zve32f ? s->sew <= MO_32 : true; } +static bool require_scale_zve32f(DisasContext *s) +{ + /* RVV + Zve32f = RVV. */ + if (has_ext(s, RVV)) { + return true; + } + + /* Zve32f doesn't support FP64. (Section 18.2) */ + return s->ext_zve64f ? s->sew <= MO_16 : true; +} + static bool require_zve64f(DisasContext *s) { /* RVV + Zve64f = RVV. */@@ -2356,6 +2367,7 @@ static bool opfvv_widen_check(DisasContext *s, arg_rmrr *a) (s->sew != MO_8) && vext_check_isa_ill(s) && vext_check_dss(s, a->rd, a->rs1, a->rs2, a->vm) && + require_scale_zve32f(s) && require_scale_zve64f(s); }@@ -2396,6 +2408,7 @@ static bool opfvf_widen_check(DisasContext *s, arg_rmrr *a) (s->sew != MO_8) && vext_check_isa_ill(s) && vext_check_ds(s, a->rd, a->rs2, a->vm) && + require_scale_zve32f(s) && require_scale_zve64f(s); }@@ -2427,6 +2440,7 @@ static bool opfwv_widen_check(DisasContext *s, arg_rmrr *a) (s->sew != MO_8) && vext_check_isa_ill(s) && vext_check_dds(s, a->rd, a->rs1, a->rs2, a->vm) && + require_scale_zve32f(s) && require_scale_zve64f(s); }@@ -2467,6 +2481,7 @@ static bool opfwf_widen_check(DisasContext *s, arg_rmrr *a) (s->sew != MO_8) && vext_check_isa_ill(s) && vext_check_dd(s, a->rd, a->rs2, a->vm) && + require_scale_zve32f(s) && require_scale_zve64f(s); }@@ -2731,6 +2746,7 @@ static bool opxfv_widen_check(DisasContext *s, arg_rmr *a) { return opfv_widen_check(s, a) && require_rvf(s) && + require_zve32f(s) && require_zve64f(s); }@@ -2739,6 +2755,7 @@ static bool opffv_widen_check(DisasContext *s, arg_rmr *a) return opfv_widen_check(s, a) && require_scale_rvf(s) && (s->sew != MO_8) && + require_scale_zve32f(s) && require_scale_zve64f(s); }@@ -2791,6 +2808,7 @@ static bool opfxv_widen_check(DisasContext *s, arg_rmr *a) vext_check_isa_ill(s) && /* OPFV widening instructions ignore vs1 check */ vext_check_ds(s, a->rd, a->rs2, a->vm) && + require_scale_zve32f(s) && require_scale_zve64f(s); } --2.31.1
PATCH 16/17 target/riscv: rvv-1.0: Add Zve32f support for narrowing type-convert insns
In reply to [email protected]From: Frank Chang <[email protected]>
Vector narrowing conversion instructions are provided to and from all supported integer EEWs for Zve32f extension.
--- target/riscv/insn_trans/trans_rvv.c.inc | 3 +++ 1 file changed, 3 insertions(+)
target/riscv/insn_trans/trans_rvv.c.inc +3 -0
@@ -2860,6 +2860,7 @@ static bool opfxv_narrow_check(DisasContext *s, arg_rmr *a) return opfv_narrow_check(s, a) && require_rvf(s) && (s->sew != MO_64) && + require_zve32f(s) && require_zve64f(s); }
@@ -2868,6 +2869,7 @@ static bool opffv_narrow_check(DisasContext *s, arg_rmr *a) return opfv_narrow_check(s, a) && require_scale_rvf(s) && (s->sew != MO_8) && + require_scale_zve32f(s) && require_scale_zve64f(s); }
@@ -2918,6 +2920,7 @@ static bool opxfv_narrow_check(DisasContext *s, arg_rmr *a) vext_check_isa_ill(s) && /* OPFV narrowing instructions ignore vs1 check */ vext_check_sd(s, a->rd, a->rs2, a->vm) && + require_scale_zve32f(s) && require_scale_zve64f(s); }
Signature · 1 line
2.31.1
Re: [PATCH 16/17] target/riscv: rvv-1.0: Add Zve32f support for narrowing type-convert insns
Quoted 7 lines · On Wed, Dec 29, 2021 at 12:46 PM <[email protected]> wrote:
From: Frank Chang <[email protected]>
Vector narrowing conversion instructions are provided to and from all supported integer EEWs for Zve32f extension.
Signed-off-by Frank Chang <[email protected]>
Alistair
Quoted 36 lines
--- target/riscv/insn_trans/trans_rvv.c.inc | 3 +++ 1 file changed, 3 insertions(+)target/riscv/insn_trans/trans_rvv.c.inc +3
-1@@ -2860,6 +2860,7 @@ static bool opfxv_narrow_check(DisasContext *s, arg_rmr *a) return opfv_narrow_check(s, a) && require_rvf(s) && (s->sew != MO_64) && + require_zve32f(s) && require_zve64f(s); }@@ -2868,6 +2869,7 @@ static bool opffv_narrow_check(DisasContext *s, arg_rmr *a) return opfv_narrow_check(s, a) && require_scale_rvf(s) && (s->sew != MO_8) && + require_scale_zve32f(s) && require_scale_zve64f(s); }@@ -2918,6 +2920,7 @@ static bool opxfv_narrow_check(DisasContext *s, arg_rmr *a) vext_check_isa_ill(s) && /* OPFV narrowing instructions ignore vs1 check */ vext_check_sd(s, a->rd, a->rs2, a->vm) && + require_scale_zve32f(s) && require_scale_zve64f(s); } --2.31.1
PATCH 17/17 target/riscv: rvv-1.0: Allow Zve32f extension to be turned on
In reply to [email protected]From: Frank Chang <[email protected]>
--- target/riscv/cpu.c | 1 + 1 file changed, 1 insertion(+)
target/riscv/cpu.c +1 -0
@@ -636,6 +636,7 @@ static Property riscv_cpu_properties[] = {DEFINE_PROP_BOOL ("Zicsr" ,RISCVCPU , cfg.ext_icsr, true),DEFINE_PROP_BOOL ("Zfh" ,RISCVCPU , cfg.ext_zfh, false),DEFINE_PROP_BOOL ("Zfhmin" ,RISCVCPU , cfg.ext_zfhmin, false), +DEFINE_PROP_BOOL ("Zve32f" ,RISCVCPU , cfg.ext_zve32f, false),DEFINE_PROP_BOOL ("Zve64f" ,RISCVCPU , cfg.ext_zve64f, false),DEFINE_PROP_BOOL ("mmu" ,RISCVCPU , cfg.mmu, true), DEFINE_PROP_BOOL("pmp", RISCVCPU, cfg.pmp, true),
Signature · 1 line
2.31.1
Re: [PATCH 17/17] target/riscv: rvv-1.0: Allow Zve32f extension to be turned on
Quoted 4 lines · On Wed, Dec 29, 2021 at 12:52 PM <[email protected]> wrote:
From: Frank Chang <[email protected]>
Signed-off-by Frank Chang <[email protected]>
Alistair
Quoted 20 lines
--- target/riscv/cpu.c | 1 + 1 file changed, 1 insertion(+)target/riscv/cpu.c +1
-1@@ -636,6 +636,7 @@ static Property riscv_cpu_properties[] = {DEFINE_PROP_BOOL ("Zicsr" ,RISCVCPU , cfg.ext_icsr, true),DEFINE_PROP_BOOL ("Zfh" ,RISCVCPU , cfg.ext_zfh, false),DEFINE_PROP_BOOL ("Zfhmin" ,RISCVCPU , cfg.ext_zfhmin, false), +DEFINE_PROP_BOOL ("Zve32f" ,RISCVCPU , cfg.ext_zve32f, false),DEFINE_PROP_BOOL ("Zve64f" ,RISCVCPU , cfg.ext_zve64f, false),DEFINE_PROP_BOOL ("mmu" ,RISCVCPU , cfg.mmu, true), DEFINE_PROP_BOOL("pmp", RISCVCPU, cfg.pmp, true), --2.31.1
<[email protected]> 於 2021年12月29日 週三 上午10:35寫道:
Quoted 69 lines
From: Frank Chang <[email protected]>
In RVV v1.0 spec, several Zve* vector extensions for embedded processors are defined in Chapter 18.2:
This patchset implements Zve32f and Zve64f extensions.
The port is available at:
https://github.com/sifive/qemu/tree/rvv-zve32f-zve64f-upstreamZve32f can be enabled with -cpu option: Zve32f=true and Zve64f can be enabled with -cpu option: Zve64f=true. V is not required to be enabled explicitly.
Quote from the inclusion diagram for the six standard vector extensions from Nick Knight <[email protected]>:
V | Zve64d | Zve64f / \ Zve64x Zve32f \ / Zve32xNote: This patchset depends on other patchsets listed in Based-on
section below so it is not able to be built unless those patchsets are applied.Based-on: <[email protected]>
Frank Chang (17):
target/riscv: rvv-1.0: Add Zve64f extension into RISC-V target/riscv: rvv-1.0: Add Zve64f support for configuration insns target/riscv: rvv-1.0: Add Zve64f support for load and store insns target/riscv: rvv-1.0: Add Zve64f support for vmulh variant insns target/riscv: rvv-1.0: Add Zve64f support for vsmul.vv and vsmul.vx
insns
target/riscv: rvv-1.0: Add Zve64f support for scalar fp insns target/riscv: rvv-1.0: Add Zve64f support for single-width fp
reduction insns
target/riscv: rvv-1.0: Add Zve64f support for widening type-convert
insns
target/riscv: rvv-1.0: Add Zve64f support for narrowing type-convert
insns
target/riscv: rvv-1.0: Allow Zve64f extension to be turned on target/riscv: rvv-1.0: Add Zve32f extension into RISC-V target/riscv: rvv-1.0: Add Zve32f support for configuration insns target/riscv: rvv-1.0: Add Zve32f support for scalar fp insns target/riscv: rvv-1.0: Add Zve32f support for single-width fp
reduction insns
target/riscv: rvv-1.0: Add Zve32f support for widening type-convert
insns
target/riscv: rvv-1.0: Add Zve32f support for narrowing type-convert
insns
target/riscv: rvv-1.0: Allow Zve32f extension to be turned ontarget/riscv/cpu.c | 6 + target/riscv/cpu.h | 2 + target/riscv/cpu_helper.c | 5 +- target/riscv/csr.c | 6 +- target/riscv/insn_trans/trans_rvv.c.inc | 217 ++++++++++++++++++++---- target/riscv/translate.c | 4 + 6 files changed, 203 insertions(+), 37 deletions(-)
Quoted 5 lines
--
2.31.1
ping