5-10
Intel® PXA27x Processor Family
Optimization Guide
High Level Language Optimization
for(i=0; i<5; i++){
f(i);}
is converted to the faster equivalent
f(0);
f(1);
f(2);
f(3);
f(4);
This optimization eliminates loop overhead.
Additionally, there is also a method of loop unrolling for loops with an unknown amount of
iterations at compile time. Therefore, the method is often referred to as dynamic loop unrolling. By
breaking down an arbitrary size loop into small unrolled blocks, some loop overhead can be
avoided.
For example, it is unlikely that a compiler will unroll this code.
void f(int nTotalIterations)
{
for(i=0; i<nTotalIterations; i++){
f(i);}
}
Replacing this small loop with the considerably larger code segment below will potentially provide
a significant performance improvement at the expense of code size.
void f(int nTotalIterations)
{
const int nItersPerBlock = 4;
int nTotalBlockIters;
int i;
// find the largest multiple of nItersPerBlock that is less
// than or equal to nTotalIterations
nTotalBlockIters = (nTotalIterations / nItersPerBlock) *
Summary of Contents for PXA270
Page 1: ...Order Number 280004 001 Intel PXA27x Processor Family Optimization Guide April 2004...
Page 10: ...x Intel PXA27x Processor Family Optimization Guide Contents...
Page 20: ...1 10 Intel PXA27x Processor Family Optimization Guide Introduction...
Page 30: ...2 10 Intel PXA27x Processor Family Optimization Guide Microarchitecture Overview...
Page 48: ...3 18 Intel PXA27x Processor Family Optimization Guide System Level Optimization...
Page 114: ...5 16 Intel PXA27x Processor Family Optimization Guide High Level Language Optimization...
Page 122: ...6 8 Intel PXA27x Processor Family Optimization Guide Power Optimization...
Page 143: ...Intel PXA27x Processor Family Optimization Guide Index 5 Index...
Page 144: ......