summaryrefslogtreecommitdiff
path: root/sc/inc
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-10-26 23:40:47 +0200
committerLuboš Luňák <l.lunak@collabora.com>2021-10-27 15:02:11 +0200
commitef42ce579f0e4e4c436f70615f3adeb9f0f68217 (patch)
treeb688259454d3b571831bc3dd706ec3c974dd1f45 /sc/inc
parent56b0d05991391d7a885e6928138d5512cbbdfb47 (diff)
fix AVX512 detection
The value wasn't in config_host.mk.in, so it's never been used. And also fix Calc Kahan CPU-specific code yet again :( . Change-Id: Iacfd500e5a662b2b4b96a009d129a012d278a3ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124248 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/arraysumfunctor.hxx5
-rw-r--r--sc/inc/arraysumfunctorinternal.hxx6
2 files changed, 7 insertions, 4 deletions
diff --git a/sc/inc/arraysumfunctor.hxx b/sc/inc/arraysumfunctor.hxx
index d251b4a6f9fb..b727f5893a8c 100644
--- a/sc/inc/arraysumfunctor.hxx
+++ b/sc/inc/arraysumfunctor.hxx
@@ -19,8 +19,9 @@
namespace sc::op
{
/* Checkout available optimization options */
-const bool hasAVX = cpuid::hasAVX();
-const bool hasSSE2 = cpuid::hasSSE2();
+const bool hasAVX512F = hasAVX512FCode() && cpuid::hasAVX512F();
+const bool hasAVX = hasAVXCode() && cpuid::hasAVX();
+const bool hasSSE2 = hasSSE2Code() && cpuid::hasSSE2();
/**
* If no boosts available, Unrolled KahanSum.
diff --git a/sc/inc/arraysumfunctorinternal.hxx b/sc/inc/arraysumfunctorinternal.hxx
index a06e3fc17439..e939dbd3037d 100644
--- a/sc/inc/arraysumfunctorinternal.hxx
+++ b/sc/inc/arraysumfunctorinternal.hxx
@@ -13,8 +13,6 @@
namespace sc::op
{
-SC_DLLPUBLIC extern const bool hasAVX512F;
-
// Plain old data structure, to be used by code compiled with CPU intrinsics without generating any
// code for it (so that code requiring intrinsics doesn't get accidentally selected as the one copy
// when merging duplicates).
@@ -29,6 +27,10 @@ SC_DLLPUBLIC KahanSumSimple executeAVX512F(size_t& i, size_t nSize, const double
SC_DLLPUBLIC KahanSumSimple executeAVX(size_t& i, size_t nSize, const double* pCurrent);
SC_DLLPUBLIC KahanSumSimple executeSSE2(size_t& i, size_t nSize, const double* pCurrent);
+SC_DLLPUBLIC bool hasAVX512FCode();
+SC_DLLPUBLIC bool hasAVXCode();
+SC_DLLPUBLIC bool hasSSE2Code();
+
} // namespace
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */