SSE 错误 - 使用 m128i_i32 定义 __m128i 变量的字段 [英] SSE Error - Using m128i_i32 to define fields of a __m128i variable
本文介绍了SSE 错误 - 使用 m128i_i32 定义 __m128i 变量的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以这种方式定义 __m128i
变量后:
Upon defining a __m128i
variable in this manner:
__m128i a;
a.m128i_i32[0] = 65000;
我收到以下错误:
错误:请求'a'中的成员'm128i_i32',这是非类输入‘__m128i {aka __vector(2) long long int}’ a.m128i_i32[0] =65000;
error: request for member ‘m128i_i32’ in ‘a’, which is of non-class type ‘__m128i {aka __vector(2) long long int}’ a.m128i_i32[0] = 65000;
我已经包含了以下头文件:
I have included the followinf header files:
#include <x86intrin.h>
#include <emmintrin.h>
#include <smmintrin.h>
推荐答案
您的代码将在 Visual 下工作,其中 __m128 定义为
Your code will work under Visual where __m128 is defined as
typedef union __declspec(intrin_type) __declspec(align(16)) __m128i {
__int8 m128i_i8[16];
__int16 m128i_i16[8];
__int32 m128i_i32[4];
__int64 m128i_i64[2];
unsigned __int8 m128i_u8[16];
unsigned __int16 m128i_u16[8];
unsigned __int32 m128i_u32[4];
unsigned __int64 m128i_u64[2];
} __m128i;
所以你可以访问m128_i32,但是在g++下__m128被定义为
so you can access m128_i32, but under g++ __m128 is defined as
typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__));
你的代码不会被编译.
您可以通过
int32_t* p = (int32_t*)&a;
p[0] = 65000;
这篇关于SSE 错误 - 使用 m128i_i32 定义 __m128i 变量的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文