Reputation: 4725
I receive some error when evaluating my program using valgrind. More precisely, I get errors like
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;
}
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.
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.
If anyone have a better alternative to valgrind for register-aware programming, I would like to know.
Thanks in advance
Upvotes: 3
Views: 3262
Reputation: 57784
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).
See the Valgrind core documentation for an explanation.
Upvotes: 1
Reputation: 8494
You are using very old valgrind 3.7.0 which was released in Nov 2011. It does not support AVX / AVX2.
Support for AVX was added in 3.8.0 and for AVX2 in 3.9.0. The latest available version is 3.10.1 released in Nov 2014.
Upvotes: 5