问题描述
我在使用 valgrind 评估我的程序时收到一些错误.更准确地说,我得到了像
I receive some error when evaluating my program using valgrind. More precisely, I get errors like
vex amd64->IR:未处理的指令字节:0xC5 0xF8 0x28 0x0 0xC5 0xF8 0x29 0x45......非法指令
vex amd64->IR: unhandled instruction bytes: 0xC5 0xF8 0x28 0x0 0xC5 0xF8 0x29 0x45......Illegal instruction
我将问题隔离为一个非常简单的示例
I isolated the problem to a very simple example
#include <immintrin.h>
int main() {
float f __attribute__((aligned(16))); // No need to be aligned
f = 2.0f;
__m128 a = _mm_broadcast_ss(&f);
return 0;
}
程序是使用 gcc 和选项 -mavx 编译的.如果使用 SSE2 指令 _mm_set1_ps,则会发生相同的错误,但仅在使用 -mavx 编译时才会发生.使用-msse2编译程序时,valgrind没有报错.
The program is compiled using gcc with the options -mavx. If the SSE2 instruction _mm_set1_ps is used instead, the same error occurs but only when compiled with -mavx. When compiling the program using -msse2, valgrind reports no errors.
我怀疑这是一个 valgrind 错误,但找不到关于 x86 的任何报告.我的机器是 Core-i7 Sandy-Bridge 和 valgrind 3.7.0 版.
I suspect this is a valgrind bug, but can't find any reports on this for x86. My machine is a Core-i7 Sandy-Bridge and valgrind version 3.7.0.
如果有人有更好的 valgrind 替代方案来进行寄存器感知编程,我想知道.
If anyone have a better alternative to valgrind for register-aware programming, I would like to know.
提前致谢
推荐答案
mm_broadcast_ss
转换为单个 CPU 指令,它需要 AVX 指令集.您可能需要更新的 valgrind 来支持该指令,位于 最低版本 3.8.0(2012 年 8 月 10 日).
mm_broadcast_ss
translates to a single CPU instruction and it requires the AVX instruction set. You may need a more up-to-date valgrind to support that instruction, at least release 3.8.0 (10 August 2012).
有关说明,请参阅 Valgrind 核心文档.
这篇关于Valgrind 非法指令 AVX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!