From: Pavel P Date: Thu, 23 Jan 2025 22:05:03 +0000 (+0200) Subject: Move STATIC_BMI2 block as-is to portability_macros.h X-Git-Tag: v1.5.7^2~15^2~2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=1b15e888fc1a2f5f84583b0df014c6032eb3a162;p=thirdparty%2Fzstd.git Move STATIC_BMI2 block as-is to portability_macros.h --- diff --git a/lib/common/compiler.h b/lib/common/compiler.h index c942b984c..5ad212383 100644 --- a/lib/common/compiler.h +++ b/lib/common/compiler.h @@ -207,21 +207,6 @@ # pragma warning(disable : 4324) /* disable: C4324: padded structure */ #endif -/* Like DYNAMIC_BMI2 but for compile time determination of BMI2 support */ -#ifndef STATIC_BMI2 -# if defined(_MSC_VER) -# ifdef __AVX2__ /* MSVC does not have a BMI2 specific flag, but every CPU that supports AVX2 also supports BMI2 */ -# define STATIC_BMI2 1 -# endif -# elif defined(__BMI2__) -# define STATIC_BMI2 1 -# endif -#endif - -#ifndef STATIC_BMI2 -# define STATIC_BMI2 0 -#endif - /* compile time determination of SIMD support */ #if !defined(ZSTD_NO_INTRINSICS) # if defined(__AVX2__) diff --git a/lib/common/portability_macros.h b/lib/common/portability_macros.h index b52394382..b4da8a744 100644 --- a/lib/common/portability_macros.h +++ b/lib/common/portability_macros.h @@ -74,6 +74,21 @@ # define ZSTD_HIDE_ASM_FUNCTION(func) #endif +/* Like DYNAMIC_BMI2 but for compile time determination of BMI2 support */ +#ifndef STATIC_BMI2 +# if defined(_MSC_VER) +# ifdef __AVX2__ /* MSVC does not have a BMI2 specific flag, but every CPU that supports AVX2 also supports BMI2 */ +# define STATIC_BMI2 1 +# endif +# elif defined(__BMI2__) +# define STATIC_BMI2 1 +# endif +#endif + +#ifndef STATIC_BMI2 +# define STATIC_BMI2 0 +#endif + /* Enable runtime BMI2 dispatch based on the CPU. * Enabled for clang & gcc >=4.8 on x86 when BMI2 isn't enabled by default. */