target/arm: Add missing checks for fpsp_v2

We will eventually remove the early ARM_FEATURE_VFP test,
so add a proper test for each trans_* that does not already
have another ISA test.

Backports commit 82f6abe16b9b951180657c5fe15942d5214aa12e from qemu
This commit is contained in:
Richard Henderson 2020-03-21 23:42:25 -04:00 committed by Lioncash
parent ed1ce1437a
commit f6b5a9ef81

View file

@ -563,6 +563,13 @@ static bool trans_VMOV_to_gp(DisasContext *s, arg_VMOV_to_gp *a)
int pass; int pass;
uint32_t offset; uint32_t offset;
/* SIZE == 2 is a VFP instruction; otherwise NEON. */
if (a->size == 2
? !dc_isar_feature(aa32_fpsp_v2, s)
: !arm_dc_feature(s, ARM_FEATURE_NEON)) {
return false;
}
/* UNDEF accesses to D16-D31 if they don't exist */ /* UNDEF accesses to D16-D31 if they don't exist */
if (!dc_isar_feature(aa32_simd_r32, s) && (a->vn & 0x10)) { if (!dc_isar_feature(aa32_simd_r32, s) && (a->vn & 0x10)) {
return false; return false;
@ -572,10 +579,6 @@ static bool trans_VMOV_to_gp(DisasContext *s, arg_VMOV_to_gp *a)
pass = extract32(offset, 2, 1); pass = extract32(offset, 2, 1);
offset = extract32(offset, 0, 2) * 8; offset = extract32(offset, 0, 2) * 8;
if (a->size != 2 && !arm_dc_feature(s, ARM_FEATURE_NEON)) {
return false;
}
if (!vfp_access_check(s)) { if (!vfp_access_check(s)) {
return true; return true;
} }
@ -623,6 +626,13 @@ static bool trans_VMOV_from_gp(DisasContext *s, arg_VMOV_from_gp *a)
int pass; int pass;
uint32_t offset; uint32_t offset;
/* SIZE == 2 is a VFP instruction; otherwise NEON. */
if (a->size == 2
? !dc_isar_feature(aa32_fpsp_v2, s)
: !arm_dc_feature(s, ARM_FEATURE_NEON)) {
return false;
}
/* UNDEF accesses to D16-D31 if they don't exist */ /* UNDEF accesses to D16-D31 if they don't exist */
if (!dc_isar_feature(aa32_simd_r32, s) && (a->vn & 0x10)) { if (!dc_isar_feature(aa32_simd_r32, s) && (a->vn & 0x10)) {
return false; return false;
@ -632,10 +642,6 @@ static bool trans_VMOV_from_gp(DisasContext *s, arg_VMOV_from_gp *a)
pass = extract32(offset, 2, 1); pass = extract32(offset, 2, 1);
offset = extract32(offset, 0, 2) * 8; offset = extract32(offset, 0, 2) * 8;
if (a->size != 2 && !arm_dc_feature(s, ARM_FEATURE_NEON)) {
return false;
}
if (!vfp_access_check(s)) { if (!vfp_access_check(s)) {
return true; return true;
} }
@ -711,6 +717,10 @@ static bool trans_VMSR_VMRS(DisasContext *s, arg_VMSR_VMRS *a)
TCGv_i32 tmp; TCGv_i32 tmp;
bool ignore_vfp_enabled = false; bool ignore_vfp_enabled = false;
if (!dc_isar_feature(aa32_fpsp_v2, s)) {
return false;
}
if (arm_dc_feature(s, ARM_FEATURE_M)) { if (arm_dc_feature(s, ARM_FEATURE_M)) {
/* /*
* The only M-profile VFP vmrs/vmsr sysreg is FPSCR. * The only M-profile VFP vmrs/vmsr sysreg is FPSCR.
@ -856,6 +866,10 @@ static bool trans_VMOV_single(DisasContext *s, arg_VMOV_single *a)
TCGContext *tcg_ctx = s->uc->tcg_ctx; TCGContext *tcg_ctx = s->uc->tcg_ctx;
TCGv_i32 tmp; TCGv_i32 tmp;
if (!dc_isar_feature(aa32_fpsp_v2, s)) {
return false;
}
if (!vfp_access_check(s)) { if (!vfp_access_check(s)) {
return true; return true;
} }
@ -886,6 +900,10 @@ static bool trans_VMOV_64_sp(DisasContext *s, arg_VMOV_64_sp *a)
TCGContext *tcg_ctx = s->uc->tcg_ctx; TCGContext *tcg_ctx = s->uc->tcg_ctx;
TCGv_i32 tmp; TCGv_i32 tmp;
if (!dc_isar_feature(aa32_fpsp_v2, s)) {
return false;
}
/* /*
* VMOV between two general-purpose registers and two single precision * VMOV between two general-purpose registers and two single precision
* floating point registers * floating point registers
@ -922,8 +940,12 @@ static bool trans_VMOV_64_dp(DisasContext *s, arg_VMOV_64_dp *a)
/* /*
* VMOV between two general-purpose registers and one double precision * VMOV between two general-purpose registers and one double precision
* floating point register * floating point register. Note that this does not require support
* for double precision arithmetic.
*/ */
if (!dc_isar_feature(aa32_fpsp_v2, s)) {
return false;
}
/* UNDEF accesses to D16-D31 if they don't exist */ /* UNDEF accesses to D16-D31 if they don't exist */
if (!dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) { if (!dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) {
@ -961,6 +983,10 @@ static bool trans_VLDR_VSTR_sp(DisasContext *s, arg_VLDR_VSTR_sp *a)
uint32_t offset; uint32_t offset;
TCGv_i32 addr, tmp; TCGv_i32 addr, tmp;
if (!dc_isar_feature(aa32_fpsp_v2, s)) {
return false;
}
if (!vfp_access_check(s)) { if (!vfp_access_check(s)) {
return true; return true;
} }
@ -994,6 +1020,11 @@ static bool trans_VLDR_VSTR_dp(DisasContext *s, arg_VLDR_VSTR_dp *a)
TCGv_i32 addr; TCGv_i32 addr;
TCGv_i64 tmp; TCGv_i64 tmp;
/* Note that this does not require support for double arithmetic. */
if (!dc_isar_feature(aa32_fpsp_v2, s)) {
return false;
}
/* UNDEF accesses to D16-D31 if they don't exist */ /* UNDEF accesses to D16-D31 if they don't exist */
if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) { if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) {
return false; return false;
@ -1032,6 +1063,10 @@ static bool trans_VLDM_VSTM_sp(DisasContext *s, arg_VLDM_VSTM_sp *a)
TCGv_i32 addr, tmp; TCGv_i32 addr, tmp;
int i, n; int i, n;
if (!dc_isar_feature(aa32_fpsp_v2, s)) {
return false;
}
n = a->imm; n = a->imm;
if (n == 0 || (a->vd + n) > 32) { if (n == 0 || (a->vd + n) > 32) {
@ -1106,6 +1141,11 @@ static bool trans_VLDM_VSTM_dp(DisasContext *s, arg_VLDM_VSTM_dp *a)
TCGv_i64 tmp; TCGv_i64 tmp;
int i, n; int i, n;
/* Note that this does not require support for double arithmetic. */
if (!dc_isar_feature(aa32_fpsp_v2, s)) {
return false;
}
n = a->imm >> 1; n = a->imm >> 1;
if (n == 0 || (a->vd + n) > 32 || n > 16) { if (n == 0 || (a->vd + n) > 32 || n > 16) {
@ -1255,6 +1295,10 @@ static bool do_vfp_3op_sp(DisasContext *s, VFPGen3OpSPFn *fn,
TCGv_i32 f0, f1, fd; TCGv_i32 f0, f1, fd;
TCGv_ptr fpst; TCGv_ptr fpst;
if (!dc_isar_feature(aa32_fpsp_v2, s)) {
return false;
}
if (!dc_isar_feature(aa32_fpshvec, s) && if (!dc_isar_feature(aa32_fpshvec, s) &&
(veclen != 0 || s->vec_stride != 0)) { (veclen != 0 || s->vec_stride != 0)) {
return false; return false;
@ -1411,6 +1455,10 @@ static bool do_vfp_2op_sp(DisasContext *s, VFPGen2OpSPFn *fn, int vd, int vm)
int veclen = s->vec_len; int veclen = s->vec_len;
TCGv_i32 f0, fd; TCGv_i32 f0, fd;
if (!dc_isar_feature(aa32_fpsp_v2, s)) {
return false;
}
if (!dc_isar_feature(aa32_fpshvec, s) && if (!dc_isar_feature(aa32_fpshvec, s) &&
(veclen != 0 || s->vec_stride != 0)) { (veclen != 0 || s->vec_stride != 0)) {
return false; return false;
@ -2051,6 +2099,10 @@ static bool trans_VCMP_sp(DisasContext *s, arg_VCMP_sp *a)
TCGContext *tcg_ctx = s->uc->tcg_ctx; TCGContext *tcg_ctx = s->uc->tcg_ctx;
TCGv_i32 vd, vm; TCGv_i32 vd, vm;
if (!dc_isar_feature(aa32_fpsp_v2, s)) {
return false;
}
/* Vm/M bits must be zero for the Z variant */ /* Vm/M bits must be zero for the Z variant */
if (a->z && a->vm != 0) { if (a->z && a->vm != 0) {
return false; return false;
@ -2509,6 +2561,10 @@ static bool trans_VCVT_int_sp(DisasContext *s, arg_VCVT_int_sp *a)
TCGv_i32 vm; TCGv_i32 vm;
TCGv_ptr fpst; TCGv_ptr fpst;
if (!dc_isar_feature(aa32_fpsp_v2, s)) {
return false;
}
if (!vfp_access_check(s)) { if (!vfp_access_check(s)) {
return true; return true;
} }
@ -2732,6 +2788,10 @@ static bool trans_VCVT_sp_int(DisasContext *s, arg_VCVT_sp_int *a)
TCGv_i32 vm; TCGv_i32 vm;
TCGv_ptr fpst; TCGv_ptr fpst;
if (!dc_isar_feature(aa32_fpsp_v2, s)) {
return false;
}
if (!vfp_access_check(s)) { if (!vfp_access_check(s)) {
return true; return true;
} }