
Note the model, model name, and steppingprocessor : 0
vendor_id : AuthenticAMD
cpu family : 6
model : 10
model name : AMD Athlon(tm) XP 2500+
stepping : 0
cpu MHz : 1830.030
cache size : 512 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse syscall mmxext 3dnowext 3dnow up ts
bogomips : 3664.15
As you can see, the model name clearly says its an XP, which is what I was expecting, given that it is a single CPU mobo, and that I was told it was an XP when I got it. However, the model and stepping numbers say that it's an MP. Which is itAthlon XP/Geode NX (AMD)
vendor_id : AuthenticAMD
cpu family : 6
model : 6
stepping : 2
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
Athlon MP (AMD)
vendor_id : AuthenticAMD
cpu family : 6
model : 10
model name : AMD Sempron(tm)
stepping : 0
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon-mp -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
Code: Select all
root@smoker / # cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 6
model : 10
model name : AMD Athlon(tm) XP 2500+
stepping : 0
cpu MHz : 1830.130
cache size : 512 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse syscall mmxext 3dnowext 3dnow up ts
bogomips : 3665.02
root@smoker / # 

Code: Select all
CFLAGS="-march=athlon-xp -msse2 -msse3 -O2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"Using athlon64 as march implies/activates the 64-bit instruction set extensions, as per the GCC Manual.k8, opteron, athlon64, athlon-fx
AMD K8 core based CPUs with x86-64 instruction set support. (This supersets MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.)
Code: Select all
emerge --noreplace `cat world.new`
Code: Select all
letto@localhost ~/devel/genscript $ diff pkg_list.O2 pkg_list.O3
442c442
< sys-apps/dbus-0.62-r1
---
> sys-apps/dbus-0.62
letto@localhost ~/devel/genscript $
Code: Select all
letto@localhost ~/devel/genscript $ cat /etc/make.conf|grep -e FLAGS -e ACCEPT
CFLAGS="-march=k8 -O3 -pipe -msse3 -fprefetch-loop-arrays -fmerge-all-constants -funroll-loops -fpeel-loops -ftracer -ftree-loop-ivcanon -funswitch-loops -ftree-vectorize -fivopts -ftree-loop-im -ftree-loop-linear"
CXXFLAGS="${CFLAGS}"
ACCEPT_KEYWORDS="~amd64"
LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,-z,now"
letto@localhost ~/devel/genscript $
Code: Select all
(chr) letto@localhost ~/devel/genscript $ cat /etc/make.conf|grep -e FLAGS -e ACCEPT
CFLAGS="-march=k8 -O2 -pipe -msse3 -ftree-vectorize"
CXXFLAGS="${CFLAGS}"
ACCEPT_KEYWORDS="~amd64"
LDFLAGS="-Wl,-O1"
(chr) letto@localhost ~/devel/genscript $
Code: Select all
letto@localhost ~/devel/genscript $ cat bin_size.sh
#!/bin/bash
TOTAL=0
LIBS=0
for i in `seq 1 20`;
do
DIR=`echo $PATH|cut -d: -f$i`
if [[ -e $DIR ]] ; then
TOTAL=`expr $TOTAL + $(du $DIR |cut -f1)`
du -h $DIR
fi
done
echo binaries $TOTAL
echo
for i in `cat /etc/ld.so.conf |grep -v \#`
do
#echo $i
if [[ -e $i ]] ; then
LIBS=`expr $LIBS + $( du -s $i|cut -f1) `
du -hs $i
fi
done
TOTAL=`expr $TOTAL + $LIBS`
echo libs $LIBS
echo $TOTAL
letto@localhost ~/devel/genscript $
Code: Select all
letto@localhost ~/devel/genscript $ ./bin_size.sh
0 /usr/local/bin
191M /usr/bin
11M /bin
0 /opt/bin
581K /usr/x86_64-pc-linux-gnu/gcc-bin/4.1.1
2.0M /opt/blackdown-jdk-1.4.2.03/bin
904K /opt/blackdown-jdk-1.4.2.03/jre/bin
56M /usr/kde/3.5/bin
7.6M /usr/qt/3/bin
13M /usr/games/bin
binaries 286729
0 /usr/local/lib
8.4M //usr/lib32/opengl/nvidia/lib
8.3M //usr/lib64/opengl/nvidia/lib
0 /lib
0 /usr/lib
0 /usr/local/lib
22M /lib64
817M /usr/lib64
0 /usr/local/lib64
2.3M /lib32
44M /usr/lib32
0 /usr/local/lib32
0 /usr/x86_64-pc-linux-gnu/lib
80M /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1
5.0M /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/32
969K /usr/lib64/nspr
4.7M /usr/lib64/nss
0 /usr/lib
14M /opt/blackdown-jdk-1.4.2.03/jre/lib/amd64/
44K /opt/blackdown-jdk-1.4.2.03/jre/lib/amd64/native_threads/
6.5M /opt/blackdown-jdk-1.4.2.03/jre/lib/amd64/server/
7.3M /emul/linux/x86/usr/qt/3/lib
0 /usr/kde/3.5/lib
184M /usr/kde/3.5//lib64
0 /usr/qt/3/lib
19M /usr/qt/3/lib64
2.8M /emul/linux/x86/lib
43M /emul/linux/x86/usr/lib
2.8M /emul/linux/x86/lib
43M /emul/linux/x86/usr/lib
5.8M /usr/games/lib
809K /usr/lib64/libstdc++-v3/
libs 1347635
1634364
letto@localhost ~/devel/genscript $
Code: Select all
(chr) letto@localhost ~/devel/genscript $ ./bin_size.sh
0 /usr/local/bin
160M /usr/bin
9.0M /bin
0 /opt/bin
581K /usr/x86_64-pc-linux-gnu/gcc-bin/4.1.1
2.0M /opt/blackdown-jdk-1.4.2.03/bin
904K /opt/blackdown-jdk-1.4.2.03/jre/bin
49M /usr/kde/3.5/bin
7.0M /usr/qt/3/bin
9.9M /usr/games/bin
binaries 243084
0 /usr/local/lib
8.4M /usr/lib32/opengl/nvidia/lib
8.3M /usr/lib64/opengl/nvidia/lib
0 /lib
0 /usr/lib
0 /usr/local/lib
21M /lib64
804M /usr/lib64
0 /usr/local/lib64
2.3M /lib32
44M /usr/lib32
0 /usr/local/lib32
0 /usr/x86_64-pc-linux-gnu/lib
80M /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1
5.0M /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/32
877K /usr/lib64/nspr
4.7M /usr/lib64/nss
0 /usr/lib
14M /opt/blackdown-jdk-1.4.2.03/jre/lib/amd64/
44K /opt/blackdown-jdk-1.4.2.03/jre/lib/amd64/native_threads/
6.5M /opt/blackdown-jdk-1.4.2.03/jre/lib/amd64/server/
7.3M /emul/linux/x86/usr/qt/3/lib
0 /usr/kde/3.5/lib
171M /usr/kde/3.5//lib64
0 /usr/qt/3/lib
19M /usr/qt/3/lib64
2.8M /emul/linux/x86/lib
43M /emul/linux/x86/usr/lib
2.8M /emul/linux/x86/lib
43M /emul/linux/x86/usr/lib
4.6M /usr/games/lib
817K /usr/lib64/libstdc++-v3/
libs 1318182
1561266
(chr) letto@localhost ~/devel/genscript $
Code: Select all
letto@localhost ~/devel/genscript $ cat bin_dir.sh
#!/bin/bash
TOTAL=0
for i in `ls /usr/bin`
do
B1=$(ls -l /mnt/disk/usr/bin/$i|cut -f3 -dt|cut -f1 -dS)
B2=$(ls -l /usr/bin/$i|cut -f3 -dt|cut -f1 -dS)
echo $(./proc $B1 $B2) $i $B1 $B2
done
letto@localhost ~/devel/genscript $
Code: Select all
100.9 % paperconf 9448 9368
101.2 % giffiltr 7168 7080
101.3 % gnome-cups-manager 108624 107232
101.6 % osx 77720 76472
101.9 % epsilon_thumb_test 7560 7416
102.9 % pat2dat 144296 140248
106.3 % dat2c 27552 25920
107.5 % cupstestdsc 11136 10360
108.0 % autoconf 27 25
108.0 % autoheader 27 25
108.0 % autom4te 27 25
108.0 % autoreconf 27 25
108.0 % autoscan 27 25
108.0 % autoupdate 27 25
108.0 % ifnames 27 25
110.1 % ecore-config 2585 2347
110.8 % textconv 15576 14056
111.0 % ospent 19576 17632
19.3 % pgmtexture 19576 101464
42.8 % pnmconvol 32176 75136
43.0 % pbmupc 12200 28360
47.5 % cabextract 52792 111200
47.5 % dc 40512 85232
49.3 % ppmtoilbm 37000 75032
49.7 % pgmmorphconv 8264 16632
50.9 % cxpm 23728 46592
52.9 % pbmpage 8016 15144
53.0 % ilbmtoppm 33400 63064
53.2 % funzip 21880 41096
53.5 % tcrequant 76920 143776
53.7 % rletopaint 37368 69608
54.0 % pcxtoppm 11640 21560
54.3 % bc 77864 143416
54.6 % cameratopam 93624 171424
55.7 % grotty 82320 147888
56.6 % eyuvtoppm 8776 15512
56.6 % gpgv 325728 574984
57.1 % unrar 175488 307408
57.3 % grolj4 82360 143832
57.6 % unarj 21040 36504
57.8 % fant 44872 77680
57.8 % rleldmap 44880 77688
57.9 % mpeg2encode 78880 136232
58.0 % pbmtoln03 8096 13952
58.2 % grn 60952 104696
58.3 % pre-grohtml 74400 127680
58.4 % grodvi 86456 147928
58.5 % pgmmedian 10296 17592
58.9 % ppmrough 10048 17072
59.3 % pnmtoddif 12408 20928
59.3 % rletorla 41120 69392
59.3 % texindex 23976 40400
59.4 % ppmtopcx 13272 22336
59.6 % gif2epsn 17528 29392
59.6 % pnmtofiasco 145744 244512
59.7 % grops 128808 215752
59.8 % install-info 29136 48744
59.9 % msggrep 97944 163544
60.1 % refer 123304 205256
60.4 % mpeg3cat 162440 268944
60.4 % mpeg3dump 162440 268944
60.7 % bggen 11816 19480
60.9 % pktopbm 11760 19296
61.0 % mpeg3toc 166504 273008
61.0 % soxmix 309416 506992
61.1 % sox 309096 506032
61.2 % ppmtogif 15512 25328
61.3 % gpgsplit 41288 67408
61.5 % gif2x11 19624 31888
61.5 % rlesplice 40744 66256
61.8 % grolbp 95664 154768
61.8 % picttoppm 48592 78624
Code: Select all
CFLAGS="-march=pentium2 -mtune=pentium2 -O2 -pipe -ftracer -fweb -fforce-addr -fomit-frame-pointer
-fexpensive-optimizations -frerun-cse-after-loop -frerun-loop-opt -falign-functions=4 -Qn -fno-ident"

Code: Select all
CFLAGS="-march=athlon-xp -mtune=athlon-xp -O2 -mmmx -m3dnow -msse -pipe -fomit-frame-pointer -momit-leaf-frame-pointer -fno-ident"
CHOST="i686-pc-linux-gnu"
Code: Select all
CFLAGS="-march=athlon64 -mtune=athlon64 -O3 -mmmx -mmmxext -m3dnow -m3dnowext -msse -msse2 -pipe -fomit-frame-pointer -momit-leaf-frame-pointer -fno-ident"
CHOST="i686-pc-linux-gnu"


[SOLVED]:cybermonkey wrote:Hi all,
I'm building a new system this weekend, A celeron D 2.53ghz.
I don't need 64 bitness and have mainly used AMD in the past so a few pointers from the CFLAGS god's
that dwell in this thread would be appreciatedSo.......
![]()
What would be the best cflags to use?
Excuse me if this has already been posted, But this is one hell of a thread to get through
Code: Select all
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

Also from the gentoo-wiki:golding wrote:I have bought an AMD Athlon64-3800+ 939 and re-used my existing install, AMD Athlon XP 2500+ Barton, and everything is running fast and really sweet.
What I would like to do, as I don't want to use a chrooted env for the odd 32bit app, is run my AMD64 in a 32bit enhanced environment.
I would like to know, providing any body knows of course, if I left my CHOST ("i686-pc-linux-gnu") as is and ONLY changed my CFLAGS to reflect the CPU, will this run 32bit compile or will the 64 bit CFLAGS automatically produce a 64bit compiled system?
Current config:Proposed config:Code: Select all
CFLAGS="-march=athlon-xp -mtune=athlon-xp -O2 -mmmx -m3dnow -msse -pipe -fomit-frame-pointer -momit-leaf-frame-pointer -fno-ident" CHOST="i686-pc-linux-gnu"Code: Select all
CFLAGS="-march=athlon64 -mtune=athlon64 -O3 -mmmx -mmmxext -m3dnow -m3dnowext -msse -msse2 -pipe -fomit-frame-pointer -momit-leaf-frame-pointer -fno-ident" CHOST="i686-pc-linux-gnu"
Code: Select all
Athlon 64 X2 (AMD)
vendor_id: AuthenticAMD
cpu family: 15
model: 43
stepping: 1 or 2
model name: AMD Athlon(tm) X2 Dual Core Processor
32 bit
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
64 bit
CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe"
CXXFLAGS="${CFLAGS}"
If you have a newer Athlon64("Venice" or "San Diego")/Athlon64-X2("Manchester" or "Toledo") (check for pni in cat /proc/cpuinfo) you can also add -msse3 to your CFLAGS to enable SSE3 support. Any chip using the 90nm process except for the "Winchester" class Athlon64 supports SSE3.
Also bear in mind that all Athlon64 X2 and Opteron 165, 170, 175, 180, and 185 processors are dual-core CPUs so make sure that you use MAKEOPTS="-j3" in your make.conf. This doesn't affect the code but might reduce compile times.

My understanding is that it doesn't really improve anything as it is assumed by the compiler from the -march=athlon64 flag.ConiKost wrote:Could I use -mfpmath=sse on a AMD Athlon 64 X2 4600+ ?
Or not a good idea?
Code: Select all
MAKEOPTS="-j3"

It seems -O3 makes bigger binaries, and implies a very little performance gain ( 2% or 3% ).baigsabeeh wrote:Is -O3 safe and what are the benefits of it? The wiki makes it a little too vague.
Code: Select all
CHOST="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=nocona -fomit-frame-pointer -fno-ident"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j3"From the "man gcc" :baigsabeeh wrote:What is -fPIC for and how is it dangerous? I'm using it right now to complement the hashstyles and I've compiled half of my system without a hitch. Whereas when I didn't have it, it would stop after every 10 or 15 packages.
So basically, it's important in some cases, but overall you can get happily rid of it, since I suppose most ebuilds which will need it will commit this flag when needed.-fpic
If supported for the target machines, generate position-independent code, suitable for use in a shared library.
-fPIC
If supported for the target machine, emit position-independent code, suitable for dynamic linking, even if branches need large displacements.
Code: Select all
CFLAGS="-O2 -march=athlon-xp -mno-tls-direct-seg-refs -m32 -pipe -fomit-frame-pointer -momit-leaf-frame-pointer"
USE="... sse 3dnow"
LDFLAGS="-Wl,-O1 -Wl,--enable-new-dtags -Wl,--sort-common -s"
LINGUAS="en_GB""-fomit-frame-pointer" includes all actions caused by "-momit-leaf-frame-pointer", so remove "-momit-leaf-frame-pointer".#2 wrote:Code: Select all
CFLAGS="(...) -fomit-frame-pointer -momit-leaf-frame-pointer"
"--enable-new-dtags" is default in Gentoo, so remove it.#2 wrote:Code: Select all
LDFLAGS="(...) -Wl,--enable-new-dtags (...)"
"spidermonkey" will fail to build.#2 wrote:-fforce-addr
Yes.#2 wrote:-fprefetch-loop-arrays
Yes, but use only "-fvisibility-inlines-hidden". Some packages will fail to build even with alone "-fvisibility-inlines-hidden" (Maybe KOffice?).#2 wrote:Also I have read. http://gcc.gnu.org/gcc-4.0/changes.html#visibility and http://gcc.gnu.org/wiki/Visibility I'm not sure how to implement this.
I this correct? CXXFLAGS="${CFLAGS} -fvisibility=hidden -fvisibility-inlines-hidden"
I have very bad experience not using it in many cases: Many packages will then not be able to link with -Wl,-z,now, because some libraries were compiled without this flag (i.e. my experience is that a huge amount of ebuilds is buggy w.r.t. -fPIC). What is worse is that linking without -Wl,-z,now might even be a security issue. So I would suggest to use these flags whenever possible and only omit them if something breaks (despite the annoying warnings of portage). It does probably not improve the performance (on x86 actually quite the opposite, on amd64 it might improve the performance slightly), but it improves the security.-JeaN- wrote:[...] -fPIC [...]
So basically, it's important in some cases, but overall you can get happily rid of it, since I suppose most ebuilds which will need it will commit this flag when needed.
I suggest you take it out of your CFLAGS and only include it on package base, if needed. I don't think it improves any of the performance.