1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

-marchのx86-64向け, CPU命令世代オプション

Last updated at Posted at 2021-05-02

GCC 11.0, LLVM 12.0から, -marchオプションにx86-64用のCPU命令世代指定が追加されました.
-march=x86-64-v[234]のように, 命令セットを対象に, ある程度の範囲に分割して指定することができます.
これまで, -march=nativeとしてコンパイルしたCPUに合わせるか, -march=skylakeなどのCPUを固定する方法しかありませんでした.

CPUベンダとしては, 新CPUごとに新しい命令を追加してアピールしたい. 開発者としては, ある程度古いCPUもサポートしながら, 新しい命令も使いたい. このふたつの間を埋める機能といえます.
開発者が, ある命令セットがどのCPUからサポートしているのか, 把握して管理することは手間がかかります.

オプション 有効になる命令 CPU世代
x86-64 CMOV, CMPXCHG8B, FPU, FXSR, MMX, FXSR, SCE, SSE, SSE2 Pentium 4
x86-64-v2 CMPXCHG16B, LAHF-SAHF, POPCNT, SSE3, SSE4.1, SSE4.2, SSSE3 Nehalem
x86-64-v3 AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE, XSAVE Haswell
x86-64-v4 AVX512F, AVX512BW, AVX512CD, AVX512DQ, AVX512VL Xeon Skylake
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?