SSE g ++编译问题

mor*_*njt 1 c++ sse g++

我正在尝试使用SSE内在函数.我已经制作了一个测试程序,它只添加了两个带有四个16位元素的向量.

#include <xmmintrin.h>
#include <iostream>
using namespace std;

void test_vec_add(){
  const int length = 4;
  float product[128*4]  __attribute__ ((aligned(16)));
  _m128 x = _mm_set_ps(1.0f,2.0f,3.0f,4.0f);
  _m128 y = _mm_set_ps(1.0f,2.0f,3.0f,4.0f);
  _m128 z = _mm_add_ps(x,y);
  _mm_store_ps(product,z);
}
int main(){
  test_vec_add();
}
Run Code Online (Sandbox Code Playgroud)

我正在编译这段代码

g++ -msse3 test_sse.cpp
Run Code Online (Sandbox Code Playgroud)

但是,我收到以下复杂错误

test_sse.cpp: In function ‘void test_vec_add()’:
test_sse.cpp:7:3: error: ‘_m128’ was not declared in this scope
test_sse.cpp:7:9: error: expected ‘;’ before ‘x’
test_sse.cpp:8:9: error: expected ‘;’ before ‘y’
test_sse.cpp:9:9: error: expected ‘;’ before ‘z’
test_sse.cpp:10:24: error: ‘z’ was not declared in this scope
test_sse.cpp: In function ‘int main()’:
test_sse.cpp:15:20: error: ‘test_vec_add’ was not declared in this scope
Run Code Online (Sandbox Code Playgroud)

它可能是一个非常愚蠢的错误,但我不能把手指放在它的位置.任何帮助将不胜感激.

Pot*_*ter 6

这是一个简单的错字.

类型如__m128以两个下划线开头.诸如_mm_store_psdo之类的功能仅以一个下划线开头.