免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 639 | 回复: 8
打印 上一主题 下一主题

編譯時優化的問題,先謝過. [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-06-10 14:11 |只看该作者 |倒序浏览
請教各位大大,在編譯內核時,會以 -march=i686 對機器作出優化,請問若果我是使用pentium4或者athlon能否作出特定機器的優化呢, 如 -march=pentium4 或 -march=amd等呢?

另外,我可以在那找到更多優化的資料呢? 因我在google找過, 但並沒有這方面的資料. 再請指教. thanks.

论坛徽章:
0
2 [报告]
发表于 2005-06-10 14:41 |只看该作者

編譯時優化的問題,先謝過.

gcc的man page里有说明,对AMD的CPU也有对应的参数。更深入的我就不清楚了

论坛徽章:
0
3 [报告]
发表于 2005-06-10 15:32 |只看该作者

編譯時優化的問題,先謝過.

From gcc manual:
  1. Intel 386 and AMD x86-64 Options

  2.        These -m options are defined for the i386 and x86-64 family of comput-
  3.        ers:

  4.        -mtune=cpu-type
  5.            Tune to cpu-type everything applicable about the generated code,
  6.            except for the ABI and the set of available instructions.  The
  7.            choices for cpu-type are:

  8.            i386
  9.                Original Intel's i386 CPU.

  10.            i486
  11.                Intel's i486 CPU.  (No scheduling is implemented for this
  12.                chip.)

  13.            i586, pentium
  14.                Intel Pentium CPU with no MMX support.

  15.            pentium-mmx
  16.                Intel PentiumMMX CPU based on Pentium core with MMX instruction
  17.                set support.

  18.            i686, pentiumpro
  19.                Intel PentiumPro CPU.

  20.            pentium2
  21.                Intel Pentium2 CPU based on PentiumPro core with MMX instruc-
  22.                tion set support.

  23.            pentium3, pentium3m
  24.                Intel Pentium3 CPU based on PentiumPro core with MMX and SSE
  25.                instruction set support.

  26.            pentium-m
  27.                Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2
  28.                instruction set support.         Used by Centrino notebooks.

  29.            pentium4, pentium4m
  30.                Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set sup-
  31.                port.

  32.            prescott
  33.                Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and
  34.                SSE3 instruction set support.

  35.            nocona
  36.                Improved version of Intel Pentium4 CPU with 64-bit extensions,
  37.                MMX, SSE, SSE2 and SSE3 instruction set support.

  38.            k6  AMD K6 CPU with MMX instruction set support.

  39.            k6-2, k6-3
  40.                Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction
  41.                set support.

  42.            athlon, athlon-tbird
  43.                AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE
  44.                prefetch instructions support.

  45.            athlon-4, athlon-xp, athlon-mp
  46.                Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and
  47.                full SSE instruction set support.

  48.            k8, opteron, athlon64, athlon-fx
  49.                AMD K8 core based CPUs with x86-64 instruction set support.
  50.                (This supersets MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and
  51.                64-bit instruction set extensions.)

  52.            winchip-c6
  53.                IDT Winchip C6 CPU, dealt in same way as i486 with additional
  54.                MMX instruction set support.

  55.            winchip2
  56.                IDT Winchip2 CPU, dealt in same way as i486 with additional MMX
  57.                and 3dNOW!  instruction set support.

  58.            c3  Via C3 CPU with MMX and 3dNOW!  instruction set support.         (No
  59.                scheduling is implemented for this chip.)

  60.            c3-2
  61.                Via C3-2 CPU with MMX and SSE instruction set support.  (No
  62.                scheduling is implemented for this chip.)

  63.            While picking a specific cpu-type will schedule things appropri-
  64.            ately for that particular chip, the compiler will not generate any
  65.            code that does not run on the i386 without the -march=cpu-type
  66.            option being used.

  67.        -march=cpu-type
  68.            Generate instructions for the machine type cpu-type.         The choices
  69.            for cpu-type are the same as for -mtune.  Moreover, specifying
  70.            -march=cpu-type implies -mtune=cpu-type.
复制代码

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
4 [报告]
发表于 2005-06-10 15:39 |只看该作者

編譯時優化的問題,先謝過.

配置参数可以优化,一般的linux都做好了,
可以上gentoo社区找找,我记得有这方面的资料

论坛徽章:
0
5 [报告]
发表于 2005-06-10 15:40 |只看该作者

編譯時優化的問題,先謝過.

不过编译内核选不同的Processor family和设置gcc的编译选项是不大一样的。除非你像用Gentoo那样,所以软件都用编译的方式来安装,设置gcc的编译选项是优化不了系统的。

论坛徽章:
0
6 [报告]
发表于 2005-06-10 15:46 |只看该作者

編譯時優化的問題,先謝過.

先謝謝各位的指教.小弟明白了,再嘗試學習.
egret 的資料很詳細呢, 請問在那找到的呢. thx

论坛徽章:
0
7 [报告]
发表于 2005-06-10 15:47 |只看该作者

編譯時優化的問題,先謝過.

[quote]原帖由 "惠繪洋"]egret 的資料很詳細呢, 請問在那找到的呢. thx[/quote 发表:
  1. $ man gcc
复制代码
:wink:

论坛徽章:
0
8 [报告]
发表于 2005-06-10 15:48 |只看该作者

編譯時優化的問題,先謝過.

man gcc

就可以看到那段话了

论坛徽章:
0
9 [报告]
发表于 2005-06-10 15:55 |只看该作者

編譯時優化的問題,先謝過.

[quote]原帖由 "egret"]wink:[/quote 发表:


Thanks, 我只上google不停地找它相關的資料, 一時不懂找找man gcc.  
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP