diff mbox

[v2] softfloat: Handle float_muladd_negate_c when product is zero

Message ID 87zk01jgl2.fsf@talisman.default
State New
Headers show

Commit Message

Richard Sandiford Jan. 22, 2013, 5:03 p.m. UTC
Honour float_muladd_negate_c in the case where the product is zero and
c is nonzero.  Previously we would fail to negate c.

Seen in (and tested against) the gfortran testsuite on MIPS.

Signed-off-by: Richard Sandiford <rdsandiford@googlemail.com>
---
 fpu/softfloat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Peter Maydell Jan. 22, 2013, 5:10 p.m. UTC | #1
On 22 January 2013 17:03, Richard Sandiford <rdsandiford@googlemail.com> wrote:
> Honour float_muladd_negate_c in the case where the product is zero and
> c is nonzero.  Previously we would fail to negate c.
>
> Seen in (and tested against) the gfortran testsuite on MIPS.
>
> Signed-off-by: Richard Sandiford <rdsandiford@googlemail.com>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

-- PMM
Blue Swirl Jan. 26, 2013, 3:06 p.m. UTC | #2
Thanks, applied.

On Tue, Jan 22, 2013 at 5:03 PM, Richard Sandiford
<rdsandiford@googlemail.com> wrote:
> Honour float_muladd_negate_c in the case where the product is zero and
> c is nonzero.  Previously we would fail to negate c.
>
> Seen in (and tested against) the gfortran testsuite on MIPS.
>
> Signed-off-by: Richard Sandiford <rdsandiford@googlemail.com>
> ---
>  fpu/softfloat.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fpu/softfloat.c b/fpu/softfloat.c
> index ac3d150..83ccc4b 100644
> --- a/fpu/softfloat.c
> +++ b/fpu/softfloat.c
> @@ -2234,7 +2234,7 @@ float32 float32_muladd(float32 a, float32 b, float32 c, int flags STATUS_PARAM)
>              }
>          }
>          /* Zero plus something non-zero : just return the something */
> -        return make_float32(float32_val(c) ^ (signflip << 31));
> +        return packFloat32(cSign ^ signflip, cExp, cSig);
>      }
>
>      if (aExp == 0) {
> @@ -3787,7 +3787,7 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags STATUS_PARAM)
>              }
>          }
>          /* Zero plus something non-zero : just return the something */
> -        return make_float64(float64_val(c) ^ ((uint64_t)signflip << 63));
> +        return packFloat64(cSign ^ signflip, cExp, cSig);
>      }
>
>      if (aExp == 0) {
> --
> 1.7.11.7
>
>
diff mbox

Patch

diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index ac3d150..83ccc4b 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -2234,7 +2234,7 @@  float32 float32_muladd(float32 a, float32 b, float32 c, int flags STATUS_PARAM)
             }
         }
         /* Zero plus something non-zero : just return the something */
-        return make_float32(float32_val(c) ^ (signflip << 31));
+        return packFloat32(cSign ^ signflip, cExp, cSig);
     }
 
     if (aExp == 0) {
@@ -3787,7 +3787,7 @@  float64 float64_muladd(float64 a, float64 b, float64 c, int flags STATUS_PARAM)
             }
         }
         /* Zero plus something non-zero : just return the something */
-        return make_float64(float64_val(c) ^ ((uint64_t)signflip << 63));
+        return packFloat64(cSign ^ signflip, cExp, cSig);
     }
 
     if (aExp == 0) {