mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 00:26:33 +08:00
Enable prefetch also for gcc
This fix a compile error under Linux with gcc when there aren't the intel dev libraries. Also simplify the previous patch moving TT definition from search.cpp to tt.cpp so to avoid using passing a pointer to TT to the current position. Finally simplify do_move(), now we miss a prefetch in the rare case of setting an en-passant square but code is much cleaner and performance penalty is almost zero. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
12
src/tt.cpp
12
src/tt.cpp
@@ -25,15 +25,19 @@
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <xmmintrin.h>
|
||||
|
||||
#include "movegen.h"
|
||||
#include "tt.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
|
||||
/// This is the number of TTEntry slots for each position
|
||||
// This is the number of TTEntry slots for each position
|
||||
static const int ClusterSize = 5;
|
||||
|
||||
// The main transposition table
|
||||
TranspositionTable TT;
|
||||
|
||||
////
|
||||
//// Functions
|
||||
@@ -174,7 +178,11 @@ TTEntry* TranspositionTable::retrieve(const Key posKey) const {
|
||||
|
||||
void TranspositionTable::prefetch(const Key posKey) const {
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
_mm_prefetch((char*)first_entry(posKey), _MM_HINT_T0);
|
||||
#else
|
||||
__builtin_prefetch((const void*)first_entry(posKey), 0, 3);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user