On Wed, Feb 09, 2011 at 08:42:05AM +0000, Jonathan Wakely wrote: > On 9 February 2011 08:34, Sebastian Pop wrote: > > > > For example x264 defines CFLAGS="-O4 -ffast-math $CFLAGS", and so > > building this benchmark with CFLAGS="-O2" would have no effect. > > Why not? > > Ignoring the fact -O3 is the highest level for GCC, the manual says: > "If you use multiple -O options, with or without level numbers, the > last such option is the one that is effective." > http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html > > And CFLAGS="-fno-fast-math -O2" would cancel the effects of -ffast-math too.
Last time I've checked e.g. their byte-benchmark uses OPTON = -O ... $(CC) -o $(PROGDIR)/arithoh ${CFLAGS} ${OPTON} -Darithoh $(SRCDIR)/arith.c and similarly for most of the other files, so it really doesn't matter what -O level you provide in CFLAGS there, they are just comparing -O performance. Jakub