Re: [arm-gnu] Do -mtune, -mcpu, -O and -g options impact execution time?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [arm-gnu] Do -mtune, -mcpu, -O and -g options impact execution time?



Yonglei Guo wrote:

> Q1. Could '-mtune' and '-mcpu' options reduce the execution time?

Yes, the whole point of these options is to adjust the compiler to
generate better code for a paticular CPU.

> Furthermore, if they are built with optimization option (such as -O1,
> -O2, -Os, -O3), which one runs faster?

*In general*, -O3 runs fastest.  But, all optimizations are heuristics;
there are going to be programs where -O1 is faster than -O3.  Or, where
-Os is faster than -O3 because -Os generates smaller code, and i-cache
performance dominates.  And, of course, the heuristics the compiler
users can always be further improved.

> Q2. Does '-g' option impact the execution time?

No.

> Q3. I have also run the same benchmark application on the same ARM board
> but different operating system
> (arm1176jz-s, "bare metal" system, not Linux). The toolchain I used is
> arm-2009q1-161-arm-none-eabi. Contrast
> to arm-2009q1-203-arm-none-linux-gnueabi, should
> arm-2009q1-161-arm-none-eabi have a smaller execution time?
> Or bigger? Why?

It depends.  The two compilers are similar, but the run-time libraries
are very different, and Dhrystone depends in part on the run-time
libraries.  Linux also can add some overhead relative to bare metal.

-- 
Mark Mitchell
CodeSourcery
mark@xxxxxxxxxxxxxxxx
(650) 331-3385 x713