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 | b49848d6e361b76904f094b7d5e10d6edea75afe (patch) | |
tree | 9814fbd1c3effac9b8377c5d604b367b14e2db55 /util | |
parent | bcd1126cbd5d445cd0665d295198aa39c6ab8cbe (diff) | |
download | ydb-b49848d6e361b76904f094b7d5e10d6edea75afe.tar.gz |
Restoring authorship annotation for <spreis@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util')
-rw-r--r-- | util/system/cpu_id.cpp | 10 | ||||
-rw-r--r-- | util/system/cpu_id.h | 86 | ||||
-rw-r--r-- | util/system/cpu_id_ut.cpp | 28 | ||||
-rw-r--r-- | util/system/platform.h | 44 |
4 files changed, 84 insertions, 84 deletions
diff --git a/util/system/cpu_id.cpp b/util/system/cpu_id.cpp index 36ce089296..598c71f4d9 100644 --- a/util/system/cpu_id.cpp +++ b/util/system/cpu_id.cpp @@ -102,10 +102,10 @@ bool NX86::HaveSSE3() noexcept { return TX86CpuInfo(0x1).ECX & 1u; } -bool NX86::HavePCLMUL() noexcept { - return (TX86CpuInfo(0x1).ECX >> 1) & 1u; -} - +bool NX86::HavePCLMUL() noexcept { + return (TX86CpuInfo(0x1).ECX >> 1) & 1u; +} + bool NX86::HaveSSSE3() noexcept { return (TX86CpuInfo(0x1).ECX >> 9) & 1u; } @@ -259,5 +259,5 @@ const char* CpuBrand(ui32* store) noexcept { bool NX86::CachedHave##X() noexcept { \ return SingletonWithPriority<TFlagsCache, 0>()->Have##X##_; \ } -Y_CPU_ID_ENUMERATE_OUTLINED_CACHED_DEFINE(Y_DEF_NAME) +Y_CPU_ID_ENUMERATE_OUTLINED_CACHED_DEFINE(Y_DEF_NAME) #undef Y_DEF_NAME diff --git a/util/system/cpu_id.h b/util/system/cpu_id.h index e2130ea21b..3c49e728a7 100644 --- a/util/system/cpu_id.h +++ b/util/system/cpu_id.h @@ -2,7 +2,7 @@ #include "types.h" #include "compiler.h" -#include <util/generic/singleton.h> +#include <util/generic/singleton.h> #define Y_CPU_ID_ENUMERATE(F) \ F(SSE) \ @@ -15,7 +15,7 @@ F(POPCNT) \ F(BMI1) \ F(BMI2) \ - F(PCLMUL) \ + F(PCLMUL) \ F(AES) \ F(AVX) \ F(FMA) \ @@ -41,7 +41,7 @@ F(XSAVE) \ F(OSXSAVE) -#define Y_CPU_ID_ENUMERATE_OUTLINED_CACHED_DEFINE(F) \ +#define Y_CPU_ID_ENUMERATE_OUTLINED_CACHED_DEFINE(F) \ F(F16C) \ F(BMI1) \ F(BMI2) \ @@ -69,8 +69,8 @@ F(CLFLUSHOPT) \ F(CLWB) \ F(XSAVE) \ - F(OSXSAVE) - + F(OSXSAVE) + namespace NX86 { /** * returns false on non-x86 platforms @@ -83,75 +83,75 @@ namespace NX86 { #undef Y_DEF_NAME #define Y_DEF_NAME(X) Y_CONST_FUNCTION bool CachedHave##X() noexcept; - Y_CPU_ID_ENUMERATE_OUTLINED_CACHED_DEFINE(Y_DEF_NAME) -#undef Y_DEF_NAME - + Y_CPU_ID_ENUMERATE_OUTLINED_CACHED_DEFINE(Y_DEF_NAME) +#undef Y_DEF_NAME + struct TFlagsCache { -#define Y_DEF_NAME(X) const bool Have##X##_ = NX86::Have##X(); +#define Y_DEF_NAME(X) const bool Have##X##_ = NX86::Have##X(); Y_CPU_ID_ENUMERATE(Y_DEF_NAME) #undef Y_DEF_NAME }; - -#define Y_LOOKUP_CPU_ID_IMPL(X) return SingletonWithPriority<TFlagsCache, 0>()->Have##X##_; - + +#define Y_LOOKUP_CPU_ID_IMPL(X) return SingletonWithPriority<TFlagsCache, 0>()->Have##X##_; + inline bool CachedHaveSSE() noexcept { -#ifdef _sse_ +#ifdef _sse_ return true; -#else +#else Y_LOOKUP_CPU_ID_IMPL(SSE) -#endif +#endif } inline bool CachedHaveSSE2() noexcept { -#ifdef _sse2_ +#ifdef _sse2_ return true; -#else +#else Y_LOOKUP_CPU_ID_IMPL(SSE2) -#endif +#endif } - + inline bool CachedHaveSSE3() noexcept { -#ifdef _sse3_ +#ifdef _sse3_ return true; -#else +#else Y_LOOKUP_CPU_ID_IMPL(SSE3) -#endif +#endif } - + inline bool CachedHaveSSSE3() noexcept { -#ifdef _ssse3_ +#ifdef _ssse3_ return true; -#else +#else Y_LOOKUP_CPU_ID_IMPL(SSSE3) -#endif +#endif } - + inline bool CachedHaveSSE41() noexcept { -#ifdef _sse4_1_ +#ifdef _sse4_1_ return true; -#else +#else Y_LOOKUP_CPU_ID_IMPL(SSE41) -#endif +#endif } - + inline bool CachedHaveSSE42() noexcept { -#ifdef _sse4_2_ +#ifdef _sse4_2_ return true; -#else +#else Y_LOOKUP_CPU_ID_IMPL(SSE42) -#endif +#endif } - + inline bool CachedHavePOPCNT() noexcept { -#ifdef _popcnt_ +#ifdef _popcnt_ return true; -#else +#else Y_LOOKUP_CPU_ID_IMPL(POPCNT) -#endif +#endif } - -#undef Y_LOOKUP_CPU_ID_IMPL - -} - + +#undef Y_LOOKUP_CPU_ID_IMPL + +} + const char* CpuBrand(ui32 store[12]) noexcept; diff --git a/util/system/cpu_id_ut.cpp b/util/system/cpu_id_ut.cpp index 01fe0752e5..68f1f8aac7 100644 --- a/util/system/cpu_id_ut.cpp +++ b/util/system/cpu_id_ut.cpp @@ -24,7 +24,7 @@ static void ExecuteAVX2Instruction(); static void ExecutePOPCNTInstruction(); static void ExecuteBMI1Instruction(); static void ExecuteBMI2Instruction(); -static void ExecutePCLMULInstruction(); +static void ExecutePCLMULInstruction(); static void ExecuteAESInstruction(); static void ExecuteAVXInstruction(); static void ExecuteAVX2Instruction(); @@ -176,13 +176,13 @@ void ExecuteBMI2Instruction() { : "rax"); } -void ExecutePCLMULInstruction() { - __asm__ __volatile__("pclmullqlqdq %%xmm0, %%xmm0\n" - : - : - : "xmm0"); -} - +void ExecutePCLMULInstruction() { + __asm__ __volatile__("pclmullqlqdq %%xmm0, %%xmm0\n" + : + : + : "xmm0"); +} + void ExecuteAESInstruction() { __asm__ __volatile__("aesimc %%xmm0, %%xmm0\n" : @@ -294,9 +294,9 @@ void ExecuteBMI1Instruction() { void ExecuteBMI2Instruction() { } -void ExecutePCLMULInstruction() { -} - +void ExecutePCLMULInstruction() { +} + void ExecuteAESInstruction() { } @@ -391,9 +391,9 @@ void ExecuteBMI1Instruction() { void ExecuteBMI2Instruction() { } -void ExecutePCLMULInstruction() { -} - +void ExecutePCLMULInstruction() { +} + void ExecuteAESInstruction() { } diff --git a/util/system/platform.h b/util/system/platform.h index ec9a69de82..58f310ab34 100644 --- a/util/system/platform.h +++ b/util/system/platform.h @@ -146,38 +146,38 @@ #define _ssse3_ #endif -#if defined(__SSE4_1__) || defined(SSE41_ENABLED) +#if defined(__SSE4_1__) || defined(SSE41_ENABLED) #define _sse4_1_ -#endif - -#if defined(__SSE4_2__) || defined(SSE42_ENABLED) +#endif + +#if defined(__SSE4_2__) || defined(SSE42_ENABLED) #define _sse4_2_ -#endif - -#if defined(__POPCNT__) || defined(POPCNT_ENABLED) +#endif + +#if defined(__POPCNT__) || defined(POPCNT_ENABLED) #define _popcnt_ #endif -#if defined(__PCLMUL__) || defined(PCLMUL_ENABLED) +#if defined(__PCLMUL__) || defined(PCLMUL_ENABLED) #define _pclmul_ -#endif - -#if defined(__AES__) || defined(AES_ENABLED) +#endif + +#if defined(__AES__) || defined(AES_ENABLED) #define _aes_ -#endif - -#if defined(__AVX__) || defined(AVX_ENABLED) +#endif + +#if defined(__AVX__) || defined(AVX_ENABLED) #define _avx_ -#endif - -#if defined(__AVX2__) || defined(AVX2_ENABLED) +#endif + +#if defined(__AVX2__) || defined(AVX2_ENABLED) #define _avx2_ -#endif - -#if defined(__FMA__) || defined(FMA_ENABLED) +#endif + +#if defined(__FMA__) || defined(FMA_ENABLED) #define _fma_ -#endif - +#endif + #if defined(__DLL__) || defined(_DLL) #define _dll_ #endif |