什么是__m128d? [英] What is __m128d?

查看:422
本文介绍了什么是__m128d?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的无法获得C ++中类似__m128d的关键字".

I really can't get what "keyword" like __m128d is in C++.

我正在使用MSVC,并且说:The __m128d data type, for use with the Streaming SIMD Extensions 2 instructions intrinsics, is defined in <emmintrin.h>.

I'm using MSVC, and it says: The __m128d data type, for use with the Streaming SIMD Extensions 2 instructions intrinsics, is defined in <emmintrin.h>.

那么,它是数据类型吗? typedef?如果我这样做:

So, is it a Data Type? typedef? If I do:

#include <emmintrin.h>

int main() {
    __m128d x;
}

我看不到<emmintrin.h>的定义.似乎是编译器的keyword?它会自动将该关键字转换为移动寄存器xmm0"等吗?还是进行哪种操作?

I can't see the defination on <emmintrin.h>. It seems a keyword of compiler? Does it automatically convert that keyword to somethings like "move register xmm0" etc? Or which kind of operation does?

似乎根本不是数据类型.

It doesn't seems a data type at all.

有人可以照耀我吗?

推荐答案

它是typedef吗?

Is it a typedef?

是的!

__m128d是一种数据类型,编译器在优化时有望将其存储在XMM 128位寄存器中(如果未按照@PeterCordes的说明对其进行优化).它与intlong并无本质区别,intlong编译器在优化时希望将它们存储在整数寄存器中.

__m128d is a data type that the compiler will hopefully store in a XMM 128 bit register when optimizing (if not optimizing it away as @PeterCordes commented). It's not inherently different from an int or long, which the compiler will hopefully store in integer registers when optimizing.

实际定义是特定于编译器的;打算在MSVC和其他实现Intel内部函数的主要编译器之间移植的代码应避免依赖于定义的细节.

The actual definition is compiler-specific; code that intends to be portable between MSVC and the other major compilers that implement Intel's intrinsics should avoid depending on the details of the definition.

MSVC将向量类型定义为不同元素大小的数组的并集.

MSVC defines vector types as a union of arrays of different element sizes.

在实现GNU C扩展(gcc和clang)的编译器中,将其定义为double s的16字节GNU C本机向量:

In compilers that implement GNU C extensions (gcc and clang), it is typedef'ed as a 16-byte GNU C native vector of doubles:

// 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__));

<emmintrin.h> 中,如@Default注释.

in <emmintrin.h>, as @Default commented.

may_alias属性告诉编译器,__m128d*可以使用与char*相同的方式来别名其他类型,以基于C ++严格别名规则进行优化.

The may_alias attribute tells the compiler that __m128d* can alias other types the same way that char* can, for the purposes of optimization based on C++ strict-aliasing rules.

用法示例:(初始化可在MSVC和其他编译器之间移植)

Example of usage: (initialization is portable between MSVC and other compilers)

__m128d a2 = { -1.388539L, 0.0L };



对于__m128,请检查英特尔论坛 <xmmintrin.h> .



For __m128, check the Intel forum and <xmmintrin.h>.

这篇关于什么是__m128d?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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