GCC options for optimizing for a given processor architecture

I am working on an Intel processor for the Nehalam / westmere micro architecture. I want to optimize my code for this architecture. Are there any specialized compilation flags or GCC C functions that can help me improve code execution performance?

I already use -o3.

Language of the Code - C
Platform - Linux
GCC Version - 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC)

In my code, I have a floating point comparison, and they execute more than a million times.

Assume the code is already optimized.

+5
source share
4 answers

You can analyze all disabled and enabled optimizations yourself. Run on your computer:

gcc -O3 -Q --help=optimizers | grep disabled

, gcc .

+14

-, , , . 4.4 , , , . ( - 4.7)

Gcc , , : -march=native. -O3 , .

( , , .)

+16

You need to add an option -march=.... ...should be replaced with everything that is closest to your processor architecture (usually these are minor differences) described in the i386 / x86_64 parameters for GCC here .

I would use core2it because corei7(the one you need) is only available in GCC 4.6 and later. See the arch list for GCC 4.6 here .

+5
source

If you really want to use gcc so old that it does not support corei7, you can use -mtune = barcelona

0
source

All Articles