等价于其他编译器中的gcc / clang的march = native? [英] Equivalents to gcc/clang's march=native in other compilers?

查看:163
本文介绍了等价于其他编译器中的gcc / clang的march = native?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否还有gcc和clang以外的其他编译器提供类似 -march = native 的选项,如果有的话,该选项是什么? 。我已经从另一个问题(自动为Microsoft的编译器没有该选项的Visual c ++最佳可用平台(等效于gcc的-march = native)(除非隐含在激活SSE2指令集的选项中,直到并排除了AVX以及更高版本)

I'd like to know if there are other compilers than gcc and clang that provide something like an -march=native option, and if so, what that option is. I already understand from another question (Automatically building for best available platform in visual c++ (equivalent to gcc's -march=native)) that Microsoft's compilers do not have that option (unless it's implied in the option that activates the SSE2 instruction set, up to and excluding AVX and higher at least).

用例很简单:提供cmake设置,因此用户可以选择激活并构建其对所有本能的支持或她的CPU支持。我们目前有针对目标的实际内在函数的检测逻辑(例如x86上的SSE4.2和/或PCLMUL),但是当必须考虑更多平台和编译器时,该逻辑可能会变得非常复杂。简化它们可能会导致编译器在受运行时检查保护的预期位置之外开始使用不受支持的指令集的情况。

The use case is simple: provide a cmake set-up and thus the user with an option to activate and build with support for all the "intrinsics" his or her CPU supports. We currently have detection logic for the actual intrinsics we target (e.g. SSE4.2 and/or PCLMUL on x86) but that logic will probably get very complex when more platforms and compilers have to be taken into consideration. Simplifying them could lead to situations where the compiler starts to use unsupported instruction sets outside of the intended places protected by runtime checks.

推荐答案

当前,Microsoft Visual C ++编译器不提供与 march = native 等效的标志。在构建代码之前,您必须手动或使用脚本找出适当的标志。

Currently, the Microsoft Visual C++ compiler doesn't provide equivalent flags to march=native. You'll have to figure out the appropriate flags manually or using a script before building the code.

关于Intel C ++编译器, xHost和QxHost 标志的用途基本相同。

Regarding the Intel C++ compiler, the xHost and QxHost flags have basically the same purpose.

这篇关于等价于其他编译器中的gcc / clang的march = native?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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