[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: &, &&, and CPU cycles

From: Paolo Bonzini
Subject: Re: &, &&, and CPU cycles
Date: Fri, 05 Sep 2008 07:41:26 +0200
User-agent: Thunderbird (Macintosh/20080707)

Bruno Haible wrote:
> Hi Ralf,
>>>> I count ca. 2 CPU
>>>> cycles for a memory access and ca. 8 CPU cycles for a conditional jump,
>>>> therefore I would say that the change slows down the program a bit.
>> For what little it's worth, this code cycle argument does not take into
>> account the optimization features of recent GCC versions AFAIK.
> Which gcc versions are you alluding at? The attached program, compiled
> with -O2 -S for i686, yields 3 conditional branches in shortcircuit_and
> and 1 conditional branch in binary_and, with gcc 4.3.0 - same as with
> previous versions of gcc. It it improved in gcc 4.4 snapshots?

I have a pending patch to transform && || ! to & | ^ when possible, but
it does not apply necessarily to jumps.  There is a parameter called
-mbranch-cost={1,2,3,4,5} that you can use to choose how && and || are
compiled in jumps.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]