From: Marco Costalba Date: Wed, 5 Jan 2011 10:02:05 +0000 (+0100) Subject: Fix POPCNT support for Intel compiler under Windows X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=7614501362896ddee902c1257f1b56ad148bc4d3 Fix POPCNT support for Intel compiler under Windows Reported by Martin Wyngaarden that also confirmed this patch to work. No functional change. Signed-off-by: Marco Costalba --- diff --git a/src/bitcount.h b/src/bitcount.h index 0992c006..3c5ba2a1 100644 --- a/src/bitcount.h +++ b/src/bitcount.h @@ -85,6 +85,8 @@ template<> inline int count_1s(Bitboard b) { #if !defined(USE_POPCNT) return int(b != 0); // Avoid 'b not used' warning +#elif defined(_MSC_VER) && defined(__INTEL_COMPILER) + return _mm_popcnt_u64(b); #elif defined(_MSC_VER) return __popcnt64(b); #elif defined(__GNUC__) diff --git a/src/types.h b/src/types.h index 161117f8..a379d544 100644 --- a/src/types.h +++ b/src/types.h @@ -86,6 +86,11 @@ typedef uint64_t Bitboard; #define USE_BSFQ #endif +// Intel header for _mm_popcnt_u64() intrinsic +#if defined(USE_POPCNT) && defined(_MSC_VER) && defined(__INTEL_COMPILER) +#include +#endif + // Cache line alignment specification #if defined(_MSC_VER) || defined(__INTEL_COMPILER) #define CACHE_LINE_ALIGNMENT __declspec(align(64))