target/arm: Convert VFP VMLS to decodetree

Convert the VFP VMLS instruction to decodetree.

Backports commit e7258280d46af4ab6a0cc93ccfe8f6614defb4b7 from qemu
This commit is contained in:
Peter Maydell 2019-06-13 18:02:34 -04:00 committed by Lioncash
parent edf81eb214
commit 67ad40ffa4
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
3 changed files with 44 additions and 6 deletions

View file

@ -1322,3 +1322,41 @@ static bool trans_VMLA_dp(DisasContext *s, arg_VMLA_sp *a)
{
return do_vfp_3op_dp(s, gen_VMLA_dp, a->vd, a->vn, a->vm, true);
}
static void gen_VMLS_sp(TCGContext *tcg_ctx, TCGv_i32 vd, TCGv_i32 vn, TCGv_i32 vm, TCGv_ptr fpst)
{
/*
* VMLS: vd = vd + -(vn * vm)
* Note that order of inputs to the add matters for NaNs.
*/
TCGv_i32 tmp = tcg_temp_new_i32(tcg_ctx);
gen_helper_vfp_muls(tcg_ctx, tmp, vn, vm, fpst);
gen_helper_vfp_negs(tcg_ctx, tmp, tmp);
gen_helper_vfp_adds(tcg_ctx, vd, vd, tmp, fpst);
tcg_temp_free_i32(tcg_ctx, tmp);
}
static bool trans_VMLS_sp(DisasContext *s, arg_VMLS_sp *a)
{
return do_vfp_3op_sp(s, gen_VMLS_sp, a->vd, a->vn, a->vm, true);
}
static void gen_VMLS_dp(TCGContext *tcg_ctx, TCGv_i64 vd, TCGv_i64 vn, TCGv_i64 vm, TCGv_ptr fpst)
{
/*
* VMLS: vd = vd + -(vn * vm)
* Note that order of inputs to the add matters for NaNs.
*/
TCGv_i64 tmp = tcg_temp_new_i64(tcg_ctx);
gen_helper_vfp_muld(tcg_ctx, tmp, vn, vm, fpst);
gen_helper_vfp_negd(tcg_ctx, tmp, tmp);
gen_helper_vfp_addd(tcg_ctx, vd, vd, tmp, fpst);
tcg_temp_free_i64(tcg_ctx, tmp);
}
static bool trans_VMLS_dp(DisasContext *s, arg_VMLS_sp *a)
{
return do_vfp_3op_dp(s, gen_VMLS_dp, a->vd, a->vn, a->vm, true);
}

View file

@ -3239,6 +3239,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn)
switch (op) {
case 0:
case 1:
/* Already handled by decodetree */
return 1;
default:
@ -3424,12 +3425,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn)
for (;;) {
/* Perform the calculation. */
switch (op) {
case 1: /* VMLS: fd + -(fn * fm) */
gen_vfp_mul(s, dp);
gen_vfp_F1_neg(s, dp);
gen_mov_F0_vreg(s, dp, rd);
gen_vfp_add(s, dp);
break;
case 2: /* VNMLS: -fd + (fn * fm) */
/* Note that it isn't valid to replace (-A + B) with (B - A)
* or similar plausible looking simplifications

View file

@ -102,3 +102,8 @@ VMLA_sp ---- 1110 0.00 .... .... 1010 .0.0 .... \
vm=%vm_sp vn=%vn_sp vd=%vd_sp
VMLA_dp ---- 1110 0.00 .... .... 1011 .0.0 .... \
vm=%vm_dp vn=%vn_dp vd=%vd_dp
VMLS_sp ---- 1110 0.00 .... .... 1010 .1.0 .... \
vm=%vm_sp vn=%vn_sp vd=%vd_sp
VMLS_dp ---- 1110 0.00 .... .... 1011 .1.0 .... \
vm=%vm_dp vn=%vn_dp vd=%vd_dp