除了 gcc 之外,还有哪些编译器可以对代码进行向量化?
当指定并给出某些选项时,GCC 可以自动矢量化循环合适的条件。 是否还有其他广泛可用的编译器可以执行相同的操作?
GCC can vectorize loops automatically when certain options are specified and given the right conditions. Are there other compilers widely available that can do the same?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
ICC
ICC
llvm 也可以做到这一点,向量 pascal 也是一个不是免费的 VectorC。 这些只是我记得的一些。
llvm can also do it and vector pascal too and one that is not free VectorC. These are just some I remember.
还有PGI 编译器。
Also PGI's compilers.
Mono 项目是 Microsoft Silverlight 项目的开源替代方案,它添加了使用 SIMD 指令的对象。 虽然 Mono CLR 不是编译器,但它是第一个生成向量运算的托管代码系统本地。
The Mono project, the Open Source alternative to Microsoft's Silverlight project, has added objects that use SIMD instructions. While not a compiler, the Mono CLR is the first managed code system to generate vector operations natively.
IBM 的 xlc 在某种程度上也可以自动矢量化 C 和 C++。
IBM's xlc can auto-vectorize C and C++ to some extent as well.
实际上,在很多情况下GCC在自动代码矢量化方面比ICC要差很多,我不知道它最近是否改进得足够多,但我对此表示怀疑。
Actually, in many cases GCC used to be quite worse than ICC for automatic code vectorization, I don't know if it recently improved enough, but I doubt it.
VectorC 也可以做到这一点。 您还可以指定所有目标CPU,以便它利用不同的指令集(例如MMX、SIMD、SIMD2...)
VectorC can do this too. You can also specify all target CPU so that it takes advantage of different instruction sets (e.g. MMX, SIMD, SIMD2,...)
Visual C++(我使用的是VS2005)可以强制使用SSE指令。 它看起来不如Intel的编译器,但如果有人已经使用VC++,没有理由不打开这个选项。
转到项目属性、配置属性、C/C++、代码生成:启用增强指令集。 设置“Streaming SIMD Instructios”或“Streaming SIMD Instructios 2”。 您必须将浮点模型设置为快速。 其他一些选项也必须更改,但编译器会告诉您这一点。
Visual C++ (I'm using VS2005) can be forced to use SSE instructions. It seems not to be as good as Intel's compiler, but if someone already uses VC++, there's no reason not to turn this option on.
Go to project's properties, Configuration properties, C/C++, Code Generation: Enable Enhanced Instruction Set. Set "Streaming SIMD Instructios" or "Streaming SIMD Instructios 2". You will have to set floating point model to fast. Some other options will have to be changed too, but compiler will tell you about that.
尽管这是一个旧线程,但我想添加到此列表中 - Visual Studio 11 还将具有自动矢量化功能。
Even though this is an old thread, I though I'd add to this list - Visual Studio 11 will also have auto vectorisation.