hus*_*sik 0 c++ gcc compiler-errors intrinsics
我正在学习使用内在函数而不是asm-inlining.昨天,他们正在工作,但我今天总是得到错误.一无所获.
#include <iostream>
#include <intrin.h> // immintrin.h, smmintrin.h ... tried all, never worked
using namespace std;
int main()
{
_m256_zeroupper(); // __mm256_zeroupper(); does not work too
_mm128 x; // __mm128 x; does not work too
_mm256 y; // __mm256 y; does not work too
_m256_zeroupper(); // __mm256_zeroupper(); does not work too
cout << "Hello world!" << endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
这是错误.我尝试了不同内在函数的所有头文件,但错误是相同的.还重新安装了gcc但没有奏效.
我哪里错了?我需要添加什么来实际声明这些内部变量和函数?
C:\indirmeDenemesi\hello_intrin\main.cpp||In function 'int main()':|
C:\indirmeDenemesi\hello_intrin\main.cpp|8|error: '_mm256_zeroupper' was not declared in this scope|
C:\indirmeDenemesi\hello_intrin\main.cpp|9|error: '_mm128' was not declared in this scope|
C:\indirmeDenemesi\hello_intrin\main.cpp|9|error: expected ';' before 'x'|
C:\indirmeDenemesi\hello_intrin\main.cpp|10|error: '_mm256' was not declared in this scope|
C:\indirmeDenemesi\hello_intrin\main.cpp|10|error: expected ';' before 'y'|
||=== Build finished: 5 errors, 0 warnings (0 minutes, 0 seconds) ===|
Run Code Online (Sandbox Code Playgroud)
在64位cpu和64位窗口上使用64位最新版本的gcc.CPU是FX8150.尝试-march = bdver1 -mtune = bdver1,它产生了数百个垃圾错误.
这些都意味着我的CPU正在死亡吗?
编辑:其他一些项目现在正在运作,但我没有改变任何东西.这必须是项目特定的事情.使用code :: blocks,当我右键单击标题并选择"打开"时,它会给出错误"找不到"但在编译时没有给出任何错误,只是对于intrinsinc命令的错误.对于工作项目也是如此(它们编译所有内容并且工作正常,但是在右键单击并单击打开时找不到头文件).也许其他一些Windows服务干扰?我不知道,但编译器错误正在逐渐消失并再次出现.重新安装代码块也没有解决.只有一些项目可以使用内在函数,而其他项目则不能(即使所有项目都有相同的头文件.)
以下代码也不起作用.
#include <iostream>
#include <immintrin.h>
using namespace std;
int main()
{
_m256_zeroupper();
__mm128 x;
__mm256 y;
_m256_zeroupper();
cout << "Hello world!" << endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
小智 6
三件事应该让你的代码工作:
确保使用-mavx编译标志.
您的变量应声明为__m256不_mm256.
确保你包括在内 immintrin.h
| 归档时间: |
|
| 查看次数: |
4824 次 |
| 最近记录: |