Gentoo Archives: gentoo-amd64

From: Branko Badrljica <brankob@××××××××××.com>
To: gentoo-amd64@l.g.o
Subject: Re: [gentoo-amd64] quadcore
Date: Wed, 26 Nov 2008 23:56:50
Message-Id: 492DEEA2.902@avtomatika.com
In Reply to: Re: [gentoo-amd64] quadcore by Eduardo Schoedler
1 Eduardo Schoedler wrote:
2
3 <SNIP>
4 >
5 > Hi Beso.
6 >
7 > http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options
8 >
9 >
10 > "native
11 > This selects the CPU to tune for at compilation time by determining
12 > the processor type of the compiling machine. Using -mtune=native will
13 > produce code optimized for the local machine under the constraints of
14 > the selected instruction set. Using -march=native will enable all
15 > instruction subsets supported by the local machine (hence the result
16 > might not run on different machines). "
17 >
18 > Best Regards,
19 > Eduardo.
20 >
21
22 I have Phenom 9950 and use gcc-4.3.2 with CFLAGS="-march=barcelona
23 -combine -O2 -pipe"
24
25 I tried to compile some small test code with -v -march=native and -v
26 -march=barcelona, just to see if there is any difference.
27 Compiled code seems to be the same, but that means nothing, since the
28 example used was trivia
29
30 But there is one difference in gcc's coments.
31
32 With -march=native it says:
33
34 ..
35 COLLECT_GCC_OPTIONS='-v' '-O3' '-pipe' '-o' 'tt2'
36 /usr/libexec/gcc/x86_64-pc-linux-gnu/4.3.2/cc1 -quiet -v test.c
37 -march=amdfam10 -mcx16 -msahf --param l1-cache-size=64 --param
38 l1-cache-line-size=64 -mtune=amdfam10 -quiet -dumpbase test.c -auxbase
39 test -O3 -version -o - |
40 ...
41
42 ...and with -march=barcelona:
43
44 ...
45 COLLECT_GCC_OPTIONS='-v' '-march=barcelona' '-O3' '-pipe' '-o' 'tt1'
46 /usr/libexec/gcc/x86_64-pc-linux-gnu/4.3.2/cc1 -quiet -v test.c -quiet
47 -dumpbase test.c -march=barcelona -auxbase test -O3 -version -o - |
48 ..
49
50 whereas with -march=amdfam10:
51
52 ...
53 COLLECT_GCC_OPTIONS='-v' '-march=amdfam10' '-O3' '-pipe' '-o' 'tt1'
54 /usr/libexec/gcc/x86_64-pc-linux-gnu/4.3.2/cc1 -quiet -v test.c -quiet
55 -dumpbase test.c -march=amdfam10 -auxbase test -O3 -version -o - |
56 ...
57
58
59 It seems that "barcelona","amdfam10" and "native" are not exactly
60 synonymous on my machine. "amdfam10" seems to offer broadest description
61 to which "barcelona" adds some extra details, but "native" seems to be
62 most detailed,a s it adds details about cache size and cache line size,
63 CMPXCHNG16B and LAHF/SAHF instructions.
64
65 I also tried to compile "unrar" with those variations, but was unable to
66 make difference in final binary- which admittedly doesn't prove anything...

Replies

Subject Author
[gentoo-amd64] Optimal AMD64 CFLAGS ? Branko Badrljica <brankob@××××××××××.com>