gccの-marchオプションと-mtuneオプション
-marchオプション
Section titled “-marchオプション”psABI(ABIのCPU依存部分)を指定するオプション。アプリケーションのコードを、どのCPUに向けて生成するか決める。
現在のCPUがサポートしているpsABIは以下のコマンドを実行すると調べられる。
$ /lib64/ld-linux-x86-64.so.2 --help...Subdirectories of glibc-hwcaps directories, in priority order: x86-64-v4 (supported, searched) x86-64-v3 (supported, searched) x86-64-v2 (supported, searched)詳細なリストは以下にある。
-mtune(-mcpu)オプション
Section titled “-mtune(-mcpu)オプション”基本的には -march を使えばよい。i386 や i486 などの古いCPUに向けてコードを生成する場合のみ必要になる。
以前は -mcpu オプションを利用していたが、今は -mtune を利用できるならこちらが推奨される。