如何解决“非法指示"?对于vfmadd213ps? [英] How to solve "illegal instruction" for vfmadd213ps?
问题描述
我尝试了AVX内部函数.但这会导致"test.exe中0x00E01555的未处理异常:0xC000001D:非法指令."
I have tried AVX intrinsics. But it caused "Unhandled exception at 0x00E01555 in test.exe: 0xC000001D: Illegal Instruction."
我使用了Visual Studio2015.异常错误是在"vfmadd213ps ymm2,ymm1,ymm0"指令引起的. 我尝试设置"/arch:AVX"和"/arch:AVX2",但仍然导致错误. 下面是我的代码.
I used Visual studio 2015. And the exception error is caused at "vfmadd213ps ymm2,ymm1,ymm0" instruction. I have tried set "/arch:AVX" and "/arch:AVX2", but still error caused. Below is my code.
#include <immintrin.h>
int main(int argc, char *argv[])
{
float a[8] = { 0 };
float b[8] = { 0 };
float c[8] = { 0 };
__m256 _a = _mm256_loadu_ps(a);
__m256 _b = _mm256_loadu_ps(b);
__m256 _c = _mm256_loadu_ps(c);
__m256 result = _mm256_fmadd_ps(_a, _b, _c);
_mm256_storeu_ps(c, result);
return 0;
}
"__m256 result = _mm256_fmadd_ps(_a, _b, _c);" is disassembly
vmovups ymm0,ymmword ptr [_c]
vmovups ymm1,ymmword ptr [_b]
vmovups ymm2,ymmword ptr [_a]
vfmadd213ps ymm2,ymm1,ymm0
vmovups ymmword ptr [ebp-160h],ymm2
vmovups ymm0,ymmword ptr [ebp-160h]
vmovups ymmword ptr [result],ymm0
以及在"vfmadd213ps ymm2,ymm1,ymm0"处引起的错误.
and the error caused at "vfmadd213ps ymm2,ymm1,ymm0".
那我错了什么?操作系统为win 7 64位,CPU为Intel(R)i7-3520M CPU @ 2.90Ghz(4个CPU),〜2.9Ghz.
So what did I wrong? OS is win 7 64bit, CPU is Intel(R) Core(TM) i7-3520M CPU @ 2.90Ghz (4 CPUs), ~2.9Ghz.
推荐答案
因为您的处理器不支持该指令.
Because your processor doesn't support that instruction.
FVMADD213PS是FMA3指令集扩展的一部分.英特尔在Haswell(第四代内核")英特尔微体系结构中增加了对该指令集扩展的支持.笔记本电脑中的处理器是Ivy Bridge(第三代核心")部件,因此它太旧了,无法支持此功能.
FVMADD213PS is part of the FMA3 instruction set extension. Intel added support for this instruction set extension in the Haswell ("fourth-generation core") Intel microarchitecture; the processor in your laptop is an Ivy Bridge ("third-generation core") part, so it is too old to support this feature.
这篇关于如何解决“非法指示"?对于vfmadd213ps?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!