Right C FLAGS for my processor
Tim Prince
tprince@myrealbox.com
Thu Jul 5 07:22:00 GMT 2007
Roberto Guida wrote:
> Hello!! i'm new at the list, so.. hello everyone!!
> here is my /proc/cpuinfo
>
> processor : 0
> vendor_id : GenuineIntel
> cpu family : 15
> model : 2
> model name : Intel(R) Pentium(R) 4 CPU 2.60GHz
> stepping : 9
> cpu MHz : 2598.151
> cache size : 512 KB
> fdiv_bug : no
> hlt_bug : no
> f00f_bug : no
> coma_bug : no
> fpu : yes
> fpu_exception : yes
> cpuid level : 2
> wp : yes
> flags : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca
> cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe up cid
> xtpr
> bogomips : 5201.43
>
> I would like to know what are the right FLAGS to put when i compile
> something with gcc...
>
> reading the gcc manual (not all, it is huge) i found (I think!) that
> for my processor, I should put these ones:
>
> -O3 -mtune=pentium4 -march=pentium4 -mfpmath=sse -malign-double
> -m128bit-long-double -mmmx -msse -msse2 -maccumulate-outgoing-args
> -mno-push-args
>
> 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
>
You're trying too hard. -march=pentium4 is appropriate, and includes
-mtune=pentium4.
-mfpmath=sse would be the usual choice (default for 64-bit), and would
imply -msse -msse2. As I understood it (you could look up past
references in gcc mailing list) -malign-double dealt with some odd
issues in long past versions, and would not be required for current gcc
releases. -m128bit-long-double is clearly inappropriate, unless you
have a corresponding software floating point library. You have not
given any reason why you would require most of the other arguments; some
of them are defaults for targets where they are advisable.
-ffast-math enables aggressive optimizations, some of which frequently
break applications, others could be desirable individually.
-funroll-loops is usually good when improved performance is more
important than small code size.
More information about the Gcc-help
mailing list