Fix pawn entry prefetch
authormstembera <MissingEmail@email>
Wed, 15 Mar 2017 03:56:26 +0000 (20:56 -0700)
committerJoona Kiiski <joona@zoox.com>
Wed, 15 Mar 2017 03:56:26 +0000 (20:56 -0700)
No functional change

Closes #1026

src/misc.cpp
src/misc.h
src/position.cpp

index 360bd2161a64bfeb783eefa8817dd52617301da3..11833440e0c229c85bce7aefeae411f4d34d89f6 100644 (file)
@@ -205,6 +205,12 @@ void prefetch(void* addr) {
 
 #endif
 
+void prefetch2(void* addr) {
+
+    prefetch(addr);
+    prefetch((uint8_t*)addr + 64);
+}
+
 namespace WinProcGroup {
 
 #ifndef _WIN32
index 72be1ee4beaeed03649b23468dac8c617b035247..b63e613fc80f3d182af41e35bfb17a3208b01e55 100644 (file)
@@ -31,6 +31,7 @@
 
 const std::string engine_info(bool to_uci = false);
 void prefetch(void* addr);
+void prefetch2(void* addr);
 void start_logger(const std::string& fname);
 
 void dbg_hit_on(bool b);
index 40890acfd3b15e607211e137f889aa0ee3eef4b7..e20c822f5998902ba2149d13504bd9846a1833d0 100644 (file)
@@ -827,7 +827,7 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) {
 
       // Update pawn hash key and prefetch access to pawnsTable
       st->pawnKey ^= Zobrist::psq[pc][from] ^ Zobrist::psq[pc][to];
-      prefetch(thisThread->pawnsTable[st->pawnKey]);
+      prefetch2(thisThread->pawnsTable[st->pawnKey]);
 
       // Reset rule 50 draw counter
       st->rule50 = 0;