Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move STATIC_BMI2 define to portability_macros.h #4264

Merged
merged 3 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions lib/common/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
13 changes: 13 additions & 0 deletions lib/common/portability_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,19 @@
# define ZSTD_HIDE_ASM_FUNCTION(func)
#endif

/* Compile time determination of BMI2 support */
#ifndef STATIC_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

#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.
*/
Expand Down
Loading