public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sje at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/59371] New: Performance regression in GCC 4.8 and later versions.
Date: Mon, 02 Dec 2013 17:59:00 -0000	[thread overview]
Message-ID: <bug-59371-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 59371
           Summary: Performance regression in GCC 4.8 and later versions.
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sje at gcc dot gnu.org
            Target: mips*-*-*

If I compile this program with -O2 on MIPS:

int foo(int *p, unsigned short c)
{
    signed short i;
    int x = 0;
    for (i = 0; i < c; i++) {
        x = x + *p; p++;
    }
    return x;
}

With GCC 4.7.* or earlier I get loop code that looks like:

$L3:
    lw    $5,0($4)
    addiu    $3,$3,1
    seh    $3,$3
    addu    $2,$2,$5
    bne    $3,$6,$L3
    addiu    $4,$4,4

With GCC 4.8 and later I get:

$L3:
    lw    $7,0($4)
    addiu    $3,$3,1
    seh    $3,$3
    slt    $6,$3,$5
    addu    $2,$2,$7
    bne    $6,$0,$L3
    addiu    $4,$4,4

This loop has one more instruction in it and is slower.
A version of this bug appears in EEMBC 1.1.  If I change the loop
index to be unsigned then I get the better code but I can't change
the benchmark I am testing so I am trying to figure out what changed
in GCC and how to generate the faster code.


             reply	other threads:[~2013-12-02 17:59 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-02 17:59 sje at gcc dot gnu.org [this message]
2013-12-03  9:37 ` [Bug target/59371] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
2013-12-03 16:42 ` sje at gcc dot gnu.org
2013-12-03 23:10 ` pinskia at gcc dot gnu.org
2013-12-04  1:49 ` macro@linux-mips.org
2013-12-04  1:52 ` pinskia at gcc dot gnu.org
2013-12-05 11:12 ` rguenth at gcc dot gnu.org
2013-12-05 23:43 ` macro@linux-mips.org
2013-12-17 10:33 ` jakub at gcc dot gnu.org
2013-12-19 15:37 ` rguenth at gcc dot gnu.org
2014-01-09 20:40 ` macro@linux-mips.org
2014-05-22  9:07 ` [Bug target/59371] [4.8/4.9/4.10 " rguenth at gcc dot gnu.org
2014-12-19 13:34 ` [Bug target/59371] [4.8/4.9/5 " jakub at gcc dot gnu.org
2015-03-13 20:18 ` sje at gcc dot gnu.org
2015-06-23  8:28 ` [Bug target/59371] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org
2015-06-26 20:02 ` [Bug target/59371] [4.9/5/6 " jakub at gcc dot gnu.org
2015-06-26 20:32 ` jakub at gcc dot gnu.org
2021-05-14  9:47 ` [Bug target/59371] [9/10/11/12 Regression] Performance regression in GCC 4.8/9/10/11/12 " jakub at gcc dot gnu.org
2021-05-17  2:57 ` guojiufu at gcc dot gnu.org
2021-05-17  3:11 ` guojiufu at gcc dot gnu.org
2021-06-01  8:06 ` rguenth at gcc dot gnu.org
2022-05-27  9:35 ` [Bug target/59371] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:30 ` jakub at gcc dot gnu.org
2023-07-07 10:30 ` [Bug target/59371] [11/12/13/14 " rguenth 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-59371-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).