X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=599350888d86cca9243a081334b5fd48b3911d1b;hp=a005d5df2809e069318f0bbb7fec1c67d04ffea9;hb=52cab06fff5b84ecc252fb9d4137f8d92ab8dddf;hpb=bd87ab9ff508e826f7e8b62accc9ea4ddf477367 diff --git a/src/position.cpp b/src/position.cpp index a005d5df..59935088 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -802,9 +802,10 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI pieceList[them][capture][index[lastSquare]] = lastSquare; pieceList[them][capture][pieceCount[them][capture]] = SQ_NONE; - // Update hash keys + // Update material hash key and prefetch access to materialTable k ^= Zobrist::psq[them][capture][capsq]; st->materialKey ^= Zobrist::psq[them][capture][pieceCount[them][capture]]; + prefetch((char*)thisThread->materialTable[st->materialKey]); // Update incremental scores st->psqScore -= pieceSquareTable[make_piece(them, capture)][capsq]; @@ -831,7 +832,7 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI st->castleRights &= ~cr; } - // Prefetch TT access as soon as we know key is updated + // Prefetch TT access as soon as we know the new hash key prefetch((char*)TT.first_entry(k)); // Move the piece @@ -894,17 +895,14 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI st->npMaterial[us] += PieceValue[MG][promotion]; } - // Update pawn hash key + // Update pawn hash key and prefetch access to pawnsTable st->pawnKey ^= Zobrist::psq[us][PAWN][from] ^ Zobrist::psq[us][PAWN][to]; + prefetch((char*)thisThread->pawnsTable[st->pawnKey]); // Reset rule 50 draw counter st->rule50 = 0; } - // Prefetch pawn and material hash tables - prefetch((char*)thisThread->pawnsTable[st->pawnKey]); - prefetch((char*)thisThread->materialTable[st->materialKey]); - // Update incremental scores st->psqScore += psq_delta(piece, from, to);