Skip to content

Commit

Permalink
Check __AVX512__ macro
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwalisch committed Apr 4, 2024
1 parent 4ee88fb commit 0e9ca8a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
15 changes: 7 additions & 8 deletions include/primesieve/PrimeGenerator.hpp
Expand Up @@ -24,14 +24,13 @@
#include <cstddef>

#if defined(MULTIARCH_AVX512)
#if defined(__AVX512__) || \
(defined(__AVX512F__) && \
defined(__AVX512VBMI__) && \
defined(__AVX512VBMI2__))
// GCC/Clang function multiversioning for AVX512 is not needed if
// the user compiles with -mavx512f -mavx512vbmi -mavx512vbmi2.
// GCC/Clang function multiversioning generally causes a minor
// overhead, hence we disable it if it is not needed.
// GCC/Clang function multiversioning for AVX512 is not needed if
// the user compiles with -mavx512f -mavx512vbmi -mavx512vbmi2.
// GCC/Clang function multiversioning generally causes a minor
// overhead, hence we disable it if it is not needed.
#if defined(__AVX512__) || (defined(__AVX512F__) && \
defined(__AVX512VBMI__) && \
defined(__AVX512VBMI2__))
#undef MULTIARCH_AVX512
#else
#define MULTIARCH_TARGET_DEFAULT
Expand Down
7 changes: 3 additions & 4 deletions src/PrimeGenerator.cpp
Expand Up @@ -37,10 +37,9 @@

// x86-64 AVX512
#if __has_include(<immintrin.h>) && \
(defined(__AVX512__) || \
(defined(__AVX512F__) && \
defined(__AVX512VBMI__) && \
defined(__AVX512VBMI2__)))
(defined(__AVX512__) || (defined(__AVX512F__) && \
defined(__AVX512VBMI__) && \
defined(__AVX512VBMI2__)))
#include <immintrin.h>
#define HAS_AVX512_VBMI2

Expand Down

0 comments on commit 0e9ca8a

Please sign in to comment.