[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v8 06/10] trans_rvv.c.inc: set vstart = 0 in int scalar move insn
From: |
Daniel Henrique Barboza |
Subject: |
[PATCH v8 06/10] trans_rvv.c.inc: set vstart = 0 in int scalar move insns |
Date: |
Fri, 8 Mar 2024 18:53:46 -0300 |
trans_vmv_x_s, trans_vmv_s_x, trans_vfmv_f_s and trans_vfmv_s_f aren't
setting vstart = 0 after execution. This is usually done by a helper in
vector_helper.c but these functions don't use helpers.
We'll set vstart after any potential 'over' brconds, and that will also
mandate a mark_vs_dirty() too.
Fixes: dedc53cbc9 ("target/riscv: rvv-1.0: integer scalar move instructions")
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
---
target/riscv/insn_trans/trans_rvv.c.inc | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc
b/target/riscv/insn_trans/trans_rvv.c.inc
index e42728990e..f3caabc101 100644
--- a/target/riscv/insn_trans/trans_rvv.c.inc
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
@@ -3356,6 +3356,13 @@ static void vec_element_storei(DisasContext *s, int vreg,
store_element(val, tcg_env, endian_ofs(s, vreg, idx), s->sew);
}
+static void vec_set_vstart_zero(void)
+{
+ TCGv_i32 t_zero = tcg_constant_i32(0);
+
+ tcg_gen_st_i32(t_zero, tcg_env, offsetof(CPURISCVState, vstart));
+}
+
/* vmv.x.s rd, vs2 # x[rd] = vs2[0] */
static bool trans_vmv_x_s(DisasContext *s, arg_vmv_x_s *a)
{
@@ -3373,6 +3380,8 @@ static bool trans_vmv_x_s(DisasContext *s, arg_vmv_x_s *a)
vec_element_loadi(s, t1, a->rs2, 0, true);
tcg_gen_trunc_i64_tl(dest, t1);
gen_set_gpr(s, a->rd, dest);
+ vec_set_vstart_zero();
+ mark_vs_dirty(s);
return true;
}
return false;
@@ -3399,8 +3408,9 @@ static bool trans_vmv_s_x(DisasContext *s, arg_vmv_s_x *a)
s1 = get_gpr(s, a->rs1, EXT_NONE);
tcg_gen_ext_tl_i64(t1, s1);
vec_element_storei(s, a->rd, 0, t1);
- mark_vs_dirty(s);
gen_set_label(over);
+ vec_set_vstart_zero();
+ mark_vs_dirty(s);
return true;
}
return false;
@@ -3427,6 +3437,8 @@ static bool trans_vfmv_f_s(DisasContext *s, arg_vfmv_f_s
*a)
}
mark_fs_dirty(s);
+ vec_set_vstart_zero();
+ mark_vs_dirty(s);
return true;
}
return false;
@@ -3452,8 +3464,9 @@ static bool trans_vfmv_s_f(DisasContext *s, arg_vfmv_s_f
*a)
do_nanbox(s, t1, cpu_fpr[a->rs1]);
vec_element_storei(s, a->rd, 0, t1);
- mark_vs_dirty(s);
gen_set_label(over);
+ vec_set_vstart_zero();
+ mark_vs_dirty(s);
return true;
}
return false;
--
2.43.2
- [PATCH v8 00/10] riscv: set vstart_eq_zero on mark_vs_dirty, Daniel Henrique Barboza, 2024/03/08
- [PATCH v8 02/10] target/riscv: handle vstart >= vl in vext_set_tail_elems_1s(), Daniel Henrique Barboza, 2024/03/08
- [PATCH v8 01/10] target/riscv/vector_helper.c: set vstart = 0 in GEN_VEXT_VSLIDEUP_VX(), Daniel Henrique Barboza, 2024/03/08
- [PATCH v8 03/10] target/riscv/vector_helper.c: do vstart=0 after updating tail, Daniel Henrique Barboza, 2024/03/08
- [PATCH v8 04/10] target/riscv/vector_helper.c: update tail with vext_set_tail_elems_1s(), Daniel Henrique Barboza, 2024/03/08
- [PATCH v8 05/10] target/riscv: use vext_set_tail_elems_1s() in vcrypto insns, Daniel Henrique Barboza, 2024/03/08
- [PATCH v8 06/10] trans_rvv.c.inc: set vstart = 0 in int scalar move insns,
Daniel Henrique Barboza <=
- [PATCH v8 07/10] target/riscv: remove 'over' brconds from vector trans, Daniel Henrique Barboza, 2024/03/08
- [PATCH v8 08/10] trans_rvv.c.inc: remove redundant mark_vs_dirty() calls, Daniel Henrique Barboza, 2024/03/08
- [PATCH v8 09/10] target/riscv: Clear vstart_qe_zero flag, Daniel Henrique Barboza, 2024/03/08
- [PATCH v8 10/10] target/riscv/vector_helper.c: optimize loops in ldst helpers, Daniel Henrique Barboza, 2024/03/08
- Re: [PATCH v8 00/10] riscv: set vstart_eq_zero on mark_vs_dirty, Richard Henderson, 2024/03/09