C++ SSE 内部函数参考

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7156908/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 16:32:20  来源:igfitidea点击:

SSE intrinsic functions reference

c++cgccssesimd

提问by NGaffney

Does anyone know of a reference listing the operation of the SSE intrinsic functions for gcc, i.e. the functions in the <*mmintrin.h> header files?

有谁知道列出 gcc 的 SSE 内部函数的操作的参考,即 <*mmintrin.h> 头文件中的函数?

Thanks.

谢谢。

采纳答案by Paul R

As well as all the online PDF documentation already mentioned, there is also a very useful utility which summarizes all the instructions and intrinsics and groups them by technology. It runs on Linux, Windows and Mac OS X. It's hidden away on Intel's AVX technology page but it's equally useful for SSE programming. Go to http://software.intel.com/en-us/articles/intel-intrinsics-guideand then select the Intel Intrinsics Guidefor your platform of choice.

除了已经提到的所有在线 PDF 文档外,还有一个非常有用的实用程序,它汇总了所有指令和内在函数,并按技术对它们进行了分组。它在 Linux、Windows 和 Mac OS X 上运行。它隐藏在 Intel 的 AVX 技术页面上,但它对 SSE 编程同样有用。访问http://software.intel.com/en-us/articles/intel-intrinsics-guide,然后为您选择的平台选择Intel Intrinsics Guide

UPDATE

更新

There is now an online version of the intrinsics guide, so you no longer need to install anything, and it's always up-to-date.

现在有一个在线版本的内在指南,因此您不再需要安装任何东西,而且它始终是最新的。

回答by Jose Luis Blanco

I found these headers were needed for invoking the different versions of SSE from GCC:

我发现从 GCC 调用不同版本的 SSE 需要这些标头:

  • For SSE2:
  • 对于 SSE2:
extern "C"
{
#include <emmintrin.h>
#include <mmintrin.h>
}
  • For SSE3:
  • 对于 SSE3:
extern "C" 
{
#include <pmmintrin.h>
#include <immintrin.h>   // (Meta-header)
}
  • For SSE4:
  • 对于 SSE4:
extern "C" 
{
#include <smmintrin.h>
}

In modern versions of the compilers, all the headers seem to be common to Visual Studio and GCC.

在现代版本的编译器中,所有头文件似乎对 Visual Studio 和 GCC 都是通用的。

回答by alecco

SSEPlus tableon intrinsics is very easy to use for most cases.

在大多数情况下,内在函数上的SSEPlus 表非常易于使用。

回答by caf

The GCC intrinsics are implementations of the Intel compiler intrinsics. They are documented in Intel? 64 and IA-32 Architectures Developer's Manual: Vol. 2C- Appendix C.

GCC 内在函数是英特尔编译器内在函数的实现。他们记录在英特尔?64 和 IA-32 架构开发人员手册:卷。2C- 附录 C。

回答by wilx

These originally come from Intel. Intel C++ compiler describes those in its manual. AMD probably has its own manual containing those for 3Dnow! You will have to compare the availability of those with the *mmintrin.hshipped with your version of GCC.

这些最初来自英特尔。英特尔 C++ 编译器在其手册中描述了这些内容。AMD 可能有自己的手册,其中包含 3Dnow!您必须将这些可用性与*mmintrin.h随您的 GCC 版本一起提供的可用性进行比较。