summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2017-05-08 10:47:04 +0200
committerTomaž Vajngerl <quikee@gmail.com>2019-07-09 02:46:43 +0200
commitf43f9b99603736a4d54f550052509eb5f4d04b45 (patch)
tree96f8e17bc271471d54571d6ffce7146b6bcdb626 /sc
parentf65905dd0ff464774f338db44d69925f98e1766c (diff)
CPU intrinsics detection (SSE, AVX)
Adds CPU intrinsics detection in configure pass for compile time detection and "cpuid" runtime detection of which CPU instruction sets are available on the user device. Change-Id: I0ee4d0b22a7c51f72796d43e7383a31d03b437ad Reviewed-on: https://gerrit.libreoffice.org/75175 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/formulacell.cxx2
-rw-r--r--sc/source/core/inc/arraysumfunctor.hxx15
2 files changed, 7 insertions, 10 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 48cb55fae27a..365f4151aca6 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -4673,7 +4673,7 @@ bool ScFormulaCell::InterpretFormulaGroupThreading(sc::FormulaLogger::GroupScope
bDependencyComputed = true;
- const static bool bHyperThreadingActive = tools::cpuid::hasHyperThreading();
+ const static bool bHyperThreadingActive = cpuid::hasHyperThreading();
// Then do the threaded calculation
diff --git a/sc/source/core/inc/arraysumfunctor.hxx b/sc/source/core/inc/arraysumfunctor.hxx
index 226962cf1f0f..05977c026361 100644
--- a/sc/source/core/inc/arraysumfunctor.hxx
+++ b/sc/source/core/inc/arraysumfunctor.hxx
@@ -13,21 +13,18 @@
#include <cstdint>
#include <rtl/math.hxx>
+
+#include <tools/simdsupport.hxx>
+#include <tools/simd.hxx>
#include <tools/cpuid.hxx>
#if defined(LO_SSE2_AVAILABLE)
-#include <emmintrin.h>
+#include <x86intrin.h>
#endif
namespace sc
{
-template<typename T, unsigned int N>
-inline bool isAligned(const T* pointer)
-{
- return 0 == (uintptr_t(pointer) % N);
-}
-
struct ArraySumFunctor
{
private:
@@ -43,7 +40,7 @@ public:
double operator() ()
{
- const static bool hasSSE2 = tools::cpuid::hasSSE2();
+ const static bool hasSSE2 = cpuid::hasSSE2();
double fSum = 0.0;
size_t i = 0;
@@ -51,7 +48,7 @@ public:
if (hasSSE2)
{
- while ( i < mnSize && !isAligned<double, 16>(pCurrent))
+ while ( i < mnSize && !simd::isAligned<double, 16>(pCurrent))
{
fSum += *pCurrent++;
i++;