From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6414 invoked by alias); 26 Nov 2012 06:43:53 -0000 Received: (qmail 6403 invoked by uid 22791); 26 Nov 2012 06:43:51 -0000 X-SWARE-Spam-Status: No, hits=-4.8 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 26 Nov 2012 06:43:35 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1TcsPl-00039g-So from Maxim_Kuvyrkov@mentor.com ; Sun, 25 Nov 2012 22:43:33 -0800 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Sun, 25 Nov 2012 22:43:33 -0800 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.1.289.1; Mon, 26 Nov 2012 06:43:31 +0000 Subject: Re: loop-unrolling in gcc-4.6.2 MIME-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset="iso-8859-1" From: Maxim Kuvyrkov In-Reply-To: Date: Mon, 26 Nov 2012 06:43:00 -0000 CC: gcc-help Content-Transfer-Encoding: quoted-printable Message-ID: <06230AFE-EC8F-4F19-BFCF-E7D1D6DF6CBE@codesourcery.com> References: To: naga raj Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2012-11/txt/msg00189.txt.bz2 On 24/11/2012, at 4:02 AM, naga raj wrote: > Hi, >=20 > I am using Gcc-4.6.2 compiler ported to an embedded target. > I am running a CoreMark benchmark code using -funroll-loops option > Surprisingly I found that loops are not unrolled. > But the same code when compiled with older toolchain version(with > Gcc-4.1.2) is generating loop unrolling correctly. >=20 > Should we need to add anything related to Unrolling to the target. I > did not find the right document about this. >=20 > Can any one please point me to the right direction... There are several options that control loop unrolling in GCC, you could try= tweaking them. See GCC manual at http://gcc.gnu.org/onlinedocs/gcc-4.6.3/= gcc/Optimize-Options.html . Now, given that this is a well-known benchmark= you are looking at, there is a real possibility that GCC port for your tar= get accidentally prevents loop-unrolling optimization. You need to investi= gate why the instruction sequence your port is producing does not allow loo= p-unroller to do its job. -funroll-loops Unroll loops whose number of iterations can be determined at compile time o= r upon entry to the loop. -funroll-loops implies -frerun-cse-after-loop. Th= is option makes code larger, and may or may not make it run faster.=20 -funroll-all-loops Unroll all loops, even if their number of iterations is uncertain when the = loop is entered. This usually makes programs run more slowly. -funroll-all-= loops implies the same options as -funroll-loops,=20 And --param options: max-unrolled-insns The maximum number of instructions that a loop should have if that loop is = unrolled, and if the loop is unrolled, it determines how many times the loo= p code is unrolled.=20 max-average-unrolled-insns The maximum number of instructions biased by probabilities of their executi= on that a loop should have if that loop is unrolled, and if the loop is unr= olled, it determines how many times the loop code is unrolled.=20 max-unroll-times The maximum number of unrollings of a single loop.=20 -- Maxim Kuvyrkov CodeSourcery/Mentor Graphics