Author: Robert Hyatt
Date: 07:41:20 02/05/98
Go up one level in this thread
On February 05, 1998 at 09:10:20, Amir Ban wrote: >On February 04, 1998 at 23:03:26, Bruce Moreland wrote: > >>Actually, it's a good idea to compile your program once and produce an >>assembly listing ("-Fc" works great in MSVC), and search for "mul" and >>"div", in an effort to minimize these. >> >>bruce > >I thought modern processors do these rather fast. > >Amir there's fast and there's fast. In this case, fast yes, but relatively fast, no. the AND operation is one cycle on every machine I know of, from the PC to the Cray. The integer divide is not. The Cray doesn't even have such an instruction. Which means using the MOD function is a killer. But Bruce is right, DIV=bad. How bad depends on how often you do it. I don't use his AND trick to trigger a time check, because it is not multiprocessor safe. I (in Cray Blitz anyway, probably in Crafty when it starts parallel searching in a month or so now) don't want more than one processor to do the time-out check for several reasonsl.. I do a "time_ check_nodes=N" and decrement this at the top of search. It can only hit zero on one processor, and that one does the check. I used to use the AND trick as well in Crafty until I started thinking about potential things I wanted to avoid when I do the parallel search... Another example is the find first one bit on the P5. Neat. *very* slow too... you can't do better than AND/OR/XOR/SHIFT... on the machines I use, those are one-cycle jobbies... normal MUL/DIV instructions are slow. If you play with doing this, you find out why it isn't a one-cycle operation... it takes iterations to do it..
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.