summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordante <dante19031999@gmail.com>2021-05-16 16:04:20 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2021-08-26 08:48:35 +0200
commit5b9cf5881ef53fac5f1d8376f687dbadf9d3cf2b (patch)
treeff16b0dcf62236c48fed6ca87e7d584959ed1841 /include
parentfb1233d77500413ba237c335a84773d8a6f8e381 (diff)
tdf#142307 - Upgrade SSE2 sum to AVX512 sum with Neumaier 1
This part focuses on allowing it on replacing arrayfunctor By thefault it will try AVX512F (1,17%) If not available will use AVX (94,77%) Use of AVX2 (82,28%) has been avoided even if the code could been more compact Source of hardware statistics: https://store.steampowered.com/hwsurvey Change-Id: Iae737a565379e82c5f84f3fdee6321ac74f59d40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115675 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/tools/cpuid.hxx17
-rw-r--r--include/tools/simdsupport.hxx13
2 files changed, 29 insertions, 1 deletions
diff --git a/include/tools/cpuid.hxx b/include/tools/cpuid.hxx
index 90c7d37b485c..98dca497a7de 100644
--- a/include/tools/cpuid.hxx
+++ b/include/tools/cpuid.hxx
@@ -26,7 +26,8 @@ enum class InstructionSetFlags
SSE41 = 0x08,
SSE42 = 0x10,
AVX = 0x20,
- AVX2 = 0x40
+ AVX2 = 0x40,
+ AVX512F = 0x100
};
} // end cpuid
@@ -63,6 +64,13 @@ inline bool hasSSSE3()
return isCpuInstructionSetSupported(InstructionSetFlags::SSSE3);
}
+/** Check if AVX is supported by the CPU
+ */
+inline bool hasAVX()
+{
+ return isCpuInstructionSetSupported(InstructionSetFlags::AVX);
+}
+
/** Check if AVX2 is supported by the CPU
*/
inline bool hasAVX2()
@@ -70,6 +78,13 @@ inline bool hasAVX2()
return isCpuInstructionSetSupported(InstructionSetFlags::AVX2);
}
+/** Check if AVX512F is supported by the CPU
+ */
+inline bool hasAVX512F()
+{
+ return isCpuInstructionSetSupported(InstructionSetFlags::AVX512F);
+}
+
/** Check if Hyper Threading is supported
*/
inline bool hasHyperThreading()
diff --git a/include/tools/simdsupport.hxx b/include/tools/simdsupport.hxx
index 5d10d53d48ad..bc9227223da0 100644
--- a/include/tools/simdsupport.hxx
+++ b/include/tools/simdsupport.hxx
@@ -20,6 +20,7 @@
#undef LO_SSSE3_AVAILABLE
#undef LO_AVX_AVAILABLE
#undef LO_AVX2_AVAILABLE
+#undef LO_AVX512F_AVAILABLE
#if defined(_MSC_VER) // VISUAL STUDIO COMPILER
@@ -46,6 +47,12 @@
#include <immintrin.h>
#endif // defined(__AVX2__)
+// compiled with /arch:AVX512F
+#if defined(__AVX512F__)
+#define LO_AVX512F_AVAILABLE
+#include <immintrin.h>
+#endif // defined(__AVX512F__)
+
#else // compiler Clang and GCC
#if defined(__SSE2__) || defined(__x86_64__) // SSE2 is required for X64
@@ -68,6 +75,12 @@
#include <immintrin.h>
#endif // defined(__AVX2__)
+#if defined(__AVX512F__)
+#define LO_AVX512F_AVAILABLE
+#include <immintrin.h>
+#else
+#endif // defined(__AVX512F__)
+
#endif // end compiler Clang and GCC
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */