Computer Chess Club Archives


Search

Terms

Messages

Subject: RankAttacks with x^(x-2)

Author: Gerd Isenberg

Date: 11:34:48 09/30/02


Hi all,

i recently thought about and played with the x^(x-2) idea, introduced to me by
"The Hyperbola Project" some time ago. It works fine with bit 0, and i thought
that shifting to file zero is required, before generationg the attacks.
But that seems not to be necessary. The generalized term for one rank is simply

    Occupied ^ (Occupied - 2*RookMover)

where RookMover is subset of Occupied.

This term produces all rank attacks of all RookMover in positve direction
(increasing file index, here A=0,8...;B=1,9...).

What a surprise (at least for me)!

sample rank (consider the reversed bit order due to bit0 is A):
BitIndex     01234567
Occupied(O)  01011101
RookMover(R) 01001000
 2*R         00100100
-2*R         00111011
Occupied(O)  01011101
  (O-2R)     01101001
O^(O-2R)     00110100


With 64-bit mmx-registers this can be done simultaniously with all eight ranks:

input:  mm1 = RookMover subset of Occupied
             (may be forced by "por mm6,mm1")
        mm6 = Occupied
output: mm0 = (right)RookAttacks

  movq  mm0, mm6 ; Occupied
  psubb mm0, mm1 ; Occupied -   RookMover
  psubb mm0, mm1 ; Occupied - 2*RookMover
  pxor  mm0, mm6 ; Occupied ^ (Occupied - 2*RookMover)

I tried it with up/down Kogge-Stone and leftDumb7Fill.
But only a few percent better performance (24secs instead of 26secs /10**9).
With pure dumb7fill, the performance win was even less. The seven unrolled
fill-iterations with four independent mmx-instructions are not so much slower
than with three for the remaining directions.

Cheers,
Gerd



This page took 0.01 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.