Message ID | mcrob1cc9pc.fsf@iant-glaptop.roam.corp.google.com |
---|---|
State | New |
Headers | show |
Ian Lance Taylor <iant@google.com> writes: > The bug report http://golang.org/issue/7074 shows that math.Log2(1) > produces the wrong result on Aarch64, because the Go math package is > compiled to use a fused multiply-add instruction. This patch to the > libgo configure script will use -ffp-contract=off when compiling the > math package on processors other than x86. Bootstrapped and ran Go > testsuite on x86_64-unknown-linux-gnu, not that that tests much. > Committed to mainline. Thanks for this! If you are willing to go into battle enough to argue that libgcc should also be compiled with -ffp-contract=off (I did not have the stomach for that fight) then we'll be down to 1 check-go failure on aarch64 (which is peano -- due to the absence of split/copyable stacks and should probably xfail). Cheers, mwh > Ian > > diff -r 76dbb6f77e3d libgo/configure.ac > --- a/libgo/configure.ac Tue Mar 11 12:53:06 2014 -0700 > +++ b/libgo/configure.ac Tue Mar 11 21:26:35 2014 -0700 > @@ -620,6 +620,8 @@ > MATH_FLAG= > if test "$libgo_cv_c_fancymath" = yes; then > MATH_FLAG="-mfancy-math-387 -funsafe-math-optimizations" > +else > + MATH_FLAG="-ffp-contract=off" > fi > AC_SUBST(MATH_FLAG) >
On Thu, Mar 13, 2014 at 6:27 PM, Michael Hudson-Doyle <michael.hudson@linaro.org> wrote: > Ian Lance Taylor <iant@google.com> writes: > >> The bug report http://golang.org/issue/7074 shows that math.Log2(1) >> produces the wrong result on Aarch64, because the Go math package is >> compiled to use a fused multiply-add instruction. This patch to the >> libgo configure script will use -ffp-contract=off when compiling the >> math package on processors other than x86. Bootstrapped and ran Go >> testsuite on x86_64-unknown-linux-gnu, not that that tests much. >> Committed to mainline. > > Thanks for this! If you are willing to go into battle enough to argue > that libgcc should also be compiled with -ffp-contract=off (I did not > have the stomach for that fight) then we'll be down to 1 check-go > failure on aarch64 (which is peano -- due to the absence of > split/copyable stacks and should probably xfail). Hmmm, what is it that fails with libgcc? Is there a bug report for it? I agree that peano is likely to fail without split stacks. Ian
Ian Lance Taylor <iant@google.com> writes: > On Thu, Mar 13, 2014 at 6:27 PM, Michael Hudson-Doyle > <michael.hudson@linaro.org> wrote: >> Ian Lance Taylor <iant@google.com> writes: >> >>> The bug report http://golang.org/issue/7074 shows that math.Log2(1) >>> produces the wrong result on Aarch64, because the Go math package is >>> compiled to use a fused multiply-add instruction. This patch to the >>> libgo configure script will use -ffp-contract=off when compiling the >>> math package on processors other than x86. Bootstrapped and ran Go >>> testsuite on x86_64-unknown-linux-gnu, not that that tests much. >>> Committed to mainline. >> >> Thanks for this! If you are willing to go into battle enough to argue >> that libgcc should also be compiled with -ffp-contract=off (I did not >> have the stomach for that fight) then we'll be down to 1 check-go >> failure on aarch64 (which is peano -- due to the absence of >> split/copyable stacks and should probably xfail). > > Hmmm, what is it that fails with libgcc? Is there a bug report for > it? https://code.google.com/p/go/issues/detail?id=7066 and then http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59714 I wanted to propose a version using "Kahan's algorithm for the determinant" as described in http://hal-ens-lyon.archives-ouvertes.fr/docs/00/78/57/86/PDF/Jeannerod_Louvet_Muller_final.pdf but I haven't gotten around to it... Cheers, mwh > I agree that peano is likely to fail without split stacks. > > Ian
diff -r 76dbb6f77e3d libgo/configure.ac --- a/libgo/configure.ac Tue Mar 11 12:53:06 2014 -0700 +++ b/libgo/configure.ac Tue Mar 11 21:26:35 2014 -0700 @@ -620,6 +620,8 @@ MATH_FLAG= if test "$libgo_cv_c_fancymath" = yes; then MATH_FLAG="-mfancy-math-387 -funsafe-math-optimizations" +else + MATH_FLAG="-ffp-contract=off" fi AC_SUBST(MATH_FLAG)