]> git.sesse.net Git - stockfish/commitdiff
Use compiler intrinsic instead of assembly for popcnt
authorlucasart <lucas.braesch@gmail.com>
Thu, 3 Jul 2014 10:22:53 +0000 (18:22 +0800)
committerlucasart <lucas.braesch@gmail.com>
Thu, 3 Jul 2014 10:22:53 +0000 (18:22 +0800)
This time, do not break compatibility with some AMD machines that have SSE3 and popcnt, but do
not have SSE4.2.

No functional change.

src/Makefile
src/bitcount.h

index 187e7b313404fb5df608a62eba6d38cd81b546fc..1e5a16580b188df89614665027b8681453082d51 100644 (file)
@@ -285,7 +285,7 @@ endif
 
 ### 3.9 popcnt
 ifeq ($(popcnt),yes)
 
 ### 3.9 popcnt
 ifeq ($(popcnt),yes)
-       CXXFLAGS += -msse3 -DUSE_POPCNT
+       CXXFLAGS += -msse3 -mpopcnt -DUSE_POPCNT
 endif
 
 ### 3.10 pext
 endif
 
 ### 3.10 pext
index f84c51cb8596caf76e658d126330c898dafde7f8..9feed19f9755a94be0022f3e9cf5c891972589d0 100644 (file)
@@ -96,8 +96,7 @@ inline int popcount<CNT_HW_POPCNT>(Bitboard b) {
 
 #else
 
 
 #else
 
-  __asm__("popcnt %1, %0" : "=r" (b) : "r" (b));
-  return b;
+  return __builtin_popcountll(b);
 
 #endif
 }
 
 #endif
 }