This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/17236] inefficient code for long long multiply on x86
- From: "ubizjak at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Dec 2007 13:47:22 -0000
- Subject: [Bug rtl-optimization/17236] inefficient code for long long multiply on x86
- References: <bug-17236-1008@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #11 from ubizjak at gmail dot com 2007-12-18 13:47 -------
Generated code for a similar example is just plain stupid:
--cut here--
int test(long long a, long long b)
{
return a * b;
}
--cut here--
gcc -O3:
test:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
movl %esi, 4(%esp)
movl 16(%ebp), %esi
movl %ebx, (%esp)
movl 8(%ebp), %ebx
movl %esi, %eax
movl 4(%esp), %esi
mull %ebx
movl (%esp), %ebx
movl %ebp, %esp
popl %ebp
ret
gcc-4.0 is a little less creative and creates:
test:
pushl %ebp
movl %esp, %ebp
pushl %edi
pushl %esi
pushl %ebx
movl 8(%ebp), %eax
mull 16(%ebp)
popl %ebx
popl %esi
popl %edi
leave
ret
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17236