Re: [E-devel] libast from Eterm CVS fails to build with gcc4 on x86_64

2005-06-02 Thread Tres Melton
Has anyone actually looked into why this is failing?

By the rules of Discreet Math/Boolean Algebra:

something xor something = 0
something_else xor 0 = something_else

so

valA ^ ( valA ^ valB ) = valB

If that is not working then you may have found a compiler bug (probably
in the register allocator).  The appropriate output code should resemble
this (ATT syntax: op src, dest):

mov var_a, %r1
mov var_b, %r2
mov %r1, %r3
xor %r2, %r3
xor %r3, %r1
xor %r3, %r2
mov %r1, var_a
mov %r2, var_b

or optimized:

mov var_a, %r1
xor var_b, %r1
xor %r1, var_a
xor %r1, var_b

or load the values, manipulate the values, store the values.  If
something happens in the middle of those steps, like the registers are
needed elsewhere (and not saved), then it will fail.  The above code has
two memory fetches and two memory writes.  Is it really faster than? :

mov var_a, %r1
mov var_b, %r2
mov %r2, var_a
mov %r1, var_b

without the type casting:

#define BINSWAP(a, b)  ((a) ^= (b) ^= (a) ^= (b))

seems to rely on many compiler optimizations that aren't clearly
documented and may be defined differently for different architectures,
not to mention how different compilers will choose to deal with it.
Hence the failure on x86-64.  For those curious compiling:

#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.

Just my $0.02,
-- 
Tres



---
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] libast from Eterm CVS fails to build with gcc4 on x86_64

2005-06-02 Thread John Ellson

Tres Melton wrote:


Has anyone actually looked into why this is failing?

By the rules of Discreet Math/Boolean Algebra:

something xor something = 0
something_else xor 0 = something_else

so

valA ^ ( valA ^ valB ) = valB

If that is not working then you may have found a compiler bug (probably
in the register allocator).  The appropriate output code should resemble
this (ATT syntax: op src, dest):
 



Tres,

Its not the xor thats failing.   Its the cast of the LHS of the 
assignments.

The problem line in libast.h is:

#  define BINSWAP(a, b)  (((long) (a)) ^= ((long) (b)) ^= ((long) (a)) 
^= ((long) (b)))



With gcc4 the following is invalid:

  int a=1, b=2;
  (long)a = (long)b;

and that is the test I proposed for configure.


I understand that this is a ISO C99 restriction and that gcc4 is just a 
bit more pedantic

than gcc3.

John


---
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] libast from Eterm CVS fails to build with gcc4 on x86_64

2005-06-02 Thread Tres Melton
On Thu, 2005-06-02 at 21:04 -0400, John Ellson wrote:
 Its not the xor thats failing.   Its the cast of the LHS of the 
 assignments.

I understand now.  Sorry for the confusion.

-- 
Tres



---
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] libast and eterm cvs

2004-12-28 Thread Michael Jennings
On Tuesday, 28 December 2004, at 17:59:11 (-0500),
Peter Hyman wrote:

 Well, this was not easy for me, esp., since I am not the config guru. 
 
 HOWEVER, I found the problem that allowed me to complete configure,
 although it still does not create a Makefile.
 
 First, configure.in has an error
 
 [EMAIL PROTECTED]:/mnt/src/libast$ automake -a -c
 configure.in:91: required file `${srcdir}/include/libast/types.h.in' not
 found
 
 Turns out that for me, $srcdir is never defined, or taken as a literal.
 I'm not the config guru, but changing:

$srcdir is defined by AC_INIT() in the configure script.  It keys off
configure.in (thanks to AC_INIT(configure.in) of course) to see where
the sources are.

 after mv .in config.h.in, I did a config.status --recheck and configure
 completed normally.
 
 However, Makefile still was not created. WHERE IS IT?

configure creates the Makefiles

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)
---
 A woman broke up with me and sent me pictures of her and her new
  boyfriend in bed together.  Solution?  I sent them to her dad.
   -- Christopher Case


---
SF email is sponsored by - The IT Product Guide
Read honest  candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] libast and eterm cvs

2004-12-28 Thread Peter Hyman
On Tue, 2004-12-28 at 18:28 -0500, Michael Jennings wrote:
 On Tuesday, 28 December 2004, at 17:59:11 (-0500),
 Peter Hyman wrote:
 
  Well, this was not easy for me, esp., since I am not the config guru. 
  
  HOWEVER, I found the problem that allowed me to complete configure,
  although it still does not create a Makefile.
  
  First, configure.in has an error
  
  [EMAIL PROTECTED]:/mnt/src/libast$ automake -a -c
  configure.in:91: required file `${srcdir}/include/libast/types.h.in' not
  found
  
  Turns out that for me, $srcdir is never defined, or taken as a literal.
  I'm not the config guru, but changing:
 
 $srcdir is defined by AC_INIT() in the configure script.  It keys off
 configure.in (thanks to AC_INIT(configure.in) of course) to see where
 the sources are.
 
  after mv .in config.h.in, I did a config.status --recheck and configure
  completed normally.
  
  However, Makefile still was not created. WHERE IS IT?
 
 configure creates the Makefiles

That's my point. It doesn't! There is no Makefile.in.

 
 Michael
 
-- 
Peter



---
SF email is sponsored by - The IT Product Guide
Read honest  candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] libast and eterm cvs

2004-12-28 Thread Peter Hyman
On Tue, 2004-12-28 at 20:07 -0500, Mike Frysinger wrote:
 On Tuesday 28 December 2004 07:40 pm, Peter Hyman wrote:
  That's my point. It doesn't! There is no Makefile.in.
 
 Makefile.in is generated by automake from Makefile.am and other magical 
 files, 
 configure generates Makefile from Makefile.in
 -mike
 
I know it should. It does not. :(
 
 ---
 SF email is sponsored by - The IT Product Guide
 Read honest  candid reviews on hundreds of IT Products from real users.
 Discover which products truly live up to the hype. Start reading now. 
 http://productguide.itmanagersjournal.com/
 ___
 enlightenment-devel mailing list
 enlightenment-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
-- 
Peter



---
SF email is sponsored by - The IT Product Guide
Read honest  candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] libast and eterm cvs

2004-12-28 Thread Mike Frysinger
On Tuesday 28 December 2004 05:59 pm, Peter Hyman wrote:
 Well, this was not easy for me, esp., since I am not the config guru.

take a step back

why are you running these autotools yourself ?  why arent you running 
`./autogen.sh` ?

as you showed somewhere in a previous e-mail, you're attempting to use 
autotools that may just be a little too new ;)
-mike


---
SF email is sponsored by - The IT Product Guide
Read honest  candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] libast and eterm cvs

2004-12-28 Thread Michael Jennings
On Tuesday, 28 December 2004, at 19:40:34 (-0500),
Peter Hyman wrote:

  configure creates the Makefiles
 
 That's my point. It doesn't! There is no Makefile.in.

Peter,

This is why these tools are less-than-affectionately known around here
as autoFUCK.  There's very little consistency between versions, and
they often cause just as many problems as they solve.

I can't spend a bunch of time diagnosing auto* errors for you.  My
advice is to download the tarballs from eterm.org since the files
generated by auto* are already there.

Needless to say, I can't reproduce your problem here. :)

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)
---
 Whoa.  Somebody computer programmers think is anti-social?  That
  I'd like to see.-- Sydney Penny, Hyperion Bay


---
SF email is sponsored by - The IT Product Guide
Read honest  candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel