From 4501daf010499bbb912080e6d8e93fb460f08e81 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Thu, 13 Jun 2019 16:43:48 -0400 Subject: [PATCH] target/arm: Convert VMINNM, VMAXNM to decodetree Convert the VMINNM and VMAXNM instructions to decodetree. As with VSEL, we leave the trans_VMINMAXNM() function in translate.c for the moment. Backports commit f65988a1efdb42f9058db44297591491842e697c from qemu --- qemu/target/arm/translate.c | 41 +++++++++++++++++++++---------- qemu/target/arm/vfp-uncond.decode | 5 ++++ 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/qemu/target/arm/translate.c b/qemu/target/arm/translate.c index 2208e22a..c057853c 100644 --- a/qemu/target/arm/translate.c +++ b/qemu/target/arm/translate.c @@ -3304,12 +3304,32 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) return true; } -static int handle_vminmaxnm(DisasContext *s, uint32_t insn, uint32_t rd, uint32_t rn, - uint32_t rm, uint32_t dp) +static bool trans_VMINMAXNM(DisasContext *s, arg_VMINMAXNM *a) { TCGContext *tcg_ctx = s->uc->tcg_ctx; - uint32_t vmin = extract32(insn, 6, 1); - TCGv_ptr fpst = get_fpstatus_ptr(s, 0); + uint32_t rd, rn, rm; + bool dp = a->dp; + bool vmin = a->op; + TCGv_ptr fpst; + + if (!dc_isar_feature(aa32_vminmaxnm, s)) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist */ + if (dp && !dc_isar_feature(aa32_fp_d32, s) && + ((a->vm | a->vn | a->vd) & 0x10)) { + return false; + } + rd = a->vd; + rn = a->vn; + rm = a->vm; + + if (!vfp_access_check(s)) { + return true; + } + + fpst = get_fpstatus_ptr(s, 0); if (dp) { TCGv_i64 frn, frm, dest; @@ -3350,7 +3370,7 @@ static int handle_vminmaxnm(DisasContext *s, uint32_t insn, uint32_t rd, uint32_ } tcg_temp_free_ptr(tcg_ctx, fpst); - return 0; + return true; } static int handle_vrint(DisasContext *s, uint32_t insn, uint32_t rd, uint32_t rm, uint32_t dp, @@ -3464,23 +3484,18 @@ static const uint8_t fp_decode_rm[] = { static int disas_vfp_misc_insn(DisasContext *s, uint32_t insn) { - uint32_t rd, rn, rm, dp = extract32(insn, 8, 1); + uint32_t rd, rm, dp = extract32(insn, 8, 1); if (dp) { VFP_DREG_D(rd, insn); - VFP_DREG_N(rn, insn); VFP_DREG_M(rm, insn); } else { rd = VFP_SREG_D(insn); - rn = VFP_SREG_N(insn); rm = VFP_SREG_M(insn); } - if ((insn & 0x0fb00e10) == 0x0e800a00 && - dc_isar_feature(aa32_vminmaxnm, s)) { - return handle_vminmaxnm(s, insn, rd, rn, rm, dp); - } else if ((insn & 0x0fbc0ed0) == 0x0eb80a40 && - dc_isar_feature(aa32_vrint, s)) { + if ((insn & 0x0fbc0ed0) == 0x0eb80a40 && + dc_isar_feature(aa32_vrint, s)) { /* VRINTA, VRINTN, VRINTP, VRINTM */ int rounding = fp_decode_rm[extract32(insn, 16, 2)]; return handle_vrint(s, insn, rd, rm, dp, rounding); diff --git a/qemu/target/arm/vfp-uncond.decode b/qemu/target/arm/vfp-uncond.decode index b7f7c27f..8ab201fa 100644 --- a/qemu/target/arm/vfp-uncond.decode +++ b/qemu/target/arm/vfp-uncond.decode @@ -45,3 +45,8 @@ VSEL 1111 1110 0. cc:2 .... .... 1010 .0.0 .... \ vm=%vm_sp vn=%vn_sp vd=%vd_sp dp=0 VSEL 1111 1110 0. cc:2 .... .... 1011 .0.0 .... \ vm=%vm_dp vn=%vn_dp vd=%vd_dp dp=1 + +VMINMAXNM 1111 1110 1.00 .... .... 1010 . op:1 .0 .... \ + vm=%vm_sp vn=%vn_sp vd=%vd_sp dp=0 +VMINMAXNM 1111 1110 1.00 .... .... 1011 . op:1 .0 .... \ + vm=%vm_dp vn=%vn_dp vd=%vd_dp dp=1