CPUFlags is a small perl-script serving as a database for compiler-optimisation flags on different hardware-platforms and processors.
I simply was tired of setting up each Makefile with the right parameters and wanted to have an automatic procedure for this. The result might not be optimal, e.g. the database could grow quite large, but it works.
The list of known operating systems contains Linux, Solaris, Darwin (MacOSX) and (to some degree) AIX, Irix, HP-UX, Tru64 and Windows. Various compilers are supported like GCC-2/3/4, Intel-CC, Portland-CC, Sun-CC, Kai-CC, IBM-xlC, Mips-CC, Compaq-CC, Visual-C++ etc. .
You are welcome to send options for platforms/processors which are currently not supported by CPUFlags to me.
- Support for GCC up to v4.9, ICC up to v13, Clang up to v3.4 and Open64
- Support for Intel Sandybridge, Ivybridge and Haswell processors and AMD Barcelona CPUs
- Support for Power5, Power6 CPUs and Penryn CPU
- updated CPU detection under Darwin
- optional output of compiler flags for warnings added, e.g. “-Wall”
(dependend on compiler and language, e.g.
- support for GCC-4.4, Intel-CC v9/10/11 and Sun-Studio 10/11 added
- some new Core2 and Opteron processors added
- switched processor detection in Solaris to
- Core Duo/Core2 support and new Opteron model
- print reason of error (e.g. which model is unknown)
- colour support for better readability in case of error
- some source code improvements
- bug in handling of pentium3 fixed
- detection of newer IBM VisualAge C++ compilers added
- removed flag
- support for Microsoft Windows added
- cleaned up some variable declarations
- added model number for dual-core opteron processors
- changed version and flag handling of Sun compilers
- updated flags for PathScale compilers
- separated Intel compiler v5-v7 and v8-v9 since flags have changed
- automatic processor detection on HP-UX (PA-RISC)
- support for gcc-4 on Darwin
- support for pentium4 willamette, prescott, nocona and foster with flags for gcc-3.4, gcc-4.0, icc-8 and icc-9
- CPU-type “p4-xeon” was removed
- added support for Tru64 and the compaq-C-compiler for EV5, EV5.6, EV6 and EV6.7
- VisualAge-Compiler on AIX is now detected correctly
- support for gcc-4.0 and vectorisation
- unkown arguments are no longer considered an error, e.g. CC=gcc -Wall
- removed -finline-functions since already included in -O3
- removed AMD Duron since equal (from compiler) to AMD Athlon
- some code cleanups
- support for IBM VisualAge compiler on MacOSX
- correct detection of various PowerPC processors on MacOSX
- support for PathScale compiler
- removed -fexpensive-optimizations and -fschedule-insn2
- code restructuring
- changed parsing of command-line (now with Getopt::Long)
- Darwin modifications
- script is now called via “env perl” to handle different locations of perl
- changed environment variable CPU to PROCESSOR since it collides with same variable in RedHat
- slightly changed processor detection
- changed flags for centrino with gcc (3.4 vs. pre 3.4)
- changed “fpmath” to “mfpmath”
- no support of SSE2 in gcc-3.3 or less (corrected)
- new athlon-xp model (Noah Williamsson)
- support for Portland compiler on Linux
-msseflags for GCC since these should be implied by
- errors in Intel compiler flags for Pentium 3 fixed
-marchflags for Intel compiler
- wrong error output fixed
- bug in handling of Cygwin removed (Noah Williamsson)
- bugs in compiler detection removed
- restructuring of the internal database
- autodetection of compiler version (where possible)
- support for AMD K6, K6-2 and K6-3 (thanks to Noah Williamsson)
- preliminary support for Darwin and CYGWIN (again thanks to Noah Williamsson) and IRIX
- error messages are now printed on stderr
- using flags-field in /proc/cpuinfo in Linux to set support for MMX, SSE, SSE2, 3DNOW for unkown processors
- -mmx mysteriously reappeared and fixed again (thanks to Jeremy Laine)
- Pentium4 Model 1 is now detected (again thanks to Jeremy)
- (early) support for the AMD Opteron processor
- added support for Duron-XP processors (thanks to Karsten Kruse)
- added verbosity option to show some of the parsed data (mainly for debug)
- reading environment variable
CPU(circumvents cpu detection)
- wrong argment for pentium4 processors (-mmx instead of -mmmx)
- added support for the Intel Centrino (p3-centrino) processor
- added standard optimisation flags (-O) if no processor could be found
- added support for the VIA C3 Nehemiah (via-c3a) processor
- added support for AIX running on Power4-CPUs with gcc, xlC and xlC-64
- initial public release
- --cpu <name>
- Show flags for given CPU identifier <name>.
- automatic detection
- --comp <name>
- Show flags for given compiler <name>.
- Show CPU identifier.
- (Don't) print general architecture flags for compiler.
- (Don't) print optimisation flags for compiler.
- -32, -64
- Choose between 32 or 64 bit system.
- -h, --help
- Print this text.
- -v, --verbose [int]
- Define verbosity level.
- -V, --version
- Print version number of CPUFlags.
Supported Systems and Compilers
- gcc-2.x, gcc-3.x, icc-, pgi, pathcc
- gcc-2.x, gcc-3.x, SunCC-, kcc
- gcc, xlC
- gcc, Mips-CC
- gcc, xlc
- HP Ansi C++ compiler
- Visual C++
- i386, i486, i586, pentium, pentium-mmx, pentium-pro, p2, p3, p3-sse, p3-centrino, p3-xeon, p4, p4-(w|p|n|f), k6, k6-2, k6-3, athlon, duron, athlon-tbird, athlon-xp, duron-xp, opteron, via-c3a, ppc750, ppc7450
- ultra1, ultra2, ultra3, ultra3cu
- ppc, ppc6XX, ppc750, ppc7450, ppc970
- EV5, EV5.6, EV6, EV6.7
- PA7x00 und PA8x00
- i386, i486, i586, pentium, pentium-mmx, pentium-pro, p2, p3, p3-sse, p3-centrino, p3-xeon, p4, p4-(w|p|n|f), k6, k6-2, k6-3, athlon, duron, athlon-tbird, athlon-xp, duron-xp, opteron, via-c3a
Here you can find a collection of links regarding compiler optimisation: