[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 20/85] target/arm: Introduce fp_access_check_scalar_hsd
From: |
Peter Maydell |
Subject: |
[PULL 20/85] target/arm: Introduce fp_access_check_scalar_hsd |
Date: |
Fri, 13 Dec 2024 17:31:24 +0000 |
From: Richard Henderson <richard.henderson@linaro.org>
Provide a simple way to check for float64, float32,
and float16 support, as well as the fpu enabled.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20241211163036.2297116-21-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/arm/tcg/translate-a64.c | 62 ++++++++++++++++++----------------
1 file changed, 32 insertions(+), 30 deletions(-)
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
index 9c6365f5efc..4e47b8a8041 100644
--- a/target/arm/tcg/translate-a64.c
+++ b/target/arm/tcg/translate-a64.c
@@ -1239,6 +1239,27 @@ static bool fp_access_check(DisasContext *s)
return true;
}
+/*
+ * Return <0 for non-supported element sizes, with MO_16 controlled by
+ * FEAT_FP16; return 0 for fp disabled; otherwise return >0 for success.
+ */
+static int fp_access_check_scalar_hsd(DisasContext *s, MemOp esz)
+{
+ switch (esz) {
+ case MO_64:
+ case MO_32:
+ break;
+ case MO_16:
+ if (!dc_isar_feature(aa64_fp16, s)) {
+ return -1;
+ }
+ break;
+ default:
+ return -1;
+ }
+ return fp_access_check(s);
+}
+
/*
* Check that SVE access is enabled. If it is, return true.
* If not, emit code to generate an appropriate exception and return false.
@@ -6628,22 +6649,10 @@ static bool trans_FCSEL(DisasContext *s, arg_FCSEL *a)
{
TCGv_i64 t_true, t_false;
DisasCompare64 c;
+ int check = fp_access_check_scalar_hsd(s, a->esz);
- switch (a->esz) {
- case MO_32:
- case MO_64:
- break;
- case MO_16:
- if (!dc_isar_feature(aa64_fp16, s)) {
- return false;
- }
- break;
- default:
- return false;
- }
-
- if (!fp_access_check(s)) {
- return true;
+ if (check <= 0) {
+ return check == 0;
}
/* Zero extend sreg & hreg inputs to 64 bits now. */
@@ -6894,22 +6903,15 @@ TRANS(FMINV_s, do_fp_reduction, a, gen_helper_vfp_mins)
static bool trans_FMOVI_s(DisasContext *s, arg_FMOVI_s *a)
{
- switch (a->esz) {
- case MO_32:
- case MO_64:
- break;
- case MO_16:
- if (!dc_isar_feature(aa64_fp16, s)) {
- return false;
- }
- break;
- default:
- return false;
- }
- if (fp_access_check(s)) {
- uint64_t imm = vfp_expand_imm(a->esz, a->imm);
- write_fp_dreg(s, a->rd, tcg_constant_i64(imm));
+ int check = fp_access_check_scalar_hsd(s, a->esz);
+ uint64_t imm;
+
+ if (check <= 0) {
+ return check == 0;
}
+
+ imm = vfp_expand_imm(a->esz, a->imm);
+ write_fp_dreg(s, a->rd, tcg_constant_i64(imm));
return true;
}
--
2.34.1
- [PULL 00/85] target-arm queue, Peter Maydell, 2024/12/13
- [PULL 02/85] target/arm: Convert UDIV, SDIV to decodetree, Peter Maydell, 2024/12/13
- [PULL 13/85] target/arm: Convert disas_add_sub_reg to decodetree, Peter Maydell, 2024/12/13
- [PULL 17/85] target/arm: Convert SETF8, SETF16 to decodetree, Peter Maydell, 2024/12/13
- [PULL 01/85] target/arm: Add section labels for "Data Processing (register)", Peter Maydell, 2024/12/13
- [PULL 06/85] target/arm: Convert PACGA to decodetree, Peter Maydell, 2024/12/13
- [PULL 15/85] target/arm: Convert disas_adc_sbc to decodetree, Peter Maydell, 2024/12/13
- [PULL 20/85] target/arm: Introduce fp_access_check_scalar_hsd,
Peter Maydell <=
- [PULL 21/85] target/arm: Introduce fp_access_check_vector_hsd, Peter Maydell, 2024/12/13
- [PULL 05/85] target/arm: Convert SUBP, IRG, GMI to decodetree, Peter Maydell, 2024/12/13
- [PULL 04/85] target/arm: Convert CRC32, CRC32C to decodetree, Peter Maydell, 2024/12/13
- [PULL 03/85] target/arm: Convert LSLV, LSRV, ASRV, RORV to decodetree, Peter Maydell, 2024/12/13
- [PULL 08/85] target/arm: Convert CLZ, CLS to decodetree, Peter Maydell, 2024/12/13
- [PULL 22/85] target/arm: Convert FCMP, FCMPE, FCCMP, FCCMPE to decodetree, Peter Maydell, 2024/12/13
- [PULL 24/85] target/arm: Convert FMOV, FABS, FNEG (scalar) to decodetree, Peter Maydell, 2024/12/13
- [PULL 29/85] target/arm: Convert BFCVT to decodetree, Peter Maydell, 2024/12/13
- [PULL 33/85] target/arm: Convert FJCVTZS to decodetree, Peter Maydell, 2024/12/13
- [PULL 34/85] target/arm: Convert handle_fmov to decodetree, Peter Maydell, 2024/12/13