From 7614501362896ddee902c1257f1b56ad148bc4d3 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Wed, 5 Jan 2011 11:02:05 +0100 Subject: [PATCH] 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 --- src/bitcount.h | 2 ++ src/types.h | 5 +++++ 2 files changed, 7 insertions(+) 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)) -- 2.39.2