Skip to contentSkip to conversation

target/ppc: Set float_tininess_before_rounding at cpu reset

PATCH Applied Richard Henderson 3 participants 3 messages Aug 27, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/ppc: Set float_tininess_before_rounding at cpu reset

As defined in Power 3.0 section 4.4.4 "Underflow Exception", a tiny result is detected before rounding.

---
 target/ppc/translate_init.inc.c | 4 ++++
 1 file changed, 4 insertions(+)
target/ppc/translate_init.inc.c +4 -0
index 4a21ed7289..023138c2f9 100644
@@ -10461,6 +10461,10 @@ static void ppc_cpu_reset(CPUState *s)
     s->exception_index = POWERPC_EXCP_NONE;
     env->error_code = 0;
 
+    /* tininess for underflow is detected before rounding */
+    set_float_detect_tininess(float_tininess_before_rounding,
+                              &env->fp_status);
+
     for (i = 0; i < ARRAY_SIZE(env->spr_cb); i++) {
         ppc_spr_t *spr = &env->spr_cb[i];
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 2 lines · Richard Henderson

As defined in Power 3.0 section 4.4.4 "Underflow Exception", a tiny result is detected before rounding.

Responded in the bug:
https://bugs.launchpad.net/qemu/+bug/1841491/comments/3

In my testing, this works for "double", but not "float".

Quoted 12 lines
---
 target/ppc/translate_init.inc.c | 4 ++++
 1 file changed, 4 insertions(+)
target/ppc/translate_init.inc.c +0 -0
index 4a21ed7289..023138c2f9 100644

target/ppc/translate_init.inc.c static void ppc_cpu_reset(CPUState *s) · line 10469

Quoted 9 lines
target/ppc/translate_init.inc.c +4 -0
@@ -10461,6 +10461,10 @@ static void ppc_cpu_reset(CPUState *s)
     s->exception_index = POWERPC_EXCP_NONE;
     env->error_code = 0;
 
+    /* tininess for underflow is detected before rounding */
+    set_float_detect_tininess(float_tininess_before_rounding,
+                              &env->fp_status);
+
     for (i = 0; i < ARRAY_SIZE(env->spr_cb); i++) {
         ppc_spr_t *spr = &env->spr_cb[i];

PC

Applied
#2 lore raw
In reply to Richard Henderson
Quoted 6 lines · Richard Henderson

As defined in Power 3.0 section 4.4.4 "Underflow Exception", a tiny result is detected before rounding.

Applied to ppc-for-4.2, thanks.

Quoted 19 lines
---
 target/ppc/translate_init.inc.c | 4 ++++
 1 file changed, 4 insertions(+)
target/ppc/translate_init.inc.c +4 -0
index 4a21ed7289..023138c2f9 100644
@@ -10461,6 +10461,10 @@ static void ppc_cpu_reset(CPUState *s)
     s->exception_index = POWERPC_EXCP_NONE;
     env->error_code = 0;
 
+    /* tininess for underflow is detected before rounding */
+    set_float_detect_tininess(float_tininess_before_rounding,
+                              &env->fp_status);
+
     for (i = 0; i < ARRAY_SIZE(env->spr_cb); i++) {
         ppc_spr_t *spr = &env->spr_cb[i];
 
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson