mar*_*zzz 5 c++ intel intrinsics sse2
我真的无法得到__m128dC++中的"关键字" .
我正在使用MSVC,它说:The __m128d data type, for use with the Streaming SIMD Extensions 2 instructions intrinsics, is defined in <emmintrin.h>.
那么,它是数据类型吗?typedef?如果我做:
#include <emmintrin.h>
int main() {
__m128d x;
}
Run Code Online (Sandbox Code Playgroud)
我无法看清楚<emmintrin.h>.它似乎是一个keyword编译器?它会自动将该关键字转换为"移动寄存器xmm0"等等吗?或者哪种操作呢?
它似乎根本不是数据类型.
有人可以照耀我吗?
它是typedef吗?
是!
__m128d是一种数据类型,编译器在优化时希望存储在XMM 128位寄存器中(如果没有将其优化为@PeterCordes注释).它本身并不与编译器在优化时希望存储在整数寄存器中的int或不同long.
实际定义是特定于编译器的 ; 打算在MSVC和实现Intel内在函数的其他主要编译器之间移植的代码应避免依赖于定义的细节.
MSVC将矢量类型定义为不同元素大小的数组的并集.
在实现GNU C扩展(gcc和clang)的编译器中,它的typedef是一个16字节的GNU C本机向量double:
// From gcc 7.3's emmintrin.h (SSE2 extensions). SSE1 stuff in xmmintrin.h
/* The Intel API is flexible enough that we must allow aliasing with other
vector types, and their scalar components. */
typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__));
typedef double __m128d __attribute__ ((__vector_size__ (16), __may_alias__));
Run Code Online (Sandbox Code Playgroud)
在<emmintrin.h>@Default评论中.
该may_alias属性告诉编译器__m128d*可以使用相同的方式对其他类型进行别名char*,以便基于C++严格别名规则进行优化.
用法示例:(初始化可在MSVC和其他编译器之间移植)
__m128d a2 = { -1.388539L, 0.0L };
Run Code Online (Sandbox Code Playgroud)
对于__m128,请查看英特尔论坛和<xmmintrin.h>.
| 归档时间: |
|
| 查看次数: |
1032 次 |
| 最近记录: |