[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 25/36] target/arm: Define new fp_status_f16_a32 and fp_status_f16_
From: |
Peter Maydell |
Subject: |
[PULL 25/36] target/arm: Define new fp_status_f16_a32 and fp_status_f16_a64 |
Date: |
Tue, 28 Jan 2025 20:13:03 +0000 |
As the first part of splitting the existing fp_status_f16
into separate float_status fields for AArch32 and AArch64
(so that we can make FEAT_AFP control bits apply only
for AArch64), define the two new fp_status_f16_a32 and
fp_status_f16_a64 fields, but don't use them yet.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20250124162836.2332150-14-peter.maydell@linaro.org
---
target/arm/cpu.h | 4 ++++
target/arm/tcg/translate.h | 12 ++++++++++++
target/arm/cpu.c | 2 ++
target/arm/vfp_helper.c | 14 ++++++++++++++
4 files changed, 32 insertions(+)
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index 7b967bbd1d2..be409c5c76e 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -636,6 +636,8 @@ typedef struct CPUArchState {
* fp_status_a32: is the "normal" fp status for AArch32 insns
* fp_status_a64: is the "normal" fp status for AArch64 insns
* fp_status_fp16: used for half-precision calculations
+ * fp_status_fp16_a32: used for AArch32 half-precision calculations
+ * fp_status_fp16_a64: used for AArch64 half-precision calculations
* standard_fp_status : the ARM "Standard FPSCR Value"
* standard_fp_status_fp16 : used for half-precision
* calculations with the ARM "Standard FPSCR Value"
@@ -662,6 +664,8 @@ typedef struct CPUArchState {
float_status fp_status_a32;
float_status fp_status_a64;
float_status fp_status_f16;
+ float_status fp_status_f16_a32;
+ float_status fp_status_f16_a64;
float_status standard_fp_status;
float_status standard_fp_status_f16;
diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h
index fca68b7c4c8..d84c6d74aa4 100644
--- a/target/arm/tcg/translate.h
+++ b/target/arm/tcg/translate.h
@@ -673,6 +673,8 @@ typedef enum ARMFPStatusFlavour {
FPST_A32,
FPST_A64,
FPST_FPCR_F16,
+ FPST_A32_F16,
+ FPST_A64_F16,
FPST_STD,
FPST_STD_F16,
} ARMFPStatusFlavour;
@@ -691,6 +693,10 @@ typedef enum ARMFPStatusFlavour {
* for AArch64 non-FP16 operations controlled by the FPCR
* FPST_FPCR_F16
* for operations controlled by the FPCR where FPCR.FZ16 is to be used
+ * FPST_A32_F16
+ * for AArch32 operations controlled by the FPCR where FPCR.FZ16 is to be
used
+ * FPST_A64_F16
+ * for AArch64 operations controlled by the FPCR where FPCR.FZ16 is to be
used
* FPST_STD
* for A32/T32 Neon operations using the "standard FPSCR value"
* FPST_STD_F16
@@ -711,6 +717,12 @@ static inline TCGv_ptr fpstatus_ptr(ARMFPStatusFlavour
flavour)
case FPST_FPCR_F16:
offset = offsetof(CPUARMState, vfp.fp_status_f16);
break;
+ case FPST_A32_F16:
+ offset = offsetof(CPUARMState, vfp.fp_status_f16_a32);
+ break;
+ case FPST_A64_F16:
+ offset = offsetof(CPUARMState, vfp.fp_status_f16_a64);
+ break;
case FPST_STD:
offset = offsetof(CPUARMState, vfp.standard_fp_status);
break;
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index a2b9bd3fb9d..ff8514edc6d 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -576,6 +576,8 @@ static void arm_cpu_reset_hold(Object *obj, ResetType type)
arm_set_default_fp_behaviours(&env->vfp.fp_status_a64);
arm_set_default_fp_behaviours(&env->vfp.standard_fp_status);
arm_set_default_fp_behaviours(&env->vfp.fp_status_f16);
+ arm_set_default_fp_behaviours(&env->vfp.fp_status_f16_a32);
+ arm_set_default_fp_behaviours(&env->vfp.fp_status_f16_a64);
arm_set_default_fp_behaviours(&env->vfp.standard_fp_status_f16);
#ifndef CONFIG_USER_ONLY
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
index 9fee6265f20..45f9dfc8861 100644
--- a/target/arm/vfp_helper.c
+++ b/target/arm/vfp_helper.c
@@ -69,6 +69,10 @@ static uint32_t vfp_get_fpsr_from_host(CPUARMState *env)
/* FZ16 does not generate an input denormal exception. */
i |= (get_float_exception_flags(&env->vfp.fp_status_f16)
& ~float_flag_input_denormal);
+ i |= (get_float_exception_flags(&env->vfp.fp_status_f16_a32)
+ & ~float_flag_input_denormal);
+ i |= (get_float_exception_flags(&env->vfp.fp_status_f16_a64)
+ & ~float_flag_input_denormal);
i |= (get_float_exception_flags(&env->vfp.standard_fp_status_f16)
& ~float_flag_input_denormal);
return vfp_exceptbits_from_host(i);
@@ -84,6 +88,8 @@ static void vfp_clear_float_status_exc_flags(CPUARMState *env)
set_float_exception_flags(0, &env->vfp.fp_status_a32);
set_float_exception_flags(0, &env->vfp.fp_status_a64);
set_float_exception_flags(0, &env->vfp.fp_status_f16);
+ set_float_exception_flags(0, &env->vfp.fp_status_f16_a32);
+ set_float_exception_flags(0, &env->vfp.fp_status_f16_a64);
set_float_exception_flags(0, &env->vfp.standard_fp_status);
set_float_exception_flags(0, &env->vfp.standard_fp_status_f16);
}
@@ -113,12 +119,18 @@ static void vfp_set_fpcr_to_host(CPUARMState *env,
uint32_t val, uint32_t mask)
set_float_rounding_mode(i, &env->vfp.fp_status_a32);
set_float_rounding_mode(i, &env->vfp.fp_status_a64);
set_float_rounding_mode(i, &env->vfp.fp_status_f16);
+ set_float_rounding_mode(i, &env->vfp.fp_status_f16_a32);
+ set_float_rounding_mode(i, &env->vfp.fp_status_f16_a64);
}
if (changed & FPCR_FZ16) {
bool ftz_enabled = val & FPCR_FZ16;
set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16);
+ set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a32);
+ set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a64);
set_flush_to_zero(ftz_enabled, &env->vfp.standard_fp_status_f16);
set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16);
+ set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a32);
+ set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a64);
set_flush_inputs_to_zero(ftz_enabled,
&env->vfp.standard_fp_status_f16);
}
if (changed & FPCR_FZ) {
@@ -133,6 +145,8 @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t
val, uint32_t mask)
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a32);
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a64);
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16);
+ set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16_a32);
+ set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16_a64);
}
}
--
2.34.1
- [PULL 18/36] target/arm: Use vfp.fp_status_a64 in A64-only helper functions, (continued)
- [PULL 18/36] target/arm: Use vfp.fp_status_a64 in A64-only helper functions, Peter Maydell, 2025/01/28
- [PULL 22/36] target/arm: Use FPST_A32 in A32 decoder, Peter Maydell, 2025/01/28
- [PULL 20/36] target/arm: Use fp_status_a32 in vjvct helper, Peter Maydell, 2025/01/28
- [PULL 21/36] target/arm: Use fp_status_a32 in vfp_cmp helpers, Peter Maydell, 2025/01/28
- [PULL 26/36] target/arm: Use fp_status_f16_a32 in AArch32-only helpers, Peter Maydell, 2025/01/28
- [PULL 23/36] target/arm: Use FPST_A64 in A64 decoder, Peter Maydell, 2025/01/28
- [PULL 28/36] target/arm: Use FPST_A32_F16 in A32 decoder, Peter Maydell, 2025/01/28
- [PULL 35/36] target/arm: Use FPST_A64_F16 for halfprec-to-other conversions, Peter Maydell, 2025/01/28
- [PULL 34/36] target/arm: Remove redundant advsimd float16 helpers, Peter Maydell, 2025/01/28
- [PULL 36/36] hw/usb/canokey: Fix buffer overflow for OUT packet, Peter Maydell, 2025/01/28
- [PULL 25/36] target/arm: Define new fp_status_f16_a32 and fp_status_f16_a64,
Peter Maydell <=
- [PULL 24/36] target/arm: Remove now-unused vfp.fp_status and FPST_FPCR, Peter Maydell, 2025/01/28
- [PULL 27/36] target/arm: Use fp_status_f16_a64 in AArch64-only helpers, Peter Maydell, 2025/01/28
- [PULL 31/36] fpu: Rename float_flag_input_denormal to float_flag_input_denormal_flushed, Peter Maydell, 2025/01/28
- [PULL 30/36] target/arm: Remove now-unused vfp.fp_status_f16 and FPST_FPCR_F16, Peter Maydell, 2025/01/28
- [PULL 32/36] fpu: Rename float_flag_output_denormal to float_flag_output_denormal_flushed, Peter Maydell, 2025/01/28
- [PULL 33/36] fpu: Fix a comment in softfloat-types.h, Peter Maydell, 2025/01/28
- [PULL 29/36] target/arm: Use FPST_A64_F16 in A64 decoder, Peter Maydell, 2025/01/28
- Re: [PULL 00/36] target-arm queue, Stefan Hajnoczi, 2025/01/29