diff mbox

[16/19] target-alpha: fix wrong usage of float64_eq_quiet()

Message ID 1302645571-20500-17-git-send-email-aurelien@aurel32.net
State New
Headers show

Commit Message

Aurelien Jarno April 12, 2011, 9:59 p.m. UTC
On alpha, all NaN should trap during a comparison, not only sNaN. Fix
this by using float64_eq() instead of float64_eq_quiet().

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 64990e0735007f75fe03123c1339366bcb496268)
---
 target-alpha/op_helper.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

Comments

Peter Maydell April 13, 2011, 3:15 p.m. UTC | #1
On 12 April 2011 22:59, Aurelien Jarno <aurelien@aurel32.net> wrote:
> On alpha, all NaN should trap during a comparison, not only sNaN. Fix
> this by using float64_eq() instead of float64_eq_quiet().

The Compiler Writer's Guide disagrees with you:
www.compaq.com/cpq-alphaserver/technology/literature/cmpwrgd.pdf
page D-4 says CMPTEQ and CMPTUN only raise InvalidOp for SNaN.
(the Architecture Handbook is a little less clear but I think
the equivalent table is pages B-8 and B-9).

So I think this patch which changes helper_cmpteq() isn't needed.

-- PMM
diff mbox

Patch

diff --git a/target-alpha/op_helper.c b/target-alpha/op_helper.c
index bc938ed..b986b67 100644
--- a/target-alpha/op_helper.c
+++ b/target-alpha/op_helper.c
@@ -918,10 +918,11 @@  uint64_t helper_cmpteq(uint64_t a, uint64_t b)
     fa = t_to_float64(a);
     fb = t_to_float64(b);
 
-    if (float64_eq_quiet(fa, fb, &FP_STATUS))
+    if (float64_eq(fa, fb, &FP_STATUS)) {
         return 0x4000000000000000ULL;
-    else
+    } else {
         return 0;
+    }
 }
 
 uint64_t helper_cmptle(uint64_t a, uint64_t b)