Skip to content

Commit

Permalink
Reorder __BMI2__ check
Browse files Browse the repository at this point in the history
 + if `__BMI2__` defined, then set STATIC_BMI2 for all compilers
 + use `defined(_MSC_VER) && defined(__AVX2__)` as fallback for ms compiler
  • Loading branch information
pps83 committed Jan 23, 2025
1 parent 458e428 commit 5e70aac
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/common/portability_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 5e70aac

Please sign in to comment.