From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12928 invoked by alias); 9 Sep 2008 22:04:35 -0000 Received: (qmail 10364 invoked by uid 48); 9 Sep 2008 22:03:13 -0000 Date: Tue, 09 Sep 2008 22:04:00 -0000 Subject: [Bug rtl-optimization/37451] New: Extra addition for doloop in some cases X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pinskia at gcc dot gnu dot org" 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: 2008-09/txt/msg01160.txt.bz2 Simple testcase: /* { dg-do compile } */ /* { dg-options "-O2" } */ int f(int l, int *a) { int i; for(i = 0;i < l; i++) a[i] = i; return l; } /* We should be able to do this loop without adding -1 to the l to get the number of iterations with this loop still doing a do-loop. */ /* The place where we were getting an extra -1 is when converting from 32bits to 64bits as the ctr register is used as 64bits on powerpc64. */ /* { dg-final { scan-assembler-not "-1" } } */ /* { dg-final { scan-assembler "bdnz" } } */ /* { dg-final { scan-assembler-times "mtctr" 1 } } */ ---- CUT --- The issue is that we zero extend before correcting the count of the iterations. -- Summary: Extra addition for doloop in some cases Product: gcc Version: 4.4.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pinskia at gcc dot gnu dot org GCC target triplet: powerpc64-*-* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37451