Typo
[linux_from_scratch_hints.git] / OLD / compiler-optimize.txt
blob48ca17bca7c15e0808aa28c24d3fdbfd490569ce
1 TITLE:          Compiler Optimization
2 LFS VERSION:    2.3.5
3 AUTHOR:         Per Liden <per@fukt.hk-r.se>
5 SYNOPSIS:
6                 How to optimize the compilation for a certain CPU.
8 HINT:
9 To optimize for a specific architecture you can add the -m<cpu>
10 -march=<cpu> options when compiling. If you want to optimize for, say PII,
11 then you could do someting like this:
13 before running ./configure, type:
15 (if you use bash)
17         export CFLAGS="-02 -mpentiumpro -march=pentiumpro"
18         export CXXFLAGS="-02 -mpentiumpro -march=pentiumpro"
20 (or if you use tcsh)
22         setenv CFLAGS "-02 -mpentiumpro -march=pentiumpro"
23         setenv CXXFLAGS "-02 -mpentiumpro -march=pentiumpro"
25 the -O2 option could be set to something higher than 2, but 2 is a safe
26 choice. If the package in question doesn't have a ./configure script you
27 sometimes (depending on how the Makefile is written) have to edit the
28 Makefile by hand.
30 Note that when using the -march=<cpu> option, the compiler will make use
31 of architecture specific instructions, and therefor the binary will not
32 run on older architectures, in this case pentium, i486, etc.
34 The -m<cpu> option does not cause the compiler to generate archetecture
35 specific instructions, however, the compiler schedules the code to perform
36 best on the specified cpu.
38 Valid cpu (Intel and compatables) types in gcc 2.95.2 are:
39 486, pentium, pentiumpro, k6
41 /pli