summaryrefslogtreecommitdiff
path: root/arch/arm/vfp/vfpdouble.c
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2006-04-10 21:32:39 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-04-10 21:32:39 +0100
commit1320a80d1d2587545f39bc0d2dc3adaf390250ef (patch)
tree95a2af8dca357efe40a70258b70fa1227098098b /arch/arm/vfp/vfpdouble.c
parentadeff42236aec0601ec979d1a41cd6d9cf5a8c05 (diff)
downloadlinux-3.10-1320a80d1d2587545f39bc0d2dc3adaf390250ef.tar.gz
linux-3.10-1320a80d1d2587545f39bc0d2dc3adaf390250ef.tar.bz2
linux-3.10-1320a80d1d2587545f39bc0d2dc3adaf390250ef.zip
[ARM] 3471/1: FTOSI functions should return 0 for NaN
Patch from Catalin Marinas The NaN case was dealed with by the "exponent >= ... + 32" condition but it was not setting the value "d" to 0. Signed-off-by: Ken'ichi Kuromusha <musha@aplix.co.jp> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/vfp/vfpdouble.c')
-rw-r--r--arch/arm/vfp/vfpdouble.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/arm/vfp/vfpdouble.c b/arch/arm/vfp/vfpdouble.c
index 9b367a65cb4..2418d12e7fb 100644
--- a/arch/arm/vfp/vfpdouble.c
+++ b/arch/arm/vfp/vfpdouble.c
@@ -588,6 +588,7 @@ static u32 vfp_double_ftosi(int sd, int unused, int dm, u32 fpscr)
struct vfp_double vdm;
u32 d, exceptions = 0;
int rmode = fpscr & FPSCR_RMODE_MASK;
+ int tm;
vfp_double_unpack(&vdm, vfp_get_double(dm));
vfp_double_dump("VDM", &vdm);
@@ -595,10 +596,14 @@ static u32 vfp_double_ftosi(int sd, int unused, int dm, u32 fpscr)
/*
* Do we have denormalised number?
*/
- if (vfp_double_type(&vdm) & VFP_DENORMAL)
+ tm = vfp_double_type(&vdm);
+ if (tm & VFP_DENORMAL)
exceptions |= FPSCR_IDC;
- if (vdm.exponent >= 1023 + 32) {
+ if (tm & VFP_NAN) {
+ d = 0;
+ exceptions |= FPSCR_IOC;
+ } else if (vdm.exponent >= 1023 + 32) {
d = 0x7fffffff;
if (vdm.sign)
d = ~d;