public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ktietz at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/47477] [4.7/4.8/4.9 regression] Sub-optimal mov at end of method
Date: Tue, 22 Oct 2013 14:18:00 -0000	[thread overview]
Message-ID: <bug-47477-4-pbUtFjHIEp@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-47477-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47477

--- Comment #17 from Kai Tietz <ktietz at gcc dot gnu.org> ---
What optimization you expect here?  I see by the new type-demotion pass some
changes in optimized tree-output:

foo ()
{
  int i;
  short int _4;
  char _5;
  unsigned short _6;
  unsigned short _8;
  short int _9;
  unsigned short _10;
  unsigned short _11;
  short int _12;
  sizetype _25;

  <bb 2>:
  goto <bb 4>;

  <bb 3>:

  <bb 4>:
  # i_17 = PHI <i_14(3), 0(2)>
  _25 = (sizetype) i_17;
  _4 = MEM[symbol: a, index: _25, step: 2, offset: 0B];
  _5 = (char) _4;
  _6 = (unsigned short) _5;
  _9 = MEM[symbol: b, index: _25, step: 2, offset: 0B];
  _8 = (unsigned short) _9;
  _10 = _8 + 17;
  _11 = _10 + _6;
  _12 = (short int) _11;
  MEM[symbol: a, index: _25, step: 2, offset: 0B] = _12;
  i_14 = i_17 + 1;
  if (i_14 != 1024)
    goto <bb 3>;
  else
    goto <bb 5>;

  <bb 5>:
  return;
}

what then gets simplified to the following assembler on IA32:
_foo:
        xorl    %eax, %eax
        .p2align 4,,10
L2:
        movsbw  _a(%eax,%eax), %dx
        movzwl  _b(%eax,%eax), %ecx
        leal    17(%ecx,%edx), %edx
        movw    %dx, _a(%eax,%eax)
        addl    $1, %eax
        cmpl    $1024, %eax
        jne     L2
        rep ret

The same assembler gets produced for my with all compilers back to 4.6.0, just
tree-optimization output differs.


  parent reply	other threads:[~2013-10-22 14:18 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-26 16:54 [Bug rtl-optimization/47477] New: [4.6 " tony.poppleton at gmail dot com
2011-01-27  7:08 ` [Bug rtl-optimization/47477] " hjl.tools at gmail dot com
2011-01-27 11:51 ` rguenth at gcc dot gnu.org
2011-01-27 17:34 ` jakub at gcc dot gnu.org
2011-01-27 17:58 ` jakub at gcc dot gnu.org
2011-01-27 19:43 ` tony.poppleton at gmail dot com
2011-01-28 11:31 ` rguenth at gcc dot gnu.org
2011-01-29 20:37 ` jakub at gcc dot gnu.org
2011-02-08 14:40 ` rguenth at gcc dot gnu.org
2011-02-08 14:41 ` rguenth at gcc dot gnu.org
2011-02-21 16:19 ` jakub at gcc dot gnu.org
2012-01-02 11:36 ` [Bug rtl-optimization/47477] [4.6/4.7/4.8 " jakub at gcc dot gnu.org
2012-03-06 12:48 ` jakub at gcc dot gnu.org
2012-11-30 16:27 ` jakub at gcc dot gnu.org
2013-03-22 14:46 ` [Bug rtl-optimization/47477] [4.6/4.7/4.8/4.9 " jakub at gcc dot gnu.org
2013-04-10  1:44 ` tony.poppleton at gmail dot com
2013-05-31 11:03 ` [Bug rtl-optimization/47477] [4.7/4.8/4.9 " jakub at gcc dot gnu.org
2013-10-16  9:49 ` jakub at gcc dot gnu.org
2013-10-22 13:40 ` jakub at gcc dot gnu.org
2013-10-22 14:18 ` ktietz at gcc dot gnu.org [this message]
2013-10-22 14:56 ` jakub at gcc dot gnu.org
2014-05-22  9:07 ` [Bug rtl-optimization/47477] [4.7/4.8/4.9/4.10 " rguenth at gcc dot gnu.org
2014-12-19 13:40 ` [Bug rtl-optimization/47477] [4.8/4.9/5 " jakub at gcc dot gnu.org
2015-02-13 20:18 ` law at gcc dot gnu.org
2015-02-13 20:20 ` [Bug rtl-optimization/47477] [4.8/4.9 " law at redhat dot com
2015-02-17  5:22 ` law at redhat dot com
2015-06-23  8:20 ` rguenth at gcc dot gnu.org
2015-06-26 20:13 ` [Bug rtl-optimization/47477] [4.9 " jakub at gcc dot gnu.org
2015-06-26 20:35 ` jakub at gcc dot gnu.org

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-47477-4-pbUtFjHIEp@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).