ARM: Detect FP tininess before rounding
cover ARM: Detect FP tininess before rounding
Softfloat supports two kinds of FP tininess detection: before and after rounding (corresponding to the two behaviours permitted by IEEE754). The ARM architecture mandates detection before rounding, so set the flag appropriately. I had to add a setter function for this, since there wasn't one already.
Peter Maydell (2):
softfloat: Add setter function for tininess detection mode
target-arm: Detect tininess before rounding for FP operations
fpu/softfloat.h | 4 ++++ target-arm/helper.c | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-)
PATCH 1/2 softfloat: Add setter function for tininess detection mode
Add a setter function for the underflow tininess detection mode, in line with the similar functions for other parts of the float status structure.
--- fpu/softfloat.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
fpu/softfloat.h +4 -0
@@ -211,6 +211,10 @@ typedef struct float_status { void set_float_rounding_mode(int val STATUS_PARAM); void set_float_exception_flags(int val STATUS_PARAM); +INLINE void set_float_detect_tininess(int val STATUS_PARAM) +{ +STATUS (float_detect_tininess) = val; +} INLINE void set_flush_to_zero(flag val STATUS_PARAM) {STATUS (flush_to_zero) = val;
Signature · 1 line
1.7.1
PATCH 2/2 target-arm: Detect tininess before rounding for FP operations
In reply to Peter MaydellThe ARM architecture mandates that we detect tininess before rounding, so set the softfloat fp_status up appropriately.
--- target-arm/helper.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
target-arm/helper.c +4 -0
@@ -269,6 +269,10 @@ void cpu_reset(CPUARMState *env)set_flush_to_zero (1 , &env->vfp.standard_fp_status);set_flush_inputs_to_zero (1 , &env->vfp.standard_fp_status);set_default_nan_mode (1 , &env->vfp.standard_fp_status); +set_float_detect_tininess (float_tininess_before_rounding, + &env->vfp.fp_status); +set_float_detect_tininess (float_tininess_before_rounding, + &env->vfp.standard_fp_status);tlb_flush (env,1 ); }
Signature · 1 line
1.7.1
Quoted 6 lines · Peter Maydell
Softfloat supports two kinds of FP tininess detection: before and after rounding (corresponding to the two behaviours permitted by IEEE754). The ARM architecture mandates detection before rounding, so set the flag appropriately. I had to add a setter function for this, since there wasn't one already.
Quoted 9 lines
Peter Maydell (2):
softfloat: Add setter function for tininess detection mode
target-arm: Detect tininess before rounding for FP operationsfpu/softfloat.h | 4 ++++ target-arm/helper.c | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-)
Thanks, both applied.
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net