summary refs log tree commit diff stats
path: root/fpu/softfloat.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2020-06-08 16:55:49 +0000
committerPaolo Bonzini <pbonzini@redhat.com>2020-06-26 09:39:38 -0400
commit499a2f7b554a295cfc10f8cd026d9b20a38fe664 (patch)
treecac18ca24ffb0267bc7605651c3f691cdcfe5f40 /fpu/softfloat.c
parent6b8b0136ab3018e4b552b485f808bf66bcf19ead (diff)
downloadfocaccia-qemu-499a2f7b554a295cfc10f8cd026d9b20a38fe664.tar.gz
focaccia-qemu-499a2f7b554a295cfc10f8cd026d9b20a38fe664.zip
softfloat: fix floatx80 remainder pseudo-denormal check for zero
The floatx80 remainder implementation ignores the high bit of the
significand when checking whether an operand (numerator) with zero
exponent is zero.  This means it mishandles a pseudo-denormal
representation of 0x1p-16382L by treating it as zero.  Fix this by
checking the whole significand instead.

Signed-off-by: Joseph Myers <joseph@codesourcery.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <alpine.DEB.2.21.2006081655180.23637@digraph.polyomino.org.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'fpu/softfloat.c')
-rw-r--r--fpu/softfloat.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index b7dcf4d6c3..f164b5c0ad 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -5741,7 +5741,7 @@ floatx80 floatx80_modrem(floatx80 a, floatx80 b, bool mod,
         normalizeFloatx80Subnormal( bSig, &bExp, &bSig );
     }
     if ( aExp == 0 ) {
-        if ( (uint64_t) ( aSig0<<1 ) == 0 ) return a;
+        if ( aSig0 == 0 ) return a;
         normalizeFloatx80Subnormal( aSig0, &aExp, &aSig0 );
     }
     bSig |= UINT64_C(0x8000000000000000);