[Bug middle-end/47581] [4.6 regression] Unnecessary adjustments to stack pointer
hjl.tools at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Feb 2 14:57:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47581
--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> 2011-02-02 14:57:22 UTC ---
For this tescase, gcc 4.4 generates the most efficient code
while 4.5/4.6 become worse and worse:
[hjl@gnu-6 gcc]$ cat x.i
unsigned mulh(unsigned a, unsigned b)
{
unsigned long long l __attribute__ ((aligned(32)))
=((unsigned long long)a * (unsigned long long)b) >> 32;
return l;
}
[hjl@gnu-6 gcc]$ /usr/gcc-4.4/bin/gcc -O2 -S -fomit-frame-pointer x.i -m32
[hjl@gnu-6 gcc]$ cat x.s
.file "x.i"
.text
.p2align 4,,15
.globl mulh
.type mulh, @function
mulh:
movl 8(%esp), %eax
mull 4(%esp)
movl %edx, %eax
ret
.size mulh, .-mulh
.ident "GCC: (GNU) 4.4.4"
.section .note.GNU-stack,"",@progbits
[hjl@gnu-6 gcc]$ /usr/gcc-4.5/bin/gcc -O2 -S -fomit-frame-pointer x.i -m32
[hjl@gnu-6 gcc]$ cat x.s
.file "x.i"
.text
.p2align 4,,15
.globl mulh
.type mulh, @function
mulh:
pushl %ebp
movl %esp, %ebp
movl 12(%ebp), %eax
mull 8(%ebp)
popl %ebp
movl %edx, %eax
ret
.size mulh, .-mulh
.ident "GCC: (GNU) 4.5.1 20100507 (prerelease) [gcc-4_5-branch revision
159167]"
.section .note.GNU-stack,"",@progbits
[hjl@gnu-6 gcc]$ ./xgcc -B./ -O2 -S -fomit-frame-pointer x.i -m32
[hjl@gnu-6 gcc]$ cat x.s
.file "x.i"
.text
.p2align 4,,15
.globl mulh
.type mulh, @function
mulh:
.LFB0:
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
andl $-32, %esp
movl 12(%ebp), %eax
mull 8(%ebp)
leave
.cfi_restore 5
.cfi_def_cfa 4, 4
movl %edx, %eax
ret
.cfi_endproc
.LFE0:
.size mulh, .-mulh
.ident "GCC: (GNU) 4.6.0 20110131 (experimental)"
.section .note.GNU-stack,"",@progbits
[hjl@gnu-6 gcc]$
More information about the Gcc-bugs
mailing list