Skip to content

Commit

Permalink
target/riscv: rvv: Add missing early exit condition for whole registe…
Browse files Browse the repository at this point in the history
…r load/store

According to v-spec (section 7.9):
The instructions operate with an effective vector length, evl=NFIELDS*VLEN/EEW,
regardless of current settings in vtype and vl. The usual property that no
elements are written if vstart ≥ vl does not apply to these instructions.
Instead, no elements are written if vstart ≥ evl.

Signed-off-by: eop Chen <eop.chen@sifive.com>
Reviewed-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <164762720573.18409.3931931227997483525-0@git.sr.ht>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
  • Loading branch information
Yueh-Ting (eop) Chen authored and alistair23 committed Mar 31, 2022
1 parent 5242ef8 commit 8ff8ac6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions target/riscv/insn_trans/trans_rvv.c.inc
Expand Up @@ -1121,6 +1121,10 @@ static bool ldst_whole_trans(uint32_t vd, uint32_t rs1, uint32_t nf,
gen_helper_ldst_whole *fn, DisasContext *s,
bool is_store)
{
uint32_t evl = (s->cfg_ptr->vlen / 8) * nf / (1 << s->sew);
TCGLabel *over = gen_new_label();
tcg_gen_brcondi_tl(TCG_COND_GEU, cpu_vstart, evl, over);

TCGv_ptr dest;
TCGv base;
TCGv_i32 desc;
Expand All @@ -1140,6 +1144,7 @@ static bool ldst_whole_trans(uint32_t vd, uint32_t rs1, uint32_t nf,
if (!is_store) {
mark_vs_dirty(s);
}
gen_set_label(over);

return true;
}
Expand Down

0 comments on commit 8ff8ac6

Please sign in to comment.