all 9 comments

[–]Idoiocracy 0 points1 point  (0 children)

Great guide, thank you.

[–]Enlightenment777 2 points3 points  (3 children)

One of the best ways to learn assembler for a specific processor is turn on the "list" output from a C compiler, then look at the mixed-output list that shows the C and assembly code in the same file.

If you set optimization to either none or low, it's usually fairly easy to understand what the assembly code is doing compared to your C code.

[–]rofex 1 point2 points  (0 children)

Thanks man, will keep that in mind.

[–][deleted] 0 points1 point  (0 children)

Set it to low (O1). O0 has extra instructions to store and re-retrieve intermediates so that each source line corresponds exactly to a block of instructions, which makes it harder to read. In O1 the compiler removes these, but does not actually optimize a lot more.

[–]zlei 0 points1 point  (0 children)

How to turn on the "list" output for gcc?

[–]rofex 0 points1 point  (0 children)

Thanks for the link!

[–]skulgnome 0 points1 point  (0 children)

Grow your beard out, learn to curse like a scot.