From b5766d15145ed88e0f74229da4c9795a01bb4a20 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 23 Nov 2016 23:13:54 +0100 Subject: [PATCH 1/5] Tentative fix for #512 --- .travis.yml | 4 ++-- glm/simd/platform.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7201db70..cbbf87f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ script: - cd .. - mkdir ./build_simd_11 - cd ./build_simd_11 -- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_11=ON .. +- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_11=ON -DGLM_TEST_ENABLE_SIMD_AVX=ON .. - cmake --build . - ctest - cd .. @@ -46,7 +46,7 @@ script: - cd .. - mkdir ./build_simd_98 - cd ./build_simd_98 -- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_98=ON .. +- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_98=ON -DGLM_TEST_ENABLE_SIMD_AVX=ON .. - cmake --build . - ctest - cd .. diff --git a/glm/simd/platform.h b/glm/simd/platform.h index d74f23f0..f7793908 100644 --- a/glm/simd/platform.h +++ b/glm/simd/platform.h @@ -422,6 +422,9 @@ #elif GLM_ARCH & GLM_ARCH_AVX_BIT # include #elif GLM_ARCH & GLM_ARCH_SSE42_BIT +# if GLM_COMPILER & GLM_COMPILER_CLANG +# include +# endif # include #elif GLM_ARCH & GLM_ARCH_SSE41_BIT # include From 74378ce1b9fc9a1375fe9466f4194ebe03e26f86 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 23 Nov 2016 23:34:39 +0100 Subject: [PATCH 2/5] Display instruction set used on CMake prepare --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a5204ff..3414d8ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,6 +107,7 @@ if(GLM_TEST_FORCE_PURE) if(CMAKE_COMPILER_IS_GNUCXX) add_definitions(-mfpmath=387) endif() + message(STATUS "GLM: No SIMD instruction set") elseif(GLM_TEST_ENABLE_SIMD_AVX2) if(CMAKE_COMPILER_IS_GNUCXX) add_definitions(-mavx2) @@ -115,6 +116,7 @@ elseif(GLM_TEST_ENABLE_SIMD_AVX2) elseif(MSVC) add_definitions(/arch:AVX2) endif() + message(STATUS "GLM: AVX2 instruction set") elseif(GLM_TEST_ENABLE_SIMD_AVX) if(CMAKE_COMPILER_IS_GNUCXX) add_definitions(-mavx) @@ -123,14 +125,16 @@ elseif(GLM_TEST_ENABLE_SIMD_AVX) elseif(MSVC) add_definitions(/arch:AVX) endif() + message(STATUS "GLM: AVX instruction set") elseif(GLM_TEST_ENABLE_SIMD_SSE3) if(CMAKE_COMPILER_IS_GNUCXX) add_definitions(-msse3) elseif(GLM_USE_INTEL) add_definitions(/QxSSE3) elseif(MSVC AND NOT CMAKE_CL_64) - add_definitions(/arch:SSE2) # VC doesn't support /arch:SSE3 + add_definitions(/arch:SSE2) # VC doesn't support /arch:SSE3 endif() + message(STATUS "GLM: SSE3 instruction set") elseif(GLM_TEST_ENABLE_SIMD_SSE2) if(CMAKE_COMPILER_IS_GNUCXX) add_definitions(-msse2) @@ -139,6 +143,7 @@ elseif(GLM_TEST_ENABLE_SIMD_SSE2) elseif(MSVC AND NOT CMAKE_CL_64) add_definitions(/arch:SSE2) endif() + message(STATUS "GLM: SSE2 instruction set") endif() if(CMAKE_COMPILER_IS_GNUCXX) From 4ba6ef90469da86a6559b7dfeec9a73e48bfe557 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 23 Nov 2016 23:39:51 +0100 Subject: [PATCH 3/5] Fixed SIMD instruction set selection with Clang --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3414d8ac..8d8fd8dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,7 +109,7 @@ if(GLM_TEST_FORCE_PURE) endif() message(STATUS "GLM: No SIMD instruction set") elseif(GLM_TEST_ENABLE_SIMD_AVX2) - if(CMAKE_COMPILER_IS_GNUCXX) + if(CMAKE_COMPILER_IS_GNUCXX OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")) add_definitions(-mavx2) elseif(GLM_USE_INTEL) add_definitions(/QxAVX2) @@ -118,7 +118,7 @@ elseif(GLM_TEST_ENABLE_SIMD_AVX2) endif() message(STATUS "GLM: AVX2 instruction set") elseif(GLM_TEST_ENABLE_SIMD_AVX) - if(CMAKE_COMPILER_IS_GNUCXX) + if(CMAKE_COMPILER_IS_GNUCXX OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")) add_definitions(-mavx) elseif(GLM_USE_INTEL) add_definitions(/QxAVX) @@ -127,7 +127,7 @@ elseif(GLM_TEST_ENABLE_SIMD_AVX) endif() message(STATUS "GLM: AVX instruction set") elseif(GLM_TEST_ENABLE_SIMD_SSE3) - if(CMAKE_COMPILER_IS_GNUCXX) + if(CMAKE_COMPILER_IS_GNUCXX OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")) add_definitions(-msse3) elseif(GLM_USE_INTEL) add_definitions(/QxSSE3) @@ -136,7 +136,7 @@ elseif(GLM_TEST_ENABLE_SIMD_SSE3) endif() message(STATUS "GLM: SSE3 instruction set") elseif(GLM_TEST_ENABLE_SIMD_SSE2) - if(CMAKE_COMPILER_IS_GNUCXX) + if(CMAKE_COMPILER_IS_GNUCXX OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")) add_definitions(-msse2) elseif(GLM_USE_INTEL) add_definitions(/QxSSE2) From 1cbe3dfa604c07eeddfea60d9189e32ddb0b4603 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 24 Nov 2016 00:59:20 +0100 Subject: [PATCH 4/5] Added tests on OSX and release and debug mode --- .travis.yml | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index cbbf87f0..29be9e41 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,9 @@ language: cpp +os: + - linux + - osx + matrix: include: - compiler: gcc @@ -28,25 +32,49 @@ before_script: script: - mkdir ./build_pure_11 - cd ./build_pure_11 -- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_11=ON -DGLM_TEST_FORCE_PURE=ON .. +- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_11=ON -DGLM_TEST_FORCE_PURE=ON .. - cmake --build . - ctest - cd .. - mkdir ./build_simd_11 - cd ./build_simd_11 -- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_11=ON -DGLM_TEST_ENABLE_SIMD_AVX=ON .. +- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_11=ON -DGLM_TEST_ENABLE_SIMD_AVX=ON .. - cmake --build . - ctest - cd .. - mkdir ./build_pure_98 - cd ./build_pure_98 -- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_98=ON -DGLM_TEST_FORCE_PURE=ON .. +- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_98=ON -DGLM_TEST_FORCE_PURE=ON .. - cmake --build . - ctest - cd .. - mkdir ./build_simd_98 - cd ./build_simd_98 -- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_98=ON -DGLM_TEST_ENABLE_SIMD_AVX=ON .. +- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_98=ON -DGLM_TEST_ENABLE_SIMD_AVX=ON .. +- cmake --build . +- ctest +- cd .. +- mkdir ./build_pure_11_debug +- cd ./build_pure_11_debug +- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Debug -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_11=ON -DGLM_TEST_FORCE_PURE=ON .. +- cmake --build . +- ctest +- cd .. +- mkdir ./build_simd_11_debug +- cd ./build_simd_11_debug +- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Debug -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_11=ON -DGLM_TEST_ENABLE_SIMD_AVX=ON .. +- cmake --build . +- ctest +- cd .. +- mkdir ./build_pure_98_debug +- cd ./build_pure_98_debug +- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Debug -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_98=ON -DGLM_TEST_FORCE_PURE=ON .. +- cmake --build . +- ctest +- cd .. +- mkdir ./build_simd_98_debug +- cd ./build_simd_98_debug +- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Debug -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_98=ON -DGLM_TEST_ENABLE_SIMD_AVX=ON .. - cmake --build . - ctest - cd .. From ff0b1674f478d1e38b5ffbae0af577722fd89264 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 24 Nov 2016 01:20:49 +0100 Subject: [PATCH 5/5] Fixed POPCNT optimization build in Clang #512 --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index 0157bdbf..5a30ef25 100644 --- a/readme.md +++ b/readme.md @@ -54,6 +54,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) #### [GLM 0.9.8.4](https://github.com/g-truc/glm/tree/0.9.8) - 201X-XX-XX ##### Fixes: - Fixed GTC_packing test failing on GCC x86 due to denorms #212 #577 +- Fixed POPCNT optimization build in Clang #512 #### [GLM 0.9.8.3](https://github.com/g-truc/glm/releases/tag/0.9.8.3) - 2016-11-12 ##### Improvements: