From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31873 invoked by alias); 2 Dec 2013 17:59:02 -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 Received: (qmail 31844 invoked by uid 48); 2 Dec 2013 17:58:59 -0000 From: "sje at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: sje at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cf_gcctarget Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-12/txt/msg00096.txt.bz2 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.