Computer Chess Club Archives


Search

Terms

Messages

Subject: ASM/Optimization

Author: Zappa

Date: 20:24:52 12/05/05


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



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.