From: Catalin Marinas Date: Wed, 3 Aug 2005 18:53:25 +0000 (+0100) Subject: [PATCH] ARM: 2841/1: Fix VFP +/-0 case for doubles addition X-Git-Tag: v2.6.13-rc6~74^2~2 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=7b1fbf292bb4c855ddae8add8c459e94684f7543;p=~emulex%2Finfiniband.git [PATCH] ARM: 2841/1: Fix VFP +/-0 case for doubles addition Patch from Catalin Marinas The IEEE 754 standard specifies that the result of (x - x), where x is a valid number, should be -0 if the rounding mode is towards minus infinity or +0 otherwise. Signed-off-by: Catalin Marinas Signed-off-by: Russell King --- diff --git a/arch/arm/vfp/vfpdouble.c b/arch/arm/vfp/vfpdouble.c index b801cd66b6e..9b367a65cb4 100644 --- a/arch/arm/vfp/vfpdouble.c +++ b/arch/arm/vfp/vfpdouble.c @@ -770,6 +770,9 @@ vfp_double_add(struct vfp_double *vdd, struct vfp_double *vdn, if ((s64)m_sig < 0) { vdd->sign = vfp_sign_negate(vdd->sign); m_sig = -m_sig; + } else if (m_sig == 0) { + vdd->sign = (fpscr & FPSCR_RMODE_MASK) == + FPSCR_ROUND_MINUSINF ? 0x8000 : 0; } } else { m_sig += vdn->significand;