updated test

This commit is contained in:
Christophe Riccio 2011-01-11 01:58:25 +00:00
parent 197c0d26b7
commit e5c662b1a8

View File

@ -7,12 +7,76 @@
// File : test/gtx/simd-mat4.cpp // File : test/gtx/simd-mat4.cpp
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_INSTRUCTION_SET GLM_PLATFORM_SSE3
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/gtx/simd_mat4.hpp> #include <glm/gtx/simd_mat4.hpp>
#include <iostream> #include <iostream>
#include <ctime>
#include <vector>
void test_detA()
{
glm::mat4 Identity(
glm::vec4(4.0f, 0.7f, 0.1f, 0.01f),
glm::vec4(0.5f, 3.0f, 0.6f, 0.02f),
glm::vec4(0.2f, 0.4f, 2.0f, 0.03f),
glm::vec4(4.0f, 3.0f, 2.0f, 1.00f));
std::vector<float> Test(10000000);
std::clock_t TimeStart = clock();
for(std::size_t i = 0; i < Test.size(); ++i)
Test[i] = glm::determinant(Identity);
std::clock_t TimeEnd = clock();
printf("Det A: %d\n", TimeEnd - TimeStart);
}
void test_detB()
{
glm::simd_mat4 IdentityB(
glm::simd_vec4(4.0f, 0.7f, 0.1f, 0.01f),
glm::simd_vec4(0.5f, 3.0f, 0.6f, 0.02f),
glm::simd_vec4(0.2f, 0.4f, 2.0f, 0.03f),
glm::simd_vec4(4.0f, 3.0f, 2.0f, 1.00f));
std::vector<__m128> Test(10000000);
std::clock_t TimeStart = clock();
for(std::size_t i = 0; i < Test.size(); ++i)
Test[i] = glm::detail::sse_slow_det_ps(&IdentityB.Data[0].Data);
std::clock_t TimeEnd = clock();
printf("Det B: %d\n", TimeEnd - TimeStart);
}
void test_detC()
{
glm::simd_mat4 IdentityB(
glm::simd_vec4(4.0f, 0.7f, 0.1f, 0.01f),
glm::simd_vec4(0.5f, 3.0f, 0.6f, 0.02f),
glm::simd_vec4(0.2f, 0.4f, 2.0f, 0.03f),
glm::simd_vec4(4.0f, 3.0f, 2.0f, 1.00f));
std::vector<__m128> Test(10000000);
std::clock_t TimeStart = clock();
for(std::size_t i = 0; i < Test.size(); ++i)
Test[i] = glm::detail::sse_det_ps(&IdentityB.Data[0].Data);
std::clock_t TimeEnd = clock();
printf("Det C: %d\n", TimeEnd - TimeStart);
}
int main(int argc, void* argv[]) int main(int argc, void* argv[])
{ {
test_detA();
test_detB();
test_detC();
// shuffle test // shuffle test
glm::simd_vec4 A(1.0f, 2.0f, 3.0f, 4.0f); glm::simd_vec4 A(1.0f, 2.0f, 3.0f, 4.0f);
glm::simd_vec4 B(5.0f, 6.0f, 7.0f, 8.0f); glm::simd_vec4 B(5.0f, 6.0f, 7.0f, 8.0f);
@ -33,5 +97,11 @@ int main(int argc, void* argv[])
__m128 DetB = glm::detail::sse_slow_det_ps(&IdentityB.Data[0].Data); __m128 DetB = glm::detail::sse_slow_det_ps(&IdentityB.Data[0].Data);
__m128 DetC = glm::detail::sse_det_ps(&IdentityB.Data[0].Data); __m128 DetC = glm::detail::sse_det_ps(&IdentityB.Data[0].Data);
std::vector<float> TestA(100000);
std::vector<__m128> TestB(100000);
std::vector<__m128> TestC(100000);
return 0; return 0;
} }