Skip to contentSkip to conversation

fpu: Fix rounding mode for floatN_to_uintM_round_to_zero

PATCH Applied Richard Henderson 3 participants 5 messages Apr 10, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fpu: Fix rounding mode for floatN_to_uintM_round_to_zero

We incorrectly passed in the current rounding mode instead of float_round_to_zero.

---

Found while runnning SVE RISU tests; it should be visible with the right set of inputs to AdvSIMD RISU tests.

r~

---
 fpu/softfloat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fpu/softfloat.c +2 -2
index 6e16284e66..b46dccc63e 100644
@@ -1486,8 +1486,8 @@ uint ## isz ## _t float ## fsz ## _to_uint ## isz ## _round_to_zero     \
  (float ## fsz a, float_status *s)                                      \
 {                                                                       \
     FloatParts p = float ## fsz ## _unpack_canonical(a, s);             \
-    return round_to_uint_and_pack(p, s->float_rounding_mode,            \
-                                 UINT ## isz ## _MAX, s);               \
+    return round_to_uint_and_pack(p, float_round_to_zero,               \
+                                  UINT ## isz ## _MAX, s);              \
 }
 
 FLOAT_TO_UINT(16, 16)
Signature · 1 line
2.14.3
#1 lore raw
Quoted 32 lines · Richard Henderson

We incorrectly passed in the current rounding mode instead of float_round_to_zero.

---

Found while runnning SVE RISU tests; it should be visible with the right set of inputs to AdvSIMD RISU tests.

r~

---
 fpu/softfloat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fpu/softfloat.c +2 -3
index 6e16284e66..b46dccc63e 100644
@@ -1486,8 +1486,8 @@ uint ## isz ## _t float ## fsz ## _to_uint ## isz ## _round_to_zero     \
  (float ## fsz a, float_status *s)                                      \
 {                                                                       \
     FloatParts p = float ## fsz ## _unpack_canonical(a, s);             \
-    return round_to_uint_and_pack(p, s->float_rounding_mode,            \
-                                 UINT ## isz ## _MAX, s);               \
+    return round_to_uint_and_pack(p, float_round_to_zero,               \
+                                  UINT ## isz ## _MAX, s);              \
 }
 
 FLOAT_TO_UINT(16, 16)
--
Quoted 1 line

2.14.3

Would this be likely the fix for
https://bugs.launchpad.net/qemu/+bug/1761401
?

thanks
-- PMM

Reviewed-by on v1 1/1
#4 lore raw
In reply to Richard Henderson
Quoted 4 lines · Richard Henderson

We incorrectly passed in the current rounding mode instead of float_round_to_zero.

Oops,

Quoted 17 lines

---

Found while runnning SVE RISU tests; it should be visible with the right set of inputs to AdvSIMD RISU tests.

r~

---
 fpu/softfloat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fpu/softfloat.c +0 -0
index 6e16284e66..b46dccc63e 100644

fpu/softfloat.c uint ## isz ## _t float ## fsz ## _to_uint ## isz ## _round_to_zero \ · line 1493

Quoted 10 lines
fpu/softfloat.c +2 -2
@@ -1486,8 +1486,8 @@ uint ## isz ## _t float ## fsz ## _to_uint ## isz ## _round_to_zero     \
  (float ## fsz a, float_status *s)                                      \
 {                                                                       \
     FloatParts p = float ## fsz ## _unpack_canonical(a, s);             \
-    return round_to_uint_and_pack(p, s->float_rounding_mode,            \
-                                 UINT ## isz ## _MAX, s);               \
+    return round_to_uint_and_pack(p, float_round_to_zero,               \
+                                  UINT ## isz ## _MAX, s);              \
 }
 
 FLOAT_TO_UINT(16, 16)

--
Alex Bennée