diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2021-09-10 23:43:33 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2021-09-13 11:08:20 +0200 |
commit | 26072b8db7ba53f00c83197cb064229a76001989 (patch) | |
tree | d144b6b8094f91a92456306cfc0b31d602fc3577 /sc/inc/arraysumfunctor.hxx | |
parent | f75bae7082322a2e79997d041ce5f8afd3910107 (diff) |
properly separate code built with different CPU settings
Trying to write smart code and mixing different CPU flags doesn't play
nice together. Those global variables are not runtime-protected by
a CPU check, and so may crash with illegal instruction error.
And those inline functions may not get inlined and the compiler is
free to choose just one copy, any of them, so it may be the one
requiring the most demanding CPU settings.
So use only dumb code in files compiled with CPU intrinsics.
Change-Id: I8200fd4d9f991fab6fdc741120e7aa96ff9b470d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121929
Tested-by: Jenkins
Reviewed-by: Dante DM <dante19031999@gmail.com>
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sc/inc/arraysumfunctor.hxx')
-rw-r--r-- | sc/inc/arraysumfunctor.hxx | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/sc/inc/arraysumfunctor.hxx b/sc/inc/arraysumfunctor.hxx index ecd428e9f037..d251b4a6f9fb 100644 --- a/sc/inc/arraysumfunctor.hxx +++ b/sc/inc/arraysumfunctor.hxx @@ -12,35 +12,17 @@ #include <cmath> #include "kahan.hxx" -#include "scdllapi.h" +#include "arraysumfunctorinternal.hxx" #include <tools/cpuid.hxx> #include <formula/errorcodes.hxx> namespace sc::op { /* Checkout available optimization options */ -SC_DLLPUBLIC extern const bool hasAVX512F; const bool hasAVX = cpuid::hasAVX(); const bool hasSSE2 = cpuid::hasSSE2(); /** - * Performs one step of the Neumanier sum between doubles - * Overwrites the summand and error - * @parma sum - * @param err - * @param value - */ -inline void sumNeumanierNormal(double& sum, double& err, const double& value) -{ - double t = sum + value; - if (std::abs(sum) >= std::abs(value)) - err += (sum - t) + value; - else - err += (value - t) + sum; - sum = t; -} - -/** * If no boosts available, Unrolled KahanSum. * Most likely to use on android. */ @@ -69,11 +51,6 @@ static inline KahanSum executeUnrolled(size_t& i, size_t nSize, const double* pC return 0.0; } -/* Available methods */ -SC_DLLPUBLIC KahanSum executeAVX512F(size_t& i, size_t nSize, const double* pCurrent); -SC_DLLPUBLIC KahanSum executeAVX(size_t& i, size_t nSize, const double* pCurrent); -SC_DLLPUBLIC KahanSum executeSSE2(size_t& i, size_t nSize, const double* pCurrent); - /** * This function task is to choose the fastest method available to perform the sum. * @param i |