public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/47735] New: [4.5/4.6 Regression] Unnecessary adjustments to stack pointer
Date: Mon, 14 Feb 2011 17:48:00 -0000	[thread overview]
Message-ID: <bug-47735-4@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2011-02-14 17:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-14 17:48 hjl.tools at gmail dot com [this message]
2011-02-15 11:07 ` [Bug middle-end/47735] " rguenth at gcc dot gnu.org
2011-02-20 15:34 ` steven at gcc dot gnu.org
2011-02-22  9:52 ` jakub at gcc dot gnu.org
2011-04-28 15:32 ` [Bug middle-end/47735] [4.5/4.6/4.7 " rguenth at gcc dot gnu.org
2012-07-02 11:23 ` [Bug middle-end/47735] [4.5/4.6/4.7/4.8 " rguenth at gcc dot gnu.org
2013-04-12 15:17 ` [Bug middle-end/47735] [4.7/4.8/4.9 " jakub at gcc dot gnu.org
2014-01-02  9:32 ` jakub at gcc dot gnu.org
2014-01-09 21:00 ` jakub at gcc dot gnu.org
2014-01-10 21:45 ` law at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-47735-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).