If your program contains a short, heavily referenced for loop, consider expanding the code to a straight sequence of statements. For example:
array[0] = b[k+1]*c[m+1]; array[1] = b[k+2]*c[m+2]; array[2] = b[k+3]*c[m+3]; array[3] = b[k+4]*c[m+4]; array[4] = b[k+5]*c[m+5];
would run faster than:
for (i = 0; i < 5; i++) array[i] = b[k+i]*c[m+i];
The compiler will perform automatic unrolling of inner loops when the -O3 option is specified. In this case, the compiler will unroll the loop once.
Writing Optimized Code... Overview Variables Pointers Functions Function Arguments Expressions Conversions Arithmetic Conversions Inlined Components