change includes
parent
f52397934b
commit
7690ff1b9a
|
@ -20,6 +20,7 @@
|
|||
#include <bitset>
|
||||
|
||||
#include "bitboard.h"
|
||||
#include "cpuinfo.h"
|
||||
#include "misc.h"
|
||||
|
||||
namespace Stockfish {
|
||||
|
@ -38,6 +39,12 @@ Magic BishopMagics[SQUARE_NB];
|
|||
|
||||
/// popcount() counts the number of non-zero bits in a bitboard
|
||||
|
||||
// To enable one binary for all x86 CPUs, we call popcount() using a function pointer.
|
||||
// This pointer is initialized with "select_optimal_popcount_function_at_runtime".
|
||||
// At the first execution "select_optimal_popcount_function_at_runtime" reads the
|
||||
// runtime CPUInfo and updates the "popcount" pointer based on the detected CPU capabilities.
|
||||
// From this point on, the code uses the version of the function set by the selector.
|
||||
|
||||
int popcount_function_fast(Bitboard b) {
|
||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
return (int)_mm_popcnt_u64(b);
|
||||
|
@ -63,11 +70,6 @@ int select_optimal_popcount_function_at_runtime(Bitboard b) {
|
|||
}
|
||||
}
|
||||
|
||||
// To enable one binary for all x86 CPUs, we call "popcount" using a function pointer.
|
||||
// This pointer is initialized with "select_optimal_popcount_function_at_runtime".
|
||||
// At the first execution "select_optimal_popcount_function_at_runtime" reads the
|
||||
// runtime CPUInfo and updates the "popcount" pointer based on the detected CPU capabilities.
|
||||
// From this point on, the code uses the version of the function set by the selector.
|
||||
PopCntFunctionPtr popcount = &select_optimal_popcount_function_at_runtime;
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include <string>
|
||||
|
||||
#include "types.h"
|
||||
#include "cpuinfo.h"
|
||||
|
||||
namespace Stockfish {
|
||||
|
||||
|
|
12
src/misc.cpp
12
src/misc.cpp
|
@ -57,6 +57,7 @@ typedef bool(*fun3_t)(HANDLE, CONST GROUP_AFFINITY*, PGROUP_AFFINITY);
|
|||
#endif
|
||||
|
||||
#include "misc.h"
|
||||
#include "cpuinfo.h"
|
||||
#include "thread.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -67,6 +68,12 @@ namespace Stockfish {
|
|||
/// function that doesn't stall the CPU waiting for data to be loaded from memory,
|
||||
/// which can be quite slow.
|
||||
|
||||
// To enable one binary for all x86 CPUs, we call prefetch() using a function pointer.
|
||||
// This pointer is initialized with "select_optimal_prefetch_function_at_runtime".
|
||||
// At the first execution "select_optimal_prefetch_function_at_runtime" reads the
|
||||
// the runtime CPUInfo and updates "prefetch" pointer based on detected CPU capabilities.
|
||||
// From that point on, the code uses the version of the function set by the selector.
|
||||
|
||||
void prefetch_function_fast(void* addr) {
|
||||
# if defined(__INTEL_COMPILER)
|
||||
// This hack prevents prefetches from being optimized away by
|
||||
|
@ -94,11 +101,6 @@ void select_optimal_prefetch_function_at_runtime(void* addr) {
|
|||
}
|
||||
}
|
||||
|
||||
// To enable one binary for all x86 CPUs, we call "prefetch" using a function pointer.
|
||||
// This pointer is initialized with "select_optimal_prefetch_function_at_runtime".
|
||||
// At the first execution "select_optimal_prefetch_function_at_runtime" reads the
|
||||
// the runtime CPUInfo and updates "prefetch" pointer based on detected CPU capabilities.
|
||||
// From that point on, the code uses the version of the function set by the selector.
|
||||
PrefetchFunctionPtr prefetch = &select_optimal_prefetch_function_at_runtime;
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <cstdint>
|
||||
|
||||
#include "types.h"
|
||||
#include "cpuinfo.h"
|
||||
|
||||
namespace Stockfish {
|
||||
|
||||
|
|
Loading…
Reference in New Issue