我试图使用valgrind来分析用英特尔AVX2指令编写的程序。程序在memcheck下顺利运行。但是当我使用callgrind(valgrind --tool=callgrind
)运行时,它会因无法识别的指令错误而终止。我查看了Valgrind 3.9.0的release note,并说Support for Intel AVX2 instructions. This is available only on 64 bit code.
。我使用g++-4.8 -std=c++11 -mavx2 -m64
编译我的程序,但错误仍然存在。部分输出如下:
vex amd64->IR: unhandled instruction bytes: 0x16 0xC5 0xDD 0x64 0xD2 0xC5 0xF5 0xDB
vex amd64->IR: REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0
vex amd64->IR: VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=NONE
vex amd64->IR: PFX.66=0 PFX.F2=0 PFX.F3=0
==6775== valgrind: Unrecognised instruction at address 0x43d1c9.
==6775== at 0x43D1C9: byteslice::ByteSliceColumnBlock<16ul, (byteslice::Direction)1>::Scan(bytes
lice::Comparator, unsigned long, byteslice::BitVectorBlock*, byteslice::Bitwise) const (avxintrin.h
:965)
==6775== by 0x45DEAD: byteslice::Column::Scan(byteslice::Comparator, unsigned long, byteslice::B
itVector*, byteslice::Bitwise) const (column.cpp:113)
==6775== by 0x4017C9: main (simple.cpp:89)
修改:我发现错误取决于优化级别。 -O0没有错误。但错误显示为-O1及以上。