Or let gcc figure it out using
-march=native
which is what I eventually did:
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
CFLAGS="-O2 -march=native -pipe"
#Safe CFlags for the Core-i7 (web info) saved for reference
#CFLAGS="-march=core2 -msse4 -mcx16 -msahf -O2 -pipe"
CXXFLAGS="${CFLAGS}"
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
CHOST="x86_64-pc-linux-gnu"
HTH,
Mark
Hi,
I think, in your case, core2 is the correct one.
If you run this command:
gcc -Q --help=target -march=native
gcc will tell you what it thinks are the best options for your CPU.
native?
--
alan dot mckinnon at gmail dot com
[snip]
> ..............
>
> After a short research on this website:
> http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options
>
> I guess core2 is the right one?
> Is that true?
That should work fine. Or 'native', if you don't plan on playing with distcc.
--
:wq
> model name : Intel(R) Core(TM)2 Duo CPU L7100 @ 1.20GHz
<snip>
> I guess *core2* is the right one?
HTH
Best regards
Peter K
Thanks for this - I better make a note of it! ;-)
Does this mean that I did not need to have all these flags specified, because
they're already included?
CFLAGS="-march=core2 -msse4 -mcx16 -msahf -O2 -pipe"
-msse4 -mcx16 -msahf seem to be already enabled:
====================================================
$ gcc -Q --help=target -march=native
The following options are target specific:
-m128bit-long-double [disabled]
-m32 [disabled]
-m3dnow [disabled]
-m3dnowa [disabled]
-m64 [enabled]
-m80387 [enabled]
-m96bit-long-double [enabled]
-mabm [disabled]
-maccumulate-outgoing-args [disabled]
-maes [disabled]
-malign-double [disabled]
-malign-functions=
-malign-jumps=
-malign-loops=
-malign-stringops [enabled]
-march= core2
-masm=
-mavx [disabled]
-mbranch-cost=
-mcld [disabled]
-mcmodel=
-mcx16 [enabled]
-mfancy-math-387 [enabled]
-mfma [disabled]
-mforce-drap [disabled]
-mfp-ret-in-387 [enabled]
-mfpmath=
-mfused-madd [enabled]
-mglibc [enabled]
-mhard-float [enabled]
-mieee-fp [enabled]
-mincoming-stack-boundary=
-minline-all-stringops [disabled]
-minline-stringops-dynamically [disabled]
-mintel-syntax [disabled]
-mlarge-data-threshold=
-mmmx [disabled]
-mms-bitfields [disabled]
-mno-align-stringops [disabled]
-mno-fancy-math-387 [disabled]
-mno-fused-madd [disabled]
-mno-push-args [disabled]
-mno-red-zone [disabled]
-mno-sse4 [disabled]
-momit-leaf-frame-pointer [disabled]
-mpc
-mpclmul [disabled]
-mpopcnt [enabled]
-mpreferred-stack-boundary=
-mpush-args [enabled]
-mrecip [disabled]
-mred-zone [enabled]
-mregparm=
-mrtd [disabled]
-msahf [enabled]
-msoft-float [disabled]
-msse [enabled]
-msse2 [enabled]
-msse2avx [disabled]
-msse3 [enabled]
-msse4 [enabled]
-msse4.1 [enabled]
-msse4.2 [enabled]
-msse4a [disabled]
-msse5 [disabled]
-msseregparm [disabled]
-mssse3 [enabled]
-mstack-arg-probe [disabled]
-mstackrealign [enabled]
-mstringop-strategy=
-mtls-dialect=
-mtls-direct-seg-refs [enabled]
-mtune= core2
-muclibc [disabled]
-mveclibabi=
====================================================
--
Regards,
Mick
Not quite; that command specifically shows you the options that would
be used if you were using -march=native. Since you're not using
native, change it to:
gcc -Q --help=target -march=core2
And that will show the defaults when you're using core2 as the arch.
(On my own system, a side-by-side comparison of native vs core2 shows
a lot of differences)
If native shows something as "enabled" but core2 doesn't, it should be
safe to add that option to your cflags because it's likely your CPU
can handle it just fine.
moriah tuxonice-2.6.39 # gcc -Q --help=target -march=core2 >a
moriah tuxonice-2.6.39 # gcc -Q --help=target -march=native >b
moriah tuxonice-2.6.39 # diff a b
23c23
< -mcx16 [disabled]
---
> -mcx16 [enabled]
56c56
< -msahf [disabled]
---
> -msahf [enabled]
74c74
< -mtune=
---
> -mtune= core2
moriah tuxonice-2.6.39 #
I am now using core2 as I was having some really odd problems after
mixing flags after multiple hardware changes along with native. Core2
is recommended for this processor, and I cant see the two flags changed
via native making a difference, but the previous processors is no longer
available to check.
Perhaps someone could do the above and send me the result (the full "gcc
-Q --help=target -march=native", using gcc-4.5) for an intel E4600?
(the list probably wont be interested!)
BillK
Different Core 2 CPUs support different features. There are, for
example, Core 2 CPUs that support SSE4 and other Core 2's don't. If you
have "native" on one that supports it and then try to run it on another
that doesn't, chances are it will crash, even if both CPUs are "Core 2".
>Another good trick I've found on the forums is to run:
>
>$ gcc -### -e -v -march=native /usr/include/stdlib.h
>
>The last line of output will include the various CFLAGS that
>-march=native picks. In my case (Phenom II 955):
>
> "/usr/libexec/gcc/x86_64-pc-linux-gnu/4.4.5/cc1" "-quiet"
>"/usr/include/stdlib.h" "-D_FORTIFY_SOURCE=2" *"-march=amdfam10"
>"-mcx16" "-msahf" "-mpopcnt"* "--param" "l1-cache-size=64" "--param"
>"l1-cache-line-size=64" "--param" "l2-cache-size=512" "-mtune=amdfam10"
>"-quiet" "-dumpbase" "stdlib.h" "-auxbase" "stdlib" "-o"
>"/tmp/ccR1PlNZ.s" "--output-pch=/usr/include/stdlib.h.gch"
>
>I typically use -march=native when I don't need to worry about distcc,
>or the options from that output that start with "-m".
Hey, that's a nice trick! Thanks for re-sharing :)
That said, I usually *can't* use -march=native because all my Gentoo systems are virtualized servers, running on top of XenServer, which itself runs on heterogenous server boxes (all Intel).
So, I purposefully limit myself to "-march=nocona".
(I did raise an explicit point about -march parameter in my Gentoo-Wiki article)
Rgds,
--
FdS Pandu E Poluan
~ IT Optimizer ~
Sent from Nokia E72-1
> Just shared this trick in my blog.
> http://gentoo-what-did-you-say.blogspot.com/2011/07/finding-cpu-flags-using
> -gcc.html I added a link to this thread in the post.
It seems that on my early i7, the -march=core2 does not have all the -msse*
flags enabled, while native does:
$ diff -y --suppress-common-lines core2.txt native.txt
-mcx16 [disabled] | -mcx16 [enabled]
-mno-sse4 [enabled] | -mno-sse4 [disabled]
-mpopcnt [disabled] | -mpopcnt [enabled]
-msahf [disabled] | -msahf [enabled]
-msse [disabled] | -msse [enabled]
-msse2 [disabled] | -msse2 [enabled]
-msse3 [disabled] | -msse3 [enabled]
-msse4 [disabled] | -msse4 [enabled]
-msse4.1 [disabled] | -msse4.1 [enabled]
-msse4.2 [disabled] | -msse4.2 [enabled]
-mssse3 [disabled] | -mssse3 [enabled]
-mtune= | -mtune= core2
I wonder if I should just set it to "-march=native -O2 -pipe" and forget about
it ... native it seems to have more stuff switched on and it would probably be
a-good-thing® (although my understanding of what each flag does is rather
cursory).
--
Regards,
Mick
This is from an i7-980 Extreme from about 1 year ago:
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe
syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts
rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64
monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt
aes lahf_lm ida arat dts tpr_shadow vnmi flexpriority ept vpid
- Mark
Same here:
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm
constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc
aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm
sse4_1 sse4_2 popcnt lahf_lm ida dts tpr_shadow vnmi flexpriority ept vpid
--
Regards,
Mick
> It seems that on my early i7, the -march=core2 does not have all the -msse*
> flags enabled, while native does:
Acc. to this there is a flag for i7, BUT... I'm not sure if current
stable version accepts it:
http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html
> I wonder if I should just set it to "-march=native -O2 -pipe" and forget about
> it ... native it seems to have more stuff switched on and it would probably be
> a-good-thing® (although my understanding of what each flag does is rather
> cursory).
I assume "native" would do fine...
Best regards
Peter K
I don't think so. It's part of the war Intel <-> AMD
Helmut.