Date: Mon, 10 Jun 2024 16:31:02 -0700 From: Ryan Libby <rlibby@gmail.com> To: Ed Maste <emaste@freebsd.org>, kargl@freebsd.org Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 888796ade284 - main - libm: fma: correct zero sign with small inputs Message-ID: <CAHgpiFyTM-cWgyStKa4Ln7NNv84DtxjJw0sAP_-VynPvCe-=Ag@mail.gmail.com> In-Reply-To: <202406081556.458FuJYN022360@gitrepo.freebsd.org> References: <202406081556.458FuJYN022360@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jun 8, 2024 at 8:56=E2=80=AFAM Ed Maste <emaste@freebsd.org> wrote: > > The branch main has been updated by emaste: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D888796ade2842486d3167067e8= 034254c38aadd3 > > commit 888796ade2842486d3167067e8034254c38aadd3 > Author: Ed Maste <emaste@FreeBSD.org> > AuthorDate: 2024-03-19 14:31:39 +0000 > Commit: Ed Maste <emaste@FreeBSD.org> > CommitDate: 2024-06-08 15:55:36 +0000 > > libm: fma: correct zero sign with small inputs > > PR: 277783 > Reported by: Victor Stinner > Submitted by: kargl > MFC after: 1 week > Differential Revision: https://reviews.freebsd.org/D44433 > --- > lib/msun/src/s_fma.c | 4 +++- > lib/msun/src/s_fmal.c | 4 +++- > 2 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/lib/msun/src/s_fma.c b/lib/msun/src/s_fma.c > index b8a342646d85..4d08b40cc71a 100644 > --- a/lib/msun/src/s_fma.c > +++ b/lib/msun/src/s_fma.c > @@ -267,7 +267,9 @@ fma(double x, double y, double z) > */ > fesetround(oround); > volatile double vzs =3D zs; /* XXX gcc CSE bug workaround= */ > - return (xy.hi + vzs + ldexp(xy.lo, spread)); > + xs =3D ldexp(xy.lo, spread); > + xy.hi +=3D vzs; > + return (xy.hi =3D=3D 0 ? xs : xy.hi + xs); > } > > if (oround !=3D FE_TONEAREST) { > diff --git a/lib/msun/src/s_fmal.c b/lib/msun/src/s_fmal.c > index 3d333632127c..12f9c364670b 100644 > --- a/lib/msun/src/s_fmal.c > +++ b/lib/msun/src/s_fmal.c > @@ -248,7 +248,9 @@ fmal(long double x, long double y, long double z) > */ > fesetround(oround); > volatile long double vzs =3D zs; /* XXX gcc CSE bug worka= round */ > - return (xy.hi + vzs + ldexpl(xy.lo, spread)); > + xs =3D ldexpl(xy.lo, spread); > + xy.hi +=3D vzs; > + return (xy.hi =3D=3D 0 ? xs : xy.hi + xs); > } > > if (oround !=3D FE_TONEAREST) { This seems to have caused the lib/msun/fma_tests:zeroes test to fail in the FE_ROUNDDOWN mode on amd64, now finding 0 while expecting -0. I don't know if the test is wrong or too strict, or if the new result is wrong. https://ci.freebsd.org/job/FreeBSD-main-amd64-test/25249/testReport/junit/l= ib.msun/fma_test/zeroes/ Reproduces with kyua debug -k /usr/tests/Kyuafile lib/msun/fma_test:zeroes Ryan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHgpiFyTM-cWgyStKa4Ln7NNv84DtxjJw0sAP_-VynPvCe-=Ag>