View previous topic :: View next topic |
Author |
Message |
Just Modeste n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/gallery/Funny_Figure/klo.gif)
Joined: 08 Nov 2002 Posts: 14
|
Posted: Wed Dec 03, 2003 3:51 pm Post subject: Astuce: Une mise en forme peut etre appliquee au texte selec |
|
|
Bonjour a tous,
Voila, j'aimerai savoir comment optimiser les parametres CFLAGS dans le fichier /etc/make.conf.
J'ai trouve sur le site www.freehackers.org/gentoo/gccflags/flags-gcc3.html les parametres a utiliser. Pour ma machine (pentiumIII) j'ai donc :
CFLAGS="-march=pentium3 -O3 -pipe -fomit-frame-pointer"
Par contre, en voulant utiliser le stage3, j'avais plutot :
CFLAGS="-O3 -march=pentium3 -fprefetch-loop-arrays -funroll-loops -pipe"
D'ou ma question de savoir quels sont les meilleurs parametres ?
Merci pour vos reponse. _________________ "Parce que la connaissance ne vaut que losrqu'elle est partagée."
Just Modeste. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
px Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/3ed46a2e3da6d6b21e307.jpg)
Joined: 26 Sep 2002 Posts: 497 Location: Metz, France
|
Posted: Thu Dec 04, 2003 9:11 pm Post subject: |
|
|
cree un nouveau fichier appelé gcccpuopt.sh qui contient:
Code: |
#!/bin/sh
# Author: pixelbeat
#This script is Linux specific
#It should work on any gcc >= 2.95 at least
#these apply to any arch (just here for reference)
unsafe_math_opts="-ffast-math -fno-math-errno -funsafe-math-optimizations -fno-trapping-math"
gcc_version=`gcc -dumpversion | sed 's/\([0-9]\{1,\}\.[0-9]\{1,\}\)\.*\([0-9]\{1,\}\)\{0,1\}/\1\2/'`
IFS=":"
while read name value; do
unset IFS
name=`echo $name`
value=`echo $value`
IFS=":"
if [ "$name" == "vendor_id" ]; then
vendor_id="$value"
elif [ "$name" == "cpu family" ]; then
cpu_family="$value"
elif [ "$name" == "model" ]; then
cpu_model="$value"
elif [ "$name" == "flags" ]; then
flags="$value"
fi
done < /proc/cpuinfo
unset IFS
if [ "$vendor_id" == "AuthenticAMD" ]; then
if [ "$cpu_family" == "4" ]; then
_CFLAGS="$_CFLAGS -march=i486"
elif [ "$cpu_family" == "5" ]; then
if [ "$cpu_model" -lt "4" ]; then
_CFLAGS="$_CFLAGS -march=pentium"
elif [ "$cpu_model" == "6" ] || [ "$cpu_model" == "7" ]; then
_CFLAGS="$_CFLAGS -march=k6"
elif [ "$cpu_model" == "8" ] || [ "$cpu_model" == "12" ]; then
if expr $gcc_version '>=' 3.1 >/dev/null; then
_CFLAGS="$_CFLAGS -march=k6-2"
else
_CFLAGS="$_CFLAGS -march=k6"
fi
elif [ "$cpu_model" == "9" ] || [ "$cpu_model" == "13" ]; then
if expr $gcc_version '>=' 3.1 >/dev/null; then
_CFLAGS="$_CFLAGS -march=k6-3"
else
_CFLAGS="$_CFLAGS -march=k6"
fi
fi
elif [ "$cpu_family" == "6" ]; then
if [ "$cpu_model" -le "3" ]; then
if expr $gcc_version '>=' 3.0 >/dev/null; then
_CFLAGS="$_CFLAGS -march=athlon"
else
_CFLAGS="$_CFLAGS -march=k6"
fi
elif [ "$cpu_model" == "4" ]; then
if expr $gcc_version '>=' 3.1 >/dev/null; then
_CFLAGS="$_CFLAGS -march=athlon-tbird"
elif expr $gcc_version '>=' 3.0 >/dev/null; then
_CFLAGS="$_CFLAGS -march=athlon"
else
_CFLAGS="$_CFLAGS -march=k6"
fi
elif [ "$cpu_model" -ge "6" ]; then #athlon-{4,xp,mp}
if expr $gcc_version '>=' 3.1 >/dev/null; then
_CFLAGS="$_CFLAGS -march=athlon-xp"
elif expr $gcc_version '>=' 3.0 >/dev/null; then
_CFLAGS="$_CFLAGS -march=athlon"
else
_CFLAGS="$_CFLAGS -march=k6"
fi
fi
fi
else #everything else "GenuineIntel"
if [ "$cpu_family" == "3" ]; then
_CFLAGS="$_CFLAGS -march=i386"
elif [ "$cpu_family" == "4" ]; then
_CFLAGS="$_CFLAGS -march=i486"
elif [ "$cpu_family" == "5" ] && expr $gcc_version '<' 3.1 >/dev/null; then
_CFLAGS="$_CFLAGS -march=pentium"
elif [ "$cpu_family" -ge "6" ] && expr $gcc_version '<' 3.1 >/dev/null; then
_CFLAGS="$_CFLAGS -march=pentiumpro"
elif [ "$cpu_family" == "5" ]; then
if [ "$cpu_model" != "4" ]; then
_CFLAGS="$_CFLAGS -march=pentium"
else
_CFLAGS="$_CFLAGS -march=pentium-mmx" #No overlap with other vendors
fi
elif [ "$cpu_family" == "6" ]; then
if echo "$flags" | grep -vq cmov; then #gcc incorrectly assumes i686 always has cmov
_CFLAGS="$_CFLAGS -march=pentium -mcpu=pentiumpro" #VIA CPUs exhibit this
else
if [ "$cpu_model" == "0" ] || [ "$cpu_model" == "1" ]; then
_CFLAGS="$_CFLAGS -march=pentiumpro"
elif [ "$cpu_model" -ge "3" ] && [ "$cpu_model" -le "6" ]; then #4=TM5600 at least
_CFLAGS="$_CFLAGS -march=pentium2"
elif [ "$cpu_model" -ge "7" ] && [ "$cpu_model" -le "11" ]; then #9 invalid
_CFLAGS="$_CFLAGS -march=pentium3"
fi
fi
elif [ "$cpu_family" == "15" ]; then
_CFLAGS="$_CFLAGS -march=pentium4"
fi
fi
if expr $gcc_version '>=' 3.1 >/dev/null; then
if echo "$flags" | grep -q sse2; then
_CFLAGS="$_CFLAGS -mfpmath=sse -msse2"
elif echo "$flags" | grep -q sse; then
_CFLAGS="$_CFLAGS -mfpmath=sse -msse"
fi
if echo "$flags" | grep -q mmx; then
_CFLAGS="$_CFLAGS -mmmx"
fi
if echo "$flags" | grep -q 3dnow; then
_CFLAGS="$_CFLAGS -m3dnow"
fi
fi
echo "$_CFLAGS"
|
ensuite sauve le et fait chmod +x gcccpuopt.sh
puis ./gcccpuopt.sh
ca devrait te sortir les flags... Je sais plus où j'ai trouvé je l'ai trouvé, y'a peut etre une nouvelle version, faut juste la trouver avec un bon moteur de recherche _________________ Nous autres, mordus d'informatique, préférons par-dessus tout passer notre temps à bidouiller nos ordinateurs, plutôt que les utiliser pour faire quelque chose de productif. [Dave Barry] |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
cylgalad Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
Joined: 18 Apr 2003 Posts: 1327 Location: France
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|