From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25943 invoked by alias); 14 Feb 2011 17:35:48 -0000 Received: (qmail 25803 invoked by uid 22791); 14 Feb 2011 17:35:47 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Feb 2011 17:35:43 +0000 From: "hjl.tools at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/47735] New: [4.5/4.6 Regression] Unnecessary adjustments to stack pointer X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hjl.tools at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Mon, 14 Feb 2011 17:48:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-02/txt/msg01703.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47735 Summary: [4.5/4.6 Regression] Unnecessary adjustments to stack pointer Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned@gcc.gnu.org ReportedBy: hjl.tools@gmail.com CC: matz@gcc.gnu.org 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]$ This is caused by revision 146817: http://gcc.gnu.org/ml/gcc-cvs/2009-04/msg01459.html