target/arm: Use tcg_constant in translate-vfp.c
Use tcg_constant_{i32,i64} as appropriate throughout. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
aa5b0b29b1
commit
230c90ceb4
@ -180,8 +180,7 @@ static void gen_update_fp_context(DisasContext *s)
|
||||
gen_helper_vfp_set_fpscr(cpu_env, fpscr);
|
||||
tcg_temp_free_i32(fpscr);
|
||||
if (dc_isar_feature(aa32_mve, s)) {
|
||||
TCGv_i32 z32 = tcg_const_i32(0);
|
||||
store_cpu_field(z32, v7m.vpr);
|
||||
store_cpu_field(tcg_constant_i32(0), v7m.vpr);
|
||||
}
|
||||
/*
|
||||
* We just updated the FPSCR and VPR. Some of this state is cached
|
||||
@ -317,7 +316,7 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a)
|
||||
TCGv_i64 frn, frm, dest;
|
||||
TCGv_i64 tmp, zero, zf, nf, vf;
|
||||
|
||||
zero = tcg_const_i64(0);
|
||||
zero = tcg_constant_i64(0);
|
||||
|
||||
frn = tcg_temp_new_i64();
|
||||
frm = tcg_temp_new_i64();
|
||||
@ -335,27 +334,22 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a)
|
||||
vfp_load_reg64(frm, rm);
|
||||
switch (a->cc) {
|
||||
case 0: /* eq: Z */
|
||||
tcg_gen_movcond_i64(TCG_COND_EQ, dest, zf, zero,
|
||||
frn, frm);
|
||||
tcg_gen_movcond_i64(TCG_COND_EQ, dest, zf, zero, frn, frm);
|
||||
break;
|
||||
case 1: /* vs: V */
|
||||
tcg_gen_movcond_i64(TCG_COND_LT, dest, vf, zero,
|
||||
frn, frm);
|
||||
tcg_gen_movcond_i64(TCG_COND_LT, dest, vf, zero, frn, frm);
|
||||
break;
|
||||
case 2: /* ge: N == V -> N ^ V == 0 */
|
||||
tmp = tcg_temp_new_i64();
|
||||
tcg_gen_xor_i64(tmp, vf, nf);
|
||||
tcg_gen_movcond_i64(TCG_COND_GE, dest, tmp, zero,
|
||||
frn, frm);
|
||||
tcg_gen_movcond_i64(TCG_COND_GE, dest, tmp, zero, frn, frm);
|
||||
tcg_temp_free_i64(tmp);
|
||||
break;
|
||||
case 3: /* gt: !Z && N == V */
|
||||
tcg_gen_movcond_i64(TCG_COND_NE, dest, zf, zero,
|
||||
frn, frm);
|
||||
tcg_gen_movcond_i64(TCG_COND_NE, dest, zf, zero, frn, frm);
|
||||
tmp = tcg_temp_new_i64();
|
||||
tcg_gen_xor_i64(tmp, vf, nf);
|
||||
tcg_gen_movcond_i64(TCG_COND_GE, dest, tmp, zero,
|
||||
dest, frm);
|
||||
tcg_gen_movcond_i64(TCG_COND_GE, dest, tmp, zero, dest, frm);
|
||||
tcg_temp_free_i64(tmp);
|
||||
break;
|
||||
}
|
||||
@ -367,13 +361,11 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a)
|
||||
tcg_temp_free_i64(zf);
|
||||
tcg_temp_free_i64(nf);
|
||||
tcg_temp_free_i64(vf);
|
||||
|
||||
tcg_temp_free_i64(zero);
|
||||
} else {
|
||||
TCGv_i32 frn, frm, dest;
|
||||
TCGv_i32 tmp, zero;
|
||||
|
||||
zero = tcg_const_i32(0);
|
||||
zero = tcg_constant_i32(0);
|
||||
|
||||
frn = tcg_temp_new_i32();
|
||||
frm = tcg_temp_new_i32();
|
||||
@ -382,27 +374,22 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a)
|
||||
vfp_load_reg32(frm, rm);
|
||||
switch (a->cc) {
|
||||
case 0: /* eq: Z */
|
||||
tcg_gen_movcond_i32(TCG_COND_EQ, dest, cpu_ZF, zero,
|
||||
frn, frm);
|
||||
tcg_gen_movcond_i32(TCG_COND_EQ, dest, cpu_ZF, zero, frn, frm);
|
||||
break;
|
||||
case 1: /* vs: V */
|
||||
tcg_gen_movcond_i32(TCG_COND_LT, dest, cpu_VF, zero,
|
||||
frn, frm);
|
||||
tcg_gen_movcond_i32(TCG_COND_LT, dest, cpu_VF, zero, frn, frm);
|
||||
break;
|
||||
case 2: /* ge: N == V -> N ^ V == 0 */
|
||||
tmp = tcg_temp_new_i32();
|
||||
tcg_gen_xor_i32(tmp, cpu_VF, cpu_NF);
|
||||
tcg_gen_movcond_i32(TCG_COND_GE, dest, tmp, zero,
|
||||
frn, frm);
|
||||
tcg_gen_movcond_i32(TCG_COND_GE, dest, tmp, zero, frn, frm);
|
||||
tcg_temp_free_i32(tmp);
|
||||
break;
|
||||
case 3: /* gt: !Z && N == V */
|
||||
tcg_gen_movcond_i32(TCG_COND_NE, dest, cpu_ZF, zero,
|
||||
frn, frm);
|
||||
tcg_gen_movcond_i32(TCG_COND_NE, dest, cpu_ZF, zero, frn, frm);
|
||||
tmp = tcg_temp_new_i32();
|
||||
tcg_gen_xor_i32(tmp, cpu_VF, cpu_NF);
|
||||
tcg_gen_movcond_i32(TCG_COND_GE, dest, tmp, zero,
|
||||
dest, frm);
|
||||
tcg_gen_movcond_i32(TCG_COND_GE, dest, tmp, zero, dest, frm);
|
||||
tcg_temp_free_i32(tmp);
|
||||
break;
|
||||
}
|
||||
@ -414,8 +401,6 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a)
|
||||
tcg_temp_free_i32(frn);
|
||||
tcg_temp_free_i32(frm);
|
||||
tcg_temp_free_i32(dest);
|
||||
|
||||
tcg_temp_free_i32(zero);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -547,7 +532,7 @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a)
|
||||
fpst = fpstatus_ptr(FPST_FPCR);
|
||||
}
|
||||
|
||||
tcg_shift = tcg_const_i32(0);
|
||||
tcg_shift = tcg_constant_i32(0);
|
||||
|
||||
tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rounding));
|
||||
gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst);
|
||||
@ -595,8 +580,6 @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a)
|
||||
gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst);
|
||||
tcg_temp_free_i32(tcg_rmode);
|
||||
|
||||
tcg_temp_free_i32(tcg_shift);
|
||||
|
||||
tcg_temp_free_ptr(fpst);
|
||||
|
||||
return true;
|
||||
@ -850,15 +833,11 @@ static bool trans_VMSR_VMRS(DisasContext *s, arg_VMSR_VMRS *a)
|
||||
case ARM_VFP_MVFR2:
|
||||
case ARM_VFP_FPSID:
|
||||
if (s->current_el == 1) {
|
||||
TCGv_i32 tcg_reg, tcg_rt;
|
||||
|
||||
gen_set_condexec(s);
|
||||
gen_set_pc_im(s, s->pc_curr);
|
||||
tcg_reg = tcg_const_i32(a->reg);
|
||||
tcg_rt = tcg_const_i32(a->rt);
|
||||
gen_helper_check_hcr_el2_trap(cpu_env, tcg_rt, tcg_reg);
|
||||
tcg_temp_free_i32(tcg_reg);
|
||||
tcg_temp_free_i32(tcg_rt);
|
||||
gen_helper_check_hcr_el2_trap(cpu_env,
|
||||
tcg_constant_i32(a->rt),
|
||||
tcg_constant_i32(a->reg));
|
||||
}
|
||||
/* fall through */
|
||||
case ARM_VFP_FPEXC:
|
||||
@ -2388,8 +2367,6 @@ MAKE_VFM_TRANS_FNS(dp)
|
||||
|
||||
static bool trans_VMOV_imm_hp(DisasContext *s, arg_VMOV_imm_sp *a)
|
||||
{
|
||||
TCGv_i32 fd;
|
||||
|
||||
if (!dc_isar_feature(aa32_fp16_arith, s)) {
|
||||
return false;
|
||||
}
|
||||
@ -2402,9 +2379,7 @@ static bool trans_VMOV_imm_hp(DisasContext *s, arg_VMOV_imm_sp *a)
|
||||
return true;
|
||||
}
|
||||
|
||||
fd = tcg_const_i32(vfp_expand_imm(MO_16, a->imm));
|
||||
vfp_store_reg32(fd, a->vd);
|
||||
tcg_temp_free_i32(fd);
|
||||
vfp_store_reg32(tcg_constant_i32(vfp_expand_imm(MO_16, a->imm)), a->vd);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2440,7 +2415,7 @@ static bool trans_VMOV_imm_sp(DisasContext *s, arg_VMOV_imm_sp *a)
|
||||
}
|
||||
}
|
||||
|
||||
fd = tcg_const_i32(vfp_expand_imm(MO_32, a->imm));
|
||||
fd = tcg_constant_i32(vfp_expand_imm(MO_32, a->imm));
|
||||
|
||||
for (;;) {
|
||||
vfp_store_reg32(fd, vd);
|
||||
@ -2454,7 +2429,6 @@ static bool trans_VMOV_imm_sp(DisasContext *s, arg_VMOV_imm_sp *a)
|
||||
vd = vfp_advance_sreg(vd, delta_d);
|
||||
}
|
||||
|
||||
tcg_temp_free_i32(fd);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2495,7 +2469,7 @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a)
|
||||
}
|
||||
}
|
||||
|
||||
fd = tcg_const_i64(vfp_expand_imm(MO_64, a->imm));
|
||||
fd = tcg_constant_i64(vfp_expand_imm(MO_64, a->imm));
|
||||
|
||||
for (;;) {
|
||||
vfp_store_reg64(fd, vd);
|
||||
@ -2509,7 +2483,6 @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a)
|
||||
vd = vfp_advance_dreg(vd, delta_d);
|
||||
}
|
||||
|
||||
tcg_temp_free_i64(fd);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3294,7 +3267,7 @@ static bool trans_VCVT_fix_hp(DisasContext *s, arg_VCVT_fix_sp *a)
|
||||
vfp_load_reg32(vd, a->vd);
|
||||
|
||||
fpst = fpstatus_ptr(FPST_FPCR_F16);
|
||||
shift = tcg_const_i32(frac_bits);
|
||||
shift = tcg_constant_i32(frac_bits);
|
||||
|
||||
/* Switch on op:U:sx bits */
|
||||
switch (a->opc) {
|
||||
@ -3328,7 +3301,6 @@ static bool trans_VCVT_fix_hp(DisasContext *s, arg_VCVT_fix_sp *a)
|
||||
|
||||
vfp_store_reg32(vd, a->vd);
|
||||
tcg_temp_free_i32(vd);
|
||||
tcg_temp_free_i32(shift);
|
||||
tcg_temp_free_ptr(fpst);
|
||||
return true;
|
||||
}
|
||||
@ -3353,7 +3325,7 @@ static bool trans_VCVT_fix_sp(DisasContext *s, arg_VCVT_fix_sp *a)
|
||||
vfp_load_reg32(vd, a->vd);
|
||||
|
||||
fpst = fpstatus_ptr(FPST_FPCR);
|
||||
shift = tcg_const_i32(frac_bits);
|
||||
shift = tcg_constant_i32(frac_bits);
|
||||
|
||||
/* Switch on op:U:sx bits */
|
||||
switch (a->opc) {
|
||||
@ -3387,7 +3359,6 @@ static bool trans_VCVT_fix_sp(DisasContext *s, arg_VCVT_fix_sp *a)
|
||||
|
||||
vfp_store_reg32(vd, a->vd);
|
||||
tcg_temp_free_i32(vd);
|
||||
tcg_temp_free_i32(shift);
|
||||
tcg_temp_free_ptr(fpst);
|
||||
return true;
|
||||
}
|
||||
@ -3418,7 +3389,7 @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a)
|
||||
vfp_load_reg64(vd, a->vd);
|
||||
|
||||
fpst = fpstatus_ptr(FPST_FPCR);
|
||||
shift = tcg_const_i32(frac_bits);
|
||||
shift = tcg_constant_i32(frac_bits);
|
||||
|
||||
/* Switch on op:U:sx bits */
|
||||
switch (a->opc) {
|
||||
@ -3452,7 +3423,6 @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a)
|
||||
|
||||
vfp_store_reg64(vd, a->vd);
|
||||
tcg_temp_free_i64(vd);
|
||||
tcg_temp_free_i32(shift);
|
||||
tcg_temp_free_ptr(fpst);
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user