Author: Jens Kahlenberg
Date: 11:40:03 07/06/03
Go up one level in this thread
On July 06, 2003 at 14:06:21, Gerd Isenberg wrote: >On July 06, 2003 at 13:49:30, Dieter Buerssner wrote: > >>On July 06, 2003 at 12:23:32, Jens Kahlenberg wrote: >> >>>Would be interesting to know what version Dieter is using and to find out why >>>his version seems to have a __builtin_abs with branching target-code. >> >>Gcc 3.2 from DJGPP. It defaults to the branching version. When using >>-march=pentium4 it uses conditional move (also with simple_abs). I use this, to >>make DOS executables. They should normally run with 386. I have actually sent my >>engine to few people with no pentium. Gcc from MinGW shows the same behaviour >>(no surprise). >> >>BTW. Using the branchless code may very well make real applications (vs. stupid >>tight loop testing of abs()) slower. For example the cdq method will use eax and >>edx registers always, an might make surrounding code slower, because no values >>can be let in those registers. The branching method will need no additional >>register at all, often, and will work with any register. > >Yes, a trade off, one additional register against the probability of branch >misprediction. Thank you both, now i know why gcc uses branching code in __builtin_abs (for 386 default target). BTW: Just a few minutes ago i ran Dieter's slightly modified code (cmov eliminated and looping reduced) compiled with cygwin-gcc on a dusty laptop with a 150MHz P54C and __builtin_abs was fastest. > >> >>>Dieter >>>might even (with a lot of work) optimize further by compiling a new >>>(P4-targeted) gcc-compiler on his system with the existing one and perhaps abs >>>will be alright then. >> >>I doubt it very much. The optimization of the compiler itself should nothing >>have to do with the generated code. If it does, the most probable reason might >>be a bug in the compiler. Actually gcc bootstrapping procedure does this test. >>It compiles the compiler 3 times. First with the old compiler, than with the new >>compiler, then again ... Last 2 compiles are compared. >> >>Regards, >>Dieter You're right, Dieter. Just thought you could use an older version so -march and -mcpu might not be aware of pentium4. But compiling a new gcc doesn't make any sense at all if you're using 3.2. Regards, Jens
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.