mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 10:34:58 -06:00
target/riscv: vector integer merge and move instructions
Signed-off-by: LIU Zhiwei <zhiwei_liu@c-sky.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200701152549.1218-24-zhiwei_liu@c-sky.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
2b587b3350
commit
f020a7a145
4 changed files with 225 additions and 0 deletions
|
@ -1618,3 +1618,116 @@ GEN_OPIVX_WIDEN_TRANS(vwmaccu_vx)
|
|||
GEN_OPIVX_WIDEN_TRANS(vwmacc_vx)
|
||||
GEN_OPIVX_WIDEN_TRANS(vwmaccsu_vx)
|
||||
GEN_OPIVX_WIDEN_TRANS(vwmaccus_vx)
|
||||
|
||||
/* Vector Integer Merge and Move Instructions */
|
||||
static bool trans_vmv_v_v(DisasContext *s, arg_vmv_v_v *a)
|
||||
{
|
||||
if (vext_check_isa_ill(s) &&
|
||||
vext_check_reg(s, a->rd, false) &&
|
||||
vext_check_reg(s, a->rs1, false)) {
|
||||
|
||||
if (s->vl_eq_vlmax) {
|
||||
tcg_gen_gvec_mov(s->sew, vreg_ofs(s, a->rd),
|
||||
vreg_ofs(s, a->rs1),
|
||||
MAXSZ(s), MAXSZ(s));
|
||||
} else {
|
||||
uint32_t data = FIELD_DP32(0, VDATA, LMUL, s->lmul);
|
||||
static gen_helper_gvec_2_ptr * const fns[4] = {
|
||||
gen_helper_vmv_v_v_b, gen_helper_vmv_v_v_h,
|
||||
gen_helper_vmv_v_v_w, gen_helper_vmv_v_v_d,
|
||||
};
|
||||
TCGLabel *over = gen_new_label();
|
||||
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
|
||||
|
||||
tcg_gen_gvec_2_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, a->rs1),
|
||||
cpu_env, 0, s->vlen / 8, data, fns[s->sew]);
|
||||
gen_set_label(over);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
typedef void gen_helper_vmv_vx(TCGv_ptr, TCGv_i64, TCGv_env, TCGv_i32);
|
||||
static bool trans_vmv_v_x(DisasContext *s, arg_vmv_v_x *a)
|
||||
{
|
||||
if (vext_check_isa_ill(s) &&
|
||||
vext_check_reg(s, a->rd, false)) {
|
||||
|
||||
TCGv s1;
|
||||
TCGLabel *over = gen_new_label();
|
||||
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
|
||||
|
||||
s1 = tcg_temp_new();
|
||||
gen_get_gpr(s1, a->rs1);
|
||||
|
||||
if (s->vl_eq_vlmax) {
|
||||
tcg_gen_gvec_dup_tl(s->sew, vreg_ofs(s, a->rd),
|
||||
MAXSZ(s), MAXSZ(s), s1);
|
||||
} else {
|
||||
TCGv_i32 desc ;
|
||||
TCGv_i64 s1_i64 = tcg_temp_new_i64();
|
||||
TCGv_ptr dest = tcg_temp_new_ptr();
|
||||
uint32_t data = FIELD_DP32(0, VDATA, LMUL, s->lmul);
|
||||
static gen_helper_vmv_vx * const fns[4] = {
|
||||
gen_helper_vmv_v_x_b, gen_helper_vmv_v_x_h,
|
||||
gen_helper_vmv_v_x_w, gen_helper_vmv_v_x_d,
|
||||
};
|
||||
|
||||
tcg_gen_ext_tl_i64(s1_i64, s1);
|
||||
desc = tcg_const_i32(simd_desc(0, s->vlen / 8, data));
|
||||
tcg_gen_addi_ptr(dest, cpu_env, vreg_ofs(s, a->rd));
|
||||
fns[s->sew](dest, s1_i64, cpu_env, desc);
|
||||
|
||||
tcg_temp_free_ptr(dest);
|
||||
tcg_temp_free_i32(desc);
|
||||
tcg_temp_free_i64(s1_i64);
|
||||
}
|
||||
|
||||
tcg_temp_free(s1);
|
||||
gen_set_label(over);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool trans_vmv_v_i(DisasContext *s, arg_vmv_v_i *a)
|
||||
{
|
||||
if (vext_check_isa_ill(s) &&
|
||||
vext_check_reg(s, a->rd, false)) {
|
||||
|
||||
int64_t simm = sextract64(a->rs1, 0, 5);
|
||||
if (s->vl_eq_vlmax) {
|
||||
tcg_gen_gvec_dup_imm(s->sew, vreg_ofs(s, a->rd),
|
||||
MAXSZ(s), MAXSZ(s), simm);
|
||||
} else {
|
||||
TCGv_i32 desc;
|
||||
TCGv_i64 s1;
|
||||
TCGv_ptr dest;
|
||||
uint32_t data = FIELD_DP32(0, VDATA, LMUL, s->lmul);
|
||||
static gen_helper_vmv_vx * const fns[4] = {
|
||||
gen_helper_vmv_v_x_b, gen_helper_vmv_v_x_h,
|
||||
gen_helper_vmv_v_x_w, gen_helper_vmv_v_x_d,
|
||||
};
|
||||
TCGLabel *over = gen_new_label();
|
||||
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
|
||||
|
||||
s1 = tcg_const_i64(simm);
|
||||
dest = tcg_temp_new_ptr();
|
||||
desc = tcg_const_i32(simd_desc(0, s->vlen / 8, data));
|
||||
tcg_gen_addi_ptr(dest, cpu_env, vreg_ofs(s, a->rd));
|
||||
fns[s->sew](dest, s1, cpu_env, desc);
|
||||
|
||||
tcg_temp_free_ptr(dest);
|
||||
tcg_temp_free_i32(desc);
|
||||
tcg_temp_free_i64(s1);
|
||||
gen_set_label(over);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
GEN_OPIVV_TRANS(vmerge_vvm, opivv_vadc_check)
|
||||
GEN_OPIVX_TRANS(vmerge_vxm, opivx_vadc_check)
|
||||
GEN_OPIVI_TRANS(vmerge_vim, 0, vmerge_vxm, opivx_vadc_check)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue