gcc最適化
Mac OS X 10.5.8上で下記のgccを使用した。早いところ、Snow Leopardを入れよう。
- gcc version 4.0.1 (Apple Inc. build 5488)
- gcc version 4.2.1 (Based on Apple Inc. build 5636) (LLVM build 2.5)
どちらもApple版なので-fastオプションを持っている。
On Intel target, -fast currently enables the following optimization flags:
-O3 -fomit-frame-pointer -fstrict-aliasing -momit-leaf-frame-pointer -fno-tree-pre -falign-loops
All choices of flags enabled by -fast are subject to change without notice.
http://developer.apple.com/Mac/library/documentation/Darwin/Reference/ManPages/man1/gcc.1.htmlIntelターゲットにおいて、-fastは今のところ下記の最適化フラグを有効にする。
-O3 -fomit-frame-pointer -fstrict-aliasing -momit-leaf-frame-pointer -fno-tree-pre -falign-loops
-fastがどのフラグを有効かするかは、予告なしに変わることがる。
manには書いていないけれどC++用に-fastcpオプションもある。
-fastcp is intended for C++ only. Currently it is identical to -fast, but its meaning may change in the future to allow for better C++ optimization.
Documentation Archive-fastcpはC++だけを対象とする。現在は-fastと同一だが、よりよいC++最適化が行われるように、将来的には意味が変更されるかもしれない。
x86-64用のコードを生成する場合は-m64オプションを使用する。