在没有启用各种指令集的情况下,如何编译? [英] How can I compile *without* various instruction sets enabled?

查看:129
本文介绍了在没有启用各种指令集的情况下,如何编译?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用各种指令集重新编译某些软件,特别是 SSE SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 AVX ,我想看看代码在没有这些指令集的情况下如何执行

I am attempting to recompile some software with various instruction sets, specifically, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, and AVX, and I would like to see how the code performs without these instruction sets to make sure I am getting the full effect of them.

例如,我想仅用 -O2 进行编译使用 gnu 编译器,并查看将其限制为仅 SSE 时的性能查看默认情况下调用的标志。我也有一个正在使用的 intel 编译器,我想隔离每个标志(或标志的组合)对我的代码的作用,所以我如何指定确切地正在调用哪些标志?

For example, I want to compile it with just -O2 with a gnu compiler and see how it performs when restricting it to only SSE, to see which flags it is invoking by default. I also have an intel compiler that I am working with and I would like to isolate what each flag (or combination of flags) is doing to my code, so how can I specify exactly which flags are being invoked?

如果有关系,我正在使用 C C ++ Fortran Linux 上。

If it matters, I am working with C, C++, and Fortran on Linux.

推荐答案

对于 GCC 编译器:

使用 -mno-选项进行操作。

For GCC compiler:
You have to use -mno-options for doing it.


这些开关启用或禁用使用MMX,SSE,SSE2,SSE3,SSSE3, SSE4.1,AVX,AVX2,AVX512F,AVX512PF,AVX512ER,AVX512CD,SHA,AES,PCLMUL,FSGSBASE,RDRND,F16C,FMA,SSE4A,FMA4,XOP,LWP,ABM,BMI,BMI2,FXSR,XSAVE,XSAVEOPT, LZCNT,RTM或3DNow!扩展指令集。这些扩展也可以作为内置功能使用:有关这些开关启用和禁用的功能的详细信息,请参见X86内置功能。

These switches enable or disable the use of instructions in the MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD, SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM, BMI, BMI2, FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, or 3DNow! extended instruction sets. These extensions are also available as built-in functions: see X86 Built-in Functions, for details of the functions enabled and disabled by these switches.

更多信息,请参见官方GCC网站

对于 ICC 编译器,则必须使用以下的
组合:

For ICC compiler, you have to use combination of :


-march = cpu针对特定的cpu

-mtune = cpu进行优化仅针对特定的cpu

-msse3,-msse4,-mavx等生成代码。SIMD和向量$ b的级别$ b指令

-march="cpu" optimize for a specific cpu
-mtune="cpu" produce code only for a specific cpu
-msse3,-msse4,-mavx, etc. level of SIMD and vector instructions

此处有更多信息

这篇关于在没有启用各种指令集的情况下,如何编译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆