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 <rdsandif...@googlemail.com> --- fpu/softfloat.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index ac3d150..0028415 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -2234,6 +2234,9 @@ float32 float32_muladd(float32 a, float32 b, float32 c, int flags STATUS_PARAM) } } /* Zero plus something non-zero : just return the something */ + if (flags & float_muladd_negate_c) { + signflip ^= 1; + } return make_float32(float32_val(c) ^ (signflip << 31)); } @@ -3787,6 +3790,9 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags STATUS_PARAM) } } /* Zero plus something non-zero : just return the something */ + if (flags & float_muladd_negate_c) { + signflip ^= 1; + } return make_float64(float64_val(c) ^ ((uint64_t)signflip << 63)); } -- 1.7.11.7