git: e77ad954bb82 - main - Revert "libm: fma: correct zero sign with small inputs"

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Wed, 12 Jun 2024 01:38:25 UTC
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=e77ad954bb825983b4346b9cc646c9c910b1be24

commit e77ad954bb825983b4346b9cc646c9c910b1be24
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-06-12 01:34:02 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-06-12 01:36:12 +0000

    Revert "libm: fma: correct zero sign with small inputs"
    
    This change introduced a test failure, so revert until that can be
    addressed.
    
    This reverts commit 888796ade2842486d3167067e8034254c38aadd3.
    
    PR:             277783
    Reported by:    rlibby
    Sponsored by:   The FreeBSD Foundation
---
 lib/msun/src/s_fma.c  | 4 +---
 lib/msun/src/s_fmal.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/lib/msun/src/s_fma.c b/lib/msun/src/s_fma.c
index 686e80e66f5d..16902d321290 100644
--- a/lib/msun/src/s_fma.c
+++ b/lib/msun/src/s_fma.c
@@ -267,9 +267,7 @@ fma(double x, double y, double z)
 		 */
 		fesetround(oround);
 		volatile double vzs = zs; /* XXX gcc CSE bug workaround */
-		xs = ldexp(xy.lo, spread);
-		xy.hi += vzs;
-		return (xy.hi == 0 ? xs : xy.hi + xs);
+		return (xy.hi + vzs + ldexp(xy.lo, spread));
 	}
 
 	if (oround != FE_TONEAREST) {
diff --git a/lib/msun/src/s_fmal.c b/lib/msun/src/s_fmal.c
index a53d85f5ca57..9d08bc72e12e 100644
--- a/lib/msun/src/s_fmal.c
+++ b/lib/msun/src/s_fmal.c
@@ -248,9 +248,7 @@ fmal(long double x, long double y, long double z)
 		 */
 		fesetround(oround);
 		volatile long double vzs = zs; /* XXX gcc CSE bug workaround */
-		xs = ldexpl(xy.lo, spread);
-		xy.hi += vzs;
-		return (xy.hi == 0 ? xs : xy.hi + xs);
+		return (xy.hi + vzs + ldexpl(xy.lo, spread));
 	}
 
 	if (oround != FE_TONEAREST) {