Shave some instructions off a hot loop in affine transform

On x86, GCC generates highly suboptimal code for this loop in its old form,
about 2x as many instructions as necessary. This decreases throughput
especially in an SMT setting. Clang does a better job but this change still has
some improvement. Note that the std::ptrdiff_t type is not optional; using an
unsigned type brings back the bad assembly. (Not sure why, but it seems
reliable on all the GCC versions I tested.)

passed STC:
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 44672 W: 11841 L: 11527 D: 21304
Ptnml(0-2): 165, 4625, 12415, 4993, 138
https://tests.stockfishchess.org/tests/view/68d8111efa806e2e8393b10e

closes https://github.com/official-stockfish/Stockfish/pull/6331

No functional change
This commit is contained in:
Timothy Herchen
2025-09-28 21:04:29 +02:00
committed by Joost VandeVondele
parent 4f4f78f86e
commit 9b164d9520
2 changed files with 13 additions and 5 deletions
+1
View File
@@ -243,6 +243,7 @@ Thanar2
thaspel
theo77186
TierynnB
Timothy Herchen (anematode)
Ting-Hsuan Huang (fffelix-huang)
Tobias Steinmann
Tomasz Sobczyk (Sopel97)