Gentoo Archives: gentoo-user

From: Mark Knecht <markknecht@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] CFlags for CPU
Date: Wed, 27 Jul 2011 20:25:48
Message-Id: CAK2H+edGUWvcRt-7MV0_FmT+LwTxqcVkN+OvYd06Zd-R=K3N5Q@mail.gmail.com
In Reply to: Re: [gentoo-user] CFlags for CPU by Mick
1 On Wed, Jul 27, 2011 at 11:32 AM, Mick <michaelkintzios@×××××.com> wrote:
2 > On Wednesday 27 Jul 2011 17:13:21 Kfir Lavi wrote:
3 >> On Wed, Jul 27, 2011 at 5:34 PM, Kfir Lavi <lavi.kfir@×××××.com> wrote:
4 >> > On Wed, Jul 27, 2011 at 5:09 PM, Andy Wilkinson
5 >> >>
6 >> >>  Another good trick I've found on the forums is to run:
7 >> >> $ gcc -### -e -v -march=native /usr/include/stdlib.h
8 >> >>
9 >> >> The last line of output will include the various CFLAGS that
10 >> >> -march=native
11 >> >>
12 >> >> picks.  In my case (Phenom II 955):
13 >> >>  "/usr/libexec/gcc/x86_64-pc-linux-gnu/4.4.5/cc1" "-quiet"
14 >> >>
15 >> >> "/usr/include/stdlib.h" "-D_FORTIFY_SOURCE=2" *"-march=amdfam10"
16 >> >> "-mcx16" "-msahf" "-mpopcnt"* "--param" "l1-cache-size=64" "--param"
17 >> >> "l1-cache-line-size=64" "--param" "l2-cache-size=512" "-mtune=amdfam10"
18 >> >> "-quiet" "-dumpbase" "stdlib.h" "-auxbase" "stdlib" "-o"
19 >> >> "/tmp/ccR1PlNZ.s" "--output-pch=/usr/include/stdlib.h.gch"
20 >> >>
21 >> >> I typically use -march=native when I don't need to worry about distcc,
22 >> >> or the options from that output that start with "-m".
23 >
24 >> Just shared this trick in my blog.
25 >> http://gentoo-what-did-you-say.blogspot.com/2011/07/finding-cpu-flags-using
26 >> -gcc.html I added a link to this thread in the post.
27 >
28 > It seems that on my early i7, the -march=core2 does not have all the -msse*
29 > flags enabled, while native does:
30 >
31 > $ diff -y --suppress-common-lines core2.txt native.txt
32 >  -mcx16        [disabled]        |   -mcx16          [enabled]
33 >  -mno-sse4     [enabled]         |   -mno-sse4       [disabled]
34 >  -mpopcnt      [disabled]        |   -mpopcnt        [enabled]
35 >  -msahf        [disabled]        |   -msahf          [enabled]
36 >  -msse         [disabled]        |   -msse           [enabled]
37 >  -msse2        [disabled]        |   -msse2          [enabled]
38 >  -msse3        [disabled]        |   -msse3          [enabled]
39 >  -msse4        [disabled]        |   -msse4          [enabled]
40 >  -msse4.1      [disabled]        |   -msse4.1        [enabled]
41 >  -msse4.2      [disabled]        |   -msse4.2        [enabled]
42 >  -mssse3       [disabled]        |   -mssse3         [enabled]
43 >  -mtune=                         |   -mtune=         core2
44 >
45 >
46 > I wonder if I should just set it to "-march=native -O2 -pipe" and forget about
47 > it ... native it seems to have more stuff switched on and it would probably be
48 > a-good-thing® (although my understanding of what each flag does is rather
49 > cursory).
50 > --
51 > Regards,
52 > Mick
53 >
54 Just curious if that's consistent with /proc/cpuinfo in the flags
55 section? MAybe gcc is wrong in it's enable/disable choices, or maybe
56 they know something specific.
57
58 This is from an i7-980 Extreme from about 1 year ago:
59
60 flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
61 mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe
62 syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts
63 rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64
64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt
65 aes lahf_lm ida arat dts tpr_shadow vnmi flexpriority ept vpid
66
67 - Mark

Replies

Subject Author
Re: [gentoo-user] CFlags for CPU Mick <michaelkintzios@×××××.com>