Fixed SSE code included in GLM tests on pure platforms

This commit is contained in:
Christophe Riccio 2014-01-14 14:07:09 +01:00
parent dd272c52ee
commit d7862e4bb5
4 changed files with 10 additions and 11 deletions

View File

@ -41,6 +41,7 @@ GLM 0.9.5.2: 2014-0X-XX
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- Fixed warnings with the Android NDK 9c - Fixed warnings with the Android NDK 9c
- Fixed non power of two matrix products - Fixed non power of two matrix products
- Fixed SSE code included in GLM tests on "pure" platforms
================================================================================ ================================================================================
GLM 0.9.5.1: 2014-01-11 GLM 0.9.5.1: 2014-01-11

View File

@ -11,7 +11,6 @@
#include <glm/gtx/bit.hpp> #include <glm/gtx/bit.hpp>
#include <glm/gtc/type_precision.hpp> #include <glm/gtc/type_precision.hpp>
#include <emmintrin.h>
#if(GLM_ARCH != GLM_ARCH_PURE) #if(GLM_ARCH != GLM_ARCH_PURE)
# include <glm/detail/intrinsic_integer.hpp> # include <glm/detail/intrinsic_integer.hpp>
#endif #endif
@ -152,6 +151,7 @@ namespace bitfieldInterleave
return REG1 | (REG2 << 1); return REG1 | (REG2 << 1);
} }
#if(GLM_ARCH != GLM_ARCH_PURE)
inline glm::uint64 sseBitfieldInterleave(glm::uint32 x, glm::uint32 y) inline glm::uint64 sseBitfieldInterleave(glm::uint32 x, glm::uint32 y)
{ {
GLM_ALIGN(16) glm::uint32 const Array[4] = {x, 0, y, 0}; GLM_ALIGN(16) glm::uint32 const Array[4] = {x, 0, y, 0};
@ -267,6 +267,7 @@ namespace bitfieldInterleave
return Result[0]; return Result[0];
} }
#endif//(GLM_ARCH != GLM_ARCH_PURE)
int test() int test()
{ {
@ -287,16 +288,17 @@ namespace bitfieldInterleave
glm::uint64 B = fastBitfieldInterleave(x, y); glm::uint64 B = fastBitfieldInterleave(x, y);
glm::uint64 C = loopBitfieldInterleave(x, y); glm::uint64 C = loopBitfieldInterleave(x, y);
glm::uint64 D = interleaveBitfieldInterleave(x, y); glm::uint64 D = interleaveBitfieldInterleave(x, y);
glm::uint64 E = sseBitfieldInterleave(x, y);
glm::uint64 F = sseUnalignedBitfieldInterleave(x, y);
assert(A == B); assert(A == B);
assert(A == C); assert(A == C);
assert(A == D); assert(A == D);
assert(A == E);
assert(A == F);
# if(GLM_ARCH != GLM_ARCH_PURE) # if(GLM_ARCH != GLM_ARCH_PURE)
glm::uint64 E = sseBitfieldInterleave(x, y);
glm::uint64 F = sseUnalignedBitfieldInterleave(x, y);
assert(A == E);
assert(A == F);
__m128i G = glm::detail::_mm_bit_interleave_si128(_mm_set_epi32(0, y, 0, x)); __m128i G = glm::detail::_mm_bit_interleave_si128(_mm_set_epi32(0, y, 0, x));
glm::uint64 Result[2]; glm::uint64 Result[2];
_mm_storeu_si128((__m128i*)Result, G); _mm_storeu_si128((__m128i*)Result, G);
@ -366,6 +368,7 @@ namespace bitfieldInterleave
std::cout << "interleaveBitfieldInterleave Time " << Time << " clocks" << std::endl; std::cout << "interleaveBitfieldInterleave Time " << Time << " clocks" << std::endl;
} }
# if(GLM_ARCH != GLM_ARCH_PURE)
{ {
std::clock_t LastTime = std::clock(); std::clock_t LastTime = std::clock();
@ -387,6 +390,7 @@ namespace bitfieldInterleave
std::cout << "sseUnalignedBitfieldInterleave Time " << Time << " clocks" << std::endl; std::cout << "sseUnalignedBitfieldInterleave Time " << Time << " clocks" << std::endl;
} }
# endif//(GLM_ARCH != GLM_ARCH_PURE)
{ {
std::clock_t LastTime = std::clock(); std::clock_t LastTime = std::clock();

View File

@ -7,9 +7,6 @@
// File : test/gtx/associated_min_max.cpp // File : test/gtx/associated_min_max.cpp
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#include <emmintrin.h>
#include <glm/glm.hpp>
#include <glm/gtc/type_precision.hpp> #include <glm/gtc/type_precision.hpp>
#include <glm/gtx/associated_min_max.hpp> #include <glm/gtx/associated_min_max.hpp>

View File

@ -7,9 +7,6 @@
// File : test/gtx/associated_min_max.cpp // File : test/gtx/associated_min_max.cpp
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#include <emmintrin.h>
#include <glm/glm.hpp>
#include <glm/gtc/type_precision.hpp> #include <glm/gtc/type_precision.hpp>
#include <glm/gtx/associated_min_max.hpp> #include <glm/gtx/associated_min_max.hpp>