Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Journeyman III

Which CFLAGS to use ?

GCC 4.6, k8-sse3

Hello !

I wonder : which CFLAGS should I use to build a whole system like Gentoo Linux ?
I've got a AMD TF-20 processor (k8-sse3).

I've been using these ones : -march=native -O2 -fomit-frame-pointer -fprefetch-loop-arrays -ftree-vectorize -fpeel-loops -funswitch-loops -ftracer -pipe

But I don't think they are so good.

I've read some interesting docs from AMD saying that the best to use with GCC 4.0 are : -O3 -ffast-math -funroll-loops -fpeel-loops -ftracer -funswitch-loops -ftree-vectorize


So, what do you think ? What are the best CFLAGS for k8-sse3 with GCC 4.6 ?

Thank you.

1 Reply
Adept II

Just stick to "-march=native -O2 -pipe"

All the rest of exotic flags will just screw your system and for most packages you won't even get more speed- they could be actually slower !


-O2 has the most sensible optimisation subset that works best normally.

On a few packages that you feel strongly about, you can use some other CFLAGS. 

-flto and -fwhole-program are all the rage these days, but their use is linked to so many headaches these days that I would avoid them in a wide circle, IIWY. 

They might work on some latter, stabilised gcc-4.6 but not now.

And don't use gcc-4.6 for your system yet. It still has plenty of critical bugs.

Use latest 4.5* instead.