diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/tools/cpuid.hxx | 17 | ||||
-rw-r--r-- | include/tools/simdsupport.hxx | 13 |
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: */ |