Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Implementation of the abs() function [o.t.]

Author: Dieter Buerssner

Date: 10:49:30 07/06/03

Go up one level in this thread


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.

>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



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.