check_cxx_source_compiles(
[=[
#include <immintrin.h>
+ #ifndef _MSC_VER // MSVC does not need explicit enabling of AVX2.
void func() __attribute__((target("avx2")));
+ #endif
void func() { _mm256_abs_epi8(_mm256_set1_epi32(42)); }
int main()
{
}
#ifdef HAVE_AVX2
+# ifndef _MSC_VER // MSVC does not need explicit enabling of AVX2.
int check_for_temporal_macros_avx2(string_view str)
__attribute__((target("avx2")));
+# endif
// The following algorithm, which uses AVX2 instructions to find __DATE__,
// __TIME__ and __TIMESTAMP__, is heavily inspired by
// A bit set in mask now indicates a possible location for a temporal macro.
while (mask != 0) {
// The start position + 1 (as we know the first char is _).
+# ifndef _MSC_VER
const auto start = pos + __builtin_ctz(mask) + 1;
+# else
+ unsigned long index;
+ _BitScanForward(&index, mask);
+ const auto start = pos + index + 1;
+# endif
// Clear the least significant bit set.
mask = mask & (mask - 1);