Community
cancel
Showing results for 
Search instead for 
Did you mean: 
hjazz
Beginner
242 Views

ICC vs GCC in terms of Optimization Levels

Hi all,

I'm interested in knowing how GCC differs from Intel's ICC in terms of the optimization levels and catering to specific processor architecture. I'm using GCC 4.1.2 20070626 and ICC v11.1 for Linux.

How does ICC's optimization levels (O1 to O3) differ from GCC, if they differ at all?

And just to confirm, I've read in the manual that ICC uses O2 by default. Is this true?

Thank you.

Regards,
Rayne
0 Kudos
1 Reply
TimP
Black Belt
242 Views

Yes, icc defaults to -O2, roughly equivalent to '-O3 -ftree-vectorize -ffast-math -fno-cx-limited-range' in your old version of gcc, unless you set -g, which implies -O0.
So: auto-vectorization is on at -O2 and above in icc, while it takes a more recent version of gcc and -O3 to enable it implicitly.
gcc doesn't turn on any -ffast-math options unless you set them, while icc requires one of the -fp-model options to turn off such optimizations. So, gcc -O1 is roughly equivalent to icc -O1 -fp-model source.
It would be useful for you to read your gcc as well as icc manual, although you might want to upgrade gcc before learning some of the details which you might have to re-learn. I don't know whether you are excluding C++ when you say icc, and I'm not certain anyway about the distinctions about automatic function in-lining, nor whether you wanted to discuss it.
32-bit gcc still defaults to what icc defines as -mia32 ; 32-bit gcc -march=pentium4 is close enough to the icc default of -msse2.
Reply