Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] CFlags for CPU
Date: Wed, 27 Jul 2011 18:33:28
Message-Id: 201107271932.51559.michaelkintzios@gmail.com
In Reply to: Re: [gentoo-user] CFlags for CPU by Kfir Lavi
1 On Wednesday 27 Jul 2011 17:13:21 Kfir Lavi wrote:
2 > On Wed, Jul 27, 2011 at 5:34 PM, Kfir Lavi <lavi.kfir@×××××.com> wrote:
3 > > On Wed, Jul 27, 2011 at 5:09 PM, Andy Wilkinson
4 > >>
5 > >> Another good trick I've found on the forums is to run:
6 > >> $ gcc -### -e -v -march=native /usr/include/stdlib.h
7 > >>
8 > >> The last line of output will include the various CFLAGS that
9 > >> -march=native
10 > >>
11 > >> picks. In my case (Phenom II 955):
12 > >> "/usr/libexec/gcc/x86_64-pc-linux-gnu/4.4.5/cc1" "-quiet"
13 > >>
14 > >> "/usr/include/stdlib.h" "-D_FORTIFY_SOURCE=2" *"-march=amdfam10"
15 > >> "-mcx16" "-msahf" "-mpopcnt"* "--param" "l1-cache-size=64" "--param"
16 > >> "l1-cache-line-size=64" "--param" "l2-cache-size=512" "-mtune=amdfam10"
17 > >> "-quiet" "-dumpbase" "stdlib.h" "-auxbase" "stdlib" "-o"
18 > >> "/tmp/ccR1PlNZ.s" "--output-pch=/usr/include/stdlib.h.gch"
19 > >>
20 > >> I typically use -march=native when I don't need to worry about distcc,
21 > >> or the options from that output that start with "-m".
22
23 > Just shared this trick in my blog.
24 > http://gentoo-what-did-you-say.blogspot.com/2011/07/finding-cpu-flags-using
25 > -gcc.html I added a link to this thread in the post.
26
27 It seems that on my early i7, the -march=core2 does not have all the -msse*
28 flags enabled, while native does:
29
30 $ diff -y --suppress-common-lines core2.txt native.txt
31 -mcx16 [disabled] | -mcx16 [enabled]
32 -mno-sse4 [enabled] | -mno-sse4 [disabled]
33 -mpopcnt [disabled] | -mpopcnt [enabled]
34 -msahf [disabled] | -msahf [enabled]
35 -msse [disabled] | -msse [enabled]
36 -msse2 [disabled] | -msse2 [enabled]
37 -msse3 [disabled] | -msse3 [enabled]
38 -msse4 [disabled] | -msse4 [enabled]
39 -msse4.1 [disabled] | -msse4.1 [enabled]
40 -msse4.2 [disabled] | -msse4.2 [enabled]
41 -mssse3 [disabled] | -mssse3 [enabled]
42 -mtune= | -mtune= core2
43
44
45 I wonder if I should just set it to "-march=native -O2 -pipe" and forget about
46 it ... native it seems to have more stuff switched on and it would probably be
47 a-good-thing® (although my understanding of what each flag does is rather
48 cursory).
49 --
50 Regards,
51 Mick

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] CFlags for CPU Mark Knecht <markknecht@×××××.com>
Re: [gentoo-user] CFlags for CPU pk <peterk2@××××××××.se>
Re: [gentoo-user] CFlags for CPU Kfir Lavi <lavi.kfir@×××××.com>