Re: Right C FLAGS for my processor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Roberto Guida wrote:

> -O3 -mtune=pentium4 -march=pentium4 -mfpmath=sse -malign-double
> -m128bit-long-double -mmmx -msse -msse2 -maccumulate-outgoing-args
> -mno-push-args

-march=pentium4 already implies all of -mtune=pentium4 -mmmx -msse
-msse2 so there's no point in specifying them.  And several of those
options are ABI-changing which means you'll get random unexplainable
crashes (or worse) when trying to intermix code, which is why they say
"Warning" in bold in the manual.  If it were me I would use "-O3
-march=pentium4" and stop reading whatever gentoo nonsense says that
it's a good idea to enable dangerous options as defaults.

You can add -mfpmath=sse if you know that you won't ever encounter code
that relies on the excess precision of the 387 to function correctly. 
Yes, such code could probably be classified as broken, but have you
audited the source of everything that you intend to compile so that you
can rule it out?  This is the fallacy with enabling these paragraph-long
settings of options as defaults!  Not all options make sense for every
program, and the ones that do make sense in most situations are already
included in -Ox.

> then maybe (i'm less sure here, i've to study more! :) ) these ones too:
> 
> -ffast-math -fstrength-reduce -fexpensive-optimizations -funroll-loops
> -frerun-loop-opt -falign-loops

It would be a bad idea to use -ffast-math unconditionally without
understanding its consequences and testing the code it generates for
correct behavior.  -funroll-loops is also something that is not
necessarily always a good idea, and can make code slower, so again not a
good choice for a default option.  (If it made sense in all cases don't
you think it would be enabled at -Ox?)  The rest are probably just going
to make compilation take longer for unmeasurable returns.  You might
consider -ftree-vectorize though.

Brian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux