On Thursday, 02 June 2005, at 15:56:40 (-0400),
John Ellson wrote:

> RCS file: /cvsroot/enlightenment/eterm/libast/configure.in,v
> retrieving revision 1.24

Got it, thanks.



On Thursday, 02 June 2005, at 16:02:00 (-0400),
Mike Frysinger wrote:

> would an ifdef like:
> #if STRICT_ISO_C99 || __GNUC__ > 4
> be unacceptable ?  that way the installed libast wouldnt need to be 
> reconfigured/built/installed just to change STRICT_ISO_C99 ...

How about this:

#ifdef __GNUC__
#  if __GNUC__ >= 4
#    define STRICT_ISO_C99
#  fi
...
#endif




On Thursday, 02 June 2005, at 18:39:01 (-0600),
Tres Melton wrote:

> #define BINSWAP(a, b) \
>    (((long) (a)) ^= ((long) (b)) ^= ((long) (a)) ^= ((long) (b)))
> 
> int main( void )
> {
>   long a = 3;
>   long b = 8;
> 
>   asm( "noop;noop;noop" );
>   BINSWAP(a,b);
>   asm( "noop;noop;noop" );
> 
> }
> 
> yields:
> 
>         noop;noop;noop
>         movq    -16(%rbp), %rdx
>         leaq    -8(%rbp), %rax 
>         xorq    %rdx, (%rax)   
>         movq    -8(%rbp), %rdx 
>         leaq    -16(%rbp), %rax
>         xorq    %rdx, (%rax)   
>         movq    -16(%rbp), %rdx
>         leaq    -8(%rbp), %rax 
>         xorq    %rdx, (%rax)   
>         noop;noop;noop
> 
> If you enable -O[123] then you will need to use the values a & b before
> and after the BINSWAP call or they will be optimized away.  And simply
> using immediate values like I did will cause the compiler to simply set
> the different registers that are used to access them in reverse order.
> In other words the swap gets optimized out.  The above code is without
> -O and is clearly more complicated (by more than double) than it needs
> to be.

Interesting.  You think I should just get rid of it then?



On Thursday, 02 June 2005, at 21:04:59 (-0400),
John Ellson wrote:

> I understand that this is a ISO C99 restriction and that gcc4 is
> just a bit more pedantic than gcc3.

gcc4 does C99 by default now, does it not?

> In fact my first attempt at a fix was to just not use the xor
> BINSWAP macro at all, but this is really a question for Michael.  I
> was just trying to get his code to compile.

It's actually slower normally but faster optimized:

-O0
Profiling SWAP() macro...3000000 iterations in 0.052468 seconds, 1.7489e-08 
seconds per iteration
Profiling BINSWAP() macro...3000000 iterations in 0.067905 seconds, 2.2635e-08 
seconds per iteration

-O2
Profiling SWAP() macro...3000000 iterations in 0.014328 seconds, 4.776e-09 
seconds per iteration
Profiling BINSWAP() macro...3000000 iterations in 0.014183 seconds, 4.7277e-09 
seconds per iteration

(Done with libast's "make perf")

Michael

-- 
Michael Jennings (a.k.a. KainX)  http://www.kainx.org/  <[EMAIL PROTECTED]>
n + 1, Inc., http://www.nplus1.net/       Author, Eterm (www.eterm.org)
-----------------------------------------------------------------------
 "There is a greater darkness than the one we fight.  It is the 
  darkness of a soul that has lost its way."       -- G'Kar, Babylon 5


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to