This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Calculating elements addresses from arrays once



He means use the "-O1" or "-O2" optimisation options like:

gcc -O1 foobar.c

or

gcc -O2 foobar.c

As for your original question, if you're a bit familiar
with assembly language you can readily check how well
GCC is able to optimise your code by looking at the
assembly output like so:

gcc -O2 -S foobar.c

This would create a file named "foobar.s" which by
default uses the AT&T assembler syntax - use "-masm=intel"
(on x86 boxes) to use the more popular Intel assembler
syntax, like so:

gcc -O2 -S -masm=intel foobar.c

Hope this helps,
Ranjit.



Oh okay, (i had read "Zero" instead of "O")
Thanks

And what's the drawback of using -O2 option? Only a longer compilation time?

Well i'm not really familiar with asm..

___[ Pub ]____________________________________________________________
Inscrivez-vous gratuitement sur Tandaime, Le site de rencontres !
http://rencontre.rencontres.com/index.php?origine=4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]