Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: ASM/Optimization

Author: Vasik Rajlich

Date: 05:51:19 12/06/05

Go up one level in this thread


On December 05, 2005 at 23:24:52, Zappa wrote:

>I am getting really, really tired of coding all my evaluation twice (once for
>white and once for black).  However, one of the things that is keeping me from
>switching to a for(i < 2) loop is that I can't do a shift!
>
>For example, if I have some pattern based on (pawns << 8) for white, than that
>is (pawns >> 8) for black, and you can't do a negative shift in IA32.
>
>My ideas:
>
>Eugene will happily point out that on the Itanium doing two shifts and selecting
>the correct value is 1 (2?) bundles.
>
>Otherwise on AMD64 I could do
>
>a) two shifts & cmov.  I think 5 instructions (as compared to 1, and I have a
>LOT of shifts).
>
>b) << followed by >>.  1 extra instruction but I have twice as many loads for
>constants.
>
>c) rotate (X | 64-x) (but then I have the possibility of things ending up
>rotating around).
>
>d) your name here . . . :)
>
>I am not that concerned about latency because there would usually be alot of
>stuff around that could be rescheduled, but if I have to do 5 instructions for
>every shift my code size will triple.
>
>anthony

Just one thing which I am sure you are aware of - coding your evaluation twice
is a good way to make sure you don't have any bugs.

The problems come when you're impatient and start cut-and-pasting :)

Vas



This page took 0 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.