Gentoo Archives: gentoo-user

From: Florian Philipp <lists@×××××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] common flags for 2 cpu?
Date: Fri, 17 Aug 2012 13:55:43
Message-Id: 502E4CCA.3070208@binarywings.net
In Reply to: [gentoo-user] common flags for 2 cpu? by Jorge Almeida
1 Am 17.08.2012 10:58, schrieb Jorge Almeida:
2 > I'm in need of some expert advise about CFLAGS. I'm going to install
3 > Gentoo in two systems, an Atom 330 and a P4 prescott. Since compiling
4 > lots of stuff in an Atom is less than joyful, I intend to do almost
5 > all compilation on the prescott and produce binary packages to use on
6 > the Atom. So, something like
7 > CFLAGS="-march=native ..." is out. I know I could set
8 > CFLAGS="-march=i686 -O2 -pipe -fomit-frame-pointer", but I would like
9 > to extract a bit more juice from the hw, while still keeping stable
10 > systems. So, I thought of setting CFLAGS for both systems as
11 > -march=i686, plus the flags that are pulled by -march=native in both
12 > systems, plus some other flags:
13 >
14 [...]
15 >
16 > This is what is pulled by -march=native, using gcc -march=native -E -v
17 > - </dev/null 2>&1 | grep cc1
18 >
19 > Prescott:
20 > -march=prescott -mno-cx16 -mno-sahf -mno-movbe -mno-aes -mno-pclmul
21 > -mno-popcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi
22 > -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -mno-sse4.2 -mno-sse4.1
23 > -mno-lzcnt -mno-rdrnd -mno-f16c -mno-fsgsbase --param l1-cache-size=16
24 > --param l1-cache-line-size=64 --param l2-cache-size=1024
25 > -mtune=prescott
26 >
27 > Atom:
28 > -march=atom -mcx16 -msahf -mmovbe -mno-aes -mno-pclmul -mno-popcnt
29 > -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2
30 > -mno-tbm -mno-avx -mno-avx2 -mno-sse4.2 -mno-sse4.1 -mno-lzcnt
31 > -mno-rdrnd -mno-f16c -mno-fsgsbase --param l1-cache-size=24 --param
32 > l1-cache-line-size=64 --param l2-cache-size=512 -mtune=atom
33 >
34 [...]
35 >
36 > Some questions:
37 >
38 > 1) Is this strategy right? If so, any other flags to add? (or any
39 > flags to remove from the list?)
40 >
41 > 2) The --param flags are the ones of the computer that will do the
42 > compiling. I'm guessing the produced binaries are compatible with cpu
43 > with different --param flags. Is this right?
44 >
45 > TIA
46 >
47 > Jorge Almeida
48 >
49
50 1) Yes. But as you can see, -march=prescott is basically a subset of
51 atom. In fact, before there was a -march=atom option, prescott was the
52 best flag for atoms. I think you can avoid some hassle by simply
53 enabling "-march=prescott --param l1-cache-line-size=64 --param
54 l2-cache-size=512".
55
56 2) Yes, the param flags do not affect compatibility. Using the lower
57 value will probably be better but this is just an educated guess.
58
59 Regards,
60 Florian Philipp

Attachments

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

Replies

Subject Author
Re: [gentoo-user] common flags for 2 cpu? Jorge Almeida <jjalmeida@×××××.com>