未声明C++内部函数
C++ Intrinsic not declared
我正在学习使用内部函数而不是asm内联。昨天,他们在工作,但我今天总是出错。什么都没改变。
#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;
}
以下是错误。我尝试了不同内部函数的所有头文件,但错误是相同的。还重新安装了gcc,但没有工作。
我哪里错了?我需要添加什么才能真正声明这些内在变量和函数?
C:indirmeDenemesihello_intrinmain.cpp||In function 'int main()':|
C:indirmeDenemesihello_intrinmain.cpp|8|error: '_mm256_zeroupper' was not declared in this scope|
C:indirmeDenemesihello_intrinmain.cpp|9|error: '_mm128' was not declared in this scope|
C:indirmeDenemesihello_intrinmain.cpp|9|error: expected ';' before 'x'|
C:indirmeDenemesihello_intrinmain.cpp|10|error: '_mm256' was not declared in this scope|
C:indirmeDenemesihello_intrinmain.cpp|10|error: expected ';' before 'y'|
||=== Build finished: 5 errors, 0 warnings (0 minutes, 0 seconds) ===|
在64位cpu和64位窗口上使用64位最新版本的gcc。CPU为FX8150。尝试-march=bdver1-mtune=bdver1,它产生了数百个垃圾错误。
所有这些都意味着我的CPU快死了吗?
编辑:其他一些项目正在运行,但我没有更改任何内容。这一定是一个特定于项目的事情。使用代码::块,当我右键单击标题并选择"打开"时,它会给出错误"找不到",但在编译时不会给出任何与此相关的错误,只是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;
}
有三件事应该使您的代码工作:
-
请确保您使用的是-mavx编译标志。
-
您的变量应声明为
__m256
,而不是_mm256
。 -
确保包含
immintrin.h
相关文章:
- C++ SSE 内部函数:将结果存储在变量中
- C++代码停止工作错误使用cout内部函数
- 为什么从具有较大阵列的 SIMD 内部函数中获得的相对加速比标量更大?
- 使用英特尔内部函数 (AVX) 中的混合说明
- 英特尔汇编与内部函数,AVX
- 使用SSE内部函数复制少量数据时出现问题
- 在为函数编写单元测试时,我应该模拟所做的内部函数调用吗?
- 用于平铺矩阵乘法的 AVX 内部函数
- 是否可以使用类的析构函数内部函数来重置值?
- 我在理解 AVX 随机内部函数如何为 8 位时遇到一些问题
- 无法执行内部函数 strlen
- COUT 内部函数调用的顺序
- GCC(通过 CUDA)内部函数的编译器错误,但我没有使用任何
- C++ ld 链接器 --wrap 选项不适用于内部函数调用
- 通过Visual Studio将小型结构逐值传递到非内部函数的速度很慢
- 使用内部函数递增数组的特定元素
- 在使用英特尔内部函数对 SIMD 代码进行编程时,如何强制使用 vmovapd 而不是 vmovupd?
- 如何最大限度地减少使用标量 SIMD 内部函数的 SIMD 注册表的双重负载开销
- 有符号整数溢出、内部函数和未定义的行为
- SSE2 内部函数 - 找到两个无符号短向量的最大值