From c4007bc37a68f3fbd5cacbe1eea1e9a871c9282d Mon Sep 17 00:00:00 2001 From: Counterply Date: Fri, 29 Jun 2018 21:17:52 -0400 Subject: [PATCH] Use special rule for BlockedByKing bench 5512000 https://github.com/official-stockfish/Stockfish/commit/12ef8f71a2822f91e844e26d352d5fc27ac9559f --- arm/Evaluate.arm | 34 +++++++++++++++++++++++++--------- arm/Evaluate_Init.arm | 9 --------- x86/Evaluate.asm | 39 +++++++++++++++++++++++++++++---------- x86/Evaluate_Init.asm | 9 --------- 4 files changed, 54 insertions(+), 37 deletions(-) diff --git a/arm/Evaluate.arm b/arm/Evaluate.arm index e697934c5..c7243c0ad 100644 --- a/arm/Evaluate.arm +++ b/arm/Evaluate.arm @@ -830,15 +830,19 @@ macro ShelterStorm Us if Us = White Them = Black Up = DELTA_N + Down = DELTA_S Pieces_Pawn = x19 Pieces_Us = x28 Pieces_Them = x29 + BlockRanks = Rank1BB or Rank2BB else Them = White Up = DELTA_S + Down = DELTA_N Pieces_Pawn = x19 Pieces_Us = x29 Pieces_Them = x28 + BlockRanks = Rank8BB or Rank7BB end if stp x26, x27, [sp, -16]! @@ -869,6 +873,23 @@ macro ShelterStorm Us cmp x2, 0 csneg w0, w0, w0, eq ; w0 = saftey + + ;if ((shift(theirPawns) & (FileABB | FileHBB) & BlockRanks) & ksq) + mov x11, x10 + ShiftBB Down, x11, x11 + mov x22, x11 ; r12 = shift(theirPawns) + mov x11, FileABB or FileHBB + and x22, x22, x11 ; r12 & (FileABB|FileHBB) + mov x11, BlockRanks + and x22, x22, x11 ; r12 & BlockRanks + mov x11, Pieces_Us + ldr x2, [x20, Pos.typeBB + 8*King] + and x11, x11, x2 + and x22, x22, x11 ; r12 & ksq + cmp x22, 0 + beq @f + add w0, w0, 374 +@@: if Us = Black eor w23, w23, 7 end if @@ -932,18 +953,12 @@ macro ShelterStorm Us add w26, w26, 1 ; esi = rkUs+1 - _lea x11, StormDanger_BlockedByKing - _lea x8, ShelterStrengthArray - 4*1 - add x8, x8, x2 - add x11, x11, x2 cmp w1, w22 - add w22, w22, 1 bne @1f - _lea x8, ShelterStrengthArray - 4*1 - add x8, x8, x2 - cmp w27, w23 - beq @2f +; Rank Comparisons @1: + _lea x8, ShelterStrengthArray - 4*1 + add x8, x8, x2 _lea x11, StormDanger_NoFriendlyPawn add x11, x11, x2 cmp w26, 1 @@ -959,6 +974,7 @@ macro ShelterStorm Us add w0, w0, w4 ldr w4, [x11, x27, lsl 2] sub w0, w0, w4 + add x22, x22, 1 end repeat diff --git a/arm/Evaluate_Init.arm b/arm/Evaluate_Init.arm index e167d66d4..a064f6f58 100644 --- a/arm/Evaluate_Init.arm +++ b/arm/Evaluate_Init.arm @@ -228,15 +228,6 @@ dd 0, 0, 101, 16, 1, 0,0,0 dd 0, 0, 88, 27, 2, 0,0,0 dd 0, 0, 19, 23, 1, 0,0,0 - dd 0, -290, -274, 57, 41 , 0,0,0 - dd 0, 60, 144, 39, 13 , 0,0,0 - dd 0, 65, 141, 41, 34 , 0,0,0 - dd 0, 53, 127, 56, 14 , 0,0,0 - dd 0, 53, 127, 56, 14 , 0,0,0 - dd 0, 65, 141, 41, 34 , 0,0,0 - dd 0, 60, 144, 39, 13 , 0,0,0 - dd 0, -290, -274, 57, 41 , 0,0,0 - Evaluate_Init.Threat_Minor: dd (0 shl 16) + (0) dd (0 shl 16) + (0) diff --git a/x86/Evaluate.asm b/x86/Evaluate.asm index 38a513bbd..c86367dc5 100644 --- a/x86/Evaluate.asm +++ b/x86/Evaluate.asm @@ -743,13 +743,17 @@ macro ShelterStorm Us if Us = White Them = Black Up = DELTA_N + Down = DELTA_S PiecesUs equ r14 PiecesThem equ r15 + BlockRanks = Rank1BB or Rank2BB else Them = White Up = DELTA_S + Down = DELTA_N PiecesUs equ r15 PiecesThem equ r14 + BlockRanks = Rank8BB or Rank7BB end if push rsi rdi r11 r12 r13 @@ -768,18 +772,35 @@ macro ShelterStorm Us mov r9, PiecesUs and r9, r8 ; r9 = ourPawns - and ecx, 7 -; ecx = file of ksq + and ecx, 7 + ; ecx = file of ksq mov r10, PiecesThem and r10, r8 ; r10 = theirPawns - mov rax, qword[FileBB+8*rcx] + mov rax, qword[FileBB+8*rcx] and rax, r9 cmp rax, 1 sbb eax, eax - and eax, -10 + and eax, -10 ; saves instructions and keeps code linear add eax, 5 ; eax = saftey + +; if ((shift(theirPawns) & (FileABB | FileHBB) & BlockRanks) & ksq) + mov r11, r10 + ShiftBB Down, r11, r11 + mov r12, r11 ; r12 = shift(theirPawns) + mov r11, FileABB or FileHBB + and r12, r11 ; r12 & (FileABB|FileHBB) + mov r11, BlockRanks + and r12, r11 ; r12 & BlockRanks + mov r11, PiecesUs + and r11, qword [rbp+Pos.typeBB+8*King] + and r12, r11 ; r12 & ksq + test r12, r12 + jz @f + add eax, 374 + +@@: if Us eq Black xor r13d, 7 end if @@ -844,15 +865,12 @@ macro ShelterStorm Us add esi, 1 ; esi = rkUs+1 - lea r11, [StormDanger_BlockedByKing+rdx] - lea r8, [ShelterStrengthArray - 4*1 + rdx] cmp ecx, r12d - lea r12d, [r12+1] jne @f - lea r8, [ShelterStrengthArray - 4*1 + rdx] - cmp edi, r13d - je @1f + +; Rank Comparisons @@: + lea r8, [ShelterStrengthArray - 4*1 + rdx] lea r11, [StormDanger_NoFriendlyPawn + rdx] cmp esi, 1 je @1f @@ -863,6 +881,7 @@ macro ShelterStorm Us @1: add eax, dword[r8 + 4*rsi] sub eax, dword[r11 + 4*rdi] + lea r12d, [r12+1] end macro ShelterStormAcc diff --git a/x86/Evaluate_Init.asm b/x86/Evaluate_Init.asm index 60911a75f..bbcf1f862 100644 --- a/x86/Evaluate_Init.asm +++ b/x86/Evaluate_Init.asm @@ -218,15 +218,6 @@ dd 0, 0 , 101, 16, 1, 0, 0, 0 dd 0, 0 , 88, 27, 2, 0, 0, 0 dd 0, 0 , 19, 23, 1, 0, 0, 0 -dd 0, -290, -274, 57, 41, 0, 0, 0 -dd 0, 60, 144 , 39, 13, 0, 0, 0 -dd 0, 65, 141 , 41, 34, 0, 0, 0 -dd 0, 53, 127 , 56, 14, 0, 0, 0 -dd 0, 53, 127 , 56, 14, 0, 0, 0 -dd 0, 65, 141 , 41, 34, 0, 0, 0 -dd 0, 60, 144 , 39, 13, 0, 0, 0 -dd 0, -290, -274, 57, 41, 0, 0, 0 - .Threat_Minor: dd (0 shl 16) + (0) dd (0 shl 16) + (0)