GCC compilation optimization settings

Source: Internet
Author: User
GCC compilation optimization settings-general Linux technology-Linux programming and kernel information. The following is a detailed description. Check your gcc version:

# Gcc -- version

* Obtain the cpu model:

# Cat/proc/cpuinfo

* Create the make. conf file under/etc/and write different content according to the cpu model (note that your gcc version must be above 3.0 ):

I386 (Intel)

CHOST = "i386-pc-linux-gnu"
CFLAGS = "-march = i386-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = i386-O3-pipe-fomit-frame-pointer"

Isung (Intel)

CHOST = "i486-pc-linux-gnu"
CFLAGS = "-march = ibench-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = isung-O3-pipe-fomit-frame-pointer"

Pentium 1 (Intel)

CHOST = "i586-pc-linux-gnu"
CFLAGS = "-march = pentium-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = pentium-O3-pipe-fomit-frame-pointer"

Pentium MMX (Intel)

CHOST = "i586-pc-linux-gnu"
CFLAGS = "-march = pentium-mmx-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = pentium-mmx-O3-pipe-fomit-frame-pointer"

Pentium PRO (Intel)

CHOST = "i686-pc-linux-gnu"
CFLAGS = "-march = pentiumpro-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = pentiumpro-O3-pipe-fomit-frame-pointer"

Pentium II (Intel)

CHOST = "i686-pc-linux-gnu"
CFLAGS = "-march = pentium2-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = pentium2-O3-pipe-fomit-frame-pointer"

Celon (Mendocino), aka Celeron1 (Intel)

CHOST = "i686-pc-linux-gnu"
CFLAGS = "-march = pentium2-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = pentium2-O3-pipe-fomit-frame-pointer"

Pentium III (Intel)

CHOST = "i686-pc-linux-gnu"
CFLAGS = "-march = pentium3-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = pentium3-O3-pipe-fomit-frame-pointer"

Celon (Coppermine) aka Celeron2 (Intel)

CHOST = "i686-pc-linux-gnu"
CFLAGS = "-march = pentium3-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = pentium3-O3-pipe-fomit-frame-pointer"

Celon (Willamette) (Intel)

CHOST = "i686-pc-linux-gnu"
CFLAGS = "-march = pentium4-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = pentium4-O3-pipe-fomit-frame-pointer"

Pentium 4 (Intel)

CHOST = "i686-pc-linux-gnu"
CFLAGS = "-march = pentium4-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = pentium4-O3-pipe-fomit-frame-pointer"

Eden C3/Ezra ()

CHOST = "i586-pc-linux-gnu"
CFLAGS = "-march = i586-m3dnow-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = i586-m3dnow-O3-pipe-fomit-frame-pointer"

K6 (AMD)

CHOST = "i586-pc-linux-gnu"
CFLAGS = "-march = k6-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = k6-O3-pipe-fomit-frame-pointer"

AMD (K6-2)

CHOST = "i586-pc-linux-gnu"
CFLAGS = "-march = k6-2-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = k6-2-O3-pipe-fomit-frame-pointer"

AMD (K6-3)

CHOST = "i586-pc-linux-gnu"
CFLAGS = "-march = k6-3-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = k6-3-O3-pipe-fomit-frame-pointer"

Athlon (AMD)

CHOST = "i686-pc-linux-gnu"
CFLAGS = "-march = athlon-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = athlon-O3-pipe-fomit-frame-pointer"

Athlon-tbird, aka K7 (AMD)

CHOST = "i686-pc-linux-gnu"
CFLAGS = "-march = athlon-tbird-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = athlon-tbird-O3-pipe-fomit-frame-pointer"

Athlon-tbird XP (AMD)

CHOST = "i686-pc-linux-gnu"
CFLAGS = "-march = athlon-xp-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = athlon-xp-O3-pipe-fomit-frame-pointer"

Athlon 4 (AMD)

CHOST = "i686-pc-linux-gnu"
CFLAGS = "-march = athlon-4-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = athlon-4-O3-pipe-fomit-frame-pointer"

Athlon XP (AMD)

CHOST = "i686-pc-linux-gnu"
CFLAGS = "-march = athlon-xp-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = athlon-xp-O3-pipe-fomit-frame-pointer"

Athlon MP (AMD)

CHOST = "i686-pc-linux-gnu"
CFLAGS = "-march = athlon-mp-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-march = athlon-mp-O3-pipe-fomit-frame-pointer"

603 (PowerPC)

CHOST = "powerpc-unknown-linux-gnu"
CFLAGS = "-O3-pipe-fsigned-char"
CXXFLAGS = "-O3-pipe-fsigned-char"

603e (PowerPC)

CHOST = "powerpc-unknown-linux-gnu"
CFLAGS = "-O3-pipe-fsigned-char"
CXXFLAGS = "-O3-pipe-fsigned-char"

604 (PowerPC)

CHOST = "powerpc-unknown-linux-gnu"
CFLAGS = "-O3-pipe-fsigned-char"
CXXFLAGS = "-O3-pipe-fsigned-char"

604e (PowerPC)

CHOST = "powerpc-unknown-linux-gnu"
CFLAGS = "-O3-pipe-fsigned-char"
CXXFLAGS = "-O3-pipe-fsigned-char"

750 aka as G3 (PowerPC)

CHOST = "powerpc-unknown-linux-gnu"
CFLAGS = "-mcpu = 750-O3-pipe-fsigned-char-mpowerpc-gfxopt"
CXXFLAGS = "-mcpu = 750-O3-pipe-fsigned-char-mpowerpc-gfxopt"

7400, aka G4 (PowerPC)

CHOST = "powerpc-unknown-linux-gnu"
CFLAGS = "-mcpu = 7400-O2-pipe-fsigned-char-maltivec-mabi = altivec-mpowerpc-gfxopt"
CXXFLAGS = "-mcpu = 7400-O2-pipe-fsigned-char-maltivec-mabi = altivec-mpowerpc-gfxopt"

7450, aka G4 second generation (PowerPC)

CHOST = "powerpc-unknown-linux-gnu"
CFLAGS = "-mcpu = 7450-O2-pipe-fsigned-char-maltivec-mabi = altivec-mpowerpc-gfxopt"
CXXFLAGS = "-mcpu = 7450-O2-pipe-fsigned-char-maltivec-mabi = altivec-mpowerpc-gfxopt"

PowerPC (If you don't know which one)

CHOST = "powerpc-unknown-linux-gnu"
CFLAGS = "-O3-pipe-fsigned-char-mpowerpc-gfxopt"
CXXFLAGS = "-O3-pipe-fsigned-char-mpowerpc-gfxopt"

ISCSI

CHOST = "iSCSI-unknown-linux-gnu"
CFLAGS = "-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-O3-pipe-fomit-frame-pointer"

64

CHOST = "sparc64-unknown-linux-gnu"
CFLAGS = "-O3-pipe-fomit-frame-pointer"
CXXFLAGS = "-O3-pipe-fomit-frame-pointer"

Well, the program running efficiency compiled by you will be much higher than before! As long as you have time, you can put your system such as Red Hat Linux 9 source code (suffix. src. rpm) re-compile all the files once, and you will find that your Red Hat Linux system is much faster than the original one!
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.