Date: prev next · Thread: first prev next last
2016 Archives by date, by thread · List index


I shall give this a whirl.

Stephan Bergmann wrote

Turns out, the relevant GCC switches are

  -mfpmath=sse -msse2

Alex

On 16/09/16 11:05, Stephan Bergmann wrote:
On 09/07/2016 10:37 PM, Eike Rathke wrote:
You could do us a favour, are you willing to invest some machine time
and try if passing either -msse or -msse2 as compiler flags would solve
the failing function tests problem? For this you'd need to do

make clean
make ENVCFLAGS=-msse ENVCFLAGSCXX=-msse && make sc.check

and if that still fails try

make clean
make ENVCFLAGS=-msse2 ENVCFLAGSCXX=-msse2 && make sc.check

Turns out, the relevant GCC switches are

  -mfpmath=sse -msse2

-mfpmath=sse (instead of the x86-32 default of -mfpmath=387) prevents usage of the extended 80-bit precision for temporary results. (Which caused e.g. the subtraction in ScChiDistFunction::GetValue, sc/source/core/tool/interpr3.cxx, to produce results different from IEEE double, causing the computation of CHIINV(0.999999999999999, 1.00000000000000E+001) in sc/qa/unit/data/functions/fods/chiinv.fods to produce unexpected results.) <https://gcc.gnu.org/onlinedocs/gcc-6.2.0/gcc/x86-Options.html#x86-Options> also claims: "The resulting code should be considerably faster [compared to -mfpmath=387] in the majority of cases and avoid the numerical instability problems of 387 code [...]"

But -mfpmath=sse only takes effect when compiling for an architecture that actually supports the relevant SSE instructions (otherwise silently falling back to the "387" instructions, it appears). So we need an additional -msse2 to enable the instructions relevant for 64-bit double (-msse would only enable instructions relevant for 32-bit float).

SSE2 support reportedly got added with Pentium 4, around 2001. Any thoughts on whether we'd want to enforce that for 32-bit x86 Linux builds (or already effectively enforce anyway)? In which case we could add the relevant flags to solenv/gbuild/platform/LINUX_INTEL_GCC.mk and revert <https://cgit.freedesktop.org/libreoffice/core/commit/?id=b9a27d5856f60688456762bfcc29c38670009254> "sc: disable function test documents for 32-bit PLATFORMID=linux_x86" again.

(Notwithstanding the fact that tests that rely on Calc doing computations in a specific way, when Calc doesn't give any guarantees of how those computations should be carried out exactly AFAIK, are dubious and a pain at best.)
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.