diff --git a/src/Makefile b/src/Makefile index 562192ca615..187e7b31340 100644 --- a/src/Makefile +++ b/src/Makefile @@ -285,7 +285,7 @@ endif ### 3.9 popcnt ifeq ($(popcnt),yes) - CXXFLAGS += -msse4.2 -DUSE_POPCNT + CXXFLAGS += -msse3 -DUSE_POPCNT endif ### 3.10 pext diff --git a/src/bitcount.h b/src/bitcount.h index 9feed19f975..f84c51cb859 100644 --- a/src/bitcount.h +++ b/src/bitcount.h @@ -96,7 +96,8 @@ inline int popcount(Bitboard b) { #else - return __builtin_popcountll(b); + __asm__("popcnt %1, %0" : "=r" (b) : "r" (b)); + return b; #endif }