views:

457

answers:

5

I am trying to optimize a lot of multiplications and pointer arithmetics and would like to see what the compiler does underneath when I put in optimization flags.

--Edit--

How to restrict it to a specific function or a code block?

--Edit_2--

How to let gcc generate a less verbose assembly-code?

+8  A: 

Add -S switch to your command line.

Edit: Do not forget that it will place the assembly to the files you specified under -o switch.

Pavel Shved
+4  A: 

This link describes how to ask GCC to produce assembly code output.

pavium
+3  A: 

How to restrict it to a specific function or a code block?

Put that function in a separate source file (and use a different command-line parameter for that one source file).

ChrisW
That's what I have been doing. I am curious if it's possible from just options.
vehomzzz
A: 

You could stop you program at a breakpoint in the Visual Studio debugger and do "show assembly" and even step through it one instruction at a time.

sean riley
A: 

Let me know if you can outperform mingw with -O3 and msvc with /Ox by 10 percent

Arabcoder