On 24/11/2012, at 4:02 AM, naga raj wrote: > Hi, > > 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. > > Should we need to add anything related to Unrolling to the target. I > did not find the right document about this. > > 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 target accidentally prevents loop-unrolling optimization. You need to investigate why the instruction sequence your port is producing does not allow loop-unroller to do its job. -funroll-loops Unroll loops whose number of iterations can be determined at compile time or upon entry to the loop. -funroll-loops implies -frerun-cse-after-loop. This option makes code larger, and may or may not make it run faster. -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, 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 loop code is unrolled. max-average-unrolled-insns The maximum number of instructions biased by probabilities of their execution that a loop should have if that loop is unrolled, and if the loop is unrolled, it determines how many times the loop code is unrolled. max-unroll-times The maximum number of unrollings of a single loop. -- Maxim Kuvyrkov CodeSourcery/Mentor Graphics