LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1025|回复: 6

[转摘]超级优化系统的flags

[复制链接]
发表于 2004-10-26 02:44:59 | 显示全部楼层 |阅读模式
Those flags are for gcc-3.x and alike (mostly gcc-3.0, gcc-3.1.1 and gcc-3.2), you may check which gcc you're using with the following command : How to know your gcc version

[PHP]#gcc --version[/PHP]  


You can know which CPU you have with the following command : How to know your CPU type

[PHP]cat /proc/cpuinfo[/PHP]



Ok, you really want to optimize your box to death, even if that means spending times experimenting stuff, and sometimes breaking your box ? Eventually, the flags combination that prove stable here will go on the safe flag page If you can't see any line here, that means nobody has reported either success or failure with any flags... wanna test ? The first thing you want to test are the following flags (don't forget to add -pipe -O3 -march=XXX -fomit-frame-pointer, which is the bare minimum)


[PHP]-fprefetch-loop-arrays
-ffast-math
-fforce-addr (-fforce-mem is implied by -O3)
-falign-functions=4
-funroll-loops ( bigger exe, maybe faster, usually not worth it, I don't use it) [/PHP]
The following flags have been reported to work with gentoo 1.4 (gcc-3.2). The CHOST is unrelated to compiler flags, you should use the exact same one as found on the safe flags page

note : -fstrict-aliasing -fexpensive-optimizations -force-mem -frerun-loop-opt -frerun-cse-after-loop are implied by -O3, see the FAQ
--------------------------------------------------------------------------------

Pentium III (Intel)

[PHP]CFLAGS="-march=pentium3 -O3 -pipe -fomit-frame-pointer
   -fforce-addr -falign-functions=4 -fprefetch-loop-arrays"
CXXFLAGS="${CFLAGS}"[/PHP]

note : -mmmx, -msse are implied by -march=pentium3




--------------------------------------------------------------------------------
Athlon (AMD)

[PHP]CFLAGS="-march=athlon -O3 -pipe -fomit-frame-pointer
-ffast-math  -funroll-loops -fforce-addr -falign-functions=4"
CXXFLAGS="${CFLAGS}"[/PHP]

note : -m3dnow and -mmmx optimisations are implied by -march=athlon

Athlon-tbird, aka K7 (AMD)

[PHP]CFLAGS="-march=athlon-tbird -O3 -pipe -fforce-addr -fomit-frame-pointer
  -funroll-loops -falign-functions=4 -maccumulate-outgoing-args"
CXXFLAGS="${CFLAGS}"[/PHP]

note : -m3dnow and -mmmx optimisations are implied by -march=athlon-tbird


Someone reported having a system working with no problem on an Athlon XP 2000+ with : Athlon XP 2000+

[PHP]CFLAGS="-march=athlon-xp -m3dnow -msse -mfpmath=sse -mmmx -O3
-pipe -fforce-addr -fomit-frame-pointer -funroll-loops -frerun-cse-after-loop
-frerun-loop-opt -falign-functions=4 -maccumulate-outgoing-args -ffast-math
-fprefetch-loop-arrays"
CXXFLAGS="${CFLAGS}"[/PHP]
发表于 2004-10-26 09:52:20 | 显示全部楼层
怎么没P4的?
发表于 2004-10-26 15:44:29 | 显示全部楼层
发表于 2004-10-26 15:49:15 | 显示全部楼层
发表于 2004-11-4 12:34:24 | 显示全部楼层
这些设置经过参考AMD官方网站的优化指南,可惜不记得具体网址了。
而且-march=<cpu type>并不会自动打开机器特性参数-mmmx -msse -m3dnow -msse2 或 -msse3。

所以:

CHOST="i686-pc-linux-gnu"

CFLAGS="-pipe -march=athlon-xp -mfpmath=sse -mmmx -msse -m3dnow -maccumulate-outgoing-args -minline-all-stringops -momit-leaf-frame-pointer -O3 -ffast-math -fforce-addr -fomit-frame-pointer -fprefetch-loop-arrays -ftracer -funroll-loops"

CXXFLAGS="-pipe -march=athlon-xp -mfpmath=sse -mmmx -msse -m3dnow -maccumulate-outgoing-args -minline-all-stringops -momit-leaf-frame-pointer -O3 -ffast-math -fforce-addr -fomit-frame-pointer -fprefetch-loop-arrays -ftracer -funroll-loops -fno-rtti"

LDFLAGS="-Wl,-O1"
发表于 2004-11-4 13:52:19 | 显示全部楼层
-ffast-math会打破和ieee的浮点数兼容
发表于 2004-11-4 14:06:48 | 显示全部楼层
那你哪款软件必须使用IEEE浮点数兼容?
假如某个ebuild不可以使用fastmath的话,它应该已经屏蔽了fastmath了。我机器上所有的科学计算软件都用了fastmath,还没有发现问题。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表