Added ARM instruction set detection

This commit is contained in:
Christophe Riccio 2014-12-20 17:16:52 +01:00
parent fc8b4404f0
commit 2336264f4e
3 changed files with 15 additions and 7 deletions

View File

@ -632,12 +632,13 @@
// User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_SSE3 GLM_FORCE_AVX GLM_FORCE_AVX2
#define GLM_ARCH_PURE 0x0000
#define GLM_ARCH_X86 0x0001
#define GLM_ARCH_SSE2 0x0002
#define GLM_ARCH_SSE3 0x0004
#define GLM_ARCH_SSE4 0x0008
#define GLM_ARCH_AVX 0x0010
#define GLM_ARCH_AVX2 0x0020
#define GLM_ARCH_ARM 0x0001
#define GLM_ARCH_X86 0x0002
#define GLM_ARCH_SSE2 0x0004
#define GLM_ARCH_SSE3 0x0008
#define GLM_ARCH_SSE4 0x0010
#define GLM_ARCH_AVX 0x0020
#define GLM_ARCH_AVX2 0x0040
#if defined(GLM_FORCE_PURE)
# define GLM_ARCH GLM_ARCH_PURE
@ -664,7 +665,9 @@
# define GLM_ARCH GLM_ARCH_PURE
# endif
#elif (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))
# if defined(__AVX2__)
# if defined(_M_ARM_FP)
# define GLM_ARCH (GLM_ARCH_ARM)
# elif defined(__AVX2__)
# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif defined(__AVX__)
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
@ -725,6 +728,8 @@
# define GLM_MESSAGE_ARCH_DISPLAYED
# if(GLM_ARCH == GLM_ARCH_PURE)
# pragma message("GLM: Platform independent code")
# elif(GLM_ARCH & GLM_ARCH_ARM)
# pragma message("GLM: ARM instruction set")
# elif(GLM_ARCH & GLM_ARCH_AVX2)
# pragma message("GLM: AVX2 instruction set")
# elif(GLM_ARCH & GLM_ARCH_AVX)

View File

@ -67,6 +67,7 @@ GLM 0.9.6.2: 2015-01-XX
--------------------------------------------------------------------------------
Features:
- Added display of GLM version with other GLM_MESSAGES
- Added ARM instruction set detection
Fixes:
- Fixed faceforward build #289

View File

@ -176,6 +176,8 @@ int test_instruction_set()
if(GLM_ARCH == GLM_ARCH_PURE)
std::printf("GLM_ARCH_PURE ");
if(GLM_ARCH & GLM_ARCH_ARM)
std::printf("GLM_ARCH_ARM ");
if(GLM_ARCH & GLM_ARCH_AVX2)
std::printf("GLM_ARCH_AVX2 ");
if(GLM_ARCH & GLM_ARCH_AVX)