From 568eb9bc34a739e53c135c89f486094607f594a7 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 16 Dec 2010 15:47:54 +0000 Subject: [PATCH] draft for instruction set management --- glm/setup.hpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/glm/setup.hpp b/glm/setup.hpp index bf9eb3b2..519a22e3 100644 --- a/glm/setup.hpp +++ b/glm/setup.hpp @@ -219,6 +219,37 @@ # endif//GLM_MODEL #endif//GLM_MESSAGE +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Compiler instruction set + +#define GLM_INSTRUCTION_SET_PURE 0x00000000 // x86intrin.h +#define GLM_INSTRUCTION_SET_MMX 0x00000001 // mmintrin.h (MMX) +#define GLM_INSTRUCTION_SET_3DNOW 0x00000001 // mm3dnow.h (3DNOW!) +#define GLM_INSTRUCTION_SET_SSE 0x00000001 // xmmintrin.h (SSE + MMX) +#define GLM_INSTRUCTION_SET_SSE2 0x00000002 // emmintrin.h (SSE2 + SSE) +#define GLM_INSTRUCTION_SET_SSE3 0x00000004 // pmmintrin.h (SSE3 + SSE2 + SSE1) +#define GLM_INSTRUCTION_SET_SSSE3 0x00000008 // tmmintrin.h (SSSE3 + SSE3 + SSE2 + SSE1) +#define GLM_INSTRUCTION_SET_POPCNT 0x00000800 // popcntintrin.h +#define GLM_INSTRUCTION_SET_SSE4A 0x00000020 // ammintrin.h (SSE4A + POPCNT + SSE3 + SSE2 + SSE) +#define GLM_INSTRUCTION_SET_SSE4_1 0x00000040 // smmintrin.h (SSE4_1 + SSSE3 + SSE3 + SSE2 + SSE) +#define GLM_INSTRUCTION_SET_SSE4_2 0x00000080 // nmmintrin.h (SSE4_2 + SSE4_1 + SSSE3 + SSE3 + SSE2 + SSE) +#define GLM_INSTRUCTION_SET_SSE5 0x00000100 // bmmintrin.h (SSE4A + SSE3 + SSE2 + SSE deprecated) +#define GLM_INSTRUCTION_SET_AES 0x00000200 // wmmintrin.h (AES + PCLMUL + SSE2 + SSE1) +#define GLM_INSTRUCTION_SET_PCLMUL 0x00000400 // wmmintrin.h (AES + PCLMUL + SSE2 + SSE1) +#define GLM_INSTRUCTION_SET_AVX 0x00000800 // immintrin.h (AES + PCLMUL + SSE4_2 + SSE4_1 + SSSE3 + SSE3 + SSE2 + SSE) + +#if(defined(GLM_COMPILER) && (GLM_COMPILER & GLM_COMPILER_GCC)) +# define GLM_INSTRUCTION_SET +#elif(defined(GLM_COMPILER) && (GLM_COMPILER & GLM_COMPILER_VC)) +# ifdef(_M_CEE_PURE) +# define GLM_INSTRUCTION_SET GLM_INSTRUCTION_SET_PURE +# else +# define GLM_INSTRUCTION_SET +# endif +#else +# define GLM_INSTRUCTION_SET GLM_INSTRUCTION_SET_PURE +#endif + /////////////////////////////////////////////////////////////////////////////////////////////////// // Swizzle operators