]> git.sesse.net Git - stockfish/commit
Disable POPCNT support per default
authorMarco Costalba <mcostalba@gmail.com>
Sat, 4 Jul 2009 08:07:45 +0000 (09:07 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 4 Jul 2009 08:20:28 +0000 (09:20 +0100)
commit36437f14e8cbac4c6b883248cccc9e707e957c68
tree16ee7db56e201ba9b47a68a3818171fd9d709640
parent08f3aac97c9ee9d9a4cf0a3232ac0bfa4c320896
Disable POPCNT support per default

This is mainly intended to allow 64 bit compiles on any
system and avoid to crash when the binary, compiled on a
box where POPCNT is not supported, is run on a Core i7
system or similar CPU.

What could happen is that when compiled in a standard 64 bit
system, because the correct headers for the POPCNT intrinsic
are not found, the compiler creates dummy bit count functions
instead, these are never called at runtime on the machine where
Stockfish has been compiled. But if we run the same binary on a
Core i7 system, because POPCNT is detected at run time, the dummy
bitcount functions will be called giving false results that will
crash the application.

Note that would be possible to fallback on software bit count in
these cases, but this is even more subtle because POPCNT path is not
optimized so that we have an application working but at sub-optimal
speed, so better to crash, at least user is loudly warned that there
is something wrong.

If, instead, Stockfish is compiled on a Core i7 system with POPCNT
enabled, then if the PGO compile has been done properly, the same binary
will run at optimal speed _both_ on the Core i7 machine and on any other
64 bit standard machine. This is the ideal mode for binary distribution.

Finally this patch disables bsfq support under Windows, because it seems
inline assembly is not supported both by MSVC and by Intel Windows version.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Readme.txt
src/bitcount.h
src/types.h