ICC vs GCC - Optimization and CPU architecture

Rayne picture Rayne · Mar 23, 2010 · Viewed 9.1k times · Source

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?

The ICC is able to cater specifically to different architectures (IA-32, intel64 and IA-64). I've read that GCC has the -march compiler option which I think is similar, but I can't find a list of the options to use. I'm using Intel Xeon X5570, which is 64-bit. Are there any other GCC compiler options I could use that would cater my applications for 64-bit Intel CPUs?

Answer

caf picture caf · Mar 23, 2010

See section 3.17.15 in the GCC manual, ie386 and x86-64 Options for the full list and description of all the options applicable to those architectures (IA-64 is Itanium, and it's unlikely you have one of those).

The most important options in this context are:

  • -m64 Generate 64-bit code;
  • -march= Generate instructions for a specific CPU type; and
  • -mtune= Tune the code for a specific CPU type.