diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2006-04-10 16:32:39 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-04-10 16:32:39 -0400 |
commit | 1320a80d1d2587545f39bc0d2dc3adaf390250ef (patch) | |
tree | 95a2af8dca357efe40a70258b70fa1227098098b /arch/arm | |
parent | adeff42236aec0601ec979d1a41cd6d9cf5a8c05 (diff) |
[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')
-rw-r--r-- | arch/arm/vfp/vfpdouble.c | 9 | ||||
-rw-r--r-- | arch/arm/vfp/vfpsingle.c | 7 |
2 files changed, 13 insertions, 3 deletions
diff --git a/arch/arm/vfp/vfpdouble.c b/arch/arm/vfp/vfpdouble.c index 9b367a65cb4d..2418d12e7fb5 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) | |||
588 | struct vfp_double vdm; | 588 | struct vfp_double vdm; |
589 | u32 d, exceptions = 0; | 589 | u32 d, exceptions = 0; |
590 | int rmode = fpscr & FPSCR_RMODE_MASK; | 590 | int rmode = fpscr & FPSCR_RMODE_MASK; |
591 | int tm; | ||
591 | 592 | ||
592 | vfp_double_unpack(&vdm, vfp_get_double(dm)); | 593 | vfp_double_unpack(&vdm, vfp_get_double(dm)); |
593 | vfp_double_dump("VDM", &vdm); | 594 | vfp_double_dump("VDM", &vdm); |
@@ -595,10 +596,14 @@ static u32 vfp_double_ftosi(int sd, int unused, int dm, u32 fpscr) | |||
595 | /* | 596 | /* |
596 | * Do we have denormalised number? | 597 | * Do we have denormalised number? |
597 | */ | 598 | */ |
598 | if (vfp_double_type(&vdm) & VFP_DENORMAL) | 599 | tm = vfp_double_type(&vdm); |
600 | if (tm & VFP_DENORMAL) | ||
599 | exceptions |= FPSCR_IDC; | 601 | exceptions |= FPSCR_IDC; |
600 | 602 | ||
601 | if (vdm.exponent >= 1023 + 32) { | 603 | if (tm & VFP_NAN) { |
604 | d = 0; | ||
605 | exceptions |= FPSCR_IOC; | ||
606 | } else if (vdm.exponent >= 1023 + 32) { | ||
602 | d = 0x7fffffff; | 607 | d = 0x7fffffff; |
603 | if (vdm.sign) | 608 | if (vdm.sign) |
604 | d = ~d; | 609 | d = ~d; |
diff --git a/arch/arm/vfp/vfpsingle.c b/arch/arm/vfp/vfpsingle.c index 14dd696ddeb1..df6e5e23bccb 100644 --- a/arch/arm/vfp/vfpsingle.c +++ b/arch/arm/vfp/vfpsingle.c | |||
@@ -632,6 +632,7 @@ static u32 vfp_single_ftosi(int sd, int unused, s32 m, u32 fpscr) | |||
632 | struct vfp_single vsm; | 632 | struct vfp_single vsm; |
633 | u32 d, exceptions = 0; | 633 | u32 d, exceptions = 0; |
634 | int rmode = fpscr & FPSCR_RMODE_MASK; | 634 | int rmode = fpscr & FPSCR_RMODE_MASK; |
635 | int tm; | ||
635 | 636 | ||
636 | vfp_single_unpack(&vsm, m); | 637 | vfp_single_unpack(&vsm, m); |
637 | vfp_single_dump("VSM", &vsm); | 638 | vfp_single_dump("VSM", &vsm); |
@@ -639,10 +640,14 @@ static u32 vfp_single_ftosi(int sd, int unused, s32 m, u32 fpscr) | |||
639 | /* | 640 | /* |
640 | * Do we have a denormalised number? | 641 | * Do we have a denormalised number? |
641 | */ | 642 | */ |
643 | tm = vfp_single_type(&vsm); | ||
642 | if (vfp_single_type(&vsm) & VFP_DENORMAL) | 644 | if (vfp_single_type(&vsm) & VFP_DENORMAL) |
643 | exceptions |= FPSCR_IDC; | 645 | exceptions |= FPSCR_IDC; |
644 | 646 | ||
645 | if (vsm.exponent >= 127 + 32) { | 647 | if (tm & VFP_NAN) { |
648 | d = 0; | ||
649 | exceptions |= FPSCR_IOC; | ||
650 | } else if (vsm.exponent >= 127 + 32) { | ||
646 | /* | 651 | /* |
647 | * m >= 2^31-2^7: invalid | 652 | * m >= 2^31-2^7: invalid |
648 | */ | 653 | */ |