相关编译选项
-march=cpu-type
用于指定CPU架构,自动使能对应的指令集
例如-march=broadwell
通常我们使用-march=native让编译器自动识别当前编译环境的CPU架构
-mxxx & -mno-xxx
使能开启/关闭特定指令集
例子
根据编译环境自动选定指令集
~: gcc -march=native -Q --help=target
The following options are target specific:
-mavx [enabled]
-mavx2 [enabled]
-mavx256-split-unaligned-load [disabled]
1
2
3
4
5
指定关闭avx2
~: gcc -march=native -mno-avx2 -Q --help=target
The following options are target specific:
-mavx [enabled]
-mavx2 [disabled]
-mavx256-split-unaligned-load [disabled]
1
2
3
4
5
指定开启avx256
~: gcc -march=native -mavx256-split-unaligned-load -Q --help=target
The following options are target specific:
-mavx [enabled]
-mavx2 [enabled]
-mavx256-split-unaligned-load [enabled]
12-14
2120
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-31
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交