diff options
author | spreis <spreis@yandex-team.ru> | 2022-02-10 16:47:13 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:13 +0300 |
commit | bcd1126cbd5d445cd0665d295198aa39c6ab8cbe (patch) | |
tree | d41d29a041d5733ef148335290dbb817b197d4cd /library/cpp/cpuid_check/cpu_id_check.cpp | |
parent | 986cb5d624f352524bfa0c42c9a7695235cdaa41 (diff) | |
download | ydb-bcd1126cbd5d445cd0665d295198aa39c6ab8cbe.tar.gz |
Restoring authorship annotation for <spreis@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/cpuid_check/cpu_id_check.cpp')
-rw-r--r-- | library/cpp/cpuid_check/cpu_id_check.cpp | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/library/cpp/cpuid_check/cpu_id_check.cpp b/library/cpp/cpuid_check/cpu_id_check.cpp index f19a573567..dd20443dbf 100644 --- a/library/cpp/cpuid_check/cpu_id_check.cpp +++ b/library/cpp/cpuid_check/cpu_id_check.cpp @@ -1,64 +1,64 @@ -#include <util/system/compat.h> -#include <util/system/compiler.h> -#include <util/system/cpu_id.h> -#include <util/system/platform.h> - -#define Y_CPU_ID_ENUMERATE_STARTUP_CHECKS(F) \ - F(SSE42) \ - F(PCLMUL) \ - F(AES) \ - F(AVX) \ - F(AVX2) \ - F(FMA) - -namespace { - [[noreturn]] void ReportISAError(const char* isa) { - err(-1, "This program was compiled for %s which is not supported on your system, exiting...", isa); - } - -#define Y_DEF_NAME(X) \ - void Assert##X() noexcept { \ - if (!NX86::Have##X()) { \ - ReportISAError(#X); \ - } \ - } - - Y_CPU_ID_ENUMERATE_STARTUP_CHECKS(Y_DEF_NAME) -#undef Y_DEF_NAME - - class TBuildCpuChecker { - public: - TBuildCpuChecker() { - Check(); - } - - private: - void Check() const noexcept { -#if defined(_fma_) - AssertFMA(); -#elif defined(_avx2_) - AssertAVX2(); -#elif defined(_avx_) - AssertAVX(); -#elif defined(_aes_) - AssertAES(); -#elif defined(_pclmul_) - AssertPCLMUL(); -#elif defined(_sse4_2_) - AssertSSE42(); -#endif - -#define Y_DEF_NAME(X) Y_UNUSED(Assert##X); - Y_CPU_ID_ENUMERATE_STARTUP_CHECKS(Y_DEF_NAME) -#undef Y_DEF_NAME - } - }; -} - -#if defined(_x86_) && !defined(_MSC_VER) -#define INIT_PRIORITY(x) __attribute__((init_priority(x))) -#else -#define INIT_PRIORITY(x) -#endif - -const static TBuildCpuChecker CheckCpuWeAreRunningOn INIT_PRIORITY(101) ; +#include <util/system/compat.h> +#include <util/system/compiler.h> +#include <util/system/cpu_id.h> +#include <util/system/platform.h> + +#define Y_CPU_ID_ENUMERATE_STARTUP_CHECKS(F) \ + F(SSE42) \ + F(PCLMUL) \ + F(AES) \ + F(AVX) \ + F(AVX2) \ + F(FMA) + +namespace { + [[noreturn]] void ReportISAError(const char* isa) { + err(-1, "This program was compiled for %s which is not supported on your system, exiting...", isa); + } + +#define Y_DEF_NAME(X) \ + void Assert##X() noexcept { \ + if (!NX86::Have##X()) { \ + ReportISAError(#X); \ + } \ + } + + Y_CPU_ID_ENUMERATE_STARTUP_CHECKS(Y_DEF_NAME) +#undef Y_DEF_NAME + + class TBuildCpuChecker { + public: + TBuildCpuChecker() { + Check(); + } + + private: + void Check() const noexcept { +#if defined(_fma_) + AssertFMA(); +#elif defined(_avx2_) + AssertAVX2(); +#elif defined(_avx_) + AssertAVX(); +#elif defined(_aes_) + AssertAES(); +#elif defined(_pclmul_) + AssertPCLMUL(); +#elif defined(_sse4_2_) + AssertSSE42(); +#endif + +#define Y_DEF_NAME(X) Y_UNUSED(Assert##X); + Y_CPU_ID_ENUMERATE_STARTUP_CHECKS(Y_DEF_NAME) +#undef Y_DEF_NAME + } + }; +} + +#if defined(_x86_) && !defined(_MSC_VER) +#define INIT_PRIORITY(x) __attribute__((init_priority(x))) +#else +#define INIT_PRIORITY(x) +#endif + +const static TBuildCpuChecker CheckCpuWeAreRunningOn INIT_PRIORITY(101) ; |