ChessUSA.com TalkChess.com
Hosted by Your Move Chess & Games
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Two small in-register-lookups
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions Flat
View previous topic :: View next topic  
Author Message
H.G.Muller



Joined: 10 Mar 2006
Posts: 12914
Location: Amsterdam

PostPost subject: Re: Two small in-register-lookups    Posted: Tue Apr 24, 2007 9:51 am Reply to topic Reply with quote

Why would you want to use in-register lookups? Fetching such simple things from a memory table should be very competative, if not faster. I noticed that these out-of-order CPUs often perform very poorly if you only use registers, it seems that there is some internal bottleneck on how many registers you can access per clock. Having some of the operands come from memory is usually more successful in keeping the ALUs busy.

On AMD machines load and stores are piggybacked on ALU makro ops, so there is no decoder penalty in using instructions with memory operands. uOp fusion in Intel machines now does the same (Pentium M and Core CPUs), while Pentium IV circumvented decoder limits by using a trace cache.

In addition, shifts are usually a bottleneck, as most CPUs have only one ALU capable of doing shifts, wich can become a bottleneck if your code uses them heavily. So better reserve them for what you really can't do without. (Plus, the i86 machine language requires a variable shift count to be in one specific register, leading to extra register-to-register moves to implement them.)

If you are worried about L1 footprint, you could pack several such tables in 64 byte. E.g. bits 0 and 1 the center distance, bit 2 the square color, etc.

Code:
colorOfSquare  = Data[sqr] & 4; // assuming it is used as a boolean, so 4=true
centerDistance = Data[sqr] & 3;

(Btw, Joker uses Wesley's method for square color, but I am considering to change that.)
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Subject Author Date/Time
Two small in-register-lookups Gerd Isenberg Mon Apr 23, 2007 10:28 pm
      Re: Two small in-register-lookups J. Wesley Cleveland Tue Apr 24, 2007 9:08 am
            Re: Two small in-register-lookups H.G.Muller Tue Apr 24, 2007 9:51 am
                  Re: Two small in-register-lookups Gerd Isenberg Tue Apr 24, 2007 11:00 am
            Re: Two small in-register-lookups Gerd Isenberg Tue Apr 24, 2007 10:58 am
                  Re: Two small in-register-lookups H.G.Muller Tue Apr 24, 2007 12:37 pm
                        Re: Two small in-register-lookups Gerd Isenberg Tue Apr 24, 2007 6:36 pm
                              Re: Two small in-register-lookups Gerd Isenberg Tue Apr 24, 2007 8:11 pm
                                    Re: Two small in-register-lookups H.G.Muller Tue Apr 24, 2007 9:48 pm
                                          Re: Two small in-register-lookups Gerd Isenberg Tue Apr 24, 2007 9:57 pm
                                                Re: Two small in-register-lookups Tord Romstad Wed Apr 25, 2007 7:40 am
                                                      Re: Two small in-register-lookups H.G.Muller Wed Apr 25, 2007 9:49 am
                                                            Re: Two small in-register-lookups Tord Romstad Wed Apr 25, 2007 10:53 am
                                                                  Re: Two small in-register-lookups H.G.Muller Wed Apr 25, 2007 12:01 pm
                                                      Re: Two small in-register-lookups Gerd Isenberg Fri Apr 27, 2007 7:41 pm
                        Re: Two small in-register-lookups Gerd Isenberg Fri Apr 27, 2007 7:44 pm
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Powered by phpBB © 2001, 2005 phpBB Group
Enhanced with Moby Threads