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

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



Dear all,
   I am using CodeSourcery G++ toolchain
(arm-2009q1-203-arm-none-linux-gnueabi) for compiler benchmarking on
an ARM board, which has an arm1176jz-s processor and is running Linux.
Benchmark suites I used are Dhrystone2.1
and EEMBC autobench1.0. When I got the benchmark results, I found something
strange.

   Q1. Could '-mtune' and '-mcpu' options reduce the execution time?
Assuming that binary 'bin_with_tune' is built
using command "arm-none-linux-gnueabi-gcc -mtune=arm1176jz-s
-mcpu=arm1176jz-s <other options>", and binary
'bin_without_tune' is built using "arm-none-linux-gnueabi-gcc <other
options>", which one runs faster,
bin_with_tune or bin_without_tune?
   Furthermore, if they are built with optimization option (such as -O1,
-O2, -Os, -O3), which one runs faster?
Here are some benchmark results I got (The numbers are Dhrystone benchmark
results. The bigger, the better.),
and I don't know why bin_with_tune is faster than bin_without_tune in some
cases (-O0, -O1, and -O3), and
slower in other cases (-O2 and -Os)?

      bin_without_tune  bin_with_tune
[-O0] 0.38934826        0.39053849
[-Os] 0.715740592       0.714089331
[-O1] 0.685358311       0.686168123
[-O2] 0.773893702       0.77058375
[-O3] 0.780434857       0.782451236

   Q2. Does '-g' option impact the execution time? If there are two
binaries, first one is built with '-g'
option, and second one is not, do they have same execution time?

   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?

   Any reply is appreciated, and sorry for my poor English. ^_^

Best Regards,
Yonglei Guo