here a piece of simplified code that causes me a problem/error (Vec4d is coming from the Agner Fog library VCL)
#define AVX256_ALIGNED_MALLOC(type,size) (type *)_aligned_malloc(size * sizeof(type),32)
#define AVX256_FREE(ptr) _aligned_free(ptr)
int N = 1024;
std::vector<double> A(N);
double* Aaligned = AVX256_ALIGNED_MALLOC(double, N);
memcpy(Aaligned, &A[0], N * sizeof(double));
int N4=N>>2;
for(size_t i = 4; i <N4-4; ++i)
{
//....
... = ((Vec4d*)(Aaligned - 1))[i] + ((Vec4d*)(Aaligned))[i] + ((Vec4d*)(Aaligned + 1))[i];
}
AVX256_FREE(Aaligned);
If it is clear to me that I'am allowed to use
((Vec4d*)(Aaligned))[i]
Can you confirm that I cannot use
((Vec4d*)(Aaligned-1))[i]
or ((Vec4d*)(Aaligned+1))[i] Any hints ? Many thanks. Luc