Commit 5221bed5 authored by Rashad Kanavath's avatar Rashad Kanavath

BUG: fix sse test for msvc, gnu, clang

otbsiftfast was enabling /fp:fast option with msvc along with SSE.
This is not normal as MSDN docs doesn't mention anything about /fp:fast
when using /arch:SSE.

I think it has a problematic behaviour with otb's dashboard
testing. Many --compare-image tests we do are with zero tolerance.
So it has to go.
parent 11bb4301
......@@ -8,28 +8,42 @@ function(check_sse_features sse_flags )
message(STATUS "For apple assume sse2 is on for all intel builds")
return()
endif()
if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX )
set(sse_flags_detected)
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG)
set(CMAKE_REQUIRED_FLAGS "-msse2")
check_cxx_source_runs("
set(sse_flags_detected "-msse2 -mfpmath=sse")
elseif(MSVC AND NOT CMAKE_CL_64)
set(CMAKE_REQUIRED_FLAGS "/arch:SSE2")
set(sse_flags_detected "/arch:SSE2")
endif()
check_cxx_source_runs("
#include <emmintrin.h>
int main()
int main ()
{
__m128d a, b;
double vals[2] = {0};
a = _mm_loadu_pd(vals);
b = _mm_add_pd(a,a);
_mm_storeu_pd(vals,b);
return 0;
}" HAVE_SSE2_FLAGS)
if(HAVE_SSE2_FLAGS)
set(${sse_flags} "-msse2 -mfpmath=sse" PARENT_SCOPE)
return()
endif()
__m128d a, b;
double vals[2] = {0};
a = _mm_loadu_pd (vals);
b = _mm_add_pd (a,a);
_mm_storeu_pd (vals,b);
return (0);
}"
HAVE_SSE2_EXTENSIONS)
if(HAVE_SSE2_EXTENSIONS)
set(${sse_flags} "${sse_flags_detected}" PARENT_SCOPE)
return()
endif()
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG)
set(CMAKE_REQUIRED_FLAGS "-msse")
check_cxx_source_runs("
set(sse_flags_detected "-msse -mfpmath=sse")
elseif(MSVC AND NOT CMAKE_CL_64)
set(CMAKE_REQUIRED_FLAGS "/arch:SSE")
set(sse_flags_detected "/arch:SSE")
endif()
check_cxx_source_runs("
#include <xmmintrin.h>
int main()
{
......@@ -40,37 +54,10 @@ function(check_sse_features sse_flags )
b = _mm_add_ps(a,b);
_mm_storeu_ps(vals,b);
return 0;
}" HAVE_SSE_FLAGS)
if(HAVE_SSE_FLAGS)
set(${sse_flags} "-msse -mfpmath=sse" PARENT_SCOPE)
return()
endif()
}" HAVE_SSE_EXTENSIONS)
elseif(MSVC)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
return()
endif()
check_cxx_source_runs("
#include <emmintrin.h>
int main()
{
__m128d a, b;
double vals[2] = {0};
a = _mm_loadu_pd(vals);
b = _mm_add_pd(a,a);
_mm_storeu_pd(vals,b);
return 0;
}" HAVE_SSE_FLAGS)
if(HAVE_SSE_FLAGS)
message(STATUS "Performing Test HAVE_SSE_FLAGS - Success")
set(${sse_flags} "/arch:SSE2 /fp:fast -D__SSE__ -D__SSE2__" PARENT_SCOPE)
return()
else()
message(STATUS "Performing Test HAVE_SSE_FLAGS - Failed")
return()
endif()
endif()
if(HAVE_SSE_EXTENSIONS)
set(${sse_flags} "${sse_flags_detected}" PARENT_SCOPE)
return()
endif()
endfunction() #check_sse_features
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment