Computer Chess Club Archives


Search

Terms

Messages

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

Author: Gerd Isenberg

Date: 02:02:50 07/06/03

Go up one level in this thread


Hi Dieter,

Thanks for the nice lession in macro programming and gnu/ata-assembler.
Conclusion: branchless code on random, not predictable data is clearly
favorable. The sar instructions is not that slow on P4.
The five byte sequence with cdq is fastest:

00401026 99                   cdq
00401027 33 C2                xor         eax,edx
00401029 2B C2                sub         eax,edx

With mvc using math.h abs is fastest. With gcc cdq inline assembly abs or omids
c-abs is much faster than the branching lib abs (maybe a macro from some header
file?).

Regards,
Gerd



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.