From: Pavel P Date: Thu, 23 Jan 2025 22:09:44 +0000 (+0200) Subject: Reorder __BMI2__ check X-Git-Tag: v1.5.7^2~15^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a183620a3c21bce4ca3b10a12aba7d7f84c12b2;p=thirdparty%2Fzstd.git Reorder __BMI2__ check + if `__BMI2__` defined, then set STATIC_BMI2 for all compilers + use `defined(_MSC_VER) && defined(__AVX2__)` as fallback for ms compiler --- diff --git a/lib/common/portability_macros.h b/lib/common/portability_macros.h index 70964ba01..860734141 100644 --- a/lib/common/portability_macros.h +++ b/lib/common/portability_macros.h @@ -76,12 +76,10 @@ /* 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__) +# if defined(__BMI2__) # define STATIC_BMI2 1 +# elif defined(_MSC_VER) && defined(__AVX2__) +# define STATIC_BMI2 1 /* MSVC does not have a BMI2 specific flag, but every CPU that supports AVX2 also supports BMI2 */ # endif #endif