From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21096 invoked by alias); 8 Mar 2004 02:13:37 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 21077 invoked by uid 48); 8 Mar 2004 02:13:37 -0000 Date: Mon, 08 Mar 2004 02:13:00 -0000 From: "anton at samba dot org" To: gcc-bugs@gcc.gnu.org Message-ID: <20040308021331.14473.anton@samba.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c/14473] New: Failure to use count register X-Bugzilla-Reason: CC X-SW-Source: 2004-03/txt/msg00926.txt.bz2 List-Id: I found this in ppc32 3.3.3 (Debian), it also appears in 3.4.0 20040215. If the loop count is large enough, it wont use the count register in the second loop. eg: #if 1 #define LOOPS 100000 #else #define LOOPS 10 #endif int main() { unsigned long i; i = LOOPS; while (i--) { asm volatile("":::"memory"); } i = LOOPS; while (i--) { asm volatile("":::"memory"); } } produces the following code: lis 0,0x1 ori 0,0,34464 mtctr 0 .L13: bdnz .L13 lis 0,0x1 ori 0,0,34464 .L12: addic. 0,0,-1 bne+ 0,.L12 blr If you reduce COUNT it will use the count register for both loops as expected -- Summary: Failure to use count register Product: gcc Version: 3.4.0 Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: anton at samba dot org CC: gcc-bugs at gcc dot gnu dot org GCC target triplet: powerpc-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14473