x86 SIMD 内在函数的头文件 [英] Header files for x86 SIMD intrinsics

查看:22
本文介绍了x86 SIMD 内在函数的头文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪些头文件为不同的 x86 SIMD 指令集扩展(MMX、SSE、AVX 等)提供了内在函数?在网上找不到这样的列表似乎是不可能的.如果我错了,请纠正我.

Which header files provide the intrinsics for the different x86 SIMD instruction set extensions (MMX, SSE, AVX, ...)? It seems impossible to find such a list online. Correct me if I'm wrong.

推荐答案

现在你通常应该只包含 .它包括一切.

These days you should normally just include <immintrin.h>. It includes everything.

GCC 和 clang 将阻止您将内部函数用于编译时未启用的指令(例如使用 -march=native-mavx2 -mbmi2 -mpopcnt -mfma -mcx16-mtune=znver1 或其他.)

GCC and clang will stop you from using intrinsics for instructions you haven't enabled at compile time (e.g. with -march=native or -mavx2 -mbmi2 -mpopcnt -mfma -mcx16 -mtune=znver1 or whatever.)

MSVC 和 ICC 允许您在编译时不启用任何内容的情况下使用内在函数,但您仍然应该在使用 AVX 内在函数之前启用 AVX.

MSVC and ICC will let you use intrinsics without enabling anything at compile time, but you still should enable AVX before using AVX intrinsics.

历史上(在 immintrin.h 引入所有内容之前)您必须手动包含您想要的最高级别内在函数的标题.

Historically (before immintrin.h pulled in everything) you had to manually include a header for the highest level of intrinsics you wanted.

这对于 MSVC 和 ICC 仍然有用,可以阻止您使用不需要的指令集.

This may still be useful with MSVC and ICC to stop yourself from using instruction-sets you don't want to require.

<mmintrin.h>  MMX
<xmmintrin.h> SSE
<emmintrin.h> SSE2
<pmmintrin.h> SSE3
<tmmintrin.h> SSSE3
<smmintrin.h> SSE4.1
<nmmintrin.h> SSE4.2
<ammintrin.h> SSE4A
<wmmintrin.h> AES
<immintrin.h> AVX, AVX2, FMA

在之前的所有拉取中包含其中一个(除了仅限 AMD 的 SSE4A:immintrin.h 不拉入)

Including one of these pulls in all previous ones (except AMD-only SSE4A: immintrin.h doesn't pull that in)

一些编译器也有用于 AVX512 的 .

Some compilers also have <zmmintrin.h> for AVX512.

这篇关于x86 SIMD 内在函数的头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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