Article View: gnu.gcc.bug
Article #1573missed long long optimizations on i386
From: Bruno Haible
Date: Sun, 20 Dec 1992 00:45
Date: Sun, 20 Dec 1992 00:45
76 lines
2455 bytes
2455 bytes
This is not a bug report, only a hint that "long long" performance on
i386 may be improved.
I'm working with gcc 2.2.2, configured as i386-linux.
Input file:
============================== lltest.c =====================================
unsigned long foo (unsigned long long x)
{ return x & 0x00000000FFFFFFFFULL; }
unsigned long foo2 (unsigned long long x, unsigned long long y)
{ unsigned long long z = x + y;
z &= 0x00000000FFFFFFFFULL;
return z;
}
unsigned long long bar (void* addr)
{ return (unsigned long long)(unsigned long)(addr) + 0x0000000D00000000ULL; }
==============================================================================
Output from "gcc -O6 -S lltest.c", with comments:
================================= lltest.s ===================================
.file "lltest.c"
gcc2_compiled.:
.text
.align 2
.globl _foo
_foo:
pushl %ebp
movl %esp,%ebp
movl 8(%ebp),%eax
movl 12(%ebp),%edx ! superfluous
leave
ret
.align 2,0x90
.align 2
.globl _foo2
_foo2:
pushl %ebp
movl %esp,%ebp
pushl %ebx
movl 8(%ebp),%ecx
movl 12(%ebp),%ebx
addl 16(%ebp),%ecx
adcl 20(%ebp),%ebx
movl %ecx,%eax
xorl %edx,%edx ! superfluous
movl -4(%ebp),%ebx
leave
ret
.align 2
.globl _bar
_bar:
pushl %ebp
movl %esp,%ebp
movl 8(%ebp),%eax
movl %eax,%edx !
xorl %ecx,%ecx ! may be replaced by
movl %edx,%eax ! a simple
movl %ecx,%edx !
addl $0,%eax ! movl $13,%edx
adcl $13,%edx !
leave
ret
.align 2,0x90
==============================================================================
Note further that gcc (even without -O) aborts like this on some bigger
functions that use many "long long" variables. I can provide examples.
gcc: Internal compiler error: program cc1 got fatal signal 6
Bruno Haible
haible@ma2s2.mathematik.uni-karlsruhe.de
Technical Details
Message-ID:
<9212192245.AA01050@ma2s2.mathematik.uni-karlsruhe.de>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!ma2s2.mathematik.uni-karlsruhe.de!haibleShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!ma2s2.mathematik.uni-karlsruhe.de!haible From: haible@ma2s2.mathematik.uni-karlsruhe.de (Bruno Haible) Subject: missed long long optimizations on i386 Message-ID: <9212192245.AA01050@ma2s2.mathematik.uni-karlsruhe.de> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Sun, 20 Dec 1992 00:45:33 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 77