I made a particle emitter that will use SIMD
But it crashes on the first load in SIMD - Illegal Instruction
// Particle struct
struct Particle
{
__declspec(align(32)) float x[MAX_PARTICLES];
__declspec(align(32)) float y[MAX_PARTICLES];
__declspec(align(32)) float z[MAX_PARTICLES];
__declspec(align(32)) float dirX[MAX_PARTICLES];
__declspec(align(32)) float dirY[MAX_PARTICLES];
__declspec(align(32)) float dirZ[MAX_PARTICLES];
__declspec(align(32)) float m_Rate[MAX_PARTICLES];
__declspec(align(32)) int m_RandQuality[MAX_PARTICLES];
__declspec(align(32)) float m_RemainingLifetime[MAX_PARTICLES];
};
// The list of particles
Particle m_Particle;
for( int i=0;i<MAX_PARTICLES; i += 4 )
{
// use SIMD
Particle* pPart = &m_Particle;
__m128 x = _mm256_load_ps(pPart->dirX + i); // Breaks on this line and says "Illegal Instruction" and I have no clue why
__m128 y = _mm256_load_ps(pPart->dirY + i);
// ..
// ..
// ..
}
Any suggesetions?