Message ID | 20211015074627.3957162-82-frank.chang@sifive.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | support vector extension v1.0 | expand |
On Fri, Oct 15, 2021 at 7:12 PM <frank.chang@sifive.com> wrote: > > From: Frank Chang <frank.chang@sifive.com> > > Signed-off-by: Frank Chang <frank.chang@sifive.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Alistair > --- > target/riscv/insn32.decode | 2 ++ > target/riscv/insn_trans/trans_rvv.c.inc | 27 +++++++++++++++++++++++++ > 2 files changed, 29 insertions(+) > > diff --git a/target/riscv/insn32.decode b/target/riscv/insn32.decode > index d7c6bc9af26..3b6524bad91 100644 > --- a/target/riscv/insn32.decode > +++ b/target/riscv/insn32.decode > @@ -79,6 +79,7 @@ > @r_vm_1 ...... . ..... ..... ... ..... ....... &rmrr vm=1 %rs2 %rs1 %rd > @r_vm_0 ...... . ..... ..... ... ..... ....... &rmrr vm=0 %rs2 %rs1 %rd > @r2_zimm11 . zimm:11 ..... ... ..... ....... %rs1 %rd > +@r2_zimm10 .. zimm:10 ..... ... ..... ....... %rs1 %rd > @r2_s ....... ..... ..... ... ..... ....... %rs2 %rs1 > > @hfence_gvma ....... ..... ..... ... ..... ....... %rs2 %rs1 > @@ -672,6 +673,7 @@ vsext_vf4 010010 . ..... 00101 010 ..... 1010111 @r2_vm > vsext_vf8 010010 . ..... 00011 010 ..... 1010111 @r2_vm > > vsetvli 0 ........... ..... 111 ..... 1010111 @r2_zimm11 > +vsetivli 11 .......... ..... 111 ..... 1010111 @r2_zimm10 > vsetvl 1000000 ..... ..... 111 ..... 1010111 @r > > # *** RV32 Zba Standard Extension *** > diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc > index d463e494b71..9dedcdf4779 100644 > --- a/target/riscv/insn_trans/trans_rvv.c.inc > +++ b/target/riscv/insn_trans/trans_rvv.c.inc > @@ -160,6 +160,26 @@ static bool do_vsetvl(DisasContext *s, int rd, int rs1, TCGv s2) > return true; > } > > +static bool do_vsetivli(DisasContext *s, int rd, TCGv s1, TCGv s2) > +{ > + TCGv dst; > + > + if (!require_rvv(s) || !has_ext(s, RVV)) { > + return false; > + } > + > + dst = dest_gpr(s, rd); > + > + gen_helper_vsetvl(dst, cpu_env, s1, s2); > + gen_set_gpr(s, rd, dst); > + mark_vs_dirty(s); > + tcg_gen_movi_tl(cpu_pc, s->pc_succ_insn); > + lookup_and_goto_ptr(s); > + s->base.is_jmp = DISAS_NORETURN; > + > + return true; > +} > + > static bool trans_vsetvl(DisasContext *s, arg_vsetvl *a) > { > TCGv s2 = get_gpr(s, a->rs2, EXT_ZERO); > @@ -172,6 +192,13 @@ static bool trans_vsetvli(DisasContext *s, arg_vsetvli *a) > return do_vsetvl(s, a->rd, a->rs1, s2); > } > > +static bool trans_vsetivli(DisasContext *s, arg_vsetivli *a) > +{ > + TCGv s1 = tcg_const_tl(a->rs1); > + TCGv s2 = tcg_const_tl(a->zimm); > + return do_vsetivli(s, a->rd, s1, s2); > +} > + > /* vector register offset from env */ > static uint32_t vreg_ofs(DisasContext *s, int reg) > { > -- > 2.25.1 > >
diff --git a/target/riscv/insn32.decode b/target/riscv/insn32.decode index d7c6bc9af26..3b6524bad91 100644 --- a/target/riscv/insn32.decode +++ b/target/riscv/insn32.decode @@ -79,6 +79,7 @@ @r_vm_1 ...... . ..... ..... ... ..... ....... &rmrr vm=1 %rs2 %rs1 %rd @r_vm_0 ...... . ..... ..... ... ..... ....... &rmrr vm=0 %rs2 %rs1 %rd @r2_zimm11 . zimm:11 ..... ... ..... ....... %rs1 %rd +@r2_zimm10 .. zimm:10 ..... ... ..... ....... %rs1 %rd @r2_s ....... ..... ..... ... ..... ....... %rs2 %rs1 @hfence_gvma ....... ..... ..... ... ..... ....... %rs2 %rs1 @@ -672,6 +673,7 @@ vsext_vf4 010010 . ..... 00101 010 ..... 1010111 @r2_vm vsext_vf8 010010 . ..... 00011 010 ..... 1010111 @r2_vm vsetvli 0 ........... ..... 111 ..... 1010111 @r2_zimm11 +vsetivli 11 .......... ..... 111 ..... 1010111 @r2_zimm10 vsetvl 1000000 ..... ..... 111 ..... 1010111 @r # *** RV32 Zba Standard Extension *** diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc index d463e494b71..9dedcdf4779 100644 --- a/target/riscv/insn_trans/trans_rvv.c.inc +++ b/target/riscv/insn_trans/trans_rvv.c.inc @@ -160,6 +160,26 @@ static bool do_vsetvl(DisasContext *s, int rd, int rs1, TCGv s2) return true; } +static bool do_vsetivli(DisasContext *s, int rd, TCGv s1, TCGv s2) +{ + TCGv dst; + + if (!require_rvv(s) || !has_ext(s, RVV)) { + return false; + } + + dst = dest_gpr(s, rd); + + gen_helper_vsetvl(dst, cpu_env, s1, s2); + gen_set_gpr(s, rd, dst); + mark_vs_dirty(s); + tcg_gen_movi_tl(cpu_pc, s->pc_succ_insn); + lookup_and_goto_ptr(s); + s->base.is_jmp = DISAS_NORETURN; + + return true; +} + static bool trans_vsetvl(DisasContext *s, arg_vsetvl *a) { TCGv s2 = get_gpr(s, a->rs2, EXT_ZERO); @@ -172,6 +192,13 @@ static bool trans_vsetvli(DisasContext *s, arg_vsetvli *a) return do_vsetvl(s, a->rd, a->rs1, s2); } +static bool trans_vsetivli(DisasContext *s, arg_vsetivli *a) +{ + TCGv s1 = tcg_const_tl(a->rs1); + TCGv s2 = tcg_const_tl(a->zimm); + return do_vsetivli(s, a->rd, s1, s2); +} + /* vector register offset from env */ static uint32_t vreg_ofs(DisasContext *s, int reg) {