Skip to contentSkip to conversation

ARM: Detect FP tininess before rounding

PATCH In review Peter Maydell 2 participants 4 messages Apr 12, 2011 – Apr 13, 2011

lore
Share & tools
lore
#0 lore raw

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(-)
#1 lore raw

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
index 90f4250..618537e 100644
@@ -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
#2 lore raw

PATCH 2/2 target-arm: Detect tininess before rounding for FP operations

In reply to Peter Maydell

The 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
index ce9a9d8..9172fc7 100644
@@ -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
#3 lore raw
In reply to Peter Maydell
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 operations

 fpu/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